@wertzui/ngx-restworld-client 1.0.2 → 2.0.0

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 (31) hide show
  1. package/bundles/wertzui-ngx-restworld-client.umd.js +1101 -301
  2. package/bundles/wertzui-ngx-restworld-client.umd.js.map +1 -1
  3. package/esm2015/lib/models/problem-details.js +2 -2
  4. package/esm2015/lib/pipes/as.pipe.js +25 -0
  5. package/esm2015/lib/pipes/safe-url.pipe.js +23 -0
  6. package/esm2015/lib/restworld-client.module.js +68 -8
  7. package/esm2015/lib/services/avatar-generator.js +2 -2
  8. package/esm2015/lib/services/form.service.js +69 -0
  9. package/esm2015/lib/services/restworld-client-collection.js +1 -1
  10. package/esm2015/lib/services/restworld-client.js +46 -8
  11. package/esm2015/lib/views/restworld-edit-form/restworld-edit-form.component.js +238 -0
  12. package/esm2015/lib/views/restworld-edit-view/restworld-edit-view.component.js +209 -143
  13. package/esm2015/lib/views/restworld-file-view/restworld-file-view.component.js +63 -0
  14. package/esm2015/lib/views/restworld-image-view/restworld-image-view.component.js +107 -0
  15. package/esm2015/lib/views/restworld-list-view/restworld-list-view.component.js +64 -37
  16. package/esm2015/public-api.js +7 -1
  17. package/fesm2015/wertzui-ngx-restworld-client.js +880 -220
  18. package/fesm2015/wertzui-ngx-restworld-client.js.map +1 -1
  19. package/lib/models/problem-details.d.ts +4 -8
  20. package/lib/pipes/as.pipe.d.ts +18 -0
  21. package/lib/pipes/safe-url.pipe.d.ts +10 -0
  22. package/lib/restworld-client.module.d.ts +35 -21
  23. package/lib/services/form.service.d.ts +14 -0
  24. package/lib/services/restworld-client.d.ts +4 -1
  25. package/lib/views/restworld-edit-form/restworld-edit-form.component.d.ts +69 -0
  26. package/lib/views/restworld-edit-view/restworld-edit-view.component.d.ts +53 -32
  27. package/lib/views/restworld-file-view/restworld-file-view.component.d.ts +21 -0
  28. package/lib/views/restworld-image-view/restworld-image-view.component.d.ts +38 -0
  29. package/lib/views/restworld-list-view/restworld-list-view.component.d.ts +20 -8
  30. package/package.json +29 -8
  31. package/public-api.d.ts +6 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('@wertzui/ngx-hal-client'), require('@angular/core'), require('@angular/common/http'), require('@angular/forms'), require('primeng/api'), require('@angular/common'), require('@angular/router'), require('primeng/tabview'), require('primeng/skeleton'), require('primeng/calendar'), require('primeng/inputnumber'), require('primeng/checkbox'), require('primeng/progressspinner'), require('primeng/toast'), require('primeng/confirmdialog'), require('primeng/inputtext'), require('primeng/button'), require('primeng/ripple'), require('primeng/table'), require('primeng/avatar'), require('primeng/tristatecheckbox'), require('primeng/tooltip'), require('@angular/cdk/scrolling'), require('primeng/messages'), require('primeng/panel')) :
3
- typeof define === 'function' && define.amd ? define('@wertzui/ngx-restworld-client', ['exports', 'lodash', '@wertzui/ngx-hal-client', '@angular/core', '@angular/common/http', '@angular/forms', 'primeng/api', '@angular/common', '@angular/router', 'primeng/tabview', 'primeng/skeleton', 'primeng/calendar', 'primeng/inputnumber', 'primeng/checkbox', 'primeng/progressspinner', 'primeng/toast', 'primeng/confirmdialog', 'primeng/inputtext', 'primeng/button', 'primeng/ripple', 'primeng/table', 'primeng/avatar', 'primeng/tristatecheckbox', 'primeng/tooltip', '@angular/cdk/scrolling', 'primeng/messages', 'primeng/panel'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wertzui = global.wertzui || {}, global.wertzui["ngx-restworld-client"] = {}), global._, global.i1, global.ng.core, global.ng.common.http, global.ng.forms, global.i2, global.ng.common, global.ng.router, global.i5, global.i6, global.i7, global.i8, global.i9, global.i10, global.i11, global.i12, global.i14, global.i15, global.i16, global.i4$1, global.i5$1, global.i6$1, global.i10$1, global.ng.cdk.scrolling, global.messages, global.panel));
5
- })(this, (function (exports, _, i1, i0, i1$1, i13, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i14, i15, i16, i4$1, i5$1, i6$1, i10$1, scrolling, messages, panel) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash'), require('@wertzui/ngx-hal-client'), require('@angular/core'), require('@angular/platform-browser'), require('@angular/forms'), require('@angular/common/http'), require('primeng/api'), require('primeng/dropdown'), require('primeng/multiselect'), require('primeng/calendar'), require('primeng/inputnumber'), require('primeng/checkbox'), require('primeng/tristatecheckbox'), require('primeng/fileupload'), require('primeng/button'), require('primeng/dialog'), require('ngx-image-cropper'), require('primeng/colorpicker'), require('@angular/common'), require('primeng/tooltip'), require('primeng/inputtext'), require('primeng/ripple'), require('ngx-valdemort'), require('@angular/cdk/drag-drop'), require('@angular/router'), require('primeng/tabview'), require('primeng/skeleton'), require('primeng/progressspinner'), require('primeng/toast'), require('primeng/confirmdialog'), require('primeng/table'), require('primeng/avatar'), require('@angular/cdk/scrolling'), require('primeng/messages'), require('primeng/panel')) :
3
+ typeof define === 'function' && define.amd ? define('@wertzui/ngx-restworld-client', ['exports', 'lodash', '@wertzui/ngx-hal-client', '@angular/core', '@angular/platform-browser', '@angular/forms', '@angular/common/http', 'primeng/api', 'primeng/dropdown', 'primeng/multiselect', 'primeng/calendar', 'primeng/inputnumber', 'primeng/checkbox', 'primeng/tristatecheckbox', 'primeng/fileupload', 'primeng/button', 'primeng/dialog', 'ngx-image-cropper', 'primeng/colorpicker', '@angular/common', 'primeng/tooltip', 'primeng/inputtext', 'primeng/ripple', 'ngx-valdemort', '@angular/cdk/drag-drop', '@angular/router', 'primeng/tabview', 'primeng/skeleton', 'primeng/progressspinner', 'primeng/toast', 'primeng/confirmdialog', 'primeng/table', 'primeng/avatar', '@angular/cdk/scrolling', 'primeng/messages', 'primeng/panel'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wertzui = global.wertzui || {}, global.wertzui["ngx-restworld-client"] = {}), global._, global.i1, global.ng.core, global.ng.platformBrowser, global.ng.forms, global.ng.common.http, global.i2$1, global.i4$1, global.i5$1, global.i6, global.i7$1, global.i8, global.i9$1, global.i2, global.i1$3, global.i3, global.i4, global.i5, global.ng.common, global.i7, global.i9, global.i10, global.i12, global.ng.cdk.dragDrop, global.ng.router, global.i7$2, global.i8$1, global.i10$1, global.i11, global.i12$1, global.i4$3, global.i5$2, global.ng.cdk.scrolling, global.messages, global.panel));
5
+ })(this, (function (exports, _, i1, i0, i1$1, i14, i1$2, i2$1, i4$1, i5$1, i6, i7$1, i8, i9$1, i2, i1$3, i3, i4, i5, i3$1, i7, i9, i10, i12, i17, i4$2, i7$2, i8$1, i10$1, i11, i12$1, i4$3, i5$2, scrolling, messages, panel) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -23,28 +23,37 @@
23
23
  }
24
24
 
25
25
  var ___namespace = /*#__PURE__*/_interopNamespace(_);
26
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
26
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
29
- var i13__namespace = /*#__PURE__*/_interopNamespace(i13);
28
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
29
+ var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
30
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
31
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
32
+ var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
33
+ var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
34
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
35
+ var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
36
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
37
+ var i9__namespace$1 = /*#__PURE__*/_interopNamespace(i9$1);
30
38
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
39
+ var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
31
40
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
32
41
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
33
42
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
34
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
43
+ var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
35
44
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
36
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
37
45
  var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
38
46
  var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
39
- var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
40
47
  var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
41
- var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
42
- var i15__namespace = /*#__PURE__*/_interopNamespace(i15);
43
- var i16__namespace = /*#__PURE__*/_interopNamespace(i16);
44
- var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
45
- var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
46
- var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
48
+ var i17__namespace = /*#__PURE__*/_interopNamespace(i17);
49
+ var i4__namespace$2 = /*#__PURE__*/_interopNamespace(i4$2);
50
+ var i7__namespace$2 = /*#__PURE__*/_interopNamespace(i7$2);
51
+ var i8__namespace$1 = /*#__PURE__*/_interopNamespace(i8$1);
47
52
  var i10__namespace$1 = /*#__PURE__*/_interopNamespace(i10$1);
53
+ var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
54
+ var i12__namespace$1 = /*#__PURE__*/_interopNamespace(i12$1);
55
+ var i4__namespace$3 = /*#__PURE__*/_interopNamespace(i4$3);
56
+ var i5__namespace$2 = /*#__PURE__*/_interopNamespace(i5$2);
48
57
 
49
58
  exports.LinkNames = void 0;
50
59
  (function (LinkNames) {
@@ -383,7 +392,7 @@
383
392
  return resource instanceof ProblemDetails;
384
393
  };
385
394
  ProblemDetails.containsProblemDetailsInformation = function (resource) {
386
- return resource && (resource instanceof ProblemDetails || (resource instanceof i1.Resource && resource.hasOwnProperty('status') && ___namespace.isNumber(resource.status) && resource.status >= 100 && resource.status < 600));
395
+ return resource && (resource instanceof ProblemDetails || (resource instanceof i1.Resource && 'status' in resource && ___namespace.isNumber(resource['status']) && resource['status'] >= 100 && resource['status'] < 600));
387
396
  };
388
397
  ProblemDetails.fromResource = function (resource) {
389
398
  if (!ProblemDetails.containsProblemDetailsInformation(resource))
@@ -403,9 +412,55 @@
403
412
  return RESTworldOptions;
404
413
  }());
405
414
 
415
+ var SafeUrlPipe = /** @class */ (function () {
416
+ function SafeUrlPipe(_domSanitizer) {
417
+ this._domSanitizer = _domSanitizer;
418
+ }
419
+ SafeUrlPipe.prototype.transform = function (url) {
420
+ if (___namespace.isString(url))
421
+ throw new Error("The given url '" + url + "' is not a string.");
422
+ return this._domSanitizer.bypassSecurityTrustResourceUrl(url);
423
+ };
424
+ return SafeUrlPipe;
425
+ }());
426
+ SafeUrlPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, deps: [{ token: i1__namespace.DomSanitizer }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
427
+ SafeUrlPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, name: "safeUrl" });
428
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, decorators: [{
429
+ type: i0.Pipe,
430
+ args: [{
431
+ name: 'safeUrl'
432
+ }]
433
+ }], ctorParameters: function () { return [{ type: i1__namespace.DomSanitizer }]; } });
434
+
435
+ /**
436
+ * Cast super type into type using generics
437
+ * Return Type obtained by optional @param type OR assignment type.
438
+ */
439
+ var AsPipe = /** @class */ (function () {
440
+ function AsPipe() {
441
+ }
442
+ /**
443
+ * Cast (S: SuperType) into (T: Type) using @Generics.
444
+ * @param value (S: SuperType) obtained from input type.
445
+ * @optional @param type (T CastingType)
446
+ * type?: { new (): T }
447
+ * type?: new () => T
448
+ */
449
+ AsPipe.prototype.transform = function (value, type) {
450
+ return value;
451
+ };
452
+ return AsPipe;
453
+ }());
454
+ AsPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AsPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
455
+ AsPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AsPipe, name: "as" });
456
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AsPipe, decorators: [{
457
+ type: i0.Pipe,
458
+ args: [{ name: 'as' }]
459
+ }] });
460
+
406
461
  var AvatarGenerator = /** @class */ (function () {
407
462
  function AvatarGenerator() {
408
- this.getImageOverride = function (nameOrEmail) { return ''; };
463
+ this.getImageOverride = function () { return ''; };
409
464
  }
410
465
  AvatarGenerator.prototype.getImage = function (nameOrEmail) {
411
466
  var uri = AvatarGenerator._imageCache.get(nameOrEmail);
@@ -502,6 +557,93 @@
502
557
  type: i0.Input
503
558
  }] } });
504
559
 
560
+ var FormService = /** @class */ (function () {
561
+ function FormService() {
562
+ }
563
+ FormService.prototype.createFormGroupsFromTemplates = function (templates) {
564
+ var _this = this;
565
+ var tabs = Object.fromEntries(Object.entries(templates).map(function (_a) {
566
+ var _b = __read(_a, 2), name = _b[0], template = _b[1];
567
+ return [
568
+ name,
569
+ _this.createFormGroupFromTemplate(template)
570
+ ];
571
+ }));
572
+ return tabs;
573
+ };
574
+ FormService.prototype.createFormGroupFromTemplates = function (templates, ignoredProperties) {
575
+ var _this = this;
576
+ var controls = Object.fromEntries(Object.entries(templates)
577
+ .filter(function (_a) {
578
+ var _b = __read(_a, 1), key = _b[0];
579
+ return !ignoredProperties.some(function (p) { return key === p; });
580
+ })
581
+ .map(function (_a) {
582
+ var _b = __read(_a, 2), name = _b[0], template = _b[1];
583
+ return [
584
+ name,
585
+ _this.createFormGroupFromTemplate(template)
586
+ ];
587
+ }));
588
+ var formGroup = new i14.FormGroup(controls);
589
+ return formGroup;
590
+ };
591
+ FormService.prototype.createFormArrayFromTemplates = function (templates, ignoredProperties) {
592
+ var _this = this;
593
+ var controls = Object.entries(templates)
594
+ .filter(function (_a) {
595
+ var _b = __read(_a, 1), key = _b[0];
596
+ return !ignoredProperties.some(function (p) { return key === p; });
597
+ })
598
+ .map(function (_a) {
599
+ var _b = __read(_a, 2), template = _b[1];
600
+ return _this.createFormGroupFromTemplate(template);
601
+ });
602
+ var formArray = new i14.FormArray(controls);
603
+ return formArray;
604
+ };
605
+ FormService.prototype.createFormGroupFromTemplate = function (template) {
606
+ var _this = this;
607
+ var controls = Object.fromEntries(template.properties.map(function (p) { return [
608
+ p.name,
609
+ _this.createFormControl(p)
610
+ ]; }));
611
+ var formGroup = new i14.FormGroup(controls);
612
+ return formGroup;
613
+ };
614
+ FormService.prototype.createFormControl = function (property) {
615
+ if (property.type === i1.PropertyType.Object)
616
+ return this.createFormGroupFromTemplate(property._templates['default']);
617
+ if (property.type === i1.PropertyType.Collection)
618
+ return this.createFormArrayFromTemplates(property._templates, ['default']);
619
+ var control = new i14.FormControl(property.value);
620
+ if (property.max)
621
+ control.addValidators(i14.Validators.max(property.max));
622
+ if (property.maxLength)
623
+ control.addValidators(i14.Validators.maxLength(property.maxLength));
624
+ if (property.min)
625
+ control.addValidators(i14.Validators.min(property.min));
626
+ if (property.minLength)
627
+ control.addValidators(i14.Validators.minLength(property.minLength));
628
+ if (property.regex)
629
+ control.addValidators(i14.Validators.pattern(property.regex));
630
+ if (property.required)
631
+ control.addValidators(i14.Validators.required);
632
+ if (property.type === i1.PropertyType.Email)
633
+ control.addValidators(i14.Validators.email);
634
+ return control;
635
+ };
636
+ return FormService;
637
+ }());
638
+ FormService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: FormService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
639
+ FormService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: FormService, providedIn: 'root' });
640
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: FormService, decorators: [{
641
+ type: i0.Injectable,
642
+ args: [{
643
+ providedIn: 'root'
644
+ }]
645
+ }] });
646
+
505
647
  var RESTworldClient = /** @class */ (function () {
506
648
  function RESTworldClient(_halClient, _options) {
507
649
  this._halClient = _halClient;
@@ -543,7 +685,7 @@
543
685
  return __generator(this, function (_c) {
544
686
  switch (_c.label) {
545
687
  case 0:
546
- header = RESTworldClient.createHeaders(this._options.Version);
688
+ header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
547
689
  return [4 /*yield*/, this.halClient.get(this._options.BaseUrl, i1.Resource, ProblemDetails, header)];
548
690
  case 1:
549
691
  response = _c.sent();
@@ -576,6 +718,23 @@
576
718
  });
577
719
  });
578
720
  };
721
+ RESTworldClient.prototype.getListByUri = function (uri, parameters, headers) {
722
+ return __awaiter(this, void 0, void 0, function () {
723
+ var link, filledUri, response;
724
+ return __generator(this, function (_c) {
725
+ switch (_c.label) {
726
+ case 0:
727
+ link = new i1.Link();
728
+ link.href = uri;
729
+ filledUri = link.fillTemplate(parameters);
730
+ return [4 /*yield*/, this.halClient.get(filledUri, i1.PagedListResource, ProblemDetails, headers)];
731
+ case 1:
732
+ response = _c.sent();
733
+ return [2 /*return*/, response];
734
+ }
735
+ });
736
+ });
737
+ };
579
738
  RESTworldClient.prototype.getSingle = function (relOrUri, id, headers, curie) {
580
739
  return __awaiter(this, void 0, void 0, function () {
581
740
  var uri, link, response;
@@ -616,7 +775,7 @@
616
775
  throw new Error("The save link " + saveLink + " does not have a save name.");
617
776
  uri = saveLink.href;
618
777
  method = saveLink.name.toLowerCase();
619
- header = RESTworldClient.createHeaders(this._options.Version);
778
+ header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
620
779
  _c = method;
621
780
  switch (_c) {
622
781
  case 'put': return [3 /*break*/, 1];
@@ -637,6 +796,57 @@
637
796
  });
638
797
  });
639
798
  };
799
+ RESTworldClient.prototype.getAllForms = function (resource) {
800
+ return __awaiter(this, void 0, void 0, function () {
801
+ var urls, header, formsPromises, formsAndProblems;
802
+ var _this = this;
803
+ return __generator(this, function (_c) {
804
+ switch (_c.label) {
805
+ case 0:
806
+ urls = resource.getFormLinkHrefs();
807
+ header = RESTworldClient.createHeaders('application/prs.hal-forms+json', this._options.Version);
808
+ formsPromises = urls.map(function (url) { return _this._halClient.get(url, i1.FormsResource, ProblemDetails, header); });
809
+ return [4 /*yield*/, Promise.all(formsPromises)];
810
+ case 1:
811
+ formsAndProblems = _c.sent();
812
+ return [2 /*return*/, formsAndProblems];
813
+ }
814
+ });
815
+ });
816
+ };
817
+ RESTworldClient.prototype.submit = function (template, formValues) {
818
+ var _a;
819
+ return __awaiter(this, void 0, void 0, function () {
820
+ var uri, method, header, response, _c;
821
+ return __generator(this, function (_d) {
822
+ switch (_d.label) {
823
+ case 0:
824
+ uri = template.target || '';
825
+ method = (_a = template.method) === null || _a === void 0 ? void 0 : _a.toLowerCase();
826
+ header = RESTworldClient.createHeaders('application/prs.hal-forms+json', this._options.Version);
827
+ _c = method;
828
+ switch (_c) {
829
+ case 'put': return [3 /*break*/, 1];
830
+ case 'post': return [3 /*break*/, 3];
831
+ }
832
+ return [3 /*break*/, 5];
833
+ case 1: return [4 /*yield*/, this.halClient.put(uri, formValues, i1.FormsResource, ProblemDetails, header)];
834
+ case 2:
835
+ response = _d.sent();
836
+ return [3 /*break*/, 7];
837
+ case 3: return [4 /*yield*/, this.halClient.post(uri, formValues, i1.FormsResource, ProblemDetails, header)];
838
+ case 4:
839
+ response = _d.sent();
840
+ return [3 /*break*/, 7];
841
+ case 5: return [4 /*yield*/, this.halClient.get(uri, i1.FormsResource, ProblemDetails, header)];
842
+ case 6:
843
+ response = _d.sent();
844
+ _d.label = 7;
845
+ case 7: return [2 /*return*/, response];
846
+ }
847
+ });
848
+ });
849
+ };
640
850
  RESTworldClient.prototype.delete = function (resource) {
641
851
  return __awaiter(this, void 0, void 0, function () {
642
852
  var deleteLink, uri, header, response;
@@ -647,7 +857,7 @@
647
857
  if (!deleteLink)
648
858
  throw new Error("The resource " + resource + " does not have a delete link.");
649
859
  uri = deleteLink.href;
650
- header = RESTworldClient.createHeaders(this._options.Version);
860
+ header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
651
861
  return [4 /*yield*/, this.halClient.delete(uri, ProblemDetails, header)];
652
862
  case 1:
653
863
  response = _c.sent();
@@ -663,7 +873,7 @@
663
873
  };
664
874
  RESTworldClient.prototype.getLinkFromHome = function (rel, name, curie) {
665
875
  var links = this.getLinksFromHome(rel, curie);
666
- var link = !!name ? links.find(function (l) { return l.name == name; }) : links[0];
876
+ var link = name ? links.find(function (l) { return l.name === name; }) : links[0];
667
877
  if (!link)
668
878
  throw new Error("The home resource does not have a link with the rel '" + this.getFullRel(rel, curie) + "' and the name '" + name + "'.");
669
879
  return link;
@@ -688,10 +898,10 @@
688
898
  var fullRel = curie + ":" + rel;
689
899
  return fullRel;
690
900
  };
691
- RESTworldClient.createHeaders = function (version) {
901
+ RESTworldClient.createHeaders = function (mediaType, version) {
692
902
  if (version)
693
- return new i1$1.HttpHeaders({ 'Accept': "v=" + version });
694
- return new i1$1.HttpHeaders();
903
+ return new i1$2.HttpHeaders({ 'Accept': (mediaType || 'application/hal+json') + "; v=" + version });
904
+ return new i1$2.HttpHeaders();
695
905
  };
696
906
  return RESTworldClient;
697
907
  }());
@@ -737,19 +947,19 @@
737
947
  });
738
948
  return RESTworldClientCollection;
739
949
  }());
740
- RESTworldClientCollection.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, deps: [{ token: i1__namespace.HalClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
950
+ RESTworldClientCollection.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, deps: [{ token: i1__namespace$1.HalClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
741
951
  RESTworldClientCollection.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, providedIn: 'root' });
742
952
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, decorators: [{
743
953
  type: i0.Injectable,
744
954
  args: [{
745
955
  providedIn: 'root'
746
956
  }]
747
- }], ctorParameters: function () { return [{ type: i1__namespace.HalClient }]; } });
957
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.HalClient }]; } });
748
958
 
749
959
  var SettingsService = /** @class */ (function () {
750
960
  function SettingsService(backend, _clients) {
751
961
  this._clients = _clients;
752
- this._client = new i1$1.HttpClient(backend);
962
+ this._client = new i1$2.HttpClient(backend);
753
963
  }
754
964
  Object.defineProperty(SettingsService.prototype, "settings", {
755
965
  get: function () {
@@ -810,36 +1020,443 @@
810
1020
  };
811
1021
  return SettingsService;
812
1022
  }());
813
- SettingsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, deps: [{ token: i1__namespace$1.HttpBackend }, { token: RESTworldClientCollection }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1023
+ SettingsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, deps: [{ token: i1__namespace$2.HttpBackend }, { token: RESTworldClientCollection }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
814
1024
  SettingsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, providedIn: 'root' });
815
1025
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, decorators: [{
816
1026
  type: i0.Injectable,
817
1027
  args: [{
818
1028
  providedIn: 'root'
819
1029
  }]
820
- }], ctorParameters: function () { return [{ type: i1__namespace$1.HttpBackend }, { type: RESTworldClientCollection }]; } });
1030
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.HttpBackend }, { type: RESTworldClientCollection }]; } });
1031
+
1032
+ var RESTWorldImageViewComponent = /** @class */ (function () {
1033
+ function RESTWorldImageViewComponent() {
1034
+ this.maintainAspectRatio = true;
1035
+ this.aspectRatio = 1;
1036
+ this.resizeToWidth = 0;
1037
+ this.resizeToHeight = 0;
1038
+ this.onlyScaleDown = false;
1039
+ this.containWithinAspectRatio = false;
1040
+ this.backgroundColor = "#ffffff";
1041
+ this.format = 'png';
1042
+ this.disabled = false;
1043
+ this.displayCropDialog = false;
1044
+ }
1045
+ RESTWorldImageViewComponent.prototype.writeValue = function (obj) {
1046
+ this.uri = obj;
1047
+ };
1048
+ RESTWorldImageViewComponent.prototype.registerOnChange = function (fn) {
1049
+ this.onChange = fn;
1050
+ };
1051
+ RESTWorldImageViewComponent.prototype.registerOnTouched = function () {
1052
+ // not needed for this component, but needed to implement the interface
1053
+ };
1054
+ RESTWorldImageViewComponent.prototype.setDisabledState = function (isDisabled) {
1055
+ this.disabled = isDisabled;
1056
+ };
1057
+ RESTWorldImageViewComponent.prototype.showCropDialog = function () {
1058
+ this.displayCropDialog = true;
1059
+ };
1060
+ RESTWorldImageViewComponent.prototype.imageChanged = function (event) {
1061
+ this.tempImageFile = event.files[0];
1062
+ this.showCropDialog();
1063
+ };
1064
+ RESTWorldImageViewComponent.prototype.croppedImageChanged = function (event) {
1065
+ this.tempCroppedUri = event.base64;
1066
+ };
1067
+ RESTWorldImageViewComponent.prototype.acceptCroppedImage = function () {
1068
+ var _a;
1069
+ this.uri = this.tempCroppedUri;
1070
+ (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, this.uri);
1071
+ this.closeCropDialog();
1072
+ };
1073
+ RESTWorldImageViewComponent.prototype.closeCropDialog = function () {
1074
+ var _a;
1075
+ (_a = this.fileUploads) === null || _a === void 0 ? void 0 : _a.forEach(function (f) { return f.clear(); });
1076
+ this.displayCropDialog = false;
1077
+ };
1078
+ return RESTWorldImageViewComponent;
1079
+ }());
1080
+ RESTWorldImageViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldImageViewComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1081
+ RESTWorldImageViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTWorldImageViewComponent, selector: "rw-image", inputs: { alt: "alt", accept: "accept", fileName: "fileName", maintainAspectRatio: "maintainAspectRatio", aspectRatio: "aspectRatio", resizeToWidth: "resizeToWidth", resizeToHeight: "resizeToHeight", onlyScaleDown: "onlyScaleDown", containWithinAspectRatio: "containWithinAspectRatio", backgroundColor: "backgroundColor", format: "format" }, providers: [{
1082
+ provide: i14.NG_VALUE_ACCESSOR,
1083
+ useExisting: i0.forwardRef(function () { return RESTWorldImageViewComponent; }),
1084
+ multi: true
1085
+ }], viewQueries: [{ propertyName: "fileUploads", predicate: i2.FileUpload, descendants: true }], ngImport: i0__namespace, template: "<div class=\"flex align-items-center\">\r\n <p-button *ngIf=\"!uri\" [disabled]=\"true\" icon=\"pi pi-download\" class=\"mr-1\" pTooltip=\"No image present\"></p-button>\r\n <a *ngIf=\"uri\" [href]=\"uri | safeUrl\" [download]=\"fileName || 'download'\" class=\"mr-1\" pButton pTooltip=\"Download image\" icon=\"pi pi-download\"></a>\r\n <p-fileUpload class=\"mr-1\" chooseIcon=\"pi-upload fas fa-upload\" mode=\"basic\" [auto]=\"true\" [accept]=\"accept || 'false'\" [customUpload]=\"true\" (uploadHandler)=\"imageChanged($event)\" pTooltip=\"Upload new image\"></p-fileUpload>\r\n <img *ngIf=\"uri\" [src]=\"uri\" [alt]=\"alt\" (click)=\"showCropDialog()\" pTooltip=\"Zoom and crop\" />\r\n</div>\r\n\r\n<p-dialog header=\"alt\" [(visible)]=\"displayCropDialog\">\r\n <image-cropper #cropper\r\n [imageFile]=\"tempImageFile!\"\r\n [imageURL]=\"uri!\"\r\n [maintainAspectRatio]=\"maintainAspectRatio\"\r\n [aspectRatio]=\"aspectRatio\"\r\n [resizeToWidth]=\"resizeToWidth\"\r\n [resizeToHeight]=\"resizeToHeight\"\r\n [onlyScaleDown]=\"onlyScaleDown\"\r\n [autoCrop]=\"true\"\r\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\r\n [backgroundColor]=\"backgroundColor\"\r\n [format]=\"format\"\r\n (imageCropped)=\"croppedImageChanged($event)\"></image-cropper>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"flex-auto align-items-center\">\r\n <span>Background color:&nbsp;</span>\r\n <p-colorPicker [(ngModel)]=\"cropper.backgroundColor\" appendTo=\"body\" class=\"ml-1 mr-1\"></p-colorPicker>\r\n <input pInputText [(ngModel)]=\"cropper.backgroundColor\" />\r\n </div>\r\n <button type=\"button\" pButton pRipple (click)=\"acceptCroppedImage()\" class=\"mr-2\">Ok</button>\r\n <button type=\"button\" pButton pRipple (click)=\"closeCropDialog()\">Cancel</button>\r\n </div>\r\n</p-dialog>\r\n", styles: ["img{height:calc(1rem + 2*8px + 2*1px);cursor:zoom-in;border-radius:3px}a{text-decoration:none;height:calc(1rem + 2*8px + 2px)}a.p-button-icon-only span.p-button-label{height:1rem!important}\n"], components: [{ type: i1__namespace$3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i2__namespace.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler"] }, { type: i3__namespace.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { type: i4__namespace.ImageCropperComponent, selector: "image-cropper", inputs: ["format", "transform", "maintainAspectRatio", "aspectRatio", "resizeToWidth", "resizeToHeight", "cropperMinWidth", "cropperMinHeight", "cropperMaxHeight", "cropperMaxWidth", "cropperStaticWidth", "cropperStaticHeight", "canvasRotation", "initialStepSize", "roundCropper", "onlyScaleDown", "imageQuality", "autoCrop", "backgroundColor", "containWithinAspectRatio", "hideResizeSquares", "cropper", "alignImage", "disabled", "imageChangedEvent", "imageURL", "imageBase64", "imageFile"], outputs: ["imageCropped", "startCropImage", "imageLoaded", "cropperReady", "loadImageFailed"] }, { type: i5__namespace.ColorPicker, selector: "p-colorPicker", inputs: ["style", "styleClass", "inline", "format", "appendTo", "disabled", "tabindex", "inputId", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onChange", "onShow", "onHide"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i14__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i9__namespace.InputText, selector: "[pInputText]" }, { type: i10__namespace.Ripple, selector: "[pRipple]" }], pipes: { "safeUrl": SafeUrlPipe } });
1086
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldImageViewComponent, decorators: [{
1087
+ type: i0.Component,
1088
+ args: [{
1089
+ selector: 'rw-image',
1090
+ templateUrl: './restworld-image-view.component.html',
1091
+ styleUrls: ['./restworld-image-view.component.css'],
1092
+ providers: [{
1093
+ provide: i14.NG_VALUE_ACCESSOR,
1094
+ useExisting: i0.forwardRef(function () { return RESTWorldImageViewComponent; }),
1095
+ multi: true
1096
+ }]
1097
+ }]
1098
+ }], propDecorators: { alt: [{
1099
+ type: i0.Input
1100
+ }], accept: [{
1101
+ type: i0.Input
1102
+ }], fileName: [{
1103
+ type: i0.Input
1104
+ }], maintainAspectRatio: [{
1105
+ type: i0.Input
1106
+ }], aspectRatio: [{
1107
+ type: i0.Input
1108
+ }], resizeToWidth: [{
1109
+ type: i0.Input
1110
+ }], resizeToHeight: [{
1111
+ type: i0.Input
1112
+ }], onlyScaleDown: [{
1113
+ type: i0.Input
1114
+ }], containWithinAspectRatio: [{
1115
+ type: i0.Input
1116
+ }], backgroundColor: [{
1117
+ type: i0.Input
1118
+ }], format: [{
1119
+ type: i0.Input
1120
+ }], fileUploads: [{
1121
+ type: i0.ViewChildren,
1122
+ args: [i2.FileUpload]
1123
+ }] } });
1124
+
1125
+ var RESTWorldFileViewComponent = /** @class */ (function () {
1126
+ function RESTWorldFileViewComponent() {
1127
+ this.disabled = false;
1128
+ }
1129
+ RESTWorldFileViewComponent.prototype.writeValue = function (obj) {
1130
+ this.uri = obj;
1131
+ };
1132
+ RESTWorldFileViewComponent.prototype.registerOnChange = function (fn) {
1133
+ this.onChange = fn;
1134
+ };
1135
+ RESTWorldFileViewComponent.prototype.registerOnTouched = function () {
1136
+ // not needed for this component, but needed to implement the interface
1137
+ };
1138
+ RESTWorldFileViewComponent.prototype.setDisabledState = function (isDisabled) {
1139
+ this.disabled = isDisabled;
1140
+ };
1141
+ RESTWorldFileViewComponent.prototype.fileChanged = function (event) {
1142
+ var _this = this;
1143
+ var file = event.files[0];
1144
+ var reader = new FileReader();
1145
+ reader.onload = function () {
1146
+ var _a;
1147
+ _this.uri = reader.result;
1148
+ (_a = _this.onChange) === null || _a === void 0 ? void 0 : _a.call(_this, _this.uri);
1149
+ };
1150
+ reader.readAsDataURL(file);
1151
+ };
1152
+ return RESTWorldFileViewComponent;
1153
+ }());
1154
+ RESTWorldFileViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldFileViewComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1155
+ RESTWorldFileViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTWorldFileViewComponent, selector: "rw-file", inputs: { accept: "accept", fileName: "fileName" }, providers: [{
1156
+ provide: i14.NG_VALUE_ACCESSOR,
1157
+ useExisting: i0.forwardRef(function () { return RESTWorldFileViewComponent; }),
1158
+ multi: true
1159
+ }], viewQueries: [{ propertyName: "fileUploads", predicate: i2.FileUpload, descendants: true }], ngImport: i0__namespace, template: "<div class=\"flex align-items-center\">\r\n <p-button *ngIf=\"!uri\" [disabled]=\"true\" icon=\"pi pi-download\" class=\"mr-1\" pTooltip=\"No file present\"></p-button>\r\n <a *ngIf=\"uri\" [href]=\"uri | safeUrl\" [download]=\"fileName || 'download'\" class=\"mr-1\" pButton pTooltip=\"Download file\" icon=\"pi pi-download\"></a>\r\n <p-fileUpload chooseIcon=\"pi-upload fas fa-upload\" pTooltip=\"Upload new file\" mode=\"basic\" [auto]=\"true\" [accept]=\"accept || 'false'\" [customUpload]=\"true\" (uploadHandler)=\"fileChanged($event)\"></p-fileUpload>\r\n</div>\r\n", styles: ["a{text-decoration:none;height:calc(1rem + 2*8px + 2px)}a.p-button-icon-only span.p-button-label{height:1rem!important}\n"], components: [{ type: i1__namespace$3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i2__namespace.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }], pipes: { "safeUrl": SafeUrlPipe } });
1160
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldFileViewComponent, decorators: [{
1161
+ type: i0.Component,
1162
+ args: [{
1163
+ selector: 'rw-file',
1164
+ templateUrl: './restworld-file-view.component.html',
1165
+ styleUrls: ['./restworld-file-view.component.css'],
1166
+ providers: [{
1167
+ provide: i14.NG_VALUE_ACCESSOR,
1168
+ useExisting: i0.forwardRef(function () { return RESTWorldFileViewComponent; }),
1169
+ multi: true
1170
+ }]
1171
+ }]
1172
+ }], propDecorators: { accept: [{
1173
+ type: i0.Input
1174
+ }], fileName: [{
1175
+ type: i0.Input
1176
+ }], fileUploads: [{
1177
+ type: i0.ViewChildren,
1178
+ args: [i2.FileUpload]
1179
+ }] } });
1180
+
1181
+ var RestworldEditFormComponent = /** @class */ (function () {
1182
+ function RestworldEditFormComponent(_formService, _changeDetectorRef, _messageService, _clients) {
1183
+ this._formService = _formService;
1184
+ this._changeDetectorRef = _changeDetectorRef;
1185
+ this._messageService = _messageService;
1186
+ this._clients = _clients;
1187
+ this.FormGroup = i14.FormGroup;
1188
+ this.FormArray = i14.FormArray;
1189
+ this.Number = Number;
1190
+ }
1191
+ Object.defineProperty(RestworldEditFormComponent.prototype, "PropertyType", {
1192
+ get: function () {
1193
+ return i1.PropertyType;
1194
+ },
1195
+ enumerable: false,
1196
+ configurable: true
1197
+ });
1198
+ Object.defineProperty(RestworldEditFormComponent.prototype, "dateFormat", {
1199
+ get: function () {
1200
+ return new Date(3333, 10, 22)
1201
+ .toLocaleDateString()
1202
+ .replace("22", "dd")
1203
+ .replace("11", "mm")
1204
+ .replace("3333", "yy")
1205
+ .replace("33", "y");
1206
+ },
1207
+ enumerable: false,
1208
+ configurable: true
1209
+ });
1210
+ RestworldEditFormComponent.prototype.ngOnInit = function () {
1211
+ if (!this.formGroup)
1212
+ throw new Error("[formGroup] is required on <rw-form>");
1213
+ if (!this.template)
1214
+ throw new Error("[template] is required on <rw-form>");
1215
+ if (!this.apiName)
1216
+ throw new Error("[apiName] is required on <rw-form>");
1217
+ };
1218
+ RestworldEditFormComponent.prototype.getTooltip = function (resource, keysToExclude) {
1219
+ var tooltip = Object.entries(resource)
1220
+ .filter(function (_c) {
1221
+ var _d = __read(_c, 1), key = _d[0];
1222
+ return !(key.startsWith('_') || ['createdAt', 'createdBy', 'lastChangedAt', 'lastChangedBy', 'timestamp'].includes(key) || (keysToExclude === null || keysToExclude === void 0 ? void 0 : keysToExclude.includes(key)));
1223
+ })
1224
+ .reduce(function (prev, _c, index) {
1225
+ var _d = __read(_c, 2), key = _d[0], value = _d[1];
1226
+ return "" + prev + (index === 0 ? '' : '\n') + key + ": " + RestworldEditFormComponent.jsonStringifyWithElipsis(value);
1227
+ }, '');
1228
+ return tooltip;
1229
+ };
1230
+ RestworldEditFormComponent.jsonStringifyWithElipsis = function (value) {
1231
+ var maxLength = 200;
1232
+ var end = 10;
1233
+ var start = maxLength - end - 2;
1234
+ var json = JSON.stringify(value);
1235
+ var shortened = json.length > maxLength ? json.substring(0, start) + '…' + json.substring(json.length - end) : json;
1236
+ return shortened;
1237
+ };
1238
+ RestworldEditFormComponent.prototype.getCollectionEntryTemplates = function (property) {
1239
+ if (!property)
1240
+ return [];
1241
+ return Object.entries(property._templates)
1242
+ .filter(function (_c) {
1243
+ var _d = __read(_c, 1), key = _d[0];
1244
+ return Number.isInteger(Number.parseInt(key));
1245
+ })
1246
+ .map(function (_c) {
1247
+ var _d = __read(_c, 2), value = _d[1];
1248
+ return value;
1249
+ });
1250
+ };
1251
+ RestworldEditFormComponent.prototype.addNewItemToCollection = function (property, formArray) {
1252
+ if (!(formArray instanceof i14.FormArray))
1253
+ throw new Error('formArray is not an instance of FormArray.');
1254
+ var maxIndex = Math.max.apply(Math, __spreadArray([], __read(Object.keys(property._templates)
1255
+ .map(function (key) { return Number.parseInt(key); })
1256
+ .filter(function (key) { return Number.isSafeInteger(key); }))));
1257
+ var nextIndex = maxIndex + 1;
1258
+ var defaultTemplate = property._templates['default'];
1259
+ var copiedTemplateDto = JSON.parse(JSON.stringify(defaultTemplate));
1260
+ var copiedTemplate = new i1.Template(copiedTemplateDto);
1261
+ copiedTemplate.title = nextIndex.toString();
1262
+ property._templates[copiedTemplate.title] = copiedTemplate;
1263
+ formArray.push(this._formService.createFormGroupFromTemplate(defaultTemplate));
1264
+ };
1265
+ RestworldEditFormComponent.prototype.deleteItemFromCollection = function (property, formArray, template) {
1266
+ if (!template.title)
1267
+ throw new Error("Cannot delete the item, because the template '" + template + "' does not have a title.");
1268
+ if (!(formArray instanceof i14.FormArray))
1269
+ throw new Error('formArray is not an instance of FormArray.');
1270
+ var templates = property._templates;
1271
+ delete templates[template.title];
1272
+ formArray.removeAt(Number.parseInt(template.title));
1273
+ };
1274
+ RestworldEditFormComponent.prototype.collectionItemDropped = function ($event) {
1275
+ var formArray = $event.container.data.formArray;
1276
+ var previousIndex = $event.previousIndex;
1277
+ var currentIndex = $event.currentIndex;
1278
+ var movementDirection = currentIndex > previousIndex ? 1 : -1;
1279
+ // Move in FormArray
1280
+ // We do not need to move the item in the _templates object
1281
+ var movedControl = formArray.at(previousIndex);
1282
+ for (var i = previousIndex; i * movementDirection < currentIndex * movementDirection; i = i + movementDirection) {
1283
+ formArray.setControl(i, formArray.at(i + movementDirection));
1284
+ }
1285
+ formArray.setControl(currentIndex, movedControl);
1286
+ this._changeDetectorRef.markForCheck();
1287
+ console.log($event);
1288
+ };
1289
+ RestworldEditFormComponent.prototype.onOptionsFiltered = function (property, event) {
1290
+ var _a, _b;
1291
+ return __awaiter(this, void 0, void 0, function () {
1292
+ var options, templatedUri, filter, response, message, items;
1293
+ return __generator(this, function (_c) {
1294
+ switch (_c.label) {
1295
+ case 0:
1296
+ options = property === null || property === void 0 ? void 0 : property.options;
1297
+ if (!((_a = options === null || options === void 0 ? void 0 : options.link) === null || _a === void 0 ? void 0 : _a.href) || !event.filter || event.filter === '')
1298
+ return [2 /*return*/];
1299
+ templatedUri = options.link.href;
1300
+ filter = "contains(" + options.promptField + ", '" + event.filter + "')";
1301
+ if (((_b = options.valueField) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'id' && !Number.isNaN(Number.parseInt(event.filter)))
1302
+ filter = "(" + options.valueField + " eq " + event.filter + ") or (" + filter + ")";
1303
+ return [4 /*yield*/, this.getClient().getListByUri(templatedUri, { $filter: filter, $top: 10 })];
1304
+ case 1:
1305
+ response = _c.sent();
1306
+ if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1307
+ message = "An error occurred while getting the filtered items.";
1308
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1309
+ return [2 /*return*/];
1310
+ }
1311
+ items = response.body._embedded.items;
1312
+ options.inline = items;
1313
+ return [2 /*return*/];
1314
+ }
1315
+ });
1316
+ });
1317
+ };
1318
+ RestworldEditFormComponent.prototype.getClient = function () {
1319
+ if (!this.apiName)
1320
+ throw new Error('Cannot get a client, because the apiName is not set.');
1321
+ return this._clients.getClient(this.apiName);
1322
+ };
1323
+ return RestworldEditFormComponent;
1324
+ }());
1325
+ RestworldEditFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldEditFormComponent, deps: [{ token: FormService }, { token: i0__namespace.ChangeDetectorRef }, { token: i2__namespace$1.MessageService }, { token: RESTworldClientCollection }], target: i0__namespace.ɵɵFactoryTarget.Component });
1326
+ RestworldEditFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RestworldEditFormComponent, selector: "rw-form", inputs: { formGroup: "formGroup", template: "template", apiName: "apiName" }, queries: [{ propertyName: "inputOptionsSingleRef", first: true, predicate: ["inputOptionsSingle"], descendants: true }, { propertyName: "inputOptionsMultipleRef", first: true, predicate: ["inputOptionsMultiple"], descendants: true }, { propertyName: "inputOptionsRef", first: true, predicate: ["inputOptions"], descendants: true }, { propertyName: "inputHiddenRef", first: true, predicate: ["inputHidden"], descendants: true }, { propertyName: "inputTextRef", first: true, predicate: ["inputText"], descendants: true }, { propertyName: "inputTextareaRef", first: true, predicate: ["inputTextarea"], descendants: true }, { propertyName: "inputSearchRef", first: true, predicate: ["inputSearch"], descendants: true }, { propertyName: "inputTelRef", first: true, predicate: ["inputTel"], descendants: true }, { propertyName: "inputUrlRef", first: true, predicate: ["inputUrl"], descendants: true }, { propertyName: "inputEmailRef", first: true, predicate: ["inputEmail"], descendants: true }, { propertyName: "inputPasswordRef", first: true, predicate: ["inputPassword"], descendants: true }, { propertyName: "inputDateRef", first: true, predicate: ["inputDate"], descendants: true }, { propertyName: "inputMonthRef", first: true, predicate: ["inputMonth"], descendants: true }, { propertyName: "inputWeekRef", first: true, predicate: ["inputWeek"], descendants: true }, { propertyName: "inputTimeRef", first: true, predicate: ["inputTime"], descendants: true }, { propertyName: "inputDatetimeLocalRef", first: true, predicate: ["inputDatetimeLocal"], descendants: true }, { propertyName: "inputNumberRef", first: true, predicate: ["inputNumber"], descendants: true }, { propertyName: "inputRangeRef", first: true, predicate: ["inputRange"], descendants: true }, { propertyName: "inputColorRef", first: true, predicate: ["inputColor"], descendants: true }, { propertyName: "inputBoolRef", first: true, predicate: ["inputBool"], descendants: true }, { propertyName: "inputDatetimeOffsetRef", first: true, predicate: ["inputDatetimeOffset"], descendants: true }, { propertyName: "inputDurationRef", first: true, predicate: ["inputDuration"], descendants: true }, { propertyName: "inputImageRef", first: true, predicate: ["inputImage"], descendants: true }, { propertyName: "inputFileRef", first: true, predicate: ["inputFile"], descendants: true }, { propertyName: "inputObjectRef", first: true, predicate: ["inputObject"], descendants: true }, { propertyName: "inputCollectionRef", first: true, predicate: ["inputCollection"], descendants: true }, { propertyName: "inputDefaultRef", first: true, predicate: ["inputDefault"], descendants: true }], ngImport: i0__namespace, template: "<div *ngFor=\"let property of template.properties\" class=\"grid field\" [formGroup]=\"formGroup\">\r\n <label *ngIf=\"property.type !== PropertyType.Hidden\" [attr.for]=\"property.name\" class=\"col-12 mb-2 md:col-2 md:mb-0\" [class.p-disabled]=\"property.readOnly\" [class.hasChildren]=\"property._templates\">{{property.prompt || property.name}}</label>\r\n <div class=\"col-12 md:col-10\">\r\n\r\n <ng-template #defaultInputOptions let-property=\"property\" let-template=\"template\">\r\n\r\n <ng-template #defaultInputOptionsSingle let-property=\"property\" let-template=\"template\">\r\n <p-dropdown [formControlName]=\"property.name\" [id]=\"property.name\" [options]=\"property.options.inline\" [filterBy]=\"(property.options.promptField || 'prompt') + ',' + (property.options.valueField || 'value')\" [optionValue]=\"property.options.valueField || 'value'\" [readonly]=\"property.readOnly\" [required]=\"property.required || property.options.minItems > 0\" [filter]=\"true\" [autoDisplayFirst]=\"false\" [showClear]=\"!property.required || property.options.minItems <= 0\" (onFilter)=\"onOptionsFiltered(property, $event)\" styleClass=\"w-full\" [filterPlaceholder]=\"property?.options?.link?.href ? 'search for more results' : ''\">\r\n <ng-template let-item pTemplate=\"selectedItem\">\r\n <span [pTooltip]=\"getTooltip(item, [property.options.promptField || 'prompt', property.options.valueField || 'value'])\">{{item[property.options.promptField || 'prompt']}} ({{item[property.options.valueField || 'value']}})</span>\r\n </ng-template>\r\n <ng-template let-item pTemplate=\"item\">\r\n <span [pTooltip]=\"getTooltip(item, [property.options.promptField || 'prompt', property.options.valueField || 'value'])\">{{item[property.options.promptField || 'prompt']}} ({{item[property.options.valueField || 'value']}})</span>\r\n </ng-template>\r\n </p-dropdown>\r\n </ng-template>\r\n <ng-container *ngIf=\"!property.options.maxItems || property.options.maxItems == 1\">\r\n <ng-container *ngTemplateOutlet=\"inputOptionsSingleRef || defaultInputOptionsSingle; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #defaultInputOptionsMultiple let-property=\"property\" let-template=\"template\">\r\n <p-multiSelect [formControlName]=\"property.name\" [id]=\"property.name\" [options]=\"property.options.inline\" [optionLabel]=\"property.options.promptField || 'prompt'\" [optionValue]=\"property.options.valueField || 'value'\" [readonly]=\"property.readOnly\" [selectionLimit]=\"property.options.maxItems\" [required]=\"property.required || property.options.minItems > 0\"></p-multiSelect>\r\n </ng-template>\r\n <ng-container *ngIf=\"property.options.maxItems > 1\">\r\n <ng-container *ngTemplateOutlet=\"inputOptionsMultipleRef || defaultInputOptionsMultiple; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n </ng-template>\r\n <ng-container *ngIf=\"property.options\">\r\n <ng-container *ngTemplateOutlet=\"inputOptionsRef || defaultInputOptions; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n <div *ngIf=\"!property.options\">\r\n <div [ngSwitch]=\"property.type\">\r\n\r\n <ng-template #defaultInputHidden let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"hidden\" [value]=\"property.value\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Hidden\">\r\n <ng-container *ngTemplateOutlet=\"inputHiddenRef || defaultInputHidden; context:{ property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #defaultInputText let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"text\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Text\">\r\n <ng-container *ngTemplateOutlet=\"inputTextRef || defaultInputText; context:{ property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputTextarea let-property=\"property\" let-template=\"template\">\r\n <textarea [formControlName]=\"property.name\" [id]=\"property.name\" pInputTextarea class=\"w-full p-inputtextarea p-inputtext p-component p-element\" [class.p-disabled]=\"property.readOnly\" [cols]=\"property.cols\" [rows]=\"property.rows\"></textarea>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Textarea\">\r\n <ng-container *ngTemplateOutlet=\"inputTextareaRef || defaultInputTextarea; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputSearch let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"search\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Search\">\r\n <ng-container *ngTemplateOutlet=\"inputSearchRef || defaultInputSearch; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputTel let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"tel\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Tel\">\r\n <ng-container *ngTemplateOutlet=\"inputTelRef || defaultInputTel; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputUrl let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"url\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Url\">\r\n <ng-container *ngTemplateOutlet=\"inputUrlRef || defaultInputUrl; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputEmail let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"email\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Email\">\r\n <ng-container *ngTemplateOutlet=\"inputEmailRef || defaultInputEmail; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputPassword let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"password\" pPassword class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Password\">\r\n <ng-container *ngTemplateOutlet=\"inputPasswordRef || defaultInputPassword; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDate let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showWeek]=\"true\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Date\">\r\n <ng-container *ngTemplateOutlet=\"inputDateRef || defaultInputDate; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputMonth let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showWeek]=\"false\" view=\"month\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Month\">\r\n <ng-container *ngTemplateOutlet=\"inputMonthRef || defaultInputMonth; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputWeek let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"week\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Week\">\r\n <ng-container *ngTemplateOutlet=\"inputWeekRef || defaultInputWeek; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputTime let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [timeOnly]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Time\">\r\n <ng-container *ngTemplateOutlet=\"inputTimeRef || defaultInputTime; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDatetimeLocal let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.DatetimeLocal\">\r\n <ng-container *ngTemplateOutlet=\"inputDatetimeLocalRef || defaultInputDatetimeLocal; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputNumber let-property=\"property\" let-template=\"template\">\r\n <p-inputNumber [formControlName]=\"property.name\" [id]=\"property.name\" mode=\"decimal\" [showButtons]=\"!property.readOnly\" class=\"w-full\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-inputNumber>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Number\">\r\n <ng-container *ngTemplateOutlet=\"inputNumberRef || defaultInputNumber; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputRange let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"range\" [min]=\"property.min\" [max]=\"property.max\" [step]=\"property.step\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Range\">\r\n <ng-container *ngTemplateOutlet=\"inputRangeRef || defaultInputRange; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputColor let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"color\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Color\">\r\n <ng-container *ngTemplateOutlet=\"inputColorRef || defaultInputColor; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputBool let-property=\"property\" let-template=\"template\" let-formGroup=\"formGroup\">\r\n <p-checkbox *ngIf=\"property.required\" [binary]=\"true\" [formControl]=\"formGroup.controls[property.name]\" [id]=\"property.name\" [readonly]=\"property.readOnly\"></p-checkbox>\r\n <p-triStateCheckbox *ngIf=\"!property.required\" [formControl]=\"formGroup.controls[property.name]\" [id]=\"property.name\" [readonly]=\"property.readOnly\"></p-triStateCheckbox>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Bool\">\r\n <ng-container *ngTemplateOutlet=\"inputBoolRef || defaultInputBool; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDatetimeOffset let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.DatetimeOffset\">\r\n <ng-container *ngTemplateOutlet=\"inputDatetimeOffsetRef || defaultInputDatetimeOffset; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDuration let-property=\"property\" let-template=\"template\">\r\n <p-calendar *ngSwitchCase=\"PropertyType.Duration\" [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [timeOnly]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Duration\">\r\n <ng-container *ngTemplateOutlet=\"inputDurationRef || defaultInputDuration; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputImage let-property=\"property\" let-template=\"template\">\r\n <rw-image [formControlName]=\"property.name\" [accept]=\"property.placeholder\"></rw-image>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Image\">\r\n <ng-container *ngTemplateOutlet=\"inputImageRef || defaultInputImage; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputFile let-property=\"property\" let-template=\"template\">\r\n <rw-file [formControlName]=\"property.name\" [fileName]=\"property.name\" [accept]=\"property.placeholder\"></rw-file>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.File\">\r\n <ng-container *ngTemplateOutlet=\"inputFileRef || defaultInputFile; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputObject let-property=\"property\" let-template=\"template\">\r\n <div class=\"flex align-items-center\">\r\n <div class=\"brace\">\r\n </div>\r\n <div class=\"w-full\">\r\n <rw-form [formGroup]=\"(formGroup.controls[property.name] | as : FormGroup)\" [template]=\"property._templates.default\" [apiName]=\"apiName\"></rw-form>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Object\">\r\n <ng-container *ngTemplateOutlet=\"inputObjectRef || defaultInputObject; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputCollection let-property=\"property\" let-template=\"template\">\r\n <div class=\"flex align-items-center\">\r\n <div class=\"brace\">\r\n </div>\r\n <div class=\"w-full\" cdkDropList [cdkDropListData]=\"{ property: property, formArray: (formGroup.controls[property.name] | as : FormArray)}\" (cdkDropListDropped)=\"collectionItemDropped($event)\">\r\n <div *ngFor=\"let template of getCollectionEntryTemplates(property)\" class=\"flex align-items-center\" cdkDrag>\r\n <i class=\"fas fa-grip-lines\" cdkDragHandle></i>\r\n <div class=\"brace\">\r\n </div>\r\n <div class=\"w-full flex justify-content-end\">\r\n <rw-form [formGroup]=\"((formGroup.controls[property.name] | as : FormArray).controls[Number.parseInt(template.title!)] | as : FormGroup)\" [template]=\"template\" [apiName]=\"apiName\" class=\"w-full\"></rw-form>\r\n <button pButton pRipple type=\"button\" icon=\"fas fa-trash\" class=\"p-button-outlined p-button-danger ml-2 mb-3\" (click)=\"deleteItemFromCollection(property, formGroup.controls[property.name], template)\"></button>\r\n </div>\r\n </div>\r\n <div class=\"flex justify-content-end w-full\">\r\n <button pButton pRipple type=\"button\" icon=\"fas fa-plus\" class=\"p-button-outlined p-button-info\" (click)=\"addNewItemToCollection(property, formGroup.controls[property.name])\"></button>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Collection\">\r\n <ng-container *ngTemplateOutlet=\"inputCollectionRef || defaultInputCollection; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDefault let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"text\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchDefault>\r\n <ng-container *ngTemplateOutlet=\"inputDefaultRef || defaultInputDefault; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n </div>\r\n </div>\r\n <val-errors [controlName]=\"property.name || null\">\r\n <ng-template valError=\"required\">The field '{{property.prompt || property.name}}' is required.</ng-template>\r\n <ng-template valError=\"email\">The email must be a valid email address.</ng-template>\r\n <ng-template valError=\"min\" let-error=\"error\">'{{property.prompt || property.name}}' must be equal or greater than or equal to {{ error.min }}.</ng-template>\r\n <ng-template valError=\"max\" let-error=\"error\">'{{property.prompt || property.name}}' must be smaller than or equal to {{ error.max }}.</ng-template>\r\n <ng-template valError=\"minlength\" let-error=\"error\">The length of '{{property.prompt || property.name}}' must be equal or greater than or equal to {{ error.requiredLength }}.</ng-template>\r\n <ng-template valError=\"maxlength\" let-error=\"error\">The length of '{{property.prompt || property.name}}' must be shorter than or equal to {{ error.requiredLength }}.</ng-template>\r\n <ng-template valError=\"pattern\" let-error=\"error\">The value for '{{property.prompt || property.name}}' does not match the pattern {{ error }}.</ng-template>\r\n <ng-template valError=\"remote\" let-error=\"error\">{{ error }}</ng-template>\r\n </val-errors>\r\n </div>\r\n</div>\r\n", styles: [".brace{align-self:stretch;margin:.2rem .5rem;border-left:1px solid rgb(206,212,218);border-top:1px solid rgb(206,212,218);border-bottom:1px solid rgb(206,212,218);width:1rem}.cdk-drag-handle{cursor:move}.cdk-drag-preview{background-color:#ffffffd0;border:2px dashed rgb(206,212,218);cursor:move}.cdk-drag-placeholder{border:2px dashed rgb(206,212,218);margin:-2px}\n"], components: [{ type: i4__namespace$1.Dropdown, selector: "p-dropdown", inputs: ["scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "selectId", "dataKey", "filterBy", "autofocus", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "virtualScroll", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "disabled", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear"] }, { type: i5__namespace$1.MultiSelect, selector: "p-multiSelect", inputs: ["style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "autoZIndex", "baseZIndex", "filterBy", "virtualScroll", "itemSize", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "scrollHeight", "defaultLabel", "placeholder", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onPanelShow", "onPanelHide"] }, { type: i6__namespace.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "numberOfMonths", "view", "touchUI", "timeSeparator", "focusTrap", "firstDayOfWeek", "showTransitionOptions", "hideTransitionOptions", "tabindex", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i7__namespace$1.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }, { type: i8__namespace.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }, { type: i9__namespace$1.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: RESTWorldImageViewComponent, selector: "rw-image", inputs: ["alt", "accept", "fileName", "maintainAspectRatio", "aspectRatio", "resizeToWidth", "resizeToHeight", "onlyScaleDown", "containWithinAspectRatio", "backgroundColor", "format"] }, { type: RESTWorldFileViewComponent, selector: "rw-file", inputs: ["accept", "fileName"] }, { type: RestworldEditFormComponent, selector: "rw-form", inputs: ["formGroup", "template", "apiName"] }, { type: i12__namespace.ValidationErrorsComponent, selector: "val-errors", inputs: ["control", "controlName", "label"] }], directives: [{ type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i14__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i14__namespace.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i3__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i14__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3__namespace$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.InputText, selector: "[pInputText]" }, { type: i14__namespace.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { type: i14__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i17__namespace.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i17__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i17__namespace.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i3__namespace$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i12__namespace.ValidationErrorDirective, selector: "ng-template[valError]", inputs: ["valError"] }], pipes: { "as": AsPipe } });
1327
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldEditFormComponent, decorators: [{
1328
+ type: i0.Component,
1329
+ args: [{
1330
+ selector: 'rw-form',
1331
+ templateUrl: './restworld-edit-form.component.html',
1332
+ styleUrls: ['./restworld-edit-form.component.css']
1333
+ }]
1334
+ }], ctorParameters: function () { return [{ type: FormService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace$1.MessageService }, { type: RESTworldClientCollection }]; }, propDecorators: { formGroup: [{
1335
+ type: i0.Input
1336
+ }], template: [{
1337
+ type: i0.Input
1338
+ }], apiName: [{
1339
+ type: i0.Input
1340
+ }], inputOptionsSingleRef: [{
1341
+ type: i0.ContentChild,
1342
+ args: ['inputOptionsSingle', { static: false }]
1343
+ }], inputOptionsMultipleRef: [{
1344
+ type: i0.ContentChild,
1345
+ args: ['inputOptionsMultiple', { static: false }]
1346
+ }], inputOptionsRef: [{
1347
+ type: i0.ContentChild,
1348
+ args: ['inputOptions', { static: false }]
1349
+ }], inputHiddenRef: [{
1350
+ type: i0.ContentChild,
1351
+ args: ['inputHidden', { static: false }]
1352
+ }], inputTextRef: [{
1353
+ type: i0.ContentChild,
1354
+ args: ['inputText', { static: false }]
1355
+ }], inputTextareaRef: [{
1356
+ type: i0.ContentChild,
1357
+ args: ['inputTextarea', { static: false }]
1358
+ }], inputSearchRef: [{
1359
+ type: i0.ContentChild,
1360
+ args: ['inputSearch', { static: false }]
1361
+ }], inputTelRef: [{
1362
+ type: i0.ContentChild,
1363
+ args: ['inputTel', { static: false }]
1364
+ }], inputUrlRef: [{
1365
+ type: i0.ContentChild,
1366
+ args: ['inputUrl', { static: false }]
1367
+ }], inputEmailRef: [{
1368
+ type: i0.ContentChild,
1369
+ args: ['inputEmail', { static: false }]
1370
+ }], inputPasswordRef: [{
1371
+ type: i0.ContentChild,
1372
+ args: ['inputPassword', { static: false }]
1373
+ }], inputDateRef: [{
1374
+ type: i0.ContentChild,
1375
+ args: ['inputDate', { static: false }]
1376
+ }], inputMonthRef: [{
1377
+ type: i0.ContentChild,
1378
+ args: ['inputMonth', { static: false }]
1379
+ }], inputWeekRef: [{
1380
+ type: i0.ContentChild,
1381
+ args: ['inputWeek', { static: false }]
1382
+ }], inputTimeRef: [{
1383
+ type: i0.ContentChild,
1384
+ args: ['inputTime', { static: false }]
1385
+ }], inputDatetimeLocalRef: [{
1386
+ type: i0.ContentChild,
1387
+ args: ['inputDatetimeLocal', { static: false }]
1388
+ }], inputNumberRef: [{
1389
+ type: i0.ContentChild,
1390
+ args: ['inputNumber', { static: false }]
1391
+ }], inputRangeRef: [{
1392
+ type: i0.ContentChild,
1393
+ args: ['inputRange', { static: false }]
1394
+ }], inputColorRef: [{
1395
+ type: i0.ContentChild,
1396
+ args: ['inputColor', { static: false }]
1397
+ }], inputBoolRef: [{
1398
+ type: i0.ContentChild,
1399
+ args: ['inputBool', { static: false }]
1400
+ }], inputDatetimeOffsetRef: [{
1401
+ type: i0.ContentChild,
1402
+ args: ['inputDatetimeOffset', { static: false }]
1403
+ }], inputDurationRef: [{
1404
+ type: i0.ContentChild,
1405
+ args: ['inputDuration', { static: false }]
1406
+ }], inputImageRef: [{
1407
+ type: i0.ContentChild,
1408
+ args: ['inputImage', { static: false }]
1409
+ }], inputFileRef: [{
1410
+ type: i0.ContentChild,
1411
+ args: ['inputFile', { static: false }]
1412
+ }], inputObjectRef: [{
1413
+ type: i0.ContentChild,
1414
+ args: ['inputObject', { static: false }]
1415
+ }], inputCollectionRef: [{
1416
+ type: i0.ContentChild,
1417
+ args: ['inputCollection', { static: false }]
1418
+ }], inputDefaultRef: [{
1419
+ type: i0.ContentChild,
1420
+ args: ['inputDefault', { static: false }]
1421
+ }] } });
821
1422
 
822
1423
  var RESTworldEditViewComponent = /** @class */ (function () {
823
- function RESTworldEditViewComponent(_clients, _confirmationService, _messageService, _location, _router) {
1424
+ function RESTworldEditViewComponent(_clients, _confirmationService, _messageService, _location, _router, _formService, valdemortConfig) {
824
1425
  this._clients = _clients;
825
1426
  this._confirmationService = _confirmationService;
826
1427
  this._messageService = _messageService;
827
1428
  this._location = _location;
828
1429
  this._router = _router;
829
- this._properties = [];
830
- this._formGroup = new i13.FormGroup({});
1430
+ this._formService = _formService;
1431
+ this._templates = {};
1432
+ this._formTabs = {};
831
1433
  this.isLoading = false;
1434
+ valdemortConfig.errorClasses = 'p-error text-sm';
832
1435
  }
833
- Object.defineProperty(RESTworldEditViewComponent.prototype, "properties", {
1436
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "PropertyType", {
1437
+ get: function () {
1438
+ return i1.PropertyType;
1439
+ },
1440
+ enumerable: false,
1441
+ configurable: true
1442
+ });
1443
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "templates", {
1444
+ get: function () {
1445
+ return this._templates;
1446
+ },
1447
+ enumerable: false,
1448
+ configurable: true
1449
+ });
1450
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "isLoadingForTheFirstTime", {
834
1451
  get: function () {
835
- return this._properties;
1452
+ return Object.keys(this.templates).length === 0 && this.isLoading;
836
1453
  },
837
1454
  enumerable: false,
838
1455
  configurable: true
839
1456
  });
840
- Object.defineProperty(RESTworldEditViewComponent.prototype, "formGroup", {
1457
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "formTabs", {
841
1458
  get: function () {
842
- return this._formGroup;
1459
+ return this._formTabs;
843
1460
  },
844
1461
  enumerable: false,
845
1462
  configurable: true
@@ -899,50 +1516,96 @@
899
1516
  enumerable: false,
900
1517
  configurable: true
901
1518
  });
902
- Object.defineProperty(RESTworldEditViewComponent.prototype, "dateFormat", {
903
- get: function () {
904
- return new Date(3333, 10, 22)
905
- .toLocaleDateString()
906
- .replace("22", "dd")
907
- .replace("11", "mm")
908
- .replace("3333", "yy")
909
- .replace("33", "y");
910
- },
911
- enumerable: false,
912
- configurable: true
913
- });
1519
+ RESTworldEditViewComponent.prototype.canSubmit = function (templateName) {
1520
+ var form = this.formTabs[templateName];
1521
+ return form && form.valid;
1522
+ };
1523
+ RESTworldEditViewComponent.prototype.getTooltip = function (resource, keysToExclude) {
1524
+ var tooltip = Object.entries(resource)
1525
+ .filter(function (_c) {
1526
+ var _d = __read(_c, 1), key = _d[0];
1527
+ return !(key.startsWith('_') || ['createdAt', 'createdBy', 'lastChangedAt', 'lastChangedBy', 'timestamp'].includes(key) || (keysToExclude === null || keysToExclude === void 0 ? void 0 : keysToExclude.includes(key)));
1528
+ })
1529
+ .reduce(function (prev, _c, index) {
1530
+ var _d = __read(_c, 2), key = _d[0], value = _d[1];
1531
+ return "" + prev + (index === 0 ? '' : '\n') + key + ": " + RESTworldEditViewComponent.jsonStringifyWithElipsis(value);
1532
+ }, '');
1533
+ return tooltip;
1534
+ };
1535
+ RESTworldEditViewComponent.jsonStringifyWithElipsis = function (value) {
1536
+ var maxLength = 200;
1537
+ var end = 10;
1538
+ var start = maxLength - end - 2;
1539
+ var json = JSON.stringify(value);
1540
+ var shortened = json.length > maxLength ? json.substring(0, start) + '…' + json.substring(json.length - end) : json;
1541
+ return shortened;
1542
+ };
914
1543
  RESTworldEditViewComponent.prototype.getClient = function () {
915
1544
  if (!this.apiName)
916
1545
  throw new Error('Cannot get a client, because the apiName is not set.');
917
1546
  return this._clients.getClient(this.apiName);
918
1547
  };
919
- RESTworldEditViewComponent.prototype.save = function () {
1548
+ RESTworldEditViewComponent.prototype.submit = function (templateName, template, formValue) {
920
1549
  return __awaiter(this, void 0, void 0, function () {
921
- var selfHrefBeforeSave, response, message, selfHrefAfterSave;
1550
+ var targetBeforeSave, response, summary, detail, problemDetails, form, _c, _d, _e, key, errorsForKey, path, formControl, responseResource, targetAfterSave, e_1;
1551
+ var e_2, _f;
922
1552
  var _this = this;
923
- return __generator(this, function (_c) {
924
- switch (_c.label) {
1553
+ return __generator(this, function (_g) {
1554
+ switch (_g.label) {
925
1555
  case 0:
926
- if (!this.apiName || !this.uri || !this.resource)
927
- return [2 /*return*/];
928
- Object.assign(this.resource, this.formGroup.value);
929
- selfHrefBeforeSave = this.resource._links.self[0].href;
930
1556
  this.isLoading = true;
931
- return [4 /*yield*/, this.getClient().save(this.resource)];
1557
+ _g.label = 1;
932
1558
  case 1:
933
- response = _c.sent();
934
- this.isLoading = false;
935
- if (!response.ok || ProblemDetails.isProblemDetails(response.body)) {
936
- message = response.status === 409 /* Conflict */ ? 'Someone else modified the resource. Try reloading it and apply your changes again.' : 'Error while saving the resource.';
937
- this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1559
+ _g.trys.push([1, 3, , 4]);
1560
+ targetBeforeSave = template.target;
1561
+ return [4 /*yield*/, this.getClient().submit(template, formValue)];
1562
+ case 2:
1563
+ response = _g.sent();
1564
+ if (!response.ok) {
1565
+ summary = 'Error';
1566
+ detail = 'Error while saving the resource.';
1567
+ if (ProblemDetails.isProblemDetails(response.body)) {
1568
+ problemDetails = response.body;
1569
+ summary = problemDetails.title || summary;
1570
+ detail = problemDetails.detail || detail;
1571
+ // display validation errors
1572
+ if (problemDetails['errors']) {
1573
+ form = this.formTabs[templateName];
1574
+ try {
1575
+ for (_c = __values(Object.entries(problemDetails['errors'])), _d = _c.next(); !_d.done; _d = _c.next()) {
1576
+ _e = __read(_d.value, 2), key = _e[0], errorsForKey = _e[1];
1577
+ path = key.split(/\.|\[/).map(function (e) { return e.replace("]", ""); });
1578
+ formControl = path.reduce(function (control, pathElement) { return (control instanceof i14.FormGroup ? control.controls[pathElement] : control) || control; }, form);
1579
+ formControl.setErrors({ remote: errorsForKey });
1580
+ }
1581
+ }
1582
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1583
+ finally {
1584
+ try {
1585
+ if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
1586
+ }
1587
+ finally { if (e_2) throw e_2.error; }
1588
+ }
1589
+ }
1590
+ }
1591
+ this._messageService.add({ severity: 'error', summary: summary, detail: detail, data: response, life: 10000 });
938
1592
  }
939
1593
  else {
940
- selfHrefAfterSave = this.resource._links.self[0].href;
1594
+ responseResource = response.body;
1595
+ targetAfterSave = responseResource._templates[templateName].target;
941
1596
  setTimeout(function () { return _this._messageService.add({ severity: 'success', summary: 'Saved', detail: 'The resource has been saved.' }); }, 100);
942
- if (selfHrefBeforeSave !== selfHrefAfterSave) {
943
- this._router.navigate(['/edit', this.apiName, selfHrefAfterSave]);
1597
+ if (targetBeforeSave !== targetAfterSave) {
1598
+ this._router.navigate(['/edit', this.apiName, responseResource._links.self[0].href]);
944
1599
  }
945
1600
  }
1601
+ return [3 /*break*/, 4];
1602
+ case 3:
1603
+ e_1 = _g.sent();
1604
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: "An unknown error occurred. " + JSON.stringify(e_1), life: 10000 });
1605
+ console.log(e_1);
1606
+ return [3 /*break*/, 4];
1607
+ case 4:
1608
+ this.isLoading = false;
946
1609
  return [2 /*return*/];
947
1610
  }
948
1611
  });
@@ -965,7 +1628,7 @@
965
1628
  case 0:
966
1629
  if (!this.apiName || !this.uri || !this.resource)
967
1630
  return [2 /*return*/];
968
- Object.assign(this.resource, this.formGroup.value);
1631
+ Object.assign(this.resource, this.formTabs.value);
969
1632
  return [4 /*yield*/, this.getClient().delete(this.resource)];
970
1633
  case 1:
971
1634
  _c.sent();
@@ -978,166 +1641,231 @@
978
1641
  };
979
1642
  RESTworldEditViewComponent.prototype.load = function () {
980
1643
  return __awaiter(this, void 0, void 0, function () {
981
- var response;
982
- return __generator(this, function (_c) {
983
- switch (_c.label) {
1644
+ var response, _c;
1645
+ return __generator(this, function (_d) {
1646
+ switch (_d.label) {
984
1647
  case 0:
985
1648
  if (!this.apiName || !this.uri)
986
1649
  return [2 /*return*/];
987
1650
  this.isLoading = true;
988
1651
  return [4 /*yield*/, this.getClient().getSingle(this.uri)];
989
1652
  case 1:
990
- response = _c.sent();
991
- if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
992
- this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
993
- }
994
- else {
995
- this._resource = response.body;
996
- this._properties = RESTworldEditViewComponent.createProperyInfos(this._resource);
997
- this._formGroup = RESTworldEditViewComponent.createFormGroup(this._properties);
998
- }
1653
+ response = _d.sent();
1654
+ if (!(!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body)) return [3 /*break*/, 2];
1655
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
1656
+ return [3 /*break*/, 4];
1657
+ case 2:
1658
+ this._resource = response.body;
1659
+ _c = this;
1660
+ return [4 /*yield*/, this.getAllTemplates(this._resource)];
1661
+ case 3:
1662
+ _c._templates = _d.sent();
1663
+ this._formTabs = this._formService.createFormGroupsFromTemplates(this._templates);
1664
+ _d.label = 4;
1665
+ case 4:
999
1666
  this.isLoading = false;
1000
1667
  return [2 /*return*/];
1001
1668
  }
1002
1669
  });
1003
1670
  });
1004
1671
  };
1005
- RESTworldEditViewComponent.createFormGroup = function (properties) {
1006
- var controls = Object.fromEntries(properties.map(function (p) { return [
1007
- p.field,
1008
- p.type === 'object' && p.children ? RESTworldEditViewComponent.createFormGroup(p.children) : new i13.FormControl(p.value)
1009
- ]; }));
1010
- var formGroup = new i13.FormGroup(controls);
1011
- return formGroup;
1672
+ RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementsForTemplates = function (templates) {
1673
+ return __awaiter(this, void 0, void 0, function () {
1674
+ var _this = this;
1675
+ return __generator(this, function (_c) {
1676
+ return [2 /*return*/, Promise.all(Object.values(templates)
1677
+ .map(function (template) { return _this.setInitialSelectedOptionsElementsForTemplate(template); }))];
1678
+ });
1679
+ });
1012
1680
  };
1013
- RESTworldEditViewComponent.createProperyInfos = function (resource) {
1014
- var e_1, _c;
1015
- if (!resource)
1016
- return [];
1017
- // Get all distinct properties from all rows
1018
- // We look at all rows to eliminate possible undefined values
1019
- var properties = Object.entries(resource)
1020
- .filter(function (p) { return p[0] !== '_links' &&
1021
- p[0] !== '_embedded' &&
1022
- p[0] !== 'id' &&
1023
- p[0] !== 'timestamp'; });
1024
- // Check if the rows are entities with change tracking
1025
- var withoutChangeTrackingProperties = properties.filter(function (p) { return p[0] !== 'createdAt' &&
1026
- p[0] !== 'createdBy' &&
1027
- p[0] !== 'lastChangedAt' &&
1028
- p[0] !== 'lastChangedBy'; });
1029
- var hasChangeTrackingProperties = withoutChangeTrackingProperties.length < properties.length;
1030
- // First the id, then all other properties
1031
- var sortedProperties = [];
1032
- if (Object.hasOwnProperty('id'))
1033
- sortedProperties.push(['id', resource['id']]);
1034
- sortedProperties.push.apply(sortedProperties, __spreadArray([], __read(withoutChangeTrackingProperties)));
1035
- // And change tracking properties at the end
1036
- if (hasChangeTrackingProperties) {
1037
- sortedProperties.push(['createdAt', resource['createdAt']]);
1038
- sortedProperties.push(['createdBy', resource['createdBy']]);
1039
- sortedProperties.push(['lastChangedAt', resource['lastChangedAt']]);
1040
- sortedProperties.push(['lastChangedBy', resource['lastChangedBy']]);
1041
- }
1042
- var propertyDescriptions = sortedProperties
1043
- .map(function (p) { return ({
1044
- field: p[0],
1045
- value: p[1],
1046
- label: RESTworldEditViewComponent.toTitleCase(p[0]),
1047
- type: RESTworldEditViewComponent.getColumnType(p[0], p[1]),
1048
- isReadOnly: RESTworldEditViewComponent.getIsReadOnly(p[0])
1049
- }); });
1050
- try {
1051
- for (var propertyDescriptions_1 = __values(propertyDescriptions), propertyDescriptions_1_1 = propertyDescriptions_1.next(); !propertyDescriptions_1_1.done; propertyDescriptions_1_1 = propertyDescriptions_1.next()) {
1052
- var description = propertyDescriptions_1_1.value;
1053
- if (description.type === 'object') {
1054
- var children = RESTworldEditViewComponent.createProperyInfos(description.value);
1055
- children.forEach(function (d) { return description.field + '.' + d.field; });
1056
- description.children = children;
1057
- }
1058
- }
1059
- }
1060
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1061
- finally {
1062
- try {
1063
- if (propertyDescriptions_1_1 && !propertyDescriptions_1_1.done && (_c = propertyDescriptions_1.return)) _c.call(propertyDescriptions_1);
1064
- }
1065
- finally { if (e_1) throw e_1.error; }
1066
- }
1067
- return propertyDescriptions;
1681
+ RESTworldEditViewComponent.prototype.imageChanged = function (formControl, event) {
1682
+ var file = event.files[0];
1683
+ console.log(file);
1684
+ var reader = new FileReader();
1685
+ reader.onload = function () {
1686
+ var uri = reader.result;
1687
+ console.log(uri);
1688
+ formControl.setValue(uri);
1689
+ };
1690
+ reader.readAsDataURL(file);
1068
1691
  };
1069
- RESTworldEditViewComponent.getIsReadOnly = function (field) {
1070
- return field === 'id' || field === 'createdAt' || field === 'createdBy' || field === 'lastChangedAt' || field === 'lastChangedBy';
1692
+ RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementsForTemplate = function (template) {
1693
+ return __awaiter(this, void 0, void 0, function () {
1694
+ var _this = this;
1695
+ return __generator(this, function (_c) {
1696
+ return [2 /*return*/, Promise.all(template.properties
1697
+ .filter(function (property) { var _a, _b; return (_b = (_a = property === null || property === void 0 ? void 0 : property.options) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.href; })
1698
+ .map(function (property) { return _this.setInitialSelectedOptionsElementForProperty(property); }))];
1699
+ });
1700
+ });
1071
1701
  };
1072
- RESTworldEditViewComponent.getColumnType = function (field, value) {
1073
- if (value === null || value === undefined)
1074
- return 'text';
1075
- if (___namespace.isNumber(value))
1076
- return 'numeric';
1077
- if (___namespace.isDate(value))
1078
- return 'date';
1079
- if (___namespace.isString(value)) {
1080
- return 'text';
1081
- }
1082
- if (___namespace.isBoolean(value))
1083
- return 'boolean';
1084
- if (___namespace.isObject(value))
1085
- return 'object';
1086
- if (___namespace.isArray(value))
1087
- return 'array';
1088
- return 'text';
1089
- };
1090
- RESTworldEditViewComponent.toTitleCase = function (anyCase) {
1091
- return anyCase
1092
- .replace(/(_)+/g, ' ') // underscore to whitespace
1093
- .replace(/([a-z])([A-Z][a-z])/g, "$1 $2") // insert space before each new word if there is none
1094
- .replace(/([A-Z][a-z])([A-Z])/g, "$1 $2") // insert space after each word if there is none
1095
- .replace(/([a-z])([A-Z]+[a-z])/g, "$1 $2") // insert space after single letter word if there is none
1096
- .replace(/([A-Z]+)([A-Z][a-z][a-z])/g, "$1 $2") // insert space before single letter word if there is none
1097
- .replace(/([a-z]+)([A-Z0-9]+)/g, "$1 $2") // insert space after numbers
1098
- .replace(/^./, function (match) { return match.toUpperCase(); }); // change first letter to be upper case
1702
+ RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementForProperty = function (property) {
1703
+ var _a;
1704
+ return __awaiter(this, void 0, void 0, function () {
1705
+ var options, templatedUri, filter, response, message, items;
1706
+ return __generator(this, function (_c) {
1707
+ switch (_c.label) {
1708
+ case 0:
1709
+ options = property === null || property === void 0 ? void 0 : property.options;
1710
+ if (!((_a = options === null || options === void 0 ? void 0 : options.link) === null || _a === void 0 ? void 0 : _a.href))
1711
+ return [2 /*return*/];
1712
+ templatedUri = options.link.href;
1713
+ filter = options.valueField + " eq " + property.value;
1714
+ return [4 /*yield*/, this.getClient().getListByUri(templatedUri, { $filter: filter, $top: 10 })];
1715
+ case 1:
1716
+ response = _c.sent();
1717
+ if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1718
+ message = "An error occurred while getting the filtered items.";
1719
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1720
+ return [2 /*return*/];
1721
+ }
1722
+ items = response.body._embedded.items;
1723
+ options.inline = items;
1724
+ return [2 /*return*/];
1725
+ }
1726
+ });
1727
+ });
1728
+ };
1729
+ RESTworldEditViewComponent.prototype.getAllTemplates = function (resource) {
1730
+ return __awaiter(this, void 0, void 0, function () {
1731
+ var formResponses, failedResponses, failedResponses_1, failedResponses_1_1, response, formTemplates;
1732
+ var e_3, _c;
1733
+ return __generator(this, function (_d) {
1734
+ switch (_d.label) {
1735
+ case 0: return [4 /*yield*/, this.getClient().getAllForms(resource)];
1736
+ case 1:
1737
+ formResponses = _d.sent();
1738
+ failedResponses = formResponses.filter(function (response) { return !response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body; });
1739
+ if (failedResponses.length !== 0) {
1740
+ try {
1741
+ for (failedResponses_1 = __values(failedResponses), failedResponses_1_1 = failedResponses_1.next(); !failedResponses_1_1.done; failedResponses_1_1 = failedResponses_1.next()) {
1742
+ response = failedResponses_1_1.value;
1743
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
1744
+ }
1745
+ }
1746
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1747
+ finally {
1748
+ try {
1749
+ if (failedResponses_1_1 && !failedResponses_1_1.done && (_c = failedResponses_1.return)) _c.call(failedResponses_1);
1750
+ }
1751
+ finally { if (e_3) throw e_3.error; }
1752
+ }
1753
+ return [2 /*return*/, Promise.resolve({})];
1754
+ }
1755
+ formTemplates = Object.assign.apply(Object, __spreadArray([{}], __read(formResponses.map(function (response) { return response.body._templates; }))));
1756
+ return [4 /*yield*/, this.setInitialSelectedOptionsElementsForTemplates(formTemplates)];
1757
+ case 2:
1758
+ _d.sent();
1759
+ return [2 /*return*/, formTemplates];
1760
+ }
1761
+ });
1762
+ });
1099
1763
  };
1100
1764
  return RESTworldEditViewComponent;
1101
1765
  }());
1102
- RESTworldEditViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldEditViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2__namespace.ConfirmationService }, { token: i2__namespace.MessageService }, { token: i3__namespace.Location }, { token: i4__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Component });
1103
- RESTworldEditViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTworldEditViewComponent, selector: "restworld-edit-view", inputs: { apiName: "apiName", uri: "uri" }, queries: [{ propertyName: "visualTabRef", first: true, predicate: ["visualTab"], descendants: true }, { propertyName: "formRef", first: true, predicate: ["form"], descendants: true }, { propertyName: "formRowRef", first: true, predicate: ["formRow"], descendants: true }, { propertyName: "formLabelRef", first: true, predicate: ["formLabel"], descendants: true }, { propertyName: "formInputRef", first: true, predicate: ["formInput"], descendants: true }, { propertyName: "visualTabAdditionalRef", first: true, predicate: ["visualTabAdditional"], descendants: true }, { propertyName: "rawTabRef", first: true, predicate: ["rawTab"], descendants: true }, { propertyName: "buttonsRef", first: true, predicate: ["buttonsRef"], descendants: true }], ngImport: i0__namespace, template: "<div class=\"grid\">\r\n <div class=\"col\">\r\n <h1>Edit resource</h1>\r\n </div>\r\n</div>\r\n\r\n<form [formGroup]=\"formGroup\" (ngSubmit)=\"save()\">\r\n <p-tabView>\r\n <p-tabPanel header=\"Visual\" [disabled]=\"!resource || isLoading\">\r\n <ng-template #defaultVisualTab>\r\n <ng-container *ngIf=\"!resource && isLoading\">\r\n <div *ngFor=\"let i of [1, 2, 3, 4, 5]\" class=\"grid field\">\r\n <p-skeleton class=\"col-12 mb-2 md:col-2 md:mb-0\" height=\"39px\"></p-skeleton>\r\n <div class=\"col-12 md:col-10\">\r\n <p-skeleton class=\"w-full\" height=\"39px\"></p-skeleton>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <div *ngIf=\"resource\" class=\"blockable-container\">\r\n <div class=\"blockable-element\">\r\n <ng-template #defaultForm let-properties=\"properties\" let-formGroup=\"formGroup\">\r\n <div [formGroup]=\"formGroup\">\r\n <div *ngFor=\"let property of properties\" class=\"grid field\">\r\n <ng-template #defaultFormRow>\r\n <ng-template #defaultFormLabel>\r\n <label [attr.for]=\"property.field\" class=\"col-12 mb-2 md:col-2 md:mb-0\" [class.p-disabled]=\"property.isReadOnly\" [class.hasChildren]=\"property.children?.length > 0\">{{property.label}}</label>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"formLabelRef || defaultFormLabel; context:{ $implicit: property }\"></ng-container>\r\n <ng-template #defaultFormInput let-property let-formGroup=\"formGroup\">\r\n <div [ngSwitch]=\"property.type\" class=\"col-12 md:col-10\">\r\n <input *ngSwitchCase=\"'text'\" [formControlName]=\"property.field\" [id]=\"property.field\" type=\"text\" pInputText class=\"w-full\" [class.p-disabled]=\"property.isReadOnly\">\r\n <p-calendar *ngSwitchCase=\"'date'\" [formControlName]=\"property.field\" [id]=\"property.field\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.isReadOnly\"></p-calendar>\r\n <p-inputNumber *ngSwitchCase=\"'numeric'\" [formControlName]=\"property.field\" [id]=\"property.field\" mode=\"decimal\" [showButtons]=\"!property.isReadOnly\" class=\"w-full\" styleClass=\"w-full\" [class.p-disabled]=\"property.isReadOnly\"></p-inputNumber>\r\n <p-checkbox *ngSwitchCase=\"'boolean'\" [formControl]=\"formGroup.controls[property.field]\" [id]=\"property.field\" [readonly]=\"property.isReadOnly\"></p-checkbox>\r\n <div *ngSwitchCase=\"'object'\">\r\n <ng-container *ngTemplateOutlet=\"formRef || defaultForm; context:{ properties: property.children, formGroup: formGroup.controls[property.field] }\"></ng-container>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"formInputRef || defaultFormInput; context:{ $implicit: property, formGroup: formGroup }\"></ng-container>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"formRowRef || defaultFormRow; context:{ $implicit: property }\"></ng-container>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"formRef || defaultForm; context: { properties: properties, formGroup: formGroup }\"></ng-container>\r\n </div>\r\n <div class=\"blockable-overlay\" *ngIf=\"isLoading\">\r\n <p-progressSpinner></p-progressSpinner>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"visualTabRef || defaultVisualTab\"></ng-container>\r\n <ng-container *ngTemplateOutlet=\"visualTabAdditionalRef || null; context:{ $implicit: resource, properties: properties, isLoading: isLoading }\"></ng-container>\r\n </p-tabPanel>\r\n\r\n <p-tabPanel header=\"Raw\" [disabled]=\"!resource || isLoading\">\r\n <ng-template #defaultRawTab>\r\n <pre>{{resource | json}}</pre>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"rawTabRef || defaultRawTab\"></ng-container>\r\n </p-tabPanel>\r\n </p-tabView>\r\n\r\n <div class=\"grid\">\r\n <div class=\"col\">\r\n <div class=\"flex justify-content-end w-full\">\r\n <ng-template #defaultButtons>\r\n <button pButton pRipple type=\"submit\" label=\"Save\" icon=\"far fa-save\" class=\"mx-2 p-button-success\" [disabled]=\"!resource || isLoading || !canSave\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Reload\" icon=\"fas fa-redo\" class=\"mx-2 p-button-info\" (click)=\"load()\" [disabled]=\"isLoading\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Delete\" icon=\"far fa-trash-alt\" class=\"mx-2 p-button-danger\" (click)=\"showDeleteConfirmatioModal()\" [disabled]=\"!resource || isLoading || !canDelete\"></button>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"buttonsRef || defaultButtons\"></ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n</form>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: [".blockable-container{display:grid;place-items:center;grid-template-areas:\"inner\"}.blockable-element{grid-area:inner;width:100%}.blockable-overlay{grid-area:inner;height:100%;width:100%;background-color:#0006;display:flex;align-items:center;justify-content:center;z-index:1}.field.grid>label.hasChildren{border-right:1px solid rgba(0,0,0,.1)}\n"], components: [{ type: i5__namespace.TabView, selector: "p-tabView", inputs: ["orientation", "style", "styleClass", "controlClose", "scrollable", "activeIndex"], outputs: ["onChange", "onClose", "activeIndexChange"] }, { type: i5__namespace.TabPanel, selector: "p-tabPanel", inputs: ["closable", "headerStyle", "headerStyleClass", "cache", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "selected", "disabled", "header", "leftIcon", "rightIcon"] }, { type: i6__namespace.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { type: i7__namespace.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "numberOfMonths", "view", "touchUI", "timeSeparator", "focusTrap", "firstDayOfWeek", "showTransitionOptions", "hideTransitionOptions", "tabindex", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i8__namespace.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }, { type: i9__namespace.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }, { type: i10__namespace.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { type: i11__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12__namespace.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i13__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i13__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i13__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i13__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i14__namespace.InputText, selector: "[pInputText]" }, { type: i13__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i13__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i13__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i15__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i16__namespace.Ripple, selector: "[pRipple]" }], pipes: { "json": i3__namespace.JsonPipe } });
1766
+ RESTworldEditViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldEditViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2__namespace$1.ConfirmationService }, { token: i2__namespace$1.MessageService }, { token: i3__namespace$1.Location }, { token: i4__namespace$2.Router }, { token: FormService }, { token: i12__namespace.ValdemortConfig }], target: i0__namespace.ɵɵFactoryTarget.Component });
1767
+ RESTworldEditViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTworldEditViewComponent, selector: "rw-edit", inputs: { apiName: "apiName", uri: "uri" }, queries: [{ propertyName: "extraTabsRef", first: true, predicate: ["extraTabs"], descendants: true }, { propertyName: "buttonsRef", first: true, predicate: ["buttons"], descendants: true }, { propertyName: "inputOptionsSingleRef", first: true, predicate: ["inputOptionsSingle"], descendants: true }, { propertyName: "inputOptionsMultipleRef", first: true, predicate: ["inputOptionsMultiple"], descendants: true }, { propertyName: "inputOptionsRef", first: true, predicate: ["inputOptions"], descendants: true }, { propertyName: "inputHiddenRef", first: true, predicate: ["inputHidden"], descendants: true }, { propertyName: "inputTextRef", first: true, predicate: ["inputText"], descendants: true }, { propertyName: "inputTextareaRef", first: true, predicate: ["inputTextarea"], descendants: true }, { propertyName: "inputSearchRef", first: true, predicate: ["inputSearch"], descendants: true }, { propertyName: "inputTelRef", first: true, predicate: ["inputTel"], descendants: true }, { propertyName: "inputUrlRef", first: true, predicate: ["inputUrl"], descendants: true }, { propertyName: "inputEmailRef", first: true, predicate: ["inputEmail"], descendants: true }, { propertyName: "inputPasswordRef", first: true, predicate: ["inputPassword"], descendants: true }, { propertyName: "inputDateRef", first: true, predicate: ["inputDate"], descendants: true }, { propertyName: "inputMonthRef", first: true, predicate: ["inputMonth"], descendants: true }, { propertyName: "inputWeekRef", first: true, predicate: ["inputWeek"], descendants: true }, { propertyName: "inputTimeRef", first: true, predicate: ["inputTime"], descendants: true }, { propertyName: "inputDatetimeLocalRef", first: true, predicate: ["inputDatetimeLocal"], descendants: true }, { propertyName: "inputNumberRef", first: true, predicate: ["inputNumber"], descendants: true }, { propertyName: "inputRangeRef", first: true, predicate: ["inputRange"], descendants: true }, { propertyName: "inputColorRef", first: true, predicate: ["inputColor"], descendants: true }, { propertyName: "inputBoolRef", first: true, predicate: ["inputBool"], descendants: true }, { propertyName: "inputDatetimeOffsetRef", first: true, predicate: ["inputDatetimeOffset"], descendants: true }, { propertyName: "inputDurationRef", first: true, predicate: ["inputDuration"], descendants: true }, { propertyName: "inputImageRef", first: true, predicate: ["inputImage"], descendants: true }, { propertyName: "inputFileRef", first: true, predicate: ["inputFile"], descendants: true }, { propertyName: "inputDefaultRef", first: true, predicate: ["inputDefault"], descendants: true }], ngImport: i0__namespace, template: "<div class=\"grid\">\r\n <div class=\"col\">\r\n <h1>Edit resource</h1>\r\n </div>\r\n</div>\r\n\r\n<p-tabView>\r\n\r\n <p-tabPanel *ngIf=\"isLoadingForTheFirstTime\" header=\"Loading\">\r\n <div *ngFor=\"let i of [1, 2, 3, 4, 5]\" class=\"grid field\">\r\n <p-skeleton class=\"col-12 mb-2 md:col-2 md:mb-0\" height=\"39px\"></p-skeleton>\r\n <div class=\"col-12 md:col-10\">\r\n <p-skeleton class=\"w-full\" height=\"39px\"></p-skeleton>\r\n </div>\r\n </div>\r\n <div class=\"grid\">\r\n <div class=\"col\">\r\n <div class=\"flex justify-content-end w-full\">\r\n <p-skeleton width=\"120px\" height=\"39px\" class=\"mx-2\"></p-skeleton>\r\n <p-skeleton width=\"120px\" height=\"39px\" class=\"mx-2\"></p-skeleton>\r\n <p-skeleton width=\"120px\" height=\"39px\" class=\"mx-2\"></p-skeleton>\r\n </div>\r\n </div>\r\n </div>\r\n </p-tabPanel>\r\n\r\n <p-tabPanel *ngFor=\"let item of templates | keyvalue\" [header]=\"item.value.title || item.key\" [disabled]=\"isLoading\">\r\n <form [formGroup]=\"formTabs[item.key]\" (ngSubmit)=\"submit(item.key, item.value, formTabs[item.key].value)\">\r\n <div class=\"blockable-container\">\r\n <div class=\"blockable-element\">\r\n <rw-form [formGroup]=\"formTabs[item.key]\" [template]=\"item.value\" [apiName]=\"apiName\"></rw-form>\r\n </div>\r\n <div class=\"blockable-overlay\" *ngIf=\"isLoading\">\r\n <p-progressSpinner></p-progressSpinner>\r\n </div>\r\n </div>\r\n\r\n <div class=\"grid\">\r\n <div class=\"col\">\r\n <div class=\"flex justify-content-end w-full\">\r\n <ng-template #defaultButtons>\r\n <button pButton pRipple type=\"submit\" label=\"Save\" icon=\"far fa-save\" class=\"mx-2 p-button-success\" [disabled]=\"isLoading || !canSubmit(item.key)\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Reload\" icon=\"fas fa-redo\" class=\"mx-2 p-button-info\" (click)=\"load()\" [disabled]=\"isLoading\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Delete\" icon=\"far fa-trash-alt\" class=\"ml-2 p-button-danger\" (click)=\"showDeleteConfirmatioModal()\" [disabled]=\"!resource || isLoading || !canDelete\"></button>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"buttonsRef || defaultButtons\"></ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n </p-tabPanel>\r\n\r\n <ng-template #defaultExtraTabs>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"extraTabsRef || defaultExtraTabs\"></ng-container>\r\n\r\n</p-tabView>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: ["::ng-deep .p-tooltip{max-width:-webkit-fit-content!important;max-width:-moz-fit-content!important;max-width:fit-content!important}.blockable-container{display:grid;place-items:center;grid-template-areas:\"inner\"}.blockable-element{grid-area:inner;width:100%}.blockable-overlay{grid-area:inner;height:100%;width:100%;background-color:#0006;display:flex;align-items:center;justify-content:center;z-index:1}.field.grid>label.hasChildren{border-right:1px solid rgba(0,0,0,.1)}\n"], components: [{ type: i7__namespace$2.TabView, selector: "p-tabView", inputs: ["orientation", "style", "styleClass", "controlClose", "scrollable", "activeIndex"], outputs: ["onChange", "onClose", "activeIndexChange"] }, { type: i7__namespace$2.TabPanel, selector: "p-tabPanel", inputs: ["closable", "headerStyle", "headerStyleClass", "cache", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "selected", "disabled", "header", "leftIcon", "rightIcon"] }, { type: i8__namespace$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { type: RestworldEditFormComponent, selector: "rw-form", inputs: ["formGroup", "template", "apiName"] }, { type: i10__namespace$1.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { type: i11__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12__namespace$1.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i14__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i14__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i3__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "keyvalue": i3__namespace$1.KeyValuePipe } });
1104
1768
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldEditViewComponent, decorators: [{
1105
1769
  type: i0.Component,
1106
1770
  args: [{
1107
- selector: 'restworld-edit-view',
1771
+ selector: 'rw-edit',
1108
1772
  templateUrl: './restworld-edit-view.component.html',
1109
1773
  styleUrls: ['./restworld-edit-view.component.css']
1110
1774
  }]
1111
- }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace.ConfirmationService }, { type: i2__namespace.MessageService }, { type: i3__namespace.Location }, { type: i4__namespace.Router }]; }, propDecorators: { apiName: [{
1775
+ }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace$1.ConfirmationService }, { type: i2__namespace$1.MessageService }, { type: i3__namespace$1.Location }, { type: i4__namespace$2.Router }, { type: FormService }, { type: i12__namespace.ValdemortConfig }]; }, propDecorators: { apiName: [{
1112
1776
  type: i0.Input
1113
1777
  }], uri: [{
1114
1778
  type: i0.Input
1115
- }], visualTabRef: [{
1779
+ }], extraTabsRef: [{
1116
1780
  type: i0.ContentChild,
1117
- args: ['visualTab', { static: false }]
1118
- }], formRef: [{
1781
+ args: ['extraTabs', { static: false }]
1782
+ }], buttonsRef: [{
1119
1783
  type: i0.ContentChild,
1120
- args: ['form', { static: false }]
1121
- }], formRowRef: [{
1784
+ args: ['buttons', { static: false }]
1785
+ }], inputOptionsSingleRef: [{
1122
1786
  type: i0.ContentChild,
1123
- args: ['formRow', { static: false }]
1124
- }], formLabelRef: [{
1787
+ args: ['inputOptionsSingle', { static: false }]
1788
+ }], inputOptionsMultipleRef: [{
1125
1789
  type: i0.ContentChild,
1126
- args: ['formLabel', { static: false }]
1127
- }], formInputRef: [{
1790
+ args: ['inputOptionsMultiple', { static: false }]
1791
+ }], inputOptionsRef: [{
1128
1792
  type: i0.ContentChild,
1129
- args: ['formInput', { static: false }]
1130
- }], visualTabAdditionalRef: [{
1793
+ args: ['inputOptions', { static: false }]
1794
+ }], inputHiddenRef: [{
1131
1795
  type: i0.ContentChild,
1132
- args: ['visualTabAdditional', { static: false }]
1133
- }], rawTabRef: [{
1796
+ args: ['inputHidden', { static: false }]
1797
+ }], inputTextRef: [{
1134
1798
  type: i0.ContentChild,
1135
- args: ['rawTab', { static: false }]
1136
- }], buttonsRef: [{
1799
+ args: ['inputText', { static: false }]
1800
+ }], inputTextareaRef: [{
1801
+ type: i0.ContentChild,
1802
+ args: ['inputTextarea', { static: false }]
1803
+ }], inputSearchRef: [{
1804
+ type: i0.ContentChild,
1805
+ args: ['inputSearch', { static: false }]
1806
+ }], inputTelRef: [{
1807
+ type: i0.ContentChild,
1808
+ args: ['inputTel', { static: false }]
1809
+ }], inputUrlRef: [{
1810
+ type: i0.ContentChild,
1811
+ args: ['inputUrl', { static: false }]
1812
+ }], inputEmailRef: [{
1813
+ type: i0.ContentChild,
1814
+ args: ['inputEmail', { static: false }]
1815
+ }], inputPasswordRef: [{
1816
+ type: i0.ContentChild,
1817
+ args: ['inputPassword', { static: false }]
1818
+ }], inputDateRef: [{
1819
+ type: i0.ContentChild,
1820
+ args: ['inputDate', { static: false }]
1821
+ }], inputMonthRef: [{
1822
+ type: i0.ContentChild,
1823
+ args: ['inputMonth', { static: false }]
1824
+ }], inputWeekRef: [{
1825
+ type: i0.ContentChild,
1826
+ args: ['inputWeek', { static: false }]
1827
+ }], inputTimeRef: [{
1828
+ type: i0.ContentChild,
1829
+ args: ['inputTime', { static: false }]
1830
+ }], inputDatetimeLocalRef: [{
1831
+ type: i0.ContentChild,
1832
+ args: ['inputDatetimeLocal', { static: false }]
1833
+ }], inputNumberRef: [{
1137
1834
  type: i0.ContentChild,
1138
- args: ['buttonsRef', { static: false }]
1835
+ args: ['inputNumber', { static: false }]
1836
+ }], inputRangeRef: [{
1837
+ type: i0.ContentChild,
1838
+ args: ['inputRange', { static: false }]
1839
+ }], inputColorRef: [{
1840
+ type: i0.ContentChild,
1841
+ args: ['inputColor', { static: false }]
1842
+ }], inputBoolRef: [{
1843
+ type: i0.ContentChild,
1844
+ args: ['inputBool', { static: false }]
1845
+ }], inputDatetimeOffsetRef: [{
1846
+ type: i0.ContentChild,
1847
+ args: ['inputDatetimeOffset', { static: false }]
1848
+ }], inputDurationRef: [{
1849
+ type: i0.ContentChild,
1850
+ args: ['inputDuration', { static: false }]
1851
+ }], inputImageRef: [{
1852
+ type: i0.ContentChild,
1853
+ args: ['inputImage', { static: false }]
1854
+ }], inputFileRef: [{
1855
+ type: i0.ContentChild,
1856
+ args: ['inputFile', { static: false }]
1857
+ }], inputDefaultRef: [{
1858
+ type: i0.ContentChild,
1859
+ args: ['inputDefault', { static: false }]
1139
1860
  }] } });
1140
1861
 
1862
+ exports.ColumnType = void 0;
1863
+ (function (ColumnType) {
1864
+ ColumnType["text"] = "text";
1865
+ ColumnType["numeric"] = "numeric";
1866
+ ColumnType["boolean"] = "boolean";
1867
+ ColumnType["date"] = "date";
1868
+ })(exports.ColumnType || (exports.ColumnType = {}));
1141
1869
  var RESTworldListViewComponent = /** @class */ (function () {
1142
1870
  function RESTworldListViewComponent(_clients, _confirmationService, _messageService, avatarGenerator) {
1143
1871
  this._clients = _clients;
@@ -1258,14 +1986,14 @@
1258
1986
  return [2 /*return*/];
1259
1987
  this.isLoading = true;
1260
1988
  this._lastEvent = event;
1261
- parameters = RESTworldListViewComponent.createParametersFromEvent(event);
1989
+ parameters = this.createParametersFromEvent(event);
1262
1990
  return [4 /*yield*/, this.getClient().getList(this.rel, parameters)];
1263
1991
  case 1:
1264
1992
  response = _c.sent();
1265
1993
  if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1266
1994
  this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resources from the API.', data: response });
1267
1995
  }
1268
- else {
1996
+ else if (response.body) {
1269
1997
  this.resource = response.body;
1270
1998
  this.totalRecords = this.resource.totalPages && parameters.$top ? this.resource.totalPages * parameters.$top : undefined;
1271
1999
  this._columns = this.createColumns();
@@ -1305,7 +2033,7 @@
1305
2033
  RESTworldListViewComponent.prototype.createColumns = function () {
1306
2034
  var e_1, _c, e_2, _d;
1307
2035
  if (this.value.length === 0)
1308
- return [];
2036
+ return this.columns;
1309
2037
  // Get all distinct properties from all rows
1310
2038
  // We look at all rows to eliminate possible undefined values
1311
2039
  var rowsWithProperties = this.value
@@ -1318,7 +2046,7 @@
1318
2046
  try {
1319
2047
  for (var rowsWithProperties_1 = __values(rowsWithProperties), rowsWithProperties_1_1 = rowsWithProperties_1.next(); !rowsWithProperties_1_1.done; rowsWithProperties_1_1 = rowsWithProperties_1.next()) {
1320
2048
  var propertiesOfRow = rowsWithProperties_1_1.value;
1321
- var _loop_1 = function () {
2049
+ var _loop_1 = function (property) {
1322
2050
  var propertyName = property[0];
1323
2051
  var propertyValue = property[1];
1324
2052
  var alreadyFoundPropertyWithSameName = distinctProperties.find(function (p) { return p[0] === propertyName; });
@@ -1330,7 +2058,7 @@
1330
2058
  try {
1331
2059
  for (var propertiesOfRow_1 = (e_2 = void 0, __values(propertiesOfRow)), propertiesOfRow_1_1 = propertiesOfRow_1.next(); !propertiesOfRow_1_1.done; propertiesOfRow_1_1 = propertiesOfRow_1.next()) {
1332
2060
  var property = propertiesOfRow_1_1.value;
1333
- _loop_1();
2061
+ _loop_1(property);
1334
2062
  }
1335
2063
  }
1336
2064
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -1376,16 +2104,16 @@
1376
2104
  };
1377
2105
  RESTworldListViewComponent.getColumnType = function (value) {
1378
2106
  if (value === null || value === undefined)
1379
- return 'text';
2107
+ return exports.ColumnType.text;
1380
2108
  if (___namespace.isNumber(value))
1381
- return 'numeric';
2109
+ return exports.ColumnType.numeric;
1382
2110
  if (___namespace.isDate(value))
1383
- return 'date';
2111
+ return exports.ColumnType.date;
1384
2112
  if (___namespace.isString(value))
1385
- return 'text';
2113
+ return exports.ColumnType.text;
1386
2114
  if (___namespace.isBoolean(value))
1387
- return 'boolean';
1388
- return 'text';
2115
+ return exports.ColumnType.boolean;
2116
+ return exports.ColumnType.text;
1389
2117
  };
1390
2118
  RESTworldListViewComponent.toTitleCase = function (anyCase) {
1391
2119
  return anyCase
@@ -1397,9 +2125,9 @@
1397
2125
  .replace(/([a-z]+)([A-Z0-9]+)/g, "$1 $2") // insert space after numbers
1398
2126
  .replace(/^./, function (match) { return match.toUpperCase(); }); // change first letter to be upper case
1399
2127
  };
1400
- RESTworldListViewComponent.createParametersFromEvent = function (event) {
2128
+ RESTworldListViewComponent.prototype.createParametersFromEvent = function (event) {
1401
2129
  var oDataParameters = {
1402
- $filter: RESTworldListViewComponent.createFilterFromEvent(event),
2130
+ $filter: this.createFilterFromEvent(event),
1403
2131
  $orderby: RESTworldListViewComponent.createOrderByFromEvent(event),
1404
2132
  $top: RESTworldListViewComponent.createTopFromEvent(event),
1405
2133
  $skip: RESTworldListViewComponent.createSkipFromEvent(event)
@@ -1419,25 +2147,38 @@
1419
2147
  }
1420
2148
  return undefined;
1421
2149
  };
1422
- RESTworldListViewComponent.createFilterFromEvent = function (event) {
2150
+ RESTworldListViewComponent.prototype.createFilterFromEvent = function (event) {
2151
+ var _this = this;
1423
2152
  if (!event.filters)
1424
2153
  return undefined;
1425
2154
  var filter = Object.entries(event.filters)
2155
+ // The type definition is wrong, event.filters has values of type FilterMetadata[] and not FilterMetadata.
1426
2156
  .map(function (_c) {
1427
2157
  var _d = __read(_c, 2), property = _d[0], filter = _d[1];
1428
- return RESTworldListViewComponent.createFilterForProperty(property, filter);
2158
+ return ({ property: property, filters: filter });
1429
2159
  })
1430
- .filter(function (filter) { return !!filter; })
2160
+ .map(function (f) { return _this.createFilterForPropertyArray(f.property, f.filters); })
2161
+ .filter(function (f) { return !!f; })
1431
2162
  .join(' and ');
1432
2163
  if (filter === '')
1433
2164
  return undefined;
1434
2165
  return "(" + filter + ")";
1435
2166
  };
1436
- RESTworldListViewComponent.createFilterForProperty = function (property, filter) {
2167
+ RESTworldListViewComponent.prototype.createFilterForPropertyArray = function (property, filters) {
2168
+ var _this = this;
2169
+ var filter = filters
2170
+ .map(function (f) { return _this.createFilterForProperty(property, f); })
2171
+ .filter(function (f) { return !!f; })
2172
+ .join(" " + filters[0].operator + " ");
2173
+ if (filter === '')
2174
+ return undefined;
2175
+ return "(" + filter + ")";
2176
+ };
2177
+ RESTworldListViewComponent.prototype.createFilterForProperty = function (property, filter) {
1437
2178
  if (!filter.value)
1438
2179
  return undefined;
1439
2180
  var oDataOperator = RESTworldListViewComponent.createODataOperator(filter.matchMode);
1440
- var comparisonValue = RESTworldListViewComponent.createComparisonValue(filter.value);
2181
+ var comparisonValue = this.createComparisonValue(property, filter.value);
1441
2182
  switch (oDataOperator) {
1442
2183
  case 'contains':
1443
2184
  case 'not contains':
@@ -1450,59 +2191,67 @@
1450
2191
  };
1451
2192
  RESTworldListViewComponent.createODataOperator = function (matchMode) {
1452
2193
  switch (matchMode) {
1453
- case i2.FilterMatchMode.STARTS_WITH:
2194
+ case i2$1.FilterMatchMode.STARTS_WITH:
1454
2195
  return 'startswith';
1455
- case i2.FilterMatchMode.CONTAINS:
2196
+ case i2$1.FilterMatchMode.CONTAINS:
1456
2197
  return 'contains';
1457
- case i2.FilterMatchMode.NOT_CONTAINS:
2198
+ case i2$1.FilterMatchMode.NOT_CONTAINS:
1458
2199
  return 'not contains';
1459
- case i2.FilterMatchMode.ENDS_WITH:
2200
+ case i2$1.FilterMatchMode.ENDS_WITH:
1460
2201
  return 'endswith';
1461
- case i2.FilterMatchMode.EQUALS:
2202
+ case i2$1.FilterMatchMode.EQUALS:
1462
2203
  return 'eq';
1463
- case i2.FilterMatchMode.NOT_EQUALS:
2204
+ case i2$1.FilterMatchMode.NOT_EQUALS:
1464
2205
  return 'ne';
1465
- case i2.FilterMatchMode.IN:
2206
+ case i2$1.FilterMatchMode.IN:
1466
2207
  return 'in';
1467
- case i2.FilterMatchMode.LESS_THAN:
2208
+ case i2$1.FilterMatchMode.LESS_THAN:
1468
2209
  return 'lt';
1469
- case i2.FilterMatchMode.LESS_THAN_OR_EQUAL_TO:
2210
+ case i2$1.FilterMatchMode.LESS_THAN_OR_EQUAL_TO:
1470
2211
  return 'le';
1471
- case i2.FilterMatchMode.GREATER_THAN:
2212
+ case i2$1.FilterMatchMode.GREATER_THAN:
1472
2213
  return 'gt';
1473
- case i2.FilterMatchMode.GREATER_THAN_OR_EQUAL_TO:
2214
+ case i2$1.FilterMatchMode.GREATER_THAN_OR_EQUAL_TO:
1474
2215
  return 'ge';
1475
- case i2.FilterMatchMode.IS:
2216
+ case i2$1.FilterMatchMode.IS:
1476
2217
  return 'eq';
1477
- case i2.FilterMatchMode.IS_NOT:
2218
+ case i2$1.FilterMatchMode.IS_NOT:
1478
2219
  return 'ne';
1479
- case i2.FilterMatchMode.BEFORE:
2220
+ case i2$1.FilterMatchMode.BEFORE:
1480
2221
  return 'lt';
1481
- case i2.FilterMatchMode.AFTER:
2222
+ case i2$1.FilterMatchMode.AFTER:
1482
2223
  return 'gt';
2224
+ case i2$1.FilterMatchMode.DATE_AFTER:
2225
+ return 'ge';
2226
+ case i2$1.FilterMatchMode.DATE_BEFORE:
2227
+ return 'lt';
2228
+ case i2$1.FilterMatchMode.DATE_IS:
2229
+ return 'eq';
2230
+ case i2$1.FilterMatchMode.DATE_IS_NOT:
2231
+ return 'ne';
1483
2232
  default:
1484
2233
  throw Error("Unknown matchMode " + matchMode);
1485
2234
  }
1486
2235
  };
1487
- RESTworldListViewComponent.createComparisonValue = function (value) {
1488
- var _this = this;
2236
+ RESTworldListViewComponent.prototype.createComparisonValue = function (property, value) {
1489
2237
  if (value === null || value === undefined)
1490
2238
  return 'null';
1491
- if (___namespace.isNumber(value))
1492
- return "" + value;
1493
- if (___namespace.isDate(value))
1494
- return "cast(" + value.toISOString() + ", Edm.DateTimeOffset)";
1495
- if (___namespace.isString(value)) {
1496
- var date = new Date(value);
1497
- if (!isNaN(date.valueOf()))
1498
- return "cast(" + date.toISOString() + ", Edm.DateTimeOffset)";
1499
- return "'" + value + "'";
2239
+ var columns = this.columns.filter(function (c) { return c.field === property; });
2240
+ if (columns.length !== 1)
2241
+ throw new Error("Cannot find the column for the property " + property + " which is specified in the filter.");
2242
+ var type = columns[0].type;
2243
+ switch (type) {
2244
+ case exports.ColumnType.boolean:
2245
+ return "" + value;
2246
+ case exports.ColumnType.date:
2247
+ return "cast(" + value.toISOString() + ", Edm.DateTimeOffset)";
2248
+ case exports.ColumnType.numeric:
2249
+ return "" + value;
2250
+ case exports.ColumnType.text:
2251
+ return "'" + value + "'";
2252
+ default:
2253
+ throw new Error("Unknown column type '" + type + "'");
1500
2254
  }
1501
- if (___namespace.isArray(value))
1502
- return "(" + value
1503
- .map(function (v) { return _this.createComparisonValue(v); })
1504
- .join(',') + ")";
1505
- throw new Error("Unknown type of value: " + value + ".");
1506
2255
  };
1507
2256
  return RESTworldListViewComponent;
1508
2257
  }());
@@ -1512,16 +2261,16 @@
1512
2261
  .replace("11", "MM")
1513
2262
  .replace("3333", "y")
1514
2263
  .replace("33", "yy");
1515
- RESTworldListViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldListViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2__namespace.ConfirmationService }, { token: i2__namespace.MessageService }, { token: AvatarGenerator }], target: i0__namespace.ɵɵFactoryTarget.Component });
1516
- RESTworldListViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTworldListViewComponent, selector: "restworld-list-view", inputs: { editLink: "editLink", apiName: "apiName", rel: "rel", rowsPerPage: "rowsPerPage" }, ngImport: i0__namespace, template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n <td [ngSwitch]=\"col.type\" *ngFor=\"let col of columns\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <p-avatar *ngIf=\"col.field === 'createdBy' || col.field === 'lastChangedBy'\" [pTooltip]=\"entity[col.field]\" tooltipPosition=\"top\" [image]=\"avatarGenerator.getImage(entity[col.field])\" [label]=\"avatarGenerator.getLabel(entity[col.field])\" [style]=\"avatarGenerator.getStyle(entity[col.field])\" shape=\"circle\"></p-avatar>\r\n <span *ngIf=\"col.field !== 'createdBy' && col.field !== 'lastChangedBy'\">{{entity[col.field]}}</span>\r\n </ng-container>\r\n <span *ngSwitchCase=\"'numeric'\" class=\"flex justify-content-end\">{{entity[col.field]}}</span>\r\n <span *ngSwitchCase=\"'boolean'\" class=\"flex justify-content-center\"><p-triStateCheckbox [(ngModel)]=\"entity[col.field]\" [readonly]=\"true\"></p-triStateCheckbox></span>\r\n <span *ngSwitchCase=\"'date'\" [pTooltip]=\"entity[col.field]\">{{entity[col.field] | date:dateFormat}}</span>\r\n </td>\r\n <td>\r\n <div class=\"flex justify-content-end\">\r\n <a pButton pTooltip=\"View/Edit\" tooltipPosition=\"left\" [routerLink]=\"[editLink, apiName, entity._links?.self[0].href]\" icon=\"fas fa-edit\"></a>\r\n <button pTooltip=\"Delete\" tooltipPosition=\"left\" pButton *ngIf=\"entity._links.delete\" (click)=\"showDeleteConfirmatioModal(entity)\" icon=\"fas fa-trash-alt\" type=\"button\" class=\"mx-2 p-button-danger\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"8\">No entries found.</td>\r\n </tr>\r\n </ng-template>\r\n\r\n</p-table>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: [".p-tooltip{max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content}a.p-button{text-decoration:none}\n"], components: [{ type: i4__namespace$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection"], outputs: ["selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { type: i4__namespace$1.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { type: i4__namespace$1.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping"] }, { type: i5__namespace$1.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "style", "styleClass"] }, { type: i6__namespace$1.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: i11__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12__namespace.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i2__namespace.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i3__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace$1.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { type: i10__namespace$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i4__namespace.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i15__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i3__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i13__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "date": i3__namespace.DatePipe } });
2264
+ RESTworldListViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldListViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2__namespace$1.ConfirmationService }, { token: i2__namespace$1.MessageService }, { token: AvatarGenerator }], target: i0__namespace.ɵɵFactoryTarget.Component });
2265
+ RESTworldListViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTworldListViewComponent, selector: "rw-list", inputs: { editLink: "editLink", apiName: "apiName", rel: "rel", rowsPerPage: "rowsPerPage" }, ngImport: i0__namespace, template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n <td [ngSwitch]=\"col.type\" *ngFor=\"let col of columns\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <p-avatar *ngIf=\"col.field === 'createdBy' || col.field === 'lastChangedBy'\" [pTooltip]=\"entity[col.field]\" tooltipPosition=\"top\" [image]=\"avatarGenerator.getImage(entity[col.field])\" [label]=\"avatarGenerator.getLabel(entity[col.field])\" [style]=\"avatarGenerator.getStyle(entity[col.field])\" shape=\"circle\"></p-avatar>\r\n <span *ngIf=\"col.field !== 'createdBy' && col.field !== 'lastChangedBy'\">{{entity[col.field]}}</span>\r\n </ng-container>\r\n <span *ngSwitchCase=\"'numeric'\" class=\"flex justify-content-end\">{{entity[col.field]}}</span>\r\n <span *ngSwitchCase=\"'boolean'\" class=\"flex justify-content-center\"><p-triStateCheckbox [(ngModel)]=\"entity[col.field]\" [readonly]=\"true\"></p-triStateCheckbox></span>\r\n <span *ngSwitchCase=\"'date'\" [pTooltip]=\"entity[col.field]\">{{entity[col.field] | date:dateFormat}}</span>\r\n </td>\r\n <td>\r\n <div class=\"flex justify-content-end\">\r\n <a pButton pTooltip=\"View/Edit\" tooltipPosition=\"left\" [routerLink]=\"[editLink, apiName, entity._links?.self[0].href]\" icon=\"fas fa-edit\"></a>\r\n <button pTooltip=\"Delete\" tooltipPosition=\"left\" pButton *ngIf=\"entity._links.delete\" (click)=\"showDeleteConfirmatioModal(entity)\" icon=\"fas fa-trash-alt\" type=\"button\" class=\"mx-2 p-button-danger\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"8\">No entries found.</td>\r\n </tr>\r\n </ng-template>\r\n\r\n</p-table>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: [".p-tooltip{max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content}a.p-button{text-decoration:none}\n"], components: [{ type: i4__namespace$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection"], outputs: ["selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { type: i4__namespace$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { type: i4__namespace$3.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping"] }, { type: i5__namespace$2.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "style", "styleClass"] }, { type: i9__namespace$1.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: i11__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12__namespace$1.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i4__namespace$2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i3__namespace$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "date": i3__namespace$1.DatePipe } });
1517
2266
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldListViewComponent, decorators: [{
1518
2267
  type: i0.Component,
1519
2268
  args: [{
1520
- selector: 'restworld-list-view',
2269
+ selector: 'rw-list',
1521
2270
  templateUrl: './restworld-list-view.component.html',
1522
2271
  styleUrls: ['./restworld-list-view.component.css']
1523
2272
  }]
1524
- }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace.ConfirmationService }, { type: i2__namespace.MessageService }, { type: AvatarGenerator }]; }, propDecorators: { editLink: [{
2273
+ }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace$1.ConfirmationService }, { type: i2__namespace$1.MessageService }, { type: AvatarGenerator }]; }, propDecorators: { editLink: [{
1525
2274
  type: i0.Input
1526
2275
  }], apiName: [{
1527
2276
  type: i0.Input
@@ -1547,33 +2296,51 @@
1547
2296
  }());
1548
2297
  RestworldClientModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1549
2298
  RestworldClientModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, declarations: [RESTworldListViewComponent,
1550
- RESTworldEditViewComponent], imports: [i3.CommonModule,
1551
- i4.RouterModule,
1552
- i13.FormsModule,
1553
- i13.ReactiveFormsModule,
1554
- i4$1.TableModule,
1555
- i10$1.TooltipModule,
2299
+ RESTworldEditViewComponent,
2300
+ RESTWorldImageViewComponent,
2301
+ RESTWorldFileViewComponent,
2302
+ SafeUrlPipe,
2303
+ AsPipe,
2304
+ RestworldEditFormComponent], imports: [i3$1.CommonModule,
2305
+ i4$2.RouterModule,
2306
+ i14.FormsModule,
2307
+ i14.ReactiveFormsModule,
2308
+ i4$3.TableModule,
2309
+ i7.TooltipModule,
1556
2310
  scrolling.ScrollingModule,
1557
- i14.InputTextModule,
1558
- i8.InputNumberModule,
1559
- i7.CalendarModule,
1560
- i9.CheckboxModule,
1561
- i12.ConfirmDialogModule,
2311
+ i9.InputTextModule,
2312
+ i7$1.InputNumberModule,
2313
+ i6.CalendarModule,
2314
+ i8.CheckboxModule,
2315
+ i12$1.ConfirmDialogModule,
1562
2316
  i11.ToastModule,
1563
2317
  messages.MessagesModule,
1564
2318
  panel.PanelModule,
1565
- i5.TabViewModule,
1566
- i6.SkeletonModule,
1567
- i10.ProgressSpinnerModule,
1568
- i16.RippleModule,
1569
- i6$1.TriStateCheckboxModule,
1570
- i5$1.AvatarModule], exports: [RESTworldListViewComponent,
1571
- RESTworldEditViewComponent] });
2319
+ i7$2.TabViewModule,
2320
+ i8$1.SkeletonModule,
2321
+ i10$1.ProgressSpinnerModule,
2322
+ i10.RippleModule,
2323
+ i9$1.TriStateCheckboxModule,
2324
+ i5$2.AvatarModule,
2325
+ i4$1.DropdownModule,
2326
+ i5$1.MultiSelectModule,
2327
+ i2.FileUploadModule,
2328
+ i12.ValdemortModule,
2329
+ i4.ImageCropperModule,
2330
+ i3.DialogModule,
2331
+ i1$3.ButtonModule,
2332
+ i5.ColorPickerModule,
2333
+ i17.DragDropModule], exports: [RESTworldListViewComponent,
2334
+ RESTworldEditViewComponent,
2335
+ RESTWorldImageViewComponent,
2336
+ RESTWorldFileViewComponent,
2337
+ SafeUrlPipe] });
1572
2338
  RestworldClientModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, providers: [
1573
2339
  RESTworldClientCollection,
1574
2340
  AvatarGenerator,
1575
- i2.ConfirmationService,
1576
- i2.MessageService,
2341
+ i2$1.ConfirmationService,
2342
+ FormService,
2343
+ i2$1.MessageService,
1577
2344
  {
1578
2345
  provide: i0.APP_INITIALIZER,
1579
2346
  useFactory: initializeSettings,
@@ -1581,67 +2348,94 @@
1581
2348
  multi: true,
1582
2349
  }
1583
2350
  ], imports: [[
1584
- i3.CommonModule,
1585
- i4.RouterModule,
1586
- i13.FormsModule,
1587
- i13.ReactiveFormsModule,
1588
- i4$1.TableModule,
1589
- i10$1.TooltipModule,
2351
+ i3$1.CommonModule,
2352
+ i4$2.RouterModule,
2353
+ i14.FormsModule,
2354
+ i14.ReactiveFormsModule,
2355
+ i4$3.TableModule,
2356
+ i7.TooltipModule,
1590
2357
  scrolling.ScrollingModule,
1591
- i14.InputTextModule,
1592
- i8.InputNumberModule,
1593
- i7.CalendarModule,
1594
- i9.CheckboxModule,
1595
- i12.ConfirmDialogModule,
2358
+ i9.InputTextModule,
2359
+ i7$1.InputNumberModule,
2360
+ i6.CalendarModule,
2361
+ i8.CheckboxModule,
2362
+ i12$1.ConfirmDialogModule,
1596
2363
  i11.ToastModule,
1597
2364
  messages.MessagesModule,
1598
2365
  panel.PanelModule,
1599
- i5.TabViewModule,
1600
- i6.SkeletonModule,
1601
- i10.ProgressSpinnerModule,
1602
- i16.RippleModule,
1603
- i6$1.TriStateCheckboxModule,
1604
- i5$1.AvatarModule
2366
+ i7$2.TabViewModule,
2367
+ i8$1.SkeletonModule,
2368
+ i10$1.ProgressSpinnerModule,
2369
+ i10.RippleModule,
2370
+ i9$1.TriStateCheckboxModule,
2371
+ i5$2.AvatarModule,
2372
+ i4$1.DropdownModule,
2373
+ i5$1.MultiSelectModule,
2374
+ i2.FileUploadModule,
2375
+ i12.ValdemortModule,
2376
+ i4.ImageCropperModule,
2377
+ i3.DialogModule,
2378
+ i1$3.ButtonModule,
2379
+ i5.ColorPickerModule,
2380
+ i17.DragDropModule
1605
2381
  ]] });
1606
2382
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, decorators: [{
1607
2383
  type: i0.NgModule,
1608
2384
  args: [{
1609
2385
  declarations: [
1610
2386
  RESTworldListViewComponent,
1611
- RESTworldEditViewComponent
2387
+ RESTworldEditViewComponent,
2388
+ RESTWorldImageViewComponent,
2389
+ RESTWorldFileViewComponent,
2390
+ SafeUrlPipe,
2391
+ AsPipe,
2392
+ RestworldEditFormComponent
1612
2393
  ],
1613
2394
  imports: [
1614
- i3.CommonModule,
1615
- i4.RouterModule,
1616
- i13.FormsModule,
1617
- i13.ReactiveFormsModule,
1618
- i4$1.TableModule,
1619
- i10$1.TooltipModule,
2395
+ i3$1.CommonModule,
2396
+ i4$2.RouterModule,
2397
+ i14.FormsModule,
2398
+ i14.ReactiveFormsModule,
2399
+ i4$3.TableModule,
2400
+ i7.TooltipModule,
1620
2401
  scrolling.ScrollingModule,
1621
- i14.InputTextModule,
1622
- i8.InputNumberModule,
1623
- i7.CalendarModule,
1624
- i9.CheckboxModule,
1625
- i12.ConfirmDialogModule,
2402
+ i9.InputTextModule,
2403
+ i7$1.InputNumberModule,
2404
+ i6.CalendarModule,
2405
+ i8.CheckboxModule,
2406
+ i12$1.ConfirmDialogModule,
1626
2407
  i11.ToastModule,
1627
2408
  messages.MessagesModule,
1628
2409
  panel.PanelModule,
1629
- i5.TabViewModule,
1630
- i6.SkeletonModule,
1631
- i10.ProgressSpinnerModule,
1632
- i16.RippleModule,
1633
- i6$1.TriStateCheckboxModule,
1634
- i5$1.AvatarModule
2410
+ i7$2.TabViewModule,
2411
+ i8$1.SkeletonModule,
2412
+ i10$1.ProgressSpinnerModule,
2413
+ i10.RippleModule,
2414
+ i9$1.TriStateCheckboxModule,
2415
+ i5$2.AvatarModule,
2416
+ i4$1.DropdownModule,
2417
+ i5$1.MultiSelectModule,
2418
+ i2.FileUploadModule,
2419
+ i12.ValdemortModule,
2420
+ i4.ImageCropperModule,
2421
+ i3.DialogModule,
2422
+ i1$3.ButtonModule,
2423
+ i5.ColorPickerModule,
2424
+ i17.DragDropModule
1635
2425
  ],
1636
2426
  exports: [
1637
2427
  RESTworldListViewComponent,
1638
- RESTworldEditViewComponent
2428
+ RESTworldEditViewComponent,
2429
+ RESTWorldImageViewComponent,
2430
+ RESTWorldFileViewComponent,
2431
+ SafeUrlPipe
1639
2432
  ],
1640
2433
  providers: [
1641
2434
  RESTworldClientCollection,
1642
2435
  AvatarGenerator,
1643
- i2.ConfirmationService,
1644
- i2.MessageService,
2436
+ i2$1.ConfirmationService,
2437
+ FormService,
2438
+ i2$1.MessageService,
1645
2439
  {
1646
2440
  provide: i0.APP_INITIALIZER,
1647
2441
  useFactory: initializeSettings,
@@ -1660,14 +2454,20 @@
1660
2454
  * Generated bundle index. Do not edit.
1661
2455
  */
1662
2456
 
2457
+ exports.AsPipe = AsPipe;
1663
2458
  exports.AvatarGenerator = AvatarGenerator;
2459
+ exports.FormService = FormService;
1664
2460
  exports.ProblemDetails = ProblemDetails;
2461
+ exports.RESTWorldFileViewComponent = RESTWorldFileViewComponent;
2462
+ exports.RESTWorldImageViewComponent = RESTWorldImageViewComponent;
1665
2463
  exports.RESTworldClient = RESTworldClient;
1666
2464
  exports.RESTworldClientCollection = RESTworldClientCollection;
1667
2465
  exports.RESTworldEditViewComponent = RESTworldEditViewComponent;
1668
2466
  exports.RESTworldListViewComponent = RESTworldListViewComponent;
1669
2467
  exports.RESTworldOptions = RESTworldOptions;
1670
2468
  exports.RestworldClientModule = RestworldClientModule;
2469
+ exports.RestworldEditFormComponent = RestworldEditFormComponent;
2470
+ exports.SafeUrlPipe = SafeUrlPipe;
1671
2471
  exports.SettingsService = SettingsService;
1672
2472
  exports.initializeSettings = initializeSettings;
1673
2473