@wertzui/ngx-restworld-client 1.0.1 → 1.1.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 (26) hide show
  1. package/bundles/wertzui-ngx-restworld-client.umd.js +827 -296
  2. package/bundles/wertzui-ngx-restworld-client.umd.js.map +1 -1
  3. package/esm2015/lib/models/problem-details.js +1 -1
  4. package/esm2015/lib/pipes/safe-url.pipe.js +20 -0
  5. package/esm2015/lib/restworld-client.module.js +55 -8
  6. package/esm2015/lib/services/restworld-client-collection.js +6 -3
  7. package/esm2015/lib/services/restworld-client.js +46 -8
  8. package/esm2015/lib/services/settings.service.js +7 -5
  9. package/esm2015/lib/views/restworld-edit-view/restworld-edit-view.component.js +281 -139
  10. package/esm2015/lib/views/restworld-file-view/restworld-file-view.component.js +62 -0
  11. package/esm2015/lib/views/restworld-image-view/restworld-image-view.component.js +106 -0
  12. package/esm2015/lib/views/restworld-list-view/restworld-list-view.component.js +60 -33
  13. package/esm2015/public-api.js +4 -1
  14. package/fesm2015/wertzui-ngx-restworld-client.js +629 -211
  15. package/fesm2015/wertzui-ngx-restworld-client.js.map +1 -1
  16. package/lib/models/problem-details.d.ts +2 -6
  17. package/lib/pipes/safe-url.pipe.d.ts +10 -0
  18. package/lib/restworld-client.module.d.ts +32 -21
  19. package/lib/services/restworld-client-collection.d.ts +2 -1
  20. package/lib/services/restworld-client.d.ts +4 -1
  21. package/lib/views/restworld-edit-view/restworld-edit-view.component.d.ts +60 -30
  22. package/lib/views/restworld-file-view/restworld-file-view.component.d.ts +22 -0
  23. package/lib/views/restworld-image-view/restworld-image-view.component.d.ts +39 -0
  24. package/lib/views/restworld-list-view/restworld-list-view.component.d.ts +20 -8
  25. package/package.json +28 -7
  26. package/public-api.d.ts +3 -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/common/http'), require('@angular/forms'), require('primeng/api'), require('@angular/common'), require('@angular/router'), require('ngx-valdemort'), require('primeng/tabview'), require('primeng/skeleton'), 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('primeng/tooltip'), require('primeng/inputtext'), require('primeng/ripple'), 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/common/http', '@angular/forms', 'primeng/api', '@angular/common', '@angular/router', 'ngx-valdemort', 'primeng/tabview', 'primeng/skeleton', 'primeng/dropdown', 'primeng/multiselect', 'primeng/calendar', 'primeng/inputnumber', 'primeng/checkbox', 'primeng/tristatecheckbox', 'primeng/fileupload', 'primeng/button', 'primeng/dialog', 'ngx-image-cropper', 'primeng/colorpicker', 'primeng/tooltip', 'primeng/inputtext', 'primeng/ripple', '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.common.http, global.ng.forms, global.i2$1, global.ng.common, global.ng.router, global.i5$1, global.i6, global.i7$1, global.i8, global.i9$1, global.i10$1, global.i11, global.i12, global.i13, global.i2, global.i1$3, global.i3, global.i4, global.i5, global.i7, global.i9, global.i10, global.i16, global.i17, global.i18, global.i4$2, global.i5$2, global.ng.cdk.scrolling, global.messages, global.panel));
5
+ })(this, (function (exports, _, i1, i0, i1$1, i1$2, i19, i2$1, i3$1, i4$1, i5$1, i6, i7$1, i8, i9$1, i10$1, i11, i12, i13, i2, i1$3, i3, i4, i5, i7, i9, i10, i16, i17, i18, i4$2, 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,36 @@
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);
28
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
29
+ var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
30
+ var i19__namespace = /*#__PURE__*/_interopNamespace(i19);
31
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
32
+ var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
33
+ var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
34
+ var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
35
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
36
+ var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
37
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
38
+ var i9__namespace$1 = /*#__PURE__*/_interopNamespace(i9$1);
39
+ var i10__namespace$1 = /*#__PURE__*/_interopNamespace(i10$1);
40
+ var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
41
+ var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
29
42
  var i13__namespace = /*#__PURE__*/_interopNamespace(i13);
30
43
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
44
+ var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
31
45
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
32
46
  var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
33
47
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
34
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
35
48
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
36
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
37
49
  var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
38
50
  var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
39
- var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
40
- var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
41
- var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
42
- var i15__namespace = /*#__PURE__*/_interopNamespace(i15);
43
51
  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);
47
- var i10__namespace$1 = /*#__PURE__*/_interopNamespace(i10$1);
52
+ var i17__namespace = /*#__PURE__*/_interopNamespace(i17);
53
+ var i18__namespace = /*#__PURE__*/_interopNamespace(i18);
54
+ var i4__namespace$2 = /*#__PURE__*/_interopNamespace(i4$2);
55
+ var i5__namespace$2 = /*#__PURE__*/_interopNamespace(i5$2);
48
56
 
49
57
  exports.LinkNames = void 0;
50
58
  (function (LinkNames) {
@@ -403,6 +411,24 @@
403
411
  return RESTworldOptions;
404
412
  }());
405
413
 
414
+ var SafeUrlPipe = /** @class */ (function () {
415
+ function SafeUrlPipe(_domSanitizer) {
416
+ this._domSanitizer = _domSanitizer;
417
+ }
418
+ SafeUrlPipe.prototype.transform = function (url) {
419
+ return this._domSanitizer.bypassSecurityTrustResourceUrl(url);
420
+ };
421
+ return SafeUrlPipe;
422
+ }());
423
+ 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 });
424
+ SafeUrlPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, name: "safeUrl" });
425
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, decorators: [{
426
+ type: i0.Pipe,
427
+ args: [{
428
+ name: 'safeUrl'
429
+ }]
430
+ }], ctorParameters: function () { return [{ type: i1__namespace.DomSanitizer }]; } });
431
+
406
432
  var AvatarGenerator = /** @class */ (function () {
407
433
  function AvatarGenerator() {
408
434
  this.getImageOverride = function (nameOrEmail) { return ''; };
@@ -543,7 +569,7 @@
543
569
  return __generator(this, function (_c) {
544
570
  switch (_c.label) {
545
571
  case 0:
546
- header = RESTworldClient.createHeaders(this._options.Version);
572
+ header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
547
573
  return [4 /*yield*/, this.halClient.get(this._options.BaseUrl, i1.Resource, ProblemDetails, header)];
548
574
  case 1:
549
575
  response = _c.sent();
@@ -576,6 +602,23 @@
576
602
  });
577
603
  });
578
604
  };
605
+ RESTworldClient.prototype.getListByUri = function (uri, parameters, headers) {
606
+ return __awaiter(this, void 0, void 0, function () {
607
+ var link, filledUri, response;
608
+ return __generator(this, function (_c) {
609
+ switch (_c.label) {
610
+ case 0:
611
+ link = new i1.Link();
612
+ link.href = uri;
613
+ filledUri = link.fillTemplate(parameters);
614
+ return [4 /*yield*/, this.halClient.get(filledUri, i1.PagedListResource, ProblemDetails, headers)];
615
+ case 1:
616
+ response = _c.sent();
617
+ return [2 /*return*/, response];
618
+ }
619
+ });
620
+ });
621
+ };
579
622
  RESTworldClient.prototype.getSingle = function (relOrUri, id, headers, curie) {
580
623
  return __awaiter(this, void 0, void 0, function () {
581
624
  var uri, link, response;
@@ -616,7 +659,7 @@
616
659
  throw new Error("The save link " + saveLink + " does not have a save name.");
617
660
  uri = saveLink.href;
618
661
  method = saveLink.name.toLowerCase();
619
- header = RESTworldClient.createHeaders(this._options.Version);
662
+ header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
620
663
  _c = method;
621
664
  switch (_c) {
622
665
  case 'put': return [3 /*break*/, 1];
@@ -637,6 +680,57 @@
637
680
  });
638
681
  });
639
682
  };
683
+ RESTworldClient.prototype.getAllForms = function (resource) {
684
+ return __awaiter(this, void 0, void 0, function () {
685
+ var urls, header, formsPromises, formsAndProblems;
686
+ var _this = this;
687
+ return __generator(this, function (_c) {
688
+ switch (_c.label) {
689
+ case 0:
690
+ urls = resource.getFormLinkHrefs();
691
+ header = RESTworldClient.createHeaders('application/prs.hal-forms+json', this._options.Version);
692
+ formsPromises = urls.map(function (url) { return _this._halClient.get(url, i1.FormsResource, ProblemDetails, header); });
693
+ return [4 /*yield*/, Promise.all(formsPromises)];
694
+ case 1:
695
+ formsAndProblems = _c.sent();
696
+ return [2 /*return*/, formsAndProblems];
697
+ }
698
+ });
699
+ });
700
+ };
701
+ RESTworldClient.prototype.submit = function (template, formValues) {
702
+ var _a;
703
+ return __awaiter(this, void 0, void 0, function () {
704
+ var uri, method, header, response, _c;
705
+ return __generator(this, function (_d) {
706
+ switch (_d.label) {
707
+ case 0:
708
+ uri = template.target || '';
709
+ method = (_a = template.method) === null || _a === void 0 ? void 0 : _a.toLowerCase();
710
+ header = RESTworldClient.createHeaders('application/prs.hal-forms+json', this._options.Version);
711
+ _c = method;
712
+ switch (_c) {
713
+ case 'put': return [3 /*break*/, 1];
714
+ case 'post': return [3 /*break*/, 3];
715
+ }
716
+ return [3 /*break*/, 5];
717
+ case 1: return [4 /*yield*/, this.halClient.put(uri, formValues, i1.FormsResource, ProblemDetails, header)];
718
+ case 2:
719
+ response = _d.sent();
720
+ return [3 /*break*/, 7];
721
+ case 3: return [4 /*yield*/, this.halClient.post(uri, formValues, i1.FormsResource, ProblemDetails, header)];
722
+ case 4:
723
+ response = _d.sent();
724
+ return [3 /*break*/, 7];
725
+ case 5: return [4 /*yield*/, this.halClient.get(uri, i1.FormsResource, ProblemDetails, header)];
726
+ case 6:
727
+ response = _d.sent();
728
+ _d.label = 7;
729
+ case 7: return [2 /*return*/, response];
730
+ }
731
+ });
732
+ });
733
+ };
640
734
  RESTworldClient.prototype.delete = function (resource) {
641
735
  return __awaiter(this, void 0, void 0, function () {
642
736
  var deleteLink, uri, header, response;
@@ -647,7 +741,7 @@
647
741
  if (!deleteLink)
648
742
  throw new Error("The resource " + resource + " does not have a delete link.");
649
743
  uri = deleteLink.href;
650
- header = RESTworldClient.createHeaders(this._options.Version);
744
+ header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
651
745
  return [4 /*yield*/, this.halClient.delete(uri, ProblemDetails, header)];
652
746
  case 1:
653
747
  response = _c.sent();
@@ -663,7 +757,7 @@
663
757
  };
664
758
  RESTworldClient.prototype.getLinkFromHome = function (rel, name, curie) {
665
759
  var links = this.getLinksFromHome(rel, curie);
666
- var link = !!name ? links.find(function (l) { return l.name == name; }) : links[0];
760
+ var link = name ? links.find(function (l) { return l.name === name; }) : links[0];
667
761
  if (!link)
668
762
  throw new Error("The home resource does not have a link with the rel '" + this.getFullRel(rel, curie) + "' and the name '" + name + "'.");
669
763
  return link;
@@ -688,10 +782,10 @@
688
782
  var fullRel = curie + ":" + rel;
689
783
  return fullRel;
690
784
  };
691
- RESTworldClient.createHeaders = function (version) {
785
+ RESTworldClient.createHeaders = function (mediaType, version) {
692
786
  if (version)
693
- return new i1$1.HttpHeaders({ 'Accept': "v=" + version });
694
- return new i1$1.HttpHeaders();
787
+ return new i1$2.HttpHeaders({ 'Accept': (mediaType || 'application/hal+json') + "; v=" + version });
788
+ return new i1$2.HttpHeaders();
695
789
  };
696
790
  return RESTworldClient;
697
791
  }());
@@ -701,14 +795,17 @@
701
795
  this._halClient = _halClient;
702
796
  this._clients = {};
703
797
  }
704
- RESTworldClientCollection.prototype.addClient = function (name, options) {
798
+ RESTworldClientCollection.prototype.containsClient = function (name) {
799
+ return Object.keys(this._clients).includes(name);
800
+ };
801
+ RESTworldClientCollection.prototype.addOrGetExistingClient = function (name, options) {
705
802
  return __awaiter(this, void 0, void 0, function () {
706
803
  var client;
707
804
  return __generator(this, function (_a) {
708
805
  switch (_a.label) {
709
806
  case 0:
710
807
  if (Object.keys(this._clients).includes(name))
711
- throw new Error("A client with the name '" + name + "' already exists.");
808
+ return [2 /*return*/, this.getClient(name)];
712
809
  client = new RESTworldClient(this._halClient, options);
713
810
  return [4 /*yield*/, client.ensureHomeResourceIsSet()];
714
811
  case 1:
@@ -734,19 +831,19 @@
734
831
  });
735
832
  return RESTworldClientCollection;
736
833
  }());
737
- 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 });
834
+ 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 });
738
835
  RESTworldClientCollection.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, providedIn: 'root' });
739
836
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, decorators: [{
740
837
  type: i0.Injectable,
741
838
  args: [{
742
839
  providedIn: 'root'
743
840
  }]
744
- }], ctorParameters: function () { return [{ type: i1__namespace.HalClient }]; } });
841
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.HalClient }]; } });
745
842
 
746
843
  var SettingsService = /** @class */ (function () {
747
844
  function SettingsService(backend, _clients) {
748
845
  this._clients = _clients;
749
- this._client = new i1$1.HttpClient(backend);
846
+ this._client = new i1$2.HttpClient(backend);
750
847
  }
751
848
  Object.defineProperty(SettingsService.prototype, "settings", {
752
849
  get: function () {
@@ -788,45 +885,217 @@
788
885
  });
789
886
  };
790
887
  SettingsService.prototype.populateRESTworldClientCollectionFromSettings = function () {
791
- var _this = this;
792
888
  var _a;
793
- if (!((_a = this._settings) === null || _a === void 0 ? void 0 : _a.apiUrls))
794
- return Promise.resolve([]);
795
- return Promise.all(this._settings.apiUrls
796
- .map(function (api) { return _this._clients.addClient(api.name, new RESTworldOptions(api.url, api.version)); }));
889
+ return __awaiter(this, void 0, void 0, function () {
890
+ var _this = this;
891
+ return __generator(this, function (_b) {
892
+ switch (_b.label) {
893
+ case 0:
894
+ if (!((_a = this._settings) === null || _a === void 0 ? void 0 : _a.apiUrls))
895
+ return [2 /*return*/];
896
+ return [4 /*yield*/, Promise.all(this._settings.apiUrls
897
+ .map(function (api) { return _this._clients.addOrGetExistingClient(api.name, new RESTworldOptions(api.url, api.version)); }))];
898
+ case 1:
899
+ _b.sent();
900
+ return [2 /*return*/];
901
+ }
902
+ });
903
+ });
797
904
  };
798
905
  return SettingsService;
799
906
  }());
800
- 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 });
907
+ 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 });
801
908
  SettingsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, providedIn: 'root' });
802
909
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, decorators: [{
803
910
  type: i0.Injectable,
804
911
  args: [{
805
912
  providedIn: 'root'
806
913
  }]
807
- }], ctorParameters: function () { return [{ type: i1__namespace$1.HttpBackend }, { type: RESTworldClientCollection }]; } });
914
+ }], ctorParameters: function () { return [{ type: i1__namespace$2.HttpBackend }, { type: RESTworldClientCollection }]; } });
915
+
916
+ var RESTWorldImageViewComponent = /** @class */ (function () {
917
+ function RESTWorldImageViewComponent() {
918
+ this.maintainAspectRatio = true;
919
+ this.aspectRatio = 1;
920
+ this.resizeToWidth = 0;
921
+ this.resizeToHeight = 0;
922
+ this.onlyScaleDown = false;
923
+ this.containWithinAspectRatio = false;
924
+ this.backgroundColor = "#ffffff";
925
+ this.format = 'png';
926
+ this.disabled = false;
927
+ this.displayCropDialog = false;
928
+ }
929
+ RESTWorldImageViewComponent.prototype.writeValue = function (obj) {
930
+ this.uri = obj;
931
+ };
932
+ RESTWorldImageViewComponent.prototype.registerOnChange = function (fn) {
933
+ this.onChange = fn;
934
+ };
935
+ RESTWorldImageViewComponent.prototype.registerOnTouched = function (fn) {
936
+ };
937
+ RESTWorldImageViewComponent.prototype.setDisabledState = function (isDisabled) {
938
+ this.disabled = isDisabled;
939
+ };
940
+ RESTWorldImageViewComponent.prototype.showCropDialog = function () {
941
+ this.displayCropDialog = true;
942
+ };
943
+ RESTWorldImageViewComponent.prototype.imageChanged = function (event) {
944
+ this.tempImageFile = event.files[0];
945
+ this.showCropDialog();
946
+ };
947
+ RESTWorldImageViewComponent.prototype.croppedImageChanged = function (event) {
948
+ this.tempCroppedUri = event.base64;
949
+ };
950
+ RESTWorldImageViewComponent.prototype.acceptCroppedImage = function () {
951
+ var _a;
952
+ this.uri = this.tempCroppedUri;
953
+ (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, this.uri);
954
+ this.closeCropDialog();
955
+ };
956
+ RESTWorldImageViewComponent.prototype.closeCropDialog = function () {
957
+ var _a;
958
+ (_a = this.fileUploads) === null || _a === void 0 ? void 0 : _a.forEach(function (f) { return f.clear(); });
959
+ this.displayCropDialog = false;
960
+ };
961
+ return RESTWorldImageViewComponent;
962
+ }());
963
+ RESTWorldImageViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldImageViewComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
964
+ 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: [{
965
+ provide: i19.NG_VALUE_ACCESSOR,
966
+ useExisting: i0.forwardRef(function () { return RESTWorldImageViewComponent; }),
967
+ multi: true
968
+ }], 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: i19__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i19__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i19__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 } });
969
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldImageViewComponent, decorators: [{
970
+ type: i0.Component,
971
+ args: [{
972
+ selector: 'rw-image',
973
+ templateUrl: './restworld-image-view.component.html',
974
+ styleUrls: ['./restworld-image-view.component.css'],
975
+ providers: [{
976
+ provide: i19.NG_VALUE_ACCESSOR,
977
+ useExisting: i0.forwardRef(function () { return RESTWorldImageViewComponent; }),
978
+ multi: true
979
+ }]
980
+ }]
981
+ }], ctorParameters: function () { return []; }, propDecorators: { alt: [{
982
+ type: i0.Input
983
+ }], accept: [{
984
+ type: i0.Input
985
+ }], fileName: [{
986
+ type: i0.Input
987
+ }], maintainAspectRatio: [{
988
+ type: i0.Input
989
+ }], aspectRatio: [{
990
+ type: i0.Input
991
+ }], resizeToWidth: [{
992
+ type: i0.Input
993
+ }], resizeToHeight: [{
994
+ type: i0.Input
995
+ }], onlyScaleDown: [{
996
+ type: i0.Input
997
+ }], containWithinAspectRatio: [{
998
+ type: i0.Input
999
+ }], backgroundColor: [{
1000
+ type: i0.Input
1001
+ }], format: [{
1002
+ type: i0.Input
1003
+ }], fileUploads: [{
1004
+ type: i0.ViewChildren,
1005
+ args: [i2.FileUpload]
1006
+ }] } });
1007
+
1008
+ var RESTWorldFileViewComponent = /** @class */ (function () {
1009
+ function RESTWorldFileViewComponent() {
1010
+ this.disabled = false;
1011
+ }
1012
+ RESTWorldFileViewComponent.prototype.writeValue = function (obj) {
1013
+ this.uri = obj;
1014
+ };
1015
+ RESTWorldFileViewComponent.prototype.registerOnChange = function (fn) {
1016
+ this.onChange = fn;
1017
+ };
1018
+ RESTWorldFileViewComponent.prototype.registerOnTouched = function (fn) {
1019
+ };
1020
+ RESTWorldFileViewComponent.prototype.setDisabledState = function (isDisabled) {
1021
+ this.disabled = isDisabled;
1022
+ };
1023
+ RESTWorldFileViewComponent.prototype.fileChanged = function (event) {
1024
+ var _this = this;
1025
+ var file = event.files[0];
1026
+ var reader = new FileReader();
1027
+ reader.onload = function (e) {
1028
+ var _a;
1029
+ _this.uri = reader.result;
1030
+ (_a = _this.onChange) === null || _a === void 0 ? void 0 : _a.call(_this, _this.uri);
1031
+ };
1032
+ reader.readAsDataURL(file);
1033
+ };
1034
+ return RESTWorldFileViewComponent;
1035
+ }());
1036
+ RESTWorldFileViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldFileViewComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1037
+ RESTWorldFileViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTWorldFileViewComponent, selector: "rw-file", inputs: { accept: "accept", fileName: "fileName" }, providers: [{
1038
+ provide: i19.NG_VALUE_ACCESSOR,
1039
+ useExisting: i0.forwardRef(function () { return RESTWorldFileViewComponent; }),
1040
+ multi: true
1041
+ }], 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 } });
1042
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldFileViewComponent, decorators: [{
1043
+ type: i0.Component,
1044
+ args: [{
1045
+ selector: 'rw-file',
1046
+ templateUrl: './restworld-file-view.component.html',
1047
+ styleUrls: ['./restworld-file-view.component.css'],
1048
+ providers: [{
1049
+ provide: i19.NG_VALUE_ACCESSOR,
1050
+ useExisting: i0.forwardRef(function () { return RESTWorldFileViewComponent; }),
1051
+ multi: true
1052
+ }]
1053
+ }]
1054
+ }], ctorParameters: function () { return []; }, propDecorators: { accept: [{
1055
+ type: i0.Input
1056
+ }], fileName: [{
1057
+ type: i0.Input
1058
+ }], fileUploads: [{
1059
+ type: i0.ViewChildren,
1060
+ args: [i2.FileUpload]
1061
+ }] } });
808
1062
 
809
1063
  var RESTworldEditViewComponent = /** @class */ (function () {
810
- function RESTworldEditViewComponent(_clients, _confirmationService, _messageService, _location, _router) {
1064
+ function RESTworldEditViewComponent(_clients, _confirmationService, _messageService, _location, _router, valdemortConfig) {
811
1065
  this._clients = _clients;
812
1066
  this._confirmationService = _confirmationService;
813
1067
  this._messageService = _messageService;
814
1068
  this._location = _location;
815
1069
  this._router = _router;
816
- this._properties = [];
817
- this._formGroup = new i13.FormGroup({});
1070
+ this._templates = {};
1071
+ this._formTabs = {};
818
1072
  this.isLoading = false;
1073
+ valdemortConfig.errorClasses = 'p-error text-sm';
819
1074
  }
820
- Object.defineProperty(RESTworldEditViewComponent.prototype, "properties", {
1075
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "PropertyType", {
1076
+ get: function () {
1077
+ return i1.PropertyType;
1078
+ },
1079
+ enumerable: false,
1080
+ configurable: true
1081
+ });
1082
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "templates", {
1083
+ get: function () {
1084
+ return this._templates;
1085
+ },
1086
+ enumerable: false,
1087
+ configurable: true
1088
+ });
1089
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "isLoadingForTheFirstTime", {
821
1090
  get: function () {
822
- return this._properties;
1091
+ return Object.keys(this.templates).length === 0 && this.isLoading;
823
1092
  },
824
1093
  enumerable: false,
825
1094
  configurable: true
826
1095
  });
827
- Object.defineProperty(RESTworldEditViewComponent.prototype, "formGroup", {
1096
+ Object.defineProperty(RESTworldEditViewComponent.prototype, "formTabs", {
828
1097
  get: function () {
829
- return this._formGroup;
1098
+ return this._formTabs;
830
1099
  },
831
1100
  enumerable: false,
832
1101
  configurable: true
@@ -886,6 +1155,10 @@
886
1155
  enumerable: false,
887
1156
  configurable: true
888
1157
  });
1158
+ RESTworldEditViewComponent.prototype.canSubmit = function (templateName) {
1159
+ var form = this.formTabs[templateName];
1160
+ return form && form.valid;
1161
+ };
889
1162
  Object.defineProperty(RESTworldEditViewComponent.prototype, "dateFormat", {
890
1163
  get: function () {
891
1164
  return new Date(3333, 10, 22)
@@ -898,38 +1171,92 @@
898
1171
  enumerable: false,
899
1172
  configurable: true
900
1173
  });
1174
+ RESTworldEditViewComponent.prototype.getTooltip = function (resource, keysToExclude) {
1175
+ var tooltip = Object.entries(resource)
1176
+ .filter(function (_d) {
1177
+ var _e = __read(_d, 1), key = _e[0];
1178
+ return !(key.startsWith('_') || ['createdAt', 'createdBy', 'lastChangedAt', 'lastChangedBy', 'timestamp'].includes(key) || (keysToExclude === null || keysToExclude === void 0 ? void 0 : keysToExclude.includes(key)));
1179
+ })
1180
+ .reduce(function (prev, _d, index) {
1181
+ var _e = __read(_d, 2), key = _e[0], value = _e[1];
1182
+ return "" + prev + (index === 0 ? '' : '\n') + key + ": " + RESTworldEditViewComponent.jsonStringifyWithElipsis(value);
1183
+ }, '');
1184
+ return tooltip;
1185
+ };
1186
+ RESTworldEditViewComponent.jsonStringifyWithElipsis = function (value) {
1187
+ var maxLength = 200;
1188
+ var end = 10;
1189
+ var start = maxLength - end - 2;
1190
+ var json = JSON.stringify(value);
1191
+ var shortened = json.length > maxLength ? json.substring(0, start) + '…' + json.substring(json.length - end) : json;
1192
+ return shortened;
1193
+ };
901
1194
  RESTworldEditViewComponent.prototype.getClient = function () {
902
1195
  if (!this.apiName)
903
1196
  throw new Error('Cannot get a client, because the apiName is not set.');
904
1197
  return this._clients.getClient(this.apiName);
905
1198
  };
906
- RESTworldEditViewComponent.prototype.save = function () {
1199
+ RESTworldEditViewComponent.prototype.submit = function (templateName, template, formValue) {
907
1200
  return __awaiter(this, void 0, void 0, function () {
908
- var selfHrefBeforeSave, response, message, selfHrefAfterSave;
1201
+ var targetBeforeSave, response, summary, detail, problemDetails, form, _d, _e, _f, key, errorsForKey, path, formControl, responseResource, targetAfterSave, e_1;
1202
+ var e_2, _g;
909
1203
  var _this = this;
910
- return __generator(this, function (_c) {
911
- switch (_c.label) {
1204
+ return __generator(this, function (_h) {
1205
+ switch (_h.label) {
912
1206
  case 0:
913
- if (!this.apiName || !this.uri || !this.resource)
914
- return [2 /*return*/];
915
- Object.assign(this.resource, this.formGroup.value);
916
- selfHrefBeforeSave = this.resource._links.self[0].href;
917
1207
  this.isLoading = true;
918
- return [4 /*yield*/, this.getClient().save(this.resource)];
1208
+ _h.label = 1;
919
1209
  case 1:
920
- response = _c.sent();
921
- this.isLoading = false;
922
- if (!response.ok || ProblemDetails.isProblemDetails(response.body)) {
923
- message = response.status === 409 /* Conflict */ ? 'Someone else modified the resource. Try reloading it and apply your changes again.' : 'Error while saving the resource.';
924
- this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1210
+ _h.trys.push([1, 3, , 4]);
1211
+ targetBeforeSave = template.target;
1212
+ return [4 /*yield*/, this.getClient().submit(template, formValue)];
1213
+ case 2:
1214
+ response = _h.sent();
1215
+ if (!response.ok) {
1216
+ summary = 'Error';
1217
+ detail = 'Error while saving the resource.';
1218
+ if (ProblemDetails.isProblemDetails(response.body)) {
1219
+ problemDetails = response.body;
1220
+ summary = problemDetails.title || summary;
1221
+ detail = problemDetails.detail || detail;
1222
+ // display validation errors
1223
+ if (problemDetails['errors']) {
1224
+ form = this.formTabs[templateName];
1225
+ try {
1226
+ for (_d = __values(Object.entries(problemDetails['errors'])), _e = _d.next(); !_e.done; _e = _d.next()) {
1227
+ _f = __read(_e.value, 2), key = _f[0], errorsForKey = _f[1];
1228
+ path = key.split(/\.|\[/).map(function (e) { return e.replace("]", ""); });
1229
+ formControl = path.reduce(function (control, pathElement) { return (control instanceof i19.FormGroup ? control.controls[pathElement] : control) || control; }, form);
1230
+ formControl.setErrors({ remote: errorsForKey });
1231
+ }
1232
+ }
1233
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1234
+ finally {
1235
+ try {
1236
+ if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
1237
+ }
1238
+ finally { if (e_2) throw e_2.error; }
1239
+ }
1240
+ }
1241
+ }
1242
+ this._messageService.add({ severity: 'error', summary: summary, detail: detail, data: response, life: 10000 });
925
1243
  }
926
1244
  else {
927
- selfHrefAfterSave = this.resource._links.self[0].href;
1245
+ responseResource = response.body;
1246
+ targetAfterSave = responseResource._templates[templateName].target;
928
1247
  setTimeout(function () { return _this._messageService.add({ severity: 'success', summary: 'Saved', detail: 'The resource has been saved.' }); }, 100);
929
- if (selfHrefBeforeSave !== selfHrefAfterSave) {
930
- this._router.navigate(['/edit', this.apiName, selfHrefAfterSave]);
1248
+ if (targetBeforeSave !== targetAfterSave) {
1249
+ this._router.navigate(['/edit', this.apiName, responseResource._links.self[0].href]);
931
1250
  }
932
1251
  }
1252
+ return [3 /*break*/, 4];
1253
+ case 3:
1254
+ e_1 = _h.sent();
1255
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: "An unknown error occurred. " + JSON.stringify(e_1), life: 10000 });
1256
+ console.log(e_1);
1257
+ return [3 /*break*/, 4];
1258
+ case 4:
1259
+ this.isLoading = false;
933
1260
  return [2 /*return*/];
934
1261
  }
935
1262
  });
@@ -947,15 +1274,15 @@
947
1274
  RESTworldEditViewComponent.prototype.delete = function () {
948
1275
  return __awaiter(this, void 0, void 0, function () {
949
1276
  var _this = this;
950
- return __generator(this, function (_c) {
951
- switch (_c.label) {
1277
+ return __generator(this, function (_d) {
1278
+ switch (_d.label) {
952
1279
  case 0:
953
1280
  if (!this.apiName || !this.uri || !this.resource)
954
1281
  return [2 /*return*/];
955
- Object.assign(this.resource, this.formGroup.value);
1282
+ Object.assign(this.resource, this.formTabs.value);
956
1283
  return [4 /*yield*/, this.getClient().delete(this.resource)];
957
1284
  case 1:
958
- _c.sent();
1285
+ _d.sent();
959
1286
  setTimeout(function () { return _this._messageService.add({ severity: 'success', summary: 'Deleted', detail: 'The resource has been deleted.' }); }, 100);
960
1287
  this._location.back();
961
1288
  return [2 /*return*/];
@@ -965,164 +1292,301 @@
965
1292
  };
966
1293
  RESTworldEditViewComponent.prototype.load = function () {
967
1294
  return __awaiter(this, void 0, void 0, function () {
968
- var response;
969
- return __generator(this, function (_c) {
970
- switch (_c.label) {
1295
+ var response, _d;
1296
+ return __generator(this, function (_e) {
1297
+ switch (_e.label) {
971
1298
  case 0:
972
1299
  if (!this.apiName || !this.uri)
973
1300
  return [2 /*return*/];
974
1301
  this.isLoading = true;
975
1302
  return [4 /*yield*/, this.getClient().getSingle(this.uri)];
976
1303
  case 1:
977
- response = _c.sent();
1304
+ response = _e.sent();
1305
+ if (!(!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body)) return [3 /*break*/, 2];
1306
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
1307
+ return [3 /*break*/, 4];
1308
+ case 2:
1309
+ this._resource = response.body;
1310
+ _d = this;
1311
+ return [4 /*yield*/, this.getAllTemplates(this._resource)];
1312
+ case 3:
1313
+ _d._templates = _e.sent();
1314
+ this._formTabs = RESTworldEditViewComponent.createFormTabs(this._templates);
1315
+ _e.label = 4;
1316
+ case 4:
1317
+ this.isLoading = false;
1318
+ return [2 /*return*/];
1319
+ }
1320
+ });
1321
+ });
1322
+ };
1323
+ RESTworldEditViewComponent.prototype.onOptionsFiltered = function (property, event) {
1324
+ var _a, _b, _c;
1325
+ return __awaiter(this, void 0, void 0, function () {
1326
+ var templatedUri, filter, response, message, items;
1327
+ return __generator(this, function (_d) {
1328
+ switch (_d.label) {
1329
+ case 0:
1330
+ if (!((_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) || !event.filter || event.filter == '')
1331
+ return [2 /*return*/];
1332
+ templatedUri = property.options.link.href;
1333
+ filter = "contains(" + property.options.promptField + ", '" + event.filter + "')";
1334
+ if (((_c = property.options.valueField) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'id' && !Number.isNaN(Number.parseInt(event.filter)))
1335
+ filter = "(" + property.options.valueField + " eq " + event.filter + ") or (" + filter + ")";
1336
+ return [4 /*yield*/, this.getClient().getListByUri(templatedUri, { $filter: filter, $top: 10 })];
1337
+ case 1:
1338
+ response = _d.sent();
978
1339
  if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
979
- this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
980
- }
981
- else {
982
- this._resource = response.body;
983
- this._properties = RESTworldEditViewComponent.createProperyInfos(this._resource);
984
- this._formGroup = RESTworldEditViewComponent.createFormGroup(this._properties);
1340
+ message = "An error occurred while getting the filtered items.";
1341
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1342
+ return [2 /*return*/];
985
1343
  }
986
- this.isLoading = false;
1344
+ items = response.body._embedded.items;
1345
+ property.options.inline = items;
987
1346
  return [2 /*return*/];
988
1347
  }
989
1348
  });
990
1349
  });
991
1350
  };
992
- RESTworldEditViewComponent.createFormGroup = function (properties) {
993
- var controls = Object.fromEntries(properties.map(function (p) { return [
994
- p.field,
995
- p.type === 'object' && p.children ? RESTworldEditViewComponent.createFormGroup(p.children) : new i13.FormControl(p.value)
996
- ]; }));
997
- var formGroup = new i13.FormGroup(controls);
998
- return formGroup;
1351
+ RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementsForTemplates = function (templates) {
1352
+ return __awaiter(this, void 0, void 0, function () {
1353
+ var _this = this;
1354
+ return __generator(this, function (_d) {
1355
+ return [2 /*return*/, Promise.all(Object.values(templates)
1356
+ .map(function (template) { return _this.setInitialSelectedOptionsElementsForTemplate(template); }))];
1357
+ });
1358
+ });
999
1359
  };
1000
- RESTworldEditViewComponent.createProperyInfos = function (resource) {
1001
- var e_1, _c;
1002
- if (!resource)
1003
- return [];
1004
- // Get all distinct properties from all rows
1005
- // We look at all rows to eliminate possible undefined values
1006
- var properties = Object.entries(resource)
1007
- .filter(function (p) { return p[0] !== '_links' &&
1008
- p[0] !== '_embedded' &&
1009
- p[0] !== 'id' &&
1010
- p[0] !== 'timestamp'; });
1011
- // Check if the rows are entities with change tracking
1012
- var withoutChangeTrackingProperties = properties.filter(function (p) { return p[0] !== 'createdAt' &&
1013
- p[0] !== 'createdBy' &&
1014
- p[0] !== 'lastChangedAt' &&
1015
- p[0] !== 'lastChangedBy'; });
1016
- var hasChangeTrackingProperties = withoutChangeTrackingProperties.length < properties.length;
1017
- // First the id, then all other properties
1018
- var sortedProperties = [];
1019
- if (Object.hasOwnProperty('id'))
1020
- sortedProperties.push(['id', resource['id']]);
1021
- sortedProperties.push.apply(sortedProperties, __spreadArray([], __read(withoutChangeTrackingProperties)));
1022
- // And change tracking properties at the end
1023
- if (hasChangeTrackingProperties) {
1024
- sortedProperties.push(['createdAt', resource['createdAt']]);
1025
- sortedProperties.push(['createdBy', resource['createdBy']]);
1026
- sortedProperties.push(['lastChangedAt', resource['lastChangedAt']]);
1027
- sortedProperties.push(['lastChangedBy', resource['lastChangedBy']]);
1028
- }
1029
- var propertyDescriptions = sortedProperties
1030
- .map(function (p) { return ({
1031
- field: p[0],
1032
- value: p[1],
1033
- label: RESTworldEditViewComponent.toTitleCase(p[0]),
1034
- type: RESTworldEditViewComponent.getColumnType(p[0], p[1]),
1035
- isReadOnly: RESTworldEditViewComponent.getIsReadOnly(p[0])
1036
- }); });
1037
- try {
1038
- for (var propertyDescriptions_1 = __values(propertyDescriptions), propertyDescriptions_1_1 = propertyDescriptions_1.next(); !propertyDescriptions_1_1.done; propertyDescriptions_1_1 = propertyDescriptions_1.next()) {
1039
- var description = propertyDescriptions_1_1.value;
1040
- if (description.type === 'object') {
1041
- var children = RESTworldEditViewComponent.createProperyInfos(description.value);
1042
- children.forEach(function (d) { return description.field + '.' + d.field; });
1043
- description.children = children;
1360
+ RESTworldEditViewComponent.prototype.imageChanged = function (formControl, event) {
1361
+ var file = event.files[0];
1362
+ console.log(file);
1363
+ var reader = new FileReader();
1364
+ reader.onload = function (e) {
1365
+ var uri = reader.result;
1366
+ console.log(uri);
1367
+ formControl.setValue(uri);
1368
+ };
1369
+ reader.readAsDataURL(file);
1370
+ };
1371
+ RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementsForTemplate = function (template) {
1372
+ return __awaiter(this, void 0, void 0, function () {
1373
+ var _this = this;
1374
+ return __generator(this, function (_d) {
1375
+ return [2 /*return*/, Promise.all(template.properties
1376
+ .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; })
1377
+ .map(function (property) { return _this.setInitialSelectedOptionsElementForProperty(property); }))];
1378
+ });
1379
+ });
1380
+ };
1381
+ RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementForProperty = function (property) {
1382
+ var _a, _b;
1383
+ return __awaiter(this, void 0, void 0, function () {
1384
+ var templatedUri, filter, response, message, items;
1385
+ return __generator(this, function (_d) {
1386
+ switch (_d.label) {
1387
+ case 0:
1388
+ if (!((_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))
1389
+ return [2 /*return*/];
1390
+ templatedUri = property.options.link.href;
1391
+ filter = property.options.valueField + " eq " + property.value;
1392
+ return [4 /*yield*/, this.getClient().getListByUri(templatedUri, { $filter: filter, $top: 10 })];
1393
+ case 1:
1394
+ response = _d.sent();
1395
+ if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1396
+ message = "An error occurred while getting the filtered items.";
1397
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1398
+ return [2 /*return*/];
1399
+ }
1400
+ items = response.body._embedded.items;
1401
+ property.options.inline = items;
1402
+ return [2 /*return*/];
1044
1403
  }
1045
- }
1046
- }
1047
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1048
- finally {
1049
- try {
1050
- if (propertyDescriptions_1_1 && !propertyDescriptions_1_1.done && (_c = propertyDescriptions_1.return)) _c.call(propertyDescriptions_1);
1051
- }
1052
- finally { if (e_1) throw e_1.error; }
1053
- }
1054
- return propertyDescriptions;
1404
+ });
1405
+ });
1055
1406
  };
1056
- RESTworldEditViewComponent.getIsReadOnly = function (field) {
1057
- return field === 'id' || field === 'createdAt' || field === 'createdBy' || field === 'lastChangedAt' || field === 'lastChangedBy';
1407
+ RESTworldEditViewComponent.prototype.getAllTemplates = function (resource) {
1408
+ return __awaiter(this, void 0, void 0, function () {
1409
+ var formResponses, failedResponses, failedResponses_1, failedResponses_1_1, response, formTemplates;
1410
+ var e_3, _d;
1411
+ return __generator(this, function (_e) {
1412
+ switch (_e.label) {
1413
+ case 0: return [4 /*yield*/, this.getClient().getAllForms(resource)];
1414
+ case 1:
1415
+ formResponses = _e.sent();
1416
+ failedResponses = formResponses.filter(function (response) { return !response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body; });
1417
+ if (failedResponses.length !== 0) {
1418
+ try {
1419
+ for (failedResponses_1 = __values(failedResponses), failedResponses_1_1 = failedResponses_1.next(); !failedResponses_1_1.done; failedResponses_1_1 = failedResponses_1.next()) {
1420
+ response = failedResponses_1_1.value;
1421
+ this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
1422
+ }
1423
+ }
1424
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1425
+ finally {
1426
+ try {
1427
+ if (failedResponses_1_1 && !failedResponses_1_1.done && (_d = failedResponses_1.return)) _d.call(failedResponses_1);
1428
+ }
1429
+ finally { if (e_3) throw e_3.error; }
1430
+ }
1431
+ return [2 /*return*/, Promise.resolve({})];
1432
+ }
1433
+ formTemplates = Object.assign.apply(Object, __spreadArray([{}], __read(formResponses.map(function (response) { return response.body._templates; }))));
1434
+ return [4 /*yield*/, this.setInitialSelectedOptionsElementsForTemplates(formTemplates)];
1435
+ case 2:
1436
+ _e.sent();
1437
+ return [2 /*return*/, formTemplates];
1438
+ }
1439
+ });
1440
+ });
1058
1441
  };
1059
- RESTworldEditViewComponent.getColumnType = function (field, value) {
1060
- if (value === null || value === undefined)
1061
- return 'text';
1062
- if (___namespace.isNumber(value))
1063
- return 'numeric';
1064
- if (___namespace.isDate(value))
1065
- return 'date';
1066
- if (___namespace.isString(value)) {
1067
- return 'text';
1068
- }
1069
- if (___namespace.isBoolean(value))
1070
- return 'boolean';
1071
- if (___namespace.isObject(value))
1072
- return 'object';
1073
- if (___namespace.isArray(value))
1074
- return 'array';
1075
- return 'text';
1076
- };
1077
- RESTworldEditViewComponent.toTitleCase = function (anyCase) {
1078
- return anyCase
1079
- .replace(/(_)+/g, ' ') // underscore to whitespace
1080
- .replace(/([a-z])([A-Z][a-z])/g, "$1 $2") // insert space before each new word if there is none
1081
- .replace(/([A-Z][a-z])([A-Z])/g, "$1 $2") // insert space after each word if there is none
1082
- .replace(/([a-z])([A-Z]+[a-z])/g, "$1 $2") // insert space after single letter word if there is none
1083
- .replace(/([A-Z]+)([A-Z][a-z][a-z])/g, "$1 $2") // insert space before single letter word if there is none
1084
- .replace(/([a-z]+)([A-Z0-9]+)/g, "$1 $2") // insert space after numbers
1085
- .replace(/^./, function (match) { return match.toUpperCase(); }); // change first letter to be upper case
1442
+ RESTworldEditViewComponent.createFormTabs = function (templates) {
1443
+ var _this = this;
1444
+ var tabs = Object.fromEntries(Object.entries(templates).map(function (_d) {
1445
+ var _e = __read(_d, 2), name = _e[0], template = _e[1];
1446
+ return [
1447
+ name,
1448
+ _this.createFormGroup(template)
1449
+ ];
1450
+ }));
1451
+ return tabs;
1452
+ };
1453
+ RESTworldEditViewComponent.createFormGroups = function (templates) {
1454
+ var _this = this;
1455
+ var controls = Object.fromEntries(Object.entries(templates).map(function (_d) {
1456
+ var _e = __read(_d, 2), name = _e[0], template = _e[1];
1457
+ return [
1458
+ name,
1459
+ _this.createFormGroup(template)
1460
+ ];
1461
+ }));
1462
+ var formGroup = new i19.FormGroup(controls);
1463
+ return formGroup;
1464
+ };
1465
+ RESTworldEditViewComponent.createFormGroup = function (template) {
1466
+ var _this = this;
1467
+ var controls = Object.fromEntries(template.properties.map(function (p) { return [
1468
+ p.name,
1469
+ (p.type === i1.PropertyType.Object || p.type === i1.PropertyType.Collection) && p._templates ? RESTworldEditViewComponent.createFormGroups(p._templates) : _this.createFormControl(p)
1470
+ ]; }));
1471
+ var formGroup = new i19.FormGroup(controls);
1472
+ return formGroup;
1473
+ };
1474
+ RESTworldEditViewComponent.createFormControl = function (property) {
1475
+ if (property.type === i1.PropertyType.Object || property.type === i1.PropertyType.Collection)
1476
+ return RESTworldEditViewComponent.createFormGroups(property._templates);
1477
+ var control = new i19.FormControl(property.value);
1478
+ if (property.max)
1479
+ control.addValidators(i19.Validators.max(property.max));
1480
+ if (property.maxLength)
1481
+ control.addValidators(i19.Validators.maxLength(property.maxLength));
1482
+ if (property.min)
1483
+ control.addValidators(i19.Validators.min(property.min));
1484
+ if (property.minLength)
1485
+ control.addValidators(i19.Validators.minLength(property.minLength));
1486
+ if (property.regex)
1487
+ control.addValidators(i19.Validators.pattern(property.regex));
1488
+ if (property.required)
1489
+ control.addValidators(i19.Validators.required);
1490
+ if (property.type === i1.PropertyType.Email)
1491
+ control.addValidators(i19.Validators.email);
1492
+ return control;
1086
1493
  };
1087
1494
  return RESTworldEditViewComponent;
1088
1495
  }());
1089
- 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 });
1090
- 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 } });
1496
+ 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$1.Router }, { token: i5__namespace$1.ValdemortConfig }], target: i0__namespace.ɵɵFactoryTarget.Component });
1497
+ 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 <div *ngFor=\"let property of item.value.properties\" class=\"grid field\">\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: formTabs[item.key] }\"></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: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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\" [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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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: item.value, formGroup: formTabs[item.key] }\"></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 {{ error.min }}.</ng-template>\r\n <ng-template valError=\"max\" let-error=\"error\">'{{property.prompt || property.name}}' must be smaller than {{ 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 {{ error.minlength }}.</ng-template>\r\n <ng-template valError=\"maxlength\" let-error=\"error\">The length of '{{property.prompt || property.name}}' must be shorter than {{ error.maxlength }}.</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 </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=\"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 </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: i6__namespace.TabView, selector: "p-tabView", inputs: ["orientation", "style", "styleClass", "controlClose", "scrollable", "activeIndex"], outputs: ["onChange", "onClose", "activeIndexChange"] }, { type: i6__namespace.TabPanel, selector: "p-tabPanel", inputs: ["closable", "headerStyle", "headerStyleClass", "cache", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "selected", "disabled", "header", "leftIcon", "rightIcon"] }, { type: i7__namespace$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { type: i8__namespace.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: i9__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: i10__namespace$1.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: i11__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: i12__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: i13__namespace.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: i5__namespace$1.ValidationErrorsComponent, selector: "val-errors", inputs: ["control", "controlName", "label"] }, { type: i16__namespace.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { type: i17__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i18__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: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i19__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i19__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i19__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i19__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i19__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i19__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: i19__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: i19__namespace.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { type: i19__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3__namespace$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i5__namespace$1.ValidationErrorDirective, selector: "ng-template[valError]", inputs: ["valError"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }], pipes: { "keyvalue": i3__namespace$1.KeyValuePipe } });
1091
1498
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldEditViewComponent, decorators: [{
1092
1499
  type: i0.Component,
1093
1500
  args: [{
1094
- selector: 'restworld-edit-view',
1501
+ selector: 'rw-edit',
1095
1502
  templateUrl: './restworld-edit-view.component.html',
1096
1503
  styleUrls: ['./restworld-edit-view.component.css']
1097
1504
  }]
1098
- }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace.ConfirmationService }, { type: i2__namespace.MessageService }, { type: i3__namespace.Location }, { type: i4__namespace.Router }]; }, propDecorators: { apiName: [{
1505
+ }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace$1.ConfirmationService }, { type: i2__namespace$1.MessageService }, { type: i3__namespace$1.Location }, { type: i4__namespace$1.Router }, { type: i5__namespace$1.ValdemortConfig }]; }, propDecorators: { apiName: [{
1099
1506
  type: i0.Input
1100
1507
  }], uri: [{
1101
1508
  type: i0.Input
1102
- }], visualTabRef: [{
1509
+ }], extraTabsRef: [{
1103
1510
  type: i0.ContentChild,
1104
- args: ['visualTab', { static: false }]
1105
- }], formRef: [{
1511
+ args: ['extraTabs', { static: false }]
1512
+ }], buttonsRef: [{
1106
1513
  type: i0.ContentChild,
1107
- args: ['form', { static: false }]
1108
- }], formRowRef: [{
1514
+ args: ['buttons', { static: false }]
1515
+ }], inputOptionsSingleRef: [{
1109
1516
  type: i0.ContentChild,
1110
- args: ['formRow', { static: false }]
1111
- }], formLabelRef: [{
1517
+ args: ['inputOptionsSingle', { static: false }]
1518
+ }], inputOptionsMultipleRef: [{
1112
1519
  type: i0.ContentChild,
1113
- args: ['formLabel', { static: false }]
1114
- }], formInputRef: [{
1520
+ args: ['inputOptionsMultiple', { static: false }]
1521
+ }], inputOptionsRef: [{
1115
1522
  type: i0.ContentChild,
1116
- args: ['formInput', { static: false }]
1117
- }], visualTabAdditionalRef: [{
1523
+ args: ['inputOptions', { static: false }]
1524
+ }], inputHiddenRef: [{
1118
1525
  type: i0.ContentChild,
1119
- args: ['visualTabAdditional', { static: false }]
1120
- }], rawTabRef: [{
1526
+ args: ['inputHidden', { static: false }]
1527
+ }], inputTextRef: [{
1121
1528
  type: i0.ContentChild,
1122
- args: ['rawTab', { static: false }]
1123
- }], buttonsRef: [{
1529
+ args: ['inputText', { static: false }]
1530
+ }], inputTextareaRef: [{
1531
+ type: i0.ContentChild,
1532
+ args: ['inputTextarea', { static: false }]
1533
+ }], inputSearchRef: [{
1534
+ type: i0.ContentChild,
1535
+ args: ['inputSearch', { static: false }]
1536
+ }], inputTelRef: [{
1537
+ type: i0.ContentChild,
1538
+ args: ['inputTel', { static: false }]
1539
+ }], inputUrlRef: [{
1540
+ type: i0.ContentChild,
1541
+ args: ['inputUrl', { static: false }]
1542
+ }], inputEmailRef: [{
1543
+ type: i0.ContentChild,
1544
+ args: ['inputEmail', { static: false }]
1545
+ }], inputPasswordRef: [{
1546
+ type: i0.ContentChild,
1547
+ args: ['inputPassword', { static: false }]
1548
+ }], inputDateRef: [{
1549
+ type: i0.ContentChild,
1550
+ args: ['inputDate', { static: false }]
1551
+ }], inputMonthRef: [{
1552
+ type: i0.ContentChild,
1553
+ args: ['inputMonth', { static: false }]
1554
+ }], inputWeekRef: [{
1555
+ type: i0.ContentChild,
1556
+ args: ['inputWeek', { static: false }]
1557
+ }], inputTimeRef: [{
1558
+ type: i0.ContentChild,
1559
+ args: ['inputTime', { static: false }]
1560
+ }], inputDatetimeLocalRef: [{
1561
+ type: i0.ContentChild,
1562
+ args: ['inputDatetimeLocal', { static: false }]
1563
+ }], inputNumberRef: [{
1564
+ type: i0.ContentChild,
1565
+ args: ['inputNumber', { static: false }]
1566
+ }], inputRangeRef: [{
1567
+ type: i0.ContentChild,
1568
+ args: ['inputRange', { static: false }]
1569
+ }], inputColorRef: [{
1570
+ type: i0.ContentChild,
1571
+ args: ['inputColor', { static: false }]
1572
+ }], inputBoolRef: [{
1573
+ type: i0.ContentChild,
1574
+ args: ['inputBool', { static: false }]
1575
+ }], inputDatetimeOffsetRef: [{
1576
+ type: i0.ContentChild,
1577
+ args: ['inputDatetimeOffset', { static: false }]
1578
+ }], inputDurationRef: [{
1124
1579
  type: i0.ContentChild,
1125
- args: ['buttonsRef', { static: false }]
1580
+ args: ['inputDuration', { static: false }]
1581
+ }], inputImageRef: [{
1582
+ type: i0.ContentChild,
1583
+ args: ['inputImage', { static: false }]
1584
+ }], inputFileRef: [{
1585
+ type: i0.ContentChild,
1586
+ args: ['inputFile', { static: false }]
1587
+ }], inputDefaultRef: [{
1588
+ type: i0.ContentChild,
1589
+ args: ['inputDefault', { static: false }]
1126
1590
  }] } });
1127
1591
 
1128
1592
  var RESTworldListViewComponent = /** @class */ (function () {
@@ -1245,7 +1709,7 @@
1245
1709
  return [2 /*return*/];
1246
1710
  this.isLoading = true;
1247
1711
  this._lastEvent = event;
1248
- parameters = RESTworldListViewComponent.createParametersFromEvent(event);
1712
+ parameters = this.createParametersFromEvent(event);
1249
1713
  return [4 /*yield*/, this.getClient().getList(this.rel, parameters)];
1250
1714
  case 1:
1251
1715
  response = _c.sent();
@@ -1292,7 +1756,7 @@
1292
1756
  RESTworldListViewComponent.prototype.createColumns = function () {
1293
1757
  var e_1, _c, e_2, _d;
1294
1758
  if (this.value.length === 0)
1295
- return [];
1759
+ return this.columns;
1296
1760
  // Get all distinct properties from all rows
1297
1761
  // We look at all rows to eliminate possible undefined values
1298
1762
  var rowsWithProperties = this.value
@@ -1363,16 +1827,16 @@
1363
1827
  };
1364
1828
  RESTworldListViewComponent.getColumnType = function (value) {
1365
1829
  if (value === null || value === undefined)
1366
- return 'text';
1830
+ return exports.ColumnType.text;
1367
1831
  if (___namespace.isNumber(value))
1368
- return 'numeric';
1832
+ return exports.ColumnType.numeric;
1369
1833
  if (___namespace.isDate(value))
1370
- return 'date';
1834
+ return exports.ColumnType.date;
1371
1835
  if (___namespace.isString(value))
1372
- return 'text';
1836
+ return exports.ColumnType.text;
1373
1837
  if (___namespace.isBoolean(value))
1374
- return 'boolean';
1375
- return 'text';
1838
+ return exports.ColumnType.boolean;
1839
+ return exports.ColumnType.text;
1376
1840
  };
1377
1841
  RESTworldListViewComponent.toTitleCase = function (anyCase) {
1378
1842
  return anyCase
@@ -1384,9 +1848,9 @@
1384
1848
  .replace(/([a-z]+)([A-Z0-9]+)/g, "$1 $2") // insert space after numbers
1385
1849
  .replace(/^./, function (match) { return match.toUpperCase(); }); // change first letter to be upper case
1386
1850
  };
1387
- RESTworldListViewComponent.createParametersFromEvent = function (event) {
1851
+ RESTworldListViewComponent.prototype.createParametersFromEvent = function (event) {
1388
1852
  var oDataParameters = {
1389
- $filter: RESTworldListViewComponent.createFilterFromEvent(event),
1853
+ $filter: this.createFilterFromEvent(event),
1390
1854
  $orderby: RESTworldListViewComponent.createOrderByFromEvent(event),
1391
1855
  $top: RESTworldListViewComponent.createTopFromEvent(event),
1392
1856
  $skip: RESTworldListViewComponent.createSkipFromEvent(event)
@@ -1406,25 +1870,38 @@
1406
1870
  }
1407
1871
  return undefined;
1408
1872
  };
1409
- RESTworldListViewComponent.createFilterFromEvent = function (event) {
1873
+ RESTworldListViewComponent.prototype.createFilterFromEvent = function (event) {
1874
+ var _this = this;
1410
1875
  if (!event.filters)
1411
1876
  return undefined;
1412
1877
  var filter = Object.entries(event.filters)
1878
+ // The type definition is wrong, event.filters has values of type FilterMetadata[] and not FilterMetadata.
1413
1879
  .map(function (_c) {
1414
1880
  var _d = __read(_c, 2), property = _d[0], filter = _d[1];
1415
- return RESTworldListViewComponent.createFilterForProperty(property, filter);
1881
+ return ({ property: property, filters: filter });
1416
1882
  })
1417
- .filter(function (filter) { return !!filter; })
1883
+ .map(function (f) { return _this.createFilterForPropertyArray(f.property, f.filters); })
1884
+ .filter(function (f) { return !!f; })
1418
1885
  .join(' and ');
1419
1886
  if (filter === '')
1420
1887
  return undefined;
1421
1888
  return "(" + filter + ")";
1422
1889
  };
1423
- RESTworldListViewComponent.createFilterForProperty = function (property, filter) {
1890
+ RESTworldListViewComponent.prototype.createFilterForPropertyArray = function (property, filters) {
1891
+ var _this = this;
1892
+ var filter = filters
1893
+ .map(function (f) { return _this.createFilterForProperty(property, f); })
1894
+ .filter(function (f) { return !!f; })
1895
+ .join(" " + filters[0].operator + " ");
1896
+ if (filter === '')
1897
+ return undefined;
1898
+ return "(" + filter + ")";
1899
+ };
1900
+ RESTworldListViewComponent.prototype.createFilterForProperty = function (property, filter) {
1424
1901
  if (!filter.value)
1425
1902
  return undefined;
1426
1903
  var oDataOperator = RESTworldListViewComponent.createODataOperator(filter.matchMode);
1427
- var comparisonValue = RESTworldListViewComponent.createComparisonValue(filter.value);
1904
+ var comparisonValue = this.createComparisonValue(property, filter.value);
1428
1905
  switch (oDataOperator) {
1429
1906
  case 'contains':
1430
1907
  case 'not contains':
@@ -1437,59 +1914,67 @@
1437
1914
  };
1438
1915
  RESTworldListViewComponent.createODataOperator = function (matchMode) {
1439
1916
  switch (matchMode) {
1440
- case i2.FilterMatchMode.STARTS_WITH:
1917
+ case i2$1.FilterMatchMode.STARTS_WITH:
1441
1918
  return 'startswith';
1442
- case i2.FilterMatchMode.CONTAINS:
1919
+ case i2$1.FilterMatchMode.CONTAINS:
1443
1920
  return 'contains';
1444
- case i2.FilterMatchMode.NOT_CONTAINS:
1921
+ case i2$1.FilterMatchMode.NOT_CONTAINS:
1445
1922
  return 'not contains';
1446
- case i2.FilterMatchMode.ENDS_WITH:
1923
+ case i2$1.FilterMatchMode.ENDS_WITH:
1447
1924
  return 'endswith';
1448
- case i2.FilterMatchMode.EQUALS:
1925
+ case i2$1.FilterMatchMode.EQUALS:
1449
1926
  return 'eq';
1450
- case i2.FilterMatchMode.NOT_EQUALS:
1927
+ case i2$1.FilterMatchMode.NOT_EQUALS:
1451
1928
  return 'ne';
1452
- case i2.FilterMatchMode.IN:
1929
+ case i2$1.FilterMatchMode.IN:
1453
1930
  return 'in';
1454
- case i2.FilterMatchMode.LESS_THAN:
1931
+ case i2$1.FilterMatchMode.LESS_THAN:
1455
1932
  return 'lt';
1456
- case i2.FilterMatchMode.LESS_THAN_OR_EQUAL_TO:
1933
+ case i2$1.FilterMatchMode.LESS_THAN_OR_EQUAL_TO:
1457
1934
  return 'le';
1458
- case i2.FilterMatchMode.GREATER_THAN:
1935
+ case i2$1.FilterMatchMode.GREATER_THAN:
1459
1936
  return 'gt';
1460
- case i2.FilterMatchMode.GREATER_THAN_OR_EQUAL_TO:
1937
+ case i2$1.FilterMatchMode.GREATER_THAN_OR_EQUAL_TO:
1461
1938
  return 'ge';
1462
- case i2.FilterMatchMode.IS:
1939
+ case i2$1.FilterMatchMode.IS:
1463
1940
  return 'eq';
1464
- case i2.FilterMatchMode.IS_NOT:
1941
+ case i2$1.FilterMatchMode.IS_NOT:
1465
1942
  return 'ne';
1466
- case i2.FilterMatchMode.BEFORE:
1943
+ case i2$1.FilterMatchMode.BEFORE:
1467
1944
  return 'lt';
1468
- case i2.FilterMatchMode.AFTER:
1945
+ case i2$1.FilterMatchMode.AFTER:
1469
1946
  return 'gt';
1947
+ case i2$1.FilterMatchMode.DATE_AFTER:
1948
+ return 'ge';
1949
+ case i2$1.FilterMatchMode.DATE_BEFORE:
1950
+ return 'lt';
1951
+ case i2$1.FilterMatchMode.DATE_IS:
1952
+ return 'eq';
1953
+ case i2$1.FilterMatchMode.DATE_IS_NOT:
1954
+ return 'ne';
1470
1955
  default:
1471
1956
  throw Error("Unknown matchMode " + matchMode);
1472
1957
  }
1473
1958
  };
1474
- RESTworldListViewComponent.createComparisonValue = function (value) {
1475
- var _this = this;
1959
+ RESTworldListViewComponent.prototype.createComparisonValue = function (property, value) {
1476
1960
  if (value === null || value === undefined)
1477
1961
  return 'null';
1478
- if (___namespace.isNumber(value))
1479
- return "" + value;
1480
- if (___namespace.isDate(value))
1481
- return "cast(" + value.toISOString() + ", Edm.DateTimeOffset)";
1482
- if (___namespace.isString(value)) {
1483
- var date = new Date(value);
1484
- if (!isNaN(date.valueOf()))
1485
- return "cast(" + date.toISOString() + ", Edm.DateTimeOffset)";
1486
- return "'" + value + "'";
1962
+ var columns = this.columns.filter(function (c) { return c.field === property; });
1963
+ if (columns.length !== 1)
1964
+ throw new Error("Cannot find the column for the property " + property + " which is specified in the filter.");
1965
+ var type = columns[0].type;
1966
+ switch (type) {
1967
+ case exports.ColumnType.boolean:
1968
+ return "" + value;
1969
+ case exports.ColumnType.date:
1970
+ return "cast(" + value.toISOString() + ", Edm.DateTimeOffset)";
1971
+ case exports.ColumnType.numeric:
1972
+ return "" + value;
1973
+ case exports.ColumnType.text:
1974
+ return "'" + value + "'";
1975
+ default:
1976
+ throw new Error("Unknown column type '" + type + "'");
1487
1977
  }
1488
- if (___namespace.isArray(value))
1489
- return "(" + value
1490
- .map(function (v) { return _this.createComparisonValue(v); })
1491
- .join(',') + ")";
1492
- throw new Error("Unknown type of value: " + value + ".");
1493
1978
  };
1494
1979
  return RESTworldListViewComponent;
1495
1980
  }());
@@ -1499,16 +1984,16 @@
1499
1984
  .replace("11", "MM")
1500
1985
  .replace("3333", "y")
1501
1986
  .replace("33", "yy");
1502
- 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 });
1503
- 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 } });
1987
+ 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 });
1988
+ 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$2.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$2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { type: i4__namespace$2.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: i13__namespace.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: i17__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i18__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$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace$2.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$1.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: i19__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i19__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "date": i3__namespace$1.DatePipe } });
1504
1989
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldListViewComponent, decorators: [{
1505
1990
  type: i0.Component,
1506
1991
  args: [{
1507
- selector: 'restworld-list-view',
1992
+ selector: 'rw-list',
1508
1993
  templateUrl: './restworld-list-view.component.html',
1509
1994
  styleUrls: ['./restworld-list-view.component.css']
1510
1995
  }]
1511
- }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace.ConfirmationService }, { type: i2__namespace.MessageService }, { type: AvatarGenerator }]; }, propDecorators: { editLink: [{
1996
+ }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace$1.ConfirmationService }, { type: i2__namespace$1.MessageService }, { type: AvatarGenerator }]; }, propDecorators: { editLink: [{
1512
1997
  type: i0.Input
1513
1998
  }], apiName: [{
1514
1999
  type: i0.Input
@@ -1516,7 +2001,14 @@
1516
2001
  type: i0.Input
1517
2002
  }], rowsPerPage: [{
1518
2003
  type: i0.Input
1519
- }] } });
2004
+ }] } });
2005
+ exports.ColumnType = void 0;
2006
+ (function (ColumnType) {
2007
+ ColumnType["text"] = "text";
2008
+ ColumnType["numeric"] = "numeric";
2009
+ ColumnType["boolean"] = "boolean";
2010
+ ColumnType["date"] = "date";
2011
+ })(exports.ColumnType || (exports.ColumnType = {}));
1520
2012
 
1521
2013
  function initializeSettings(settingsService) {
1522
2014
  var _this = this;
@@ -1534,33 +2026,47 @@
1534
2026
  }());
1535
2027
  RestworldClientModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1536
2028
  RestworldClientModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, declarations: [RESTworldListViewComponent,
1537
- RESTworldEditViewComponent], imports: [i3.CommonModule,
1538
- i4.RouterModule,
1539
- i13.FormsModule,
1540
- i13.ReactiveFormsModule,
1541
- i4$1.TableModule,
1542
- i10$1.TooltipModule,
2029
+ RESTworldEditViewComponent,
2030
+ RESTWorldImageViewComponent,
2031
+ RESTWorldFileViewComponent,
2032
+ SafeUrlPipe], imports: [i3$1.CommonModule,
2033
+ i4$1.RouterModule,
2034
+ i19.FormsModule,
2035
+ i19.ReactiveFormsModule,
2036
+ i4$2.TableModule,
2037
+ i7.TooltipModule,
1543
2038
  scrolling.ScrollingModule,
1544
- i14.InputTextModule,
1545
- i8.InputNumberModule,
1546
- i7.CalendarModule,
1547
- i9.CheckboxModule,
1548
- i12.ConfirmDialogModule,
1549
- i11.ToastModule,
2039
+ i9.InputTextModule,
2040
+ i11.InputNumberModule,
2041
+ i10$1.CalendarModule,
2042
+ i12.CheckboxModule,
2043
+ i18.ConfirmDialogModule,
2044
+ i17.ToastModule,
1550
2045
  messages.MessagesModule,
1551
2046
  panel.PanelModule,
1552
- i5.TabViewModule,
1553
- i6.SkeletonModule,
1554
- i10.ProgressSpinnerModule,
1555
- i16.RippleModule,
1556
- i6$1.TriStateCheckboxModule,
1557
- i5$1.AvatarModule], exports: [RESTworldListViewComponent,
1558
- RESTworldEditViewComponent] });
2047
+ i6.TabViewModule,
2048
+ i7$1.SkeletonModule,
2049
+ i16.ProgressSpinnerModule,
2050
+ i10.RippleModule,
2051
+ i13.TriStateCheckboxModule,
2052
+ i5$2.AvatarModule,
2053
+ i8.DropdownModule,
2054
+ i9$1.MultiSelectModule,
2055
+ i2.FileUploadModule,
2056
+ i5$1.ValdemortModule,
2057
+ i4.ImageCropperModule,
2058
+ i3.DialogModule,
2059
+ i1$3.ButtonModule,
2060
+ i5.ColorPickerModule], exports: [RESTworldListViewComponent,
2061
+ RESTworldEditViewComponent,
2062
+ RESTWorldImageViewComponent,
2063
+ RESTWorldFileViewComponent,
2064
+ SafeUrlPipe] });
1559
2065
  RestworldClientModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, providers: [
1560
2066
  RESTworldClientCollection,
1561
2067
  AvatarGenerator,
1562
- i2.ConfirmationService,
1563
- i2.MessageService,
2068
+ i2$1.ConfirmationService,
2069
+ i2$1.MessageService,
1564
2070
  {
1565
2071
  provide: i0.APP_INITIALIZER,
1566
2072
  useFactory: initializeSettings,
@@ -1568,67 +2074,89 @@
1568
2074
  multi: true,
1569
2075
  }
1570
2076
  ], imports: [[
1571
- i3.CommonModule,
1572
- i4.RouterModule,
1573
- i13.FormsModule,
1574
- i13.ReactiveFormsModule,
1575
- i4$1.TableModule,
1576
- i10$1.TooltipModule,
2077
+ i3$1.CommonModule,
2078
+ i4$1.RouterModule,
2079
+ i19.FormsModule,
2080
+ i19.ReactiveFormsModule,
2081
+ i4$2.TableModule,
2082
+ i7.TooltipModule,
1577
2083
  scrolling.ScrollingModule,
1578
- i14.InputTextModule,
1579
- i8.InputNumberModule,
1580
- i7.CalendarModule,
1581
- i9.CheckboxModule,
1582
- i12.ConfirmDialogModule,
1583
- i11.ToastModule,
2084
+ i9.InputTextModule,
2085
+ i11.InputNumberModule,
2086
+ i10$1.CalendarModule,
2087
+ i12.CheckboxModule,
2088
+ i18.ConfirmDialogModule,
2089
+ i17.ToastModule,
1584
2090
  messages.MessagesModule,
1585
2091
  panel.PanelModule,
1586
- i5.TabViewModule,
1587
- i6.SkeletonModule,
1588
- i10.ProgressSpinnerModule,
1589
- i16.RippleModule,
1590
- i6$1.TriStateCheckboxModule,
1591
- i5$1.AvatarModule
2092
+ i6.TabViewModule,
2093
+ i7$1.SkeletonModule,
2094
+ i16.ProgressSpinnerModule,
2095
+ i10.RippleModule,
2096
+ i13.TriStateCheckboxModule,
2097
+ i5$2.AvatarModule,
2098
+ i8.DropdownModule,
2099
+ i9$1.MultiSelectModule,
2100
+ i2.FileUploadModule,
2101
+ i5$1.ValdemortModule,
2102
+ i4.ImageCropperModule,
2103
+ i3.DialogModule,
2104
+ i1$3.ButtonModule,
2105
+ i5.ColorPickerModule
1592
2106
  ]] });
1593
2107
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, decorators: [{
1594
2108
  type: i0.NgModule,
1595
2109
  args: [{
1596
2110
  declarations: [
1597
2111
  RESTworldListViewComponent,
1598
- RESTworldEditViewComponent
2112
+ RESTworldEditViewComponent,
2113
+ RESTWorldImageViewComponent,
2114
+ RESTWorldFileViewComponent,
2115
+ SafeUrlPipe
1599
2116
  ],
1600
2117
  imports: [
1601
- i3.CommonModule,
1602
- i4.RouterModule,
1603
- i13.FormsModule,
1604
- i13.ReactiveFormsModule,
1605
- i4$1.TableModule,
1606
- i10$1.TooltipModule,
2118
+ i3$1.CommonModule,
2119
+ i4$1.RouterModule,
2120
+ i19.FormsModule,
2121
+ i19.ReactiveFormsModule,
2122
+ i4$2.TableModule,
2123
+ i7.TooltipModule,
1607
2124
  scrolling.ScrollingModule,
1608
- i14.InputTextModule,
1609
- i8.InputNumberModule,
1610
- i7.CalendarModule,
1611
- i9.CheckboxModule,
1612
- i12.ConfirmDialogModule,
1613
- i11.ToastModule,
2125
+ i9.InputTextModule,
2126
+ i11.InputNumberModule,
2127
+ i10$1.CalendarModule,
2128
+ i12.CheckboxModule,
2129
+ i18.ConfirmDialogModule,
2130
+ i17.ToastModule,
1614
2131
  messages.MessagesModule,
1615
2132
  panel.PanelModule,
1616
- i5.TabViewModule,
1617
- i6.SkeletonModule,
1618
- i10.ProgressSpinnerModule,
1619
- i16.RippleModule,
1620
- i6$1.TriStateCheckboxModule,
1621
- i5$1.AvatarModule
2133
+ i6.TabViewModule,
2134
+ i7$1.SkeletonModule,
2135
+ i16.ProgressSpinnerModule,
2136
+ i10.RippleModule,
2137
+ i13.TriStateCheckboxModule,
2138
+ i5$2.AvatarModule,
2139
+ i8.DropdownModule,
2140
+ i9$1.MultiSelectModule,
2141
+ i2.FileUploadModule,
2142
+ i5$1.ValdemortModule,
2143
+ i4.ImageCropperModule,
2144
+ i3.DialogModule,
2145
+ i1$3.ButtonModule,
2146
+ i5.ColorPickerModule
1622
2147
  ],
1623
2148
  exports: [
1624
2149
  RESTworldListViewComponent,
1625
- RESTworldEditViewComponent
2150
+ RESTworldEditViewComponent,
2151
+ RESTWorldImageViewComponent,
2152
+ RESTWorldFileViewComponent,
2153
+ SafeUrlPipe
1626
2154
  ],
1627
2155
  providers: [
1628
2156
  RESTworldClientCollection,
1629
2157
  AvatarGenerator,
1630
- i2.ConfirmationService,
1631
- i2.MessageService,
2158
+ i2$1.ConfirmationService,
2159
+ i2$1.MessageService,
1632
2160
  {
1633
2161
  provide: i0.APP_INITIALIZER,
1634
2162
  useFactory: initializeSettings,
@@ -1649,12 +2177,15 @@
1649
2177
 
1650
2178
  exports.AvatarGenerator = AvatarGenerator;
1651
2179
  exports.ProblemDetails = ProblemDetails;
2180
+ exports.RESTWorldFileViewComponent = RESTWorldFileViewComponent;
2181
+ exports.RESTWorldImageViewComponent = RESTWorldImageViewComponent;
1652
2182
  exports.RESTworldClient = RESTworldClient;
1653
2183
  exports.RESTworldClientCollection = RESTworldClientCollection;
1654
2184
  exports.RESTworldEditViewComponent = RESTworldEditViewComponent;
1655
2185
  exports.RESTworldListViewComponent = RESTworldListViewComponent;
1656
2186
  exports.RESTworldOptions = RESTworldOptions;
1657
2187
  exports.RestworldClientModule = RestworldClientModule;
2188
+ exports.SafeUrlPipe = SafeUrlPipe;
1658
2189
  exports.SettingsService = SettingsService;
1659
2190
  exports.initializeSettings = initializeSettings;
1660
2191