@wertzui/ngx-restworld-client 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/{esm2015/lib/constants/link-names.js → esm2020/lib/constants/link-names.mjs} +0 -0
  2. package/{esm2015/lib/models/api-url.js → esm2020/lib/models/api-url.mjs} +0 -0
  3. package/{esm2015/lib/models/client-settings.js → esm2020/lib/models/client-settings.mjs} +0 -0
  4. package/{esm2015/lib/models/problem-details.js → esm2020/lib/models/problem-details.mjs} +0 -0
  5. package/{esm2015/lib/models/restworld-options.js → esm2020/lib/models/restworld-options.mjs} +0 -0
  6. package/{esm2015/lib/pipes/as.pipe.js → esm2020/lib/pipes/as.pipe.mjs} +4 -4
  7. package/{esm2015/lib/pipes/safe-url.pipe.js → esm2020/lib/pipes/safe-url.pipe.mjs} +4 -4
  8. package/esm2020/lib/restworld-client.module.mjs +200 -0
  9. package/{esm2015/lib/services/avatar-generator.js → esm2020/lib/services/avatar-generator.mjs} +4 -4
  10. package/{esm2015/lib/services/form.service.js → esm2020/lib/services/form.service.mjs} +4 -4
  11. package/esm2020/lib/services/restworld-client-collection.mjs +39 -0
  12. package/esm2020/lib/services/restworld-client.mjs +162 -0
  13. package/esm2020/lib/services/settings.service.mjs +39 -0
  14. package/esm2020/lib/views/restworld-edit-form/restworld-edit-form.component.mjs +230 -0
  15. package/esm2020/lib/views/restworld-edit-view/restworld-edit-view.component.mjs +313 -0
  16. package/esm2020/lib/views/restworld-file-view/restworld-file-view.component.mjs +57 -0
  17. package/esm2020/lib/views/restworld-image-view/restworld-image-view.component.mjs +100 -0
  18. package/esm2020/lib/views/restworld-list-view/restworld-list-view.component.mjs +341 -0
  19. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  20. package/{esm2015/wertzui-ngx-restworld-client.js → esm2020/wertzui-ngx-restworld-client.mjs} +0 -0
  21. package/fesm2015/wertzui-ngx-restworld-client.mjs +1706 -0
  22. package/fesm2015/wertzui-ngx-restworld-client.mjs.map +1 -0
  23. package/fesm2020/wertzui-ngx-restworld-client.mjs +1646 -0
  24. package/fesm2020/wertzui-ngx-restworld-client.mjs.map +1 -0
  25. package/package.json +42 -31
  26. package/bundles/wertzui-ngx-restworld-client.umd.js +0 -2477
  27. package/bundles/wertzui-ngx-restworld-client.umd.js.map +0 -1
  28. package/esm2015/lib/restworld-client.module.js +0 -201
  29. package/esm2015/lib/services/restworld-client-collection.js +0 -42
  30. package/esm2015/lib/services/restworld-client.js +0 -183
  31. package/esm2015/lib/services/settings.service.js +0 -47
  32. package/esm2015/lib/views/restworld-edit-form/restworld-edit-form.component.js +0 -238
  33. package/esm2015/lib/views/restworld-edit-view/restworld-edit-view.component.js +0 -335
  34. package/esm2015/lib/views/restworld-file-view/restworld-file-view.component.js +0 -63
  35. package/esm2015/lib/views/restworld-image-view/restworld-image-view.component.js +0 -107
  36. package/esm2015/lib/views/restworld-list-view/restworld-list-view.component.js +0 -353
  37. package/fesm2015/wertzui-ngx-restworld-client.js +0 -1728
  38. package/fesm2015/wertzui-ngx-restworld-client.js.map +0 -1
@@ -1,2477 +0,0 @@
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/platform-browser'), require('@angular/forms'), require('@angular/common/http'), require('primeng/api'), require('primeng/dropdown'), require('primeng/multiselect'), require('primeng/calendar'), require('primeng/inputnumber'), require('primeng/checkbox'), require('primeng/tristatecheckbox'), require('primeng/fileupload'), require('primeng/button'), require('primeng/dialog'), require('ngx-image-cropper'), require('primeng/colorpicker'), require('@angular/common'), require('primeng/tooltip'), require('primeng/inputtext'), require('primeng/ripple'), require('ngx-valdemort'), require('@angular/cdk/drag-drop'), require('@angular/router'), require('primeng/tabview'), require('primeng/skeleton'), require('primeng/progressspinner'), require('primeng/toast'), require('primeng/confirmdialog'), require('primeng/table'), require('primeng/avatar'), require('@angular/cdk/scrolling'), require('primeng/messages'), require('primeng/panel')) :
3
- typeof define === 'function' && define.amd ? define('@wertzui/ngx-restworld-client', ['exports', 'lodash', '@wertzui/ngx-hal-client', '@angular/core', '@angular/platform-browser', '@angular/forms', '@angular/common/http', 'primeng/api', 'primeng/dropdown', 'primeng/multiselect', 'primeng/calendar', 'primeng/inputnumber', 'primeng/checkbox', 'primeng/tristatecheckbox', 'primeng/fileupload', 'primeng/button', 'primeng/dialog', 'ngx-image-cropper', 'primeng/colorpicker', '@angular/common', 'primeng/tooltip', 'primeng/inputtext', 'primeng/ripple', 'ngx-valdemort', '@angular/cdk/drag-drop', '@angular/router', 'primeng/tabview', 'primeng/skeleton', 'primeng/progressspinner', 'primeng/toast', 'primeng/confirmdialog', 'primeng/table', 'primeng/avatar', '@angular/cdk/scrolling', 'primeng/messages', 'primeng/panel'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wertzui = global.wertzui || {}, global.wertzui["ngx-restworld-client"] = {}), global._, global.i1, global.ng.core, global.ng.platformBrowser, global.ng.forms, global.ng.common.http, global.i2$1, global.i4$1, global.i5$1, global.i6, global.i7$1, global.i8, global.i9$1, global.i2, global.i1$3, global.i3, global.i4, global.i5, global.ng.common, global.i7, global.i9, global.i10, global.i12, global.ng.cdk.dragDrop, global.ng.router, global.i7$2, global.i8$1, global.i10$1, global.i11, global.i12$1, global.i4$3, global.i5$2, global.ng.cdk.scrolling, global.messages, global.panel));
5
- })(this, (function (exports, _, i1, i0, i1$1, i14, i1$2, i2$1, i4$1, i5$1, i6, i7$1, i8, i9$1, i2, i1$3, i3, i4, i5, i3$1, i7, i9, i10, i12, i17, i4$2, i7$2, i8$1, i10$1, i11, i12$1, i4$3, i5$2, scrolling, messages, panel) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var ___namespace = /*#__PURE__*/_interopNamespace(_);
26
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1);
27
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
29
- var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
30
- var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
31
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
32
- var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
33
- var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
34
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
35
- var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
36
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
37
- var i9__namespace$1 = /*#__PURE__*/_interopNamespace(i9$1);
38
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
39
- var i1__namespace$3 = /*#__PURE__*/_interopNamespace(i1$3);
40
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
41
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
42
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
43
- var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
44
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
45
- var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
46
- var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
47
- var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
48
- var i17__namespace = /*#__PURE__*/_interopNamespace(i17);
49
- var i4__namespace$2 = /*#__PURE__*/_interopNamespace(i4$2);
50
- var i7__namespace$2 = /*#__PURE__*/_interopNamespace(i7$2);
51
- var i8__namespace$1 = /*#__PURE__*/_interopNamespace(i8$1);
52
- var i10__namespace$1 = /*#__PURE__*/_interopNamespace(i10$1);
53
- var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
54
- var i12__namespace$1 = /*#__PURE__*/_interopNamespace(i12$1);
55
- var i4__namespace$3 = /*#__PURE__*/_interopNamespace(i4$3);
56
- var i5__namespace$2 = /*#__PURE__*/_interopNamespace(i5$2);
57
-
58
- exports.LinkNames = void 0;
59
- (function (LinkNames) {
60
- LinkNames["get"] = "Get";
61
- LinkNames["getList"] = "GetList";
62
- LinkNames["post"] = "Post";
63
- LinkNames["put"] = "Put";
64
- LinkNames["delete"] = "Delete";
65
- LinkNames["new"] = "New";
66
- })(exports.LinkNames || (exports.LinkNames = {}));
67
-
68
- /*! *****************************************************************************
69
- Copyright (c) Microsoft Corporation.
70
-
71
- Permission to use, copy, modify, and/or distribute this software for any
72
- purpose with or without fee is hereby granted.
73
-
74
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
75
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
76
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
77
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
78
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
79
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
80
- PERFORMANCE OF THIS SOFTWARE.
81
- ***************************************************************************** */
82
- /* global Reflect, Promise */
83
- var extendStatics = function (d, b) {
84
- extendStatics = Object.setPrototypeOf ||
85
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
86
- function (d, b) { for (var p in b)
87
- if (Object.prototype.hasOwnProperty.call(b, p))
88
- d[p] = b[p]; };
89
- return extendStatics(d, b);
90
- };
91
- function __extends(d, b) {
92
- if (typeof b !== "function" && b !== null)
93
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
94
- extendStatics(d, b);
95
- function __() { this.constructor = d; }
96
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
97
- }
98
- var __assign = function () {
99
- __assign = Object.assign || function __assign(t) {
100
- for (var s, i = 1, n = arguments.length; i < n; i++) {
101
- s = arguments[i];
102
- for (var p in s)
103
- if (Object.prototype.hasOwnProperty.call(s, p))
104
- t[p] = s[p];
105
- }
106
- return t;
107
- };
108
- return __assign.apply(this, arguments);
109
- };
110
- function __rest(s, e) {
111
- var t = {};
112
- for (var p in s)
113
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
114
- t[p] = s[p];
115
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
116
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
117
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
118
- t[p[i]] = s[p[i]];
119
- }
120
- return t;
121
- }
122
- function __decorate(decorators, target, key, desc) {
123
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
124
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
125
- r = Reflect.decorate(decorators, target, key, desc);
126
- else
127
- for (var i = decorators.length - 1; i >= 0; i--)
128
- if (d = decorators[i])
129
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
130
- return c > 3 && r && Object.defineProperty(target, key, r), r;
131
- }
132
- function __param(paramIndex, decorator) {
133
- return function (target, key) { decorator(target, key, paramIndex); };
134
- }
135
- function __metadata(metadataKey, metadataValue) {
136
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
137
- return Reflect.metadata(metadataKey, metadataValue);
138
- }
139
- function __awaiter(thisArg, _arguments, P, generator) {
140
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
141
- return new (P || (P = Promise))(function (resolve, reject) {
142
- function fulfilled(value) { try {
143
- step(generator.next(value));
144
- }
145
- catch (e) {
146
- reject(e);
147
- } }
148
- function rejected(value) { try {
149
- step(generator["throw"](value));
150
- }
151
- catch (e) {
152
- reject(e);
153
- } }
154
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
155
- step((generator = generator.apply(thisArg, _arguments || [])).next());
156
- });
157
- }
158
- function __generator(thisArg, body) {
159
- var _ = { label: 0, sent: function () { if (t[0] & 1)
160
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
161
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
162
- function verb(n) { return function (v) { return step([n, v]); }; }
163
- function step(op) {
164
- if (f)
165
- throw new TypeError("Generator is already executing.");
166
- while (_)
167
- try {
168
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
169
- return t;
170
- if (y = 0, t)
171
- op = [op[0] & 2, t.value];
172
- switch (op[0]) {
173
- case 0:
174
- case 1:
175
- t = op;
176
- break;
177
- case 4:
178
- _.label++;
179
- return { value: op[1], done: false };
180
- case 5:
181
- _.label++;
182
- y = op[1];
183
- op = [0];
184
- continue;
185
- case 7:
186
- op = _.ops.pop();
187
- _.trys.pop();
188
- continue;
189
- default:
190
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
191
- _ = 0;
192
- continue;
193
- }
194
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
195
- _.label = op[1];
196
- break;
197
- }
198
- if (op[0] === 6 && _.label < t[1]) {
199
- _.label = t[1];
200
- t = op;
201
- break;
202
- }
203
- if (t && _.label < t[2]) {
204
- _.label = t[2];
205
- _.ops.push(op);
206
- break;
207
- }
208
- if (t[2])
209
- _.ops.pop();
210
- _.trys.pop();
211
- continue;
212
- }
213
- op = body.call(thisArg, _);
214
- }
215
- catch (e) {
216
- op = [6, e];
217
- y = 0;
218
- }
219
- finally {
220
- f = t = 0;
221
- }
222
- if (op[0] & 5)
223
- throw op[1];
224
- return { value: op[0] ? op[1] : void 0, done: true };
225
- }
226
- }
227
- var __createBinding = Object.create ? (function (o, m, k, k2) {
228
- if (k2 === undefined)
229
- k2 = k;
230
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
231
- }) : (function (o, m, k, k2) {
232
- if (k2 === undefined)
233
- k2 = k;
234
- o[k2] = m[k];
235
- });
236
- function __exportStar(m, o) {
237
- for (var p in m)
238
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
239
- __createBinding(o, m, p);
240
- }
241
- function __values(o) {
242
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
243
- if (m)
244
- return m.call(o);
245
- if (o && typeof o.length === "number")
246
- return {
247
- next: function () {
248
- if (o && i >= o.length)
249
- o = void 0;
250
- return { value: o && o[i++], done: !o };
251
- }
252
- };
253
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
254
- }
255
- function __read(o, n) {
256
- var m = typeof Symbol === "function" && o[Symbol.iterator];
257
- if (!m)
258
- return o;
259
- var i = m.call(o), r, ar = [], e;
260
- try {
261
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
262
- ar.push(r.value);
263
- }
264
- catch (error) {
265
- e = { error: error };
266
- }
267
- finally {
268
- try {
269
- if (r && !r.done && (m = i["return"]))
270
- m.call(i);
271
- }
272
- finally {
273
- if (e)
274
- throw e.error;
275
- }
276
- }
277
- return ar;
278
- }
279
- /** @deprecated */
280
- function __spread() {
281
- for (var ar = [], i = 0; i < arguments.length; i++)
282
- ar = ar.concat(__read(arguments[i]));
283
- return ar;
284
- }
285
- /** @deprecated */
286
- function __spreadArrays() {
287
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
288
- s += arguments[i].length;
289
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
290
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
291
- r[k] = a[j];
292
- return r;
293
- }
294
- function __spreadArray(to, from, pack) {
295
- if (pack || arguments.length === 2)
296
- for (var i = 0, l = from.length, ar; i < l; i++) {
297
- if (ar || !(i in from)) {
298
- if (!ar)
299
- ar = Array.prototype.slice.call(from, 0, i);
300
- ar[i] = from[i];
301
- }
302
- }
303
- return to.concat(ar || Array.prototype.slice.call(from));
304
- }
305
- function __await(v) {
306
- return this instanceof __await ? (this.v = v, this) : new __await(v);
307
- }
308
- function __asyncGenerator(thisArg, _arguments, generator) {
309
- if (!Symbol.asyncIterator)
310
- throw new TypeError("Symbol.asyncIterator is not defined.");
311
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
312
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
313
- function verb(n) { if (g[n])
314
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
315
- function resume(n, v) { try {
316
- step(g[n](v));
317
- }
318
- catch (e) {
319
- settle(q[0][3], e);
320
- } }
321
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
322
- function fulfill(value) { resume("next", value); }
323
- function reject(value) { resume("throw", value); }
324
- function settle(f, v) { if (f(v), q.shift(), q.length)
325
- resume(q[0][0], q[0][1]); }
326
- }
327
- function __asyncDelegator(o) {
328
- var i, p;
329
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
330
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
331
- }
332
- function __asyncValues(o) {
333
- if (!Symbol.asyncIterator)
334
- throw new TypeError("Symbol.asyncIterator is not defined.");
335
- var m = o[Symbol.asyncIterator], i;
336
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
337
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
338
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
339
- }
340
- function __makeTemplateObject(cooked, raw) {
341
- if (Object.defineProperty) {
342
- Object.defineProperty(cooked, "raw", { value: raw });
343
- }
344
- else {
345
- cooked.raw = raw;
346
- }
347
- return cooked;
348
- }
349
- ;
350
- var __setModuleDefault = Object.create ? (function (o, v) {
351
- Object.defineProperty(o, "default", { enumerable: true, value: v });
352
- }) : function (o, v) {
353
- o["default"] = v;
354
- };
355
- function __importStar(mod) {
356
- if (mod && mod.__esModule)
357
- return mod;
358
- var result = {};
359
- if (mod != null)
360
- for (var k in mod)
361
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
362
- __createBinding(result, mod, k);
363
- __setModuleDefault(result, mod);
364
- return result;
365
- }
366
- function __importDefault(mod) {
367
- return (mod && mod.__esModule) ? mod : { default: mod };
368
- }
369
- function __classPrivateFieldGet(receiver, state, kind, f) {
370
- if (kind === "a" && !f)
371
- throw new TypeError("Private accessor was defined without a getter");
372
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
373
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
374
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
375
- }
376
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
377
- if (kind === "m")
378
- throw new TypeError("Private method is not writable");
379
- if (kind === "a" && !f)
380
- throw new TypeError("Private accessor was defined without a setter");
381
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
382
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
383
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
384
- }
385
-
386
- var ProblemDetails = /** @class */ (function (_super) {
387
- __extends(ProblemDetails, _super);
388
- function ProblemDetails() {
389
- return _super !== null && _super.apply(this, arguments) || this;
390
- }
391
- ProblemDetails.isProblemDetails = function (resource) {
392
- return resource instanceof ProblemDetails;
393
- };
394
- ProblemDetails.containsProblemDetailsInformation = function (resource) {
395
- return resource && (resource instanceof ProblemDetails || (resource instanceof i1.Resource && 'status' in resource && ___namespace.isNumber(resource['status']) && resource['status'] >= 100 && resource['status'] < 600));
396
- };
397
- ProblemDetails.fromResource = function (resource) {
398
- if (!ProblemDetails.containsProblemDetailsInformation(resource))
399
- throw new Error("The resource " + resource + " does not have problem details.");
400
- return Object.assign(new ProblemDetails(), resource);
401
- };
402
- return ProblemDetails;
403
- }(i1.Resource));
404
-
405
- var RESTworldOptions = /** @class */ (function () {
406
- function RESTworldOptions(BaseUrl, Version) {
407
- this.BaseUrl = BaseUrl;
408
- this.Version = Version;
409
- if (!BaseUrl.endsWith('/'))
410
- throw new Error("The provided BaseUrl '" + BaseUrl + "' does not end with a slash '/'.");
411
- }
412
- return RESTworldOptions;
413
- }());
414
-
415
- var SafeUrlPipe = /** @class */ (function () {
416
- function SafeUrlPipe(_domSanitizer) {
417
- this._domSanitizer = _domSanitizer;
418
- }
419
- SafeUrlPipe.prototype.transform = function (url) {
420
- if (___namespace.isString(url))
421
- throw new Error("The given url '" + url + "' is not a string.");
422
- return this._domSanitizer.bypassSecurityTrustResourceUrl(url);
423
- };
424
- return SafeUrlPipe;
425
- }());
426
- SafeUrlPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, deps: [{ token: i1__namespace.DomSanitizer }], target: i0__namespace.ɵɵFactoryTarget.Pipe });
427
- SafeUrlPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, name: "safeUrl" });
428
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SafeUrlPipe, decorators: [{
429
- type: i0.Pipe,
430
- args: [{
431
- name: 'safeUrl'
432
- }]
433
- }], ctorParameters: function () { return [{ type: i1__namespace.DomSanitizer }]; } });
434
-
435
- /**
436
- * Cast super type into type using generics
437
- * Return Type obtained by optional @param type OR assignment type.
438
- */
439
- var AsPipe = /** @class */ (function () {
440
- function AsPipe() {
441
- }
442
- /**
443
- * Cast (S: SuperType) into (T: Type) using @Generics.
444
- * @param value (S: SuperType) obtained from input type.
445
- * @optional @param type (T CastingType)
446
- * type?: { new (): T }
447
- * type?: new () => T
448
- */
449
- AsPipe.prototype.transform = function (value, type) {
450
- return value;
451
- };
452
- return AsPipe;
453
- }());
454
- AsPipe.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AsPipe, deps: [], target: i0__namespace.ɵɵFactoryTarget.Pipe });
455
- AsPipe.ɵpipe = i0__namespace.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AsPipe, name: "as" });
456
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AsPipe, decorators: [{
457
- type: i0.Pipe,
458
- args: [{ name: 'as' }]
459
- }] });
460
-
461
- var AvatarGenerator = /** @class */ (function () {
462
- function AvatarGenerator() {
463
- this.getImageOverride = function () { return ''; };
464
- }
465
- AvatarGenerator.prototype.getImage = function (nameOrEmail) {
466
- var uri = AvatarGenerator._imageCache.get(nameOrEmail);
467
- if (!uri) {
468
- uri = this.getImageOverride(nameOrEmail);
469
- AvatarGenerator._imageCache.set(nameOrEmail, uri);
470
- }
471
- return uri;
472
- };
473
- AvatarGenerator.prototype.getLabel = function (nameOrEmail) {
474
- if (!nameOrEmail)
475
- return '';
476
- if (this.getImage(nameOrEmail))
477
- return '';
478
- var name = AvatarGenerator.getLocalPartOfEmailAddress(nameOrEmail);
479
- var initials = AvatarGenerator.getTwoUppercaseLettersFromName(name);
480
- return initials;
481
- };
482
- AvatarGenerator.prototype.getStyle = function (nameOrEmail) {
483
- if (this.getImage(nameOrEmail))
484
- return '';
485
- var foregroundColor = '#ffffff';
486
- var backgroundColor = AvatarGenerator.getBackgroundColor(nameOrEmail);
487
- var style = {
488
- 'background-color': backgroundColor,
489
- color: foregroundColor,
490
- };
491
- return style;
492
- };
493
- AvatarGenerator.getLocalPartOfEmailAddress = function (email) {
494
- var indexOfAt = email.indexOf('@');
495
- if (indexOfAt < 2) {
496
- if (indexOfAt >= 0) {
497
- if (indexOfAt === email.length - 1)
498
- return email.substring(0, indexOfAt);
499
- return email.substring(indexOfAt + 1);
500
- }
501
- }
502
- else {
503
- return email.substring(0, indexOfAt);
504
- }
505
- return email;
506
- };
507
- AvatarGenerator.getTwoUppercaseLettersFromName = function (name) {
508
- // Too short to do anything besides just returning the name
509
- if (name.length <= 2) {
510
- return name.toUpperCase();
511
- }
512
- // Try to split by non word characters
513
- var splittedByNonWord = name.split(AvatarGenerator._nonWordRegex);
514
- if (splittedByNonWord.length > 1) {
515
- return (splittedByNonWord[0][0] + splittedByNonWord[1][0]).toUpperCase();
516
- }
517
- // Try to split by upper case letters
518
- var upperCaseLetters = __spreadArray([], __read(name)).filter(function (c) { return c.toUpperCase() === c && !AvatarGenerator._nonWordRegex.test(c); })
519
- .join();
520
- if (upperCaseLetters.length > 1) {
521
- return upperCaseLetters.substring(0, 2);
522
- }
523
- // Just return the first 2 letters
524
- return name.substring(0, 2).toUpperCase();
525
- };
526
- // from https://stackoverflow.com/a/66494926/1378307
527
- AvatarGenerator.getBackgroundColor = function (text, minLightness, maxLightness, minSaturation, maxSaturation) {
528
- if (minLightness === void 0) { minLightness = 40; }
529
- if (maxLightness === void 0) { maxLightness = 80; }
530
- if (minSaturation === void 0) { minSaturation = 30; }
531
- if (maxSaturation === void 0) { maxSaturation = 100; }
532
- if (!text)
533
- return '#aaa';
534
- var hash = __spreadArray([], __read(text)).reduce(function (acc, char) {
535
- return char.charCodeAt(0) + ((acc << 5) - acc);
536
- }, 0);
537
- return ('hsl(' +
538
- (hash % 360) +
539
- ', ' +
540
- ((hash % (maxSaturation - minSaturation)) + minSaturation) +
541
- '%, ' +
542
- ((hash % (maxLightness - minLightness)) + minLightness) +
543
- '%)');
544
- };
545
- return AvatarGenerator;
546
- }());
547
- AvatarGenerator._nonWordRegex = new RegExp('\\W');
548
- AvatarGenerator._imageCache = new Map();
549
- AvatarGenerator.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AvatarGenerator, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
550
- AvatarGenerator.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AvatarGenerator, providedIn: 'root' });
551
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: AvatarGenerator, decorators: [{
552
- type: i0.Injectable,
553
- args: [{
554
- providedIn: 'root',
555
- }]
556
- }], propDecorators: { getImageOverride: [{
557
- type: i0.Input
558
- }] } });
559
-
560
- var FormService = /** @class */ (function () {
561
- function FormService() {
562
- }
563
- FormService.prototype.createFormGroupsFromTemplates = function (templates) {
564
- var _this = this;
565
- var tabs = Object.fromEntries(Object.entries(templates).map(function (_a) {
566
- var _b = __read(_a, 2), name = _b[0], template = _b[1];
567
- return [
568
- name,
569
- _this.createFormGroupFromTemplate(template)
570
- ];
571
- }));
572
- return tabs;
573
- };
574
- FormService.prototype.createFormGroupFromTemplates = function (templates, ignoredProperties) {
575
- var _this = this;
576
- var controls = Object.fromEntries(Object.entries(templates)
577
- .filter(function (_a) {
578
- var _b = __read(_a, 1), key = _b[0];
579
- return !ignoredProperties.some(function (p) { return key === p; });
580
- })
581
- .map(function (_a) {
582
- var _b = __read(_a, 2), name = _b[0], template = _b[1];
583
- return [
584
- name,
585
- _this.createFormGroupFromTemplate(template)
586
- ];
587
- }));
588
- var formGroup = new i14.FormGroup(controls);
589
- return formGroup;
590
- };
591
- FormService.prototype.createFormArrayFromTemplates = function (templates, ignoredProperties) {
592
- var _this = this;
593
- var controls = Object.entries(templates)
594
- .filter(function (_a) {
595
- var _b = __read(_a, 1), key = _b[0];
596
- return !ignoredProperties.some(function (p) { return key === p; });
597
- })
598
- .map(function (_a) {
599
- var _b = __read(_a, 2), template = _b[1];
600
- return _this.createFormGroupFromTemplate(template);
601
- });
602
- var formArray = new i14.FormArray(controls);
603
- return formArray;
604
- };
605
- FormService.prototype.createFormGroupFromTemplate = function (template) {
606
- var _this = this;
607
- var controls = Object.fromEntries(template.properties.map(function (p) { return [
608
- p.name,
609
- _this.createFormControl(p)
610
- ]; }));
611
- var formGroup = new i14.FormGroup(controls);
612
- return formGroup;
613
- };
614
- FormService.prototype.createFormControl = function (property) {
615
- if (property.type === i1.PropertyType.Object)
616
- return this.createFormGroupFromTemplate(property._templates['default']);
617
- if (property.type === i1.PropertyType.Collection)
618
- return this.createFormArrayFromTemplates(property._templates, ['default']);
619
- var control = new i14.FormControl(property.value);
620
- if (property.max)
621
- control.addValidators(i14.Validators.max(property.max));
622
- if (property.maxLength)
623
- control.addValidators(i14.Validators.maxLength(property.maxLength));
624
- if (property.min)
625
- control.addValidators(i14.Validators.min(property.min));
626
- if (property.minLength)
627
- control.addValidators(i14.Validators.minLength(property.minLength));
628
- if (property.regex)
629
- control.addValidators(i14.Validators.pattern(property.regex));
630
- if (property.required)
631
- control.addValidators(i14.Validators.required);
632
- if (property.type === i1.PropertyType.Email)
633
- control.addValidators(i14.Validators.email);
634
- return control;
635
- };
636
- return FormService;
637
- }());
638
- FormService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: FormService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
639
- FormService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: FormService, providedIn: 'root' });
640
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: FormService, decorators: [{
641
- type: i0.Injectable,
642
- args: [{
643
- providedIn: 'root'
644
- }]
645
- }] });
646
-
647
- var RESTworldClient = /** @class */ (function () {
648
- function RESTworldClient(_halClient, _options) {
649
- this._halClient = _halClient;
650
- this._options = _options;
651
- }
652
- Object.defineProperty(RESTworldClient.prototype, "halClient", {
653
- get: function () {
654
- return this._halClient;
655
- },
656
- enumerable: false,
657
- configurable: true
658
- });
659
- RESTworldClient.prototype.ensureHomeResourceIsSet = function () {
660
- return __awaiter(this, void 0, void 0, function () {
661
- var response;
662
- return __generator(this, function (_c) {
663
- switch (_c.label) {
664
- case 0:
665
- if (!!this._homeResource) return [3 /*break*/, 2];
666
- return [4 /*yield*/, this.getHomeForced()];
667
- case 1:
668
- response = _c.sent();
669
- if (ProblemDetails.isProblemDetails(response.body)) {
670
- throw new Error("Cannot get the home resource from " + this._options.BaseUrl + " with Version " + this._options.Version + ". Response was: " + response);
671
- }
672
- if (!response.body)
673
- throw new Error("Cannot get the home resource from " + this._options.BaseUrl + " with Version " + this._options.Version + ". Response was empty.");
674
- this._homeResource = response.body;
675
- this.setDefaultCurie();
676
- _c.label = 2;
677
- case 2: return [2 /*return*/];
678
- }
679
- });
680
- });
681
- };
682
- RESTworldClient.prototype.getHomeForced = function () {
683
- return __awaiter(this, void 0, void 0, function () {
684
- var header, response;
685
- return __generator(this, function (_c) {
686
- switch (_c.label) {
687
- case 0:
688
- header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
689
- return [4 /*yield*/, this.halClient.get(this._options.BaseUrl, i1.Resource, ProblemDetails, header)];
690
- case 1:
691
- response = _c.sent();
692
- return [2 /*return*/, response];
693
- }
694
- });
695
- });
696
- };
697
- RESTworldClient.prototype.setDefaultCurie = function () {
698
- var _a, _b;
699
- var curies = (_b = (_a = this._homeResource) === null || _a === void 0 ? void 0 : _a._links) === null || _b === void 0 ? void 0 : _b.curies;
700
- if (!curies || curies.length === 0 || !curies[0])
701
- this._defaultCurie = undefined;
702
- else
703
- this._defaultCurie = curies[0].name;
704
- };
705
- RESTworldClient.prototype.getList = function (rel, parameters, headers, curie) {
706
- return __awaiter(this, void 0, void 0, function () {
707
- var link, uri, response;
708
- return __generator(this, function (_c) {
709
- switch (_c.label) {
710
- case 0:
711
- link = this.getLinkFromHome(rel, exports.LinkNames.getList, curie);
712
- uri = link.fillTemplate(parameters);
713
- return [4 /*yield*/, this.halClient.get(uri, i1.PagedListResource, ProblemDetails, headers)];
714
- case 1:
715
- response = _c.sent();
716
- return [2 /*return*/, response];
717
- }
718
- });
719
- });
720
- };
721
- RESTworldClient.prototype.getListByUri = function (uri, parameters, headers) {
722
- return __awaiter(this, void 0, void 0, function () {
723
- var link, filledUri, response;
724
- return __generator(this, function (_c) {
725
- switch (_c.label) {
726
- case 0:
727
- link = new i1.Link();
728
- link.href = uri;
729
- filledUri = link.fillTemplate(parameters);
730
- return [4 /*yield*/, this.halClient.get(filledUri, i1.PagedListResource, ProblemDetails, headers)];
731
- case 1:
732
- response = _c.sent();
733
- return [2 /*return*/, response];
734
- }
735
- });
736
- });
737
- };
738
- RESTworldClient.prototype.getSingle = function (relOrUri, id, headers, curie) {
739
- return __awaiter(this, void 0, void 0, function () {
740
- var uri, link, response;
741
- return __generator(this, function (_c) {
742
- switch (_c.label) {
743
- case 0:
744
- if (relOrUri.startsWith('http')) {
745
- if (id !== undefined)
746
- throw new Error('When supplying a URI, an ID cannot be supplied too.');
747
- if (curie)
748
- throw new Error('When supplying a URI, a curie cannot be supplied too.');
749
- uri = relOrUri;
750
- }
751
- else {
752
- if (!___namespace.isNumber(id))
753
- throw new Error('When supplying a rel, an ID must be supplied too.');
754
- link = this.getLinkFromHome(relOrUri, exports.LinkNames.get, curie);
755
- uri = link.fillTemplate({ id: id.toString() });
756
- }
757
- return [4 /*yield*/, this.halClient.get(uri, i1.Resource, ProblemDetails, headers)];
758
- case 1:
759
- response = _c.sent();
760
- return [2 /*return*/, response];
761
- }
762
- });
763
- });
764
- };
765
- RESTworldClient.prototype.save = function (resource) {
766
- return __awaiter(this, void 0, void 0, function () {
767
- var saveLink, uri, method, header, response, _c;
768
- return __generator(this, function (_d) {
769
- switch (_d.label) {
770
- case 0:
771
- saveLink = resource.findLink('save');
772
- if (!saveLink)
773
- throw new Error("The resource " + resource + " does not have a save link.");
774
- if (!saveLink.name)
775
- throw new Error("The save link " + saveLink + " does not have a save name.");
776
- uri = saveLink.href;
777
- method = saveLink.name.toLowerCase();
778
- header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
779
- _c = method;
780
- switch (_c) {
781
- case 'put': return [3 /*break*/, 1];
782
- case 'post': return [3 /*break*/, 3];
783
- }
784
- return [3 /*break*/, 5];
785
- case 1: return [4 /*yield*/, this.halClient.put(uri, resource, i1.Resource, ProblemDetails, header)];
786
- case 2:
787
- response = _d.sent();
788
- return [3 /*break*/, 6];
789
- case 3: return [4 /*yield*/, this.halClient.post(uri, resource, i1.Resource, ProblemDetails, header)];
790
- case 4:
791
- response = _d.sent();
792
- return [3 /*break*/, 6];
793
- case 5: throw new Error("'" + method + "' is not allowed as link name for the save link. Only 'POST' and 'PUT' are allowed.");
794
- case 6: return [2 /*return*/, response];
795
- }
796
- });
797
- });
798
- };
799
- RESTworldClient.prototype.getAllForms = function (resource) {
800
- return __awaiter(this, void 0, void 0, function () {
801
- var urls, header, formsPromises, formsAndProblems;
802
- var _this = this;
803
- return __generator(this, function (_c) {
804
- switch (_c.label) {
805
- case 0:
806
- urls = resource.getFormLinkHrefs();
807
- header = RESTworldClient.createHeaders('application/prs.hal-forms+json', this._options.Version);
808
- formsPromises = urls.map(function (url) { return _this._halClient.get(url, i1.FormsResource, ProblemDetails, header); });
809
- return [4 /*yield*/, Promise.all(formsPromises)];
810
- case 1:
811
- formsAndProblems = _c.sent();
812
- return [2 /*return*/, formsAndProblems];
813
- }
814
- });
815
- });
816
- };
817
- RESTworldClient.prototype.submit = function (template, formValues) {
818
- var _a;
819
- return __awaiter(this, void 0, void 0, function () {
820
- var uri, method, header, response, _c;
821
- return __generator(this, function (_d) {
822
- switch (_d.label) {
823
- case 0:
824
- uri = template.target || '';
825
- method = (_a = template.method) === null || _a === void 0 ? void 0 : _a.toLowerCase();
826
- header = RESTworldClient.createHeaders('application/prs.hal-forms+json', this._options.Version);
827
- _c = method;
828
- switch (_c) {
829
- case 'put': return [3 /*break*/, 1];
830
- case 'post': return [3 /*break*/, 3];
831
- }
832
- return [3 /*break*/, 5];
833
- case 1: return [4 /*yield*/, this.halClient.put(uri, formValues, i1.FormsResource, ProblemDetails, header)];
834
- case 2:
835
- response = _d.sent();
836
- return [3 /*break*/, 7];
837
- case 3: return [4 /*yield*/, this.halClient.post(uri, formValues, i1.FormsResource, ProblemDetails, header)];
838
- case 4:
839
- response = _d.sent();
840
- return [3 /*break*/, 7];
841
- case 5: return [4 /*yield*/, this.halClient.get(uri, i1.FormsResource, ProblemDetails, header)];
842
- case 6:
843
- response = _d.sent();
844
- _d.label = 7;
845
- case 7: return [2 /*return*/, response];
846
- }
847
- });
848
- });
849
- };
850
- RESTworldClient.prototype.delete = function (resource) {
851
- return __awaiter(this, void 0, void 0, function () {
852
- var deleteLink, uri, header, response;
853
- return __generator(this, function (_c) {
854
- switch (_c.label) {
855
- case 0:
856
- deleteLink = resource.findLink('delete');
857
- if (!deleteLink)
858
- throw new Error("The resource " + resource + " does not have a delete link.");
859
- uri = deleteLink.href;
860
- header = RESTworldClient.createHeaders('application/hal+json', this._options.Version);
861
- return [4 /*yield*/, this.halClient.delete(uri, ProblemDetails, header)];
862
- case 1:
863
- response = _c.sent();
864
- return [2 /*return*/, response];
865
- }
866
- });
867
- });
868
- };
869
- RESTworldClient.prototype.getAllLinksFromHome = function () {
870
- if (!this._homeResource)
871
- throw new Error('Home resource is not set. Call ensureHomeResourceIsSet() first.');
872
- return this._homeResource._links;
873
- };
874
- RESTworldClient.prototype.getLinkFromHome = function (rel, name, curie) {
875
- var links = this.getLinksFromHome(rel, curie);
876
- var link = name ? links.find(function (l) { return l.name === name; }) : links[0];
877
- if (!link)
878
- throw new Error("The home resource does not have a link with the rel '" + this.getFullRel(rel, curie) + "' and the name '" + name + "'.");
879
- return link;
880
- };
881
- RESTworldClient.prototype.getLinksFromHome = function (rel, curie) {
882
- if (!this._homeResource)
883
- throw new Error('Home resource is not set. Call ensureHomeResourceIsSet() first.');
884
- var fullRel = this.getFullRel(rel, curie);
885
- var links = this._homeResource._links[fullRel];
886
- if (!links || links.length === 0)
887
- throw Error("The home resource does not have a link with the rel '" + fullRel + "'.");
888
- return links;
889
- };
890
- RESTworldClient.prototype.getFullRel = function (rel, curie) {
891
- // rel already includes a curie => just return it
892
- if (rel.includes(':'))
893
- return rel;
894
- // No curie given => use default curie.
895
- if (!curie)
896
- curie = this._defaultCurie;
897
- // Combine curie and rel
898
- var fullRel = curie + ":" + rel;
899
- return fullRel;
900
- };
901
- RESTworldClient.createHeaders = function (mediaType, version) {
902
- if (version)
903
- return new i1$2.HttpHeaders({ 'Accept': (mediaType || 'application/hal+json') + "; v=" + version });
904
- return new i1$2.HttpHeaders();
905
- };
906
- return RESTworldClient;
907
- }());
908
-
909
- var RESTworldClientCollection = /** @class */ (function () {
910
- function RESTworldClientCollection(_halClient) {
911
- this._halClient = _halClient;
912
- this._clients = {};
913
- }
914
- RESTworldClientCollection.prototype.containsClient = function (name) {
915
- return Object.keys(this._clients).includes(name);
916
- };
917
- RESTworldClientCollection.prototype.addOrGetExistingClient = function (name, options) {
918
- return __awaiter(this, void 0, void 0, function () {
919
- var client;
920
- return __generator(this, function (_a) {
921
- switch (_a.label) {
922
- case 0:
923
- if (Object.keys(this._clients).includes(name))
924
- return [2 /*return*/, this.getClient(name)];
925
- client = new RESTworldClient(this._halClient, options);
926
- return [4 /*yield*/, client.ensureHomeResourceIsSet()];
927
- case 1:
928
- _a.sent();
929
- this._clients[name] = client;
930
- return [2 /*return*/, client];
931
- }
932
- });
933
- });
934
- };
935
- RESTworldClientCollection.prototype.getClient = function (name) {
936
- var client = this._clients[name];
937
- if (!client)
938
- throw new Error("No client with the name '" + name + "' exists.");
939
- return client;
940
- };
941
- Object.defineProperty(RESTworldClientCollection.prototype, "all", {
942
- get: function () {
943
- return this._clients;
944
- },
945
- enumerable: false,
946
- configurable: true
947
- });
948
- return RESTworldClientCollection;
949
- }());
950
- RESTworldClientCollection.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, deps: [{ token: i1__namespace$1.HalClient }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
951
- RESTworldClientCollection.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, providedIn: 'root' });
952
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldClientCollection, decorators: [{
953
- type: i0.Injectable,
954
- args: [{
955
- providedIn: 'root'
956
- }]
957
- }], ctorParameters: function () { return [{ type: i1__namespace$1.HalClient }]; } });
958
-
959
- var SettingsService = /** @class */ (function () {
960
- function SettingsService(backend, _clients) {
961
- this._clients = _clients;
962
- this._client = new i1$2.HttpClient(backend);
963
- }
964
- Object.defineProperty(SettingsService.prototype, "settings", {
965
- get: function () {
966
- return this._settings;
967
- },
968
- enumerable: false,
969
- configurable: true
970
- });
971
- SettingsService.prototype.initialize = function () {
972
- return __awaiter(this, void 0, void 0, function () {
973
- return __generator(this, function (_b) {
974
- switch (_b.label) {
975
- case 0: return [4 /*yield*/, this.ensureSettingsAreLoaded()];
976
- case 1:
977
- _b.sent();
978
- return [4 /*yield*/, this.populateRESTworldClientCollectionFromSettings()];
979
- case 2:
980
- _b.sent();
981
- return [2 /*return*/];
982
- }
983
- });
984
- });
985
- };
986
- SettingsService.prototype.ensureSettingsAreLoaded = function () {
987
- return __awaiter(this, void 0, void 0, function () {
988
- var _b;
989
- return __generator(this, function (_c) {
990
- switch (_c.label) {
991
- case 0:
992
- _b = this;
993
- return [4 /*yield*/, this._client
994
- .get('/settings')
995
- .toPromise()];
996
- case 1:
997
- _b._settings = _c.sent();
998
- return [2 /*return*/];
999
- }
1000
- });
1001
- });
1002
- };
1003
- SettingsService.prototype.populateRESTworldClientCollectionFromSettings = function () {
1004
- var _a;
1005
- return __awaiter(this, void 0, void 0, function () {
1006
- var _this = this;
1007
- return __generator(this, function (_b) {
1008
- switch (_b.label) {
1009
- case 0:
1010
- if (!((_a = this._settings) === null || _a === void 0 ? void 0 : _a.apiUrls))
1011
- return [2 /*return*/];
1012
- return [4 /*yield*/, Promise.all(this._settings.apiUrls
1013
- .map(function (api) { return _this._clients.addOrGetExistingClient(api.name, new RESTworldOptions(api.url, api.version)); }))];
1014
- case 1:
1015
- _b.sent();
1016
- return [2 /*return*/];
1017
- }
1018
- });
1019
- });
1020
- };
1021
- return SettingsService;
1022
- }());
1023
- SettingsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, deps: [{ token: i1__namespace$2.HttpBackend }, { token: RESTworldClientCollection }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1024
- SettingsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, providedIn: 'root' });
1025
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: SettingsService, decorators: [{
1026
- type: i0.Injectable,
1027
- args: [{
1028
- providedIn: 'root'
1029
- }]
1030
- }], ctorParameters: function () { return [{ type: i1__namespace$2.HttpBackend }, { type: RESTworldClientCollection }]; } });
1031
-
1032
- var RESTWorldImageViewComponent = /** @class */ (function () {
1033
- function RESTWorldImageViewComponent() {
1034
- this.maintainAspectRatio = true;
1035
- this.aspectRatio = 1;
1036
- this.resizeToWidth = 0;
1037
- this.resizeToHeight = 0;
1038
- this.onlyScaleDown = false;
1039
- this.containWithinAspectRatio = false;
1040
- this.backgroundColor = "#ffffff";
1041
- this.format = 'png';
1042
- this.disabled = false;
1043
- this.displayCropDialog = false;
1044
- }
1045
- RESTWorldImageViewComponent.prototype.writeValue = function (obj) {
1046
- this.uri = obj;
1047
- };
1048
- RESTWorldImageViewComponent.prototype.registerOnChange = function (fn) {
1049
- this.onChange = fn;
1050
- };
1051
- RESTWorldImageViewComponent.prototype.registerOnTouched = function () {
1052
- // not needed for this component, but needed to implement the interface
1053
- };
1054
- RESTWorldImageViewComponent.prototype.setDisabledState = function (isDisabled) {
1055
- this.disabled = isDisabled;
1056
- };
1057
- RESTWorldImageViewComponent.prototype.showCropDialog = function () {
1058
- this.displayCropDialog = true;
1059
- };
1060
- RESTWorldImageViewComponent.prototype.imageChanged = function (event) {
1061
- this.tempImageFile = event.files[0];
1062
- this.showCropDialog();
1063
- };
1064
- RESTWorldImageViewComponent.prototype.croppedImageChanged = function (event) {
1065
- this.tempCroppedUri = event.base64;
1066
- };
1067
- RESTWorldImageViewComponent.prototype.acceptCroppedImage = function () {
1068
- var _a;
1069
- this.uri = this.tempCroppedUri;
1070
- (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, this.uri);
1071
- this.closeCropDialog();
1072
- };
1073
- RESTWorldImageViewComponent.prototype.closeCropDialog = function () {
1074
- var _a;
1075
- (_a = this.fileUploads) === null || _a === void 0 ? void 0 : _a.forEach(function (f) { return f.clear(); });
1076
- this.displayCropDialog = false;
1077
- };
1078
- return RESTWorldImageViewComponent;
1079
- }());
1080
- RESTWorldImageViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldImageViewComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1081
- RESTWorldImageViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTWorldImageViewComponent, selector: "rw-image", inputs: { alt: "alt", accept: "accept", fileName: "fileName", maintainAspectRatio: "maintainAspectRatio", aspectRatio: "aspectRatio", resizeToWidth: "resizeToWidth", resizeToHeight: "resizeToHeight", onlyScaleDown: "onlyScaleDown", containWithinAspectRatio: "containWithinAspectRatio", backgroundColor: "backgroundColor", format: "format" }, providers: [{
1082
- provide: i14.NG_VALUE_ACCESSOR,
1083
- useExisting: i0.forwardRef(function () { return RESTWorldImageViewComponent; }),
1084
- multi: true
1085
- }], viewQueries: [{ propertyName: "fileUploads", predicate: i2.FileUpload, descendants: true }], ngImport: i0__namespace, template: "<div class=\"flex align-items-center\">\r\n <p-button *ngIf=\"!uri\" [disabled]=\"true\" icon=\"pi pi-download\" class=\"mr-1\" pTooltip=\"No image present\"></p-button>\r\n <a *ngIf=\"uri\" [href]=\"uri | safeUrl\" [download]=\"fileName || 'download'\" class=\"mr-1\" pButton pTooltip=\"Download image\" icon=\"pi pi-download\"></a>\r\n <p-fileUpload class=\"mr-1\" chooseIcon=\"pi-upload fas fa-upload\" mode=\"basic\" [auto]=\"true\" [accept]=\"accept || 'false'\" [customUpload]=\"true\" (uploadHandler)=\"imageChanged($event)\" pTooltip=\"Upload new image\"></p-fileUpload>\r\n <img *ngIf=\"uri\" [src]=\"uri\" [alt]=\"alt\" (click)=\"showCropDialog()\" pTooltip=\"Zoom and crop\" />\r\n</div>\r\n\r\n<p-dialog header=\"alt\" [(visible)]=\"displayCropDialog\">\r\n <image-cropper #cropper\r\n [imageFile]=\"tempImageFile!\"\r\n [imageURL]=\"uri!\"\r\n [maintainAspectRatio]=\"maintainAspectRatio\"\r\n [aspectRatio]=\"aspectRatio\"\r\n [resizeToWidth]=\"resizeToWidth\"\r\n [resizeToHeight]=\"resizeToHeight\"\r\n [onlyScaleDown]=\"onlyScaleDown\"\r\n [autoCrop]=\"true\"\r\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\r\n [backgroundColor]=\"backgroundColor\"\r\n [format]=\"format\"\r\n (imageCropped)=\"croppedImageChanged($event)\"></image-cropper>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"flex-auto align-items-center\">\r\n <span>Background color:&nbsp;</span>\r\n <p-colorPicker [(ngModel)]=\"cropper.backgroundColor\" appendTo=\"body\" class=\"ml-1 mr-1\"></p-colorPicker>\r\n <input pInputText [(ngModel)]=\"cropper.backgroundColor\" />\r\n </div>\r\n <button type=\"button\" pButton pRipple (click)=\"acceptCroppedImage()\" class=\"mr-2\">Ok</button>\r\n <button type=\"button\" pButton pRipple (click)=\"closeCropDialog()\">Cancel</button>\r\n </div>\r\n</p-dialog>\r\n", styles: ["img{height:calc(1rem + 2*8px + 2*1px);cursor:zoom-in;border-radius:3px}a{text-decoration:none;height:calc(1rem + 2*8px + 2px)}a.p-button-icon-only span.p-button-label{height:1rem!important}\n"], components: [{ type: i1__namespace$3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i2__namespace.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler"] }, { type: i3__namespace.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "visible", "style", "position"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { type: i4__namespace.ImageCropperComponent, selector: "image-cropper", inputs: ["format", "transform", "maintainAspectRatio", "aspectRatio", "resizeToWidth", "resizeToHeight", "cropperMinWidth", "cropperMinHeight", "cropperMaxHeight", "cropperMaxWidth", "cropperStaticWidth", "cropperStaticHeight", "canvasRotation", "initialStepSize", "roundCropper", "onlyScaleDown", "imageQuality", "autoCrop", "backgroundColor", "containWithinAspectRatio", "hideResizeSquares", "cropper", "alignImage", "disabled", "imageChangedEvent", "imageURL", "imageBase64", "imageFile"], outputs: ["imageCropped", "startCropImage", "imageLoaded", "cropperReady", "loadImageFailed"] }, { type: i5__namespace.ColorPicker, selector: "p-colorPicker", inputs: ["style", "styleClass", "inline", "format", "appendTo", "disabled", "tabindex", "inputId", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onChange", "onShow", "onHide"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i14__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i9__namespace.InputText, selector: "[pInputText]" }, { type: i10__namespace.Ripple, selector: "[pRipple]" }], pipes: { "safeUrl": SafeUrlPipe } });
1086
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldImageViewComponent, decorators: [{
1087
- type: i0.Component,
1088
- args: [{
1089
- selector: 'rw-image',
1090
- templateUrl: './restworld-image-view.component.html',
1091
- styleUrls: ['./restworld-image-view.component.css'],
1092
- providers: [{
1093
- provide: i14.NG_VALUE_ACCESSOR,
1094
- useExisting: i0.forwardRef(function () { return RESTWorldImageViewComponent; }),
1095
- multi: true
1096
- }]
1097
- }]
1098
- }], propDecorators: { alt: [{
1099
- type: i0.Input
1100
- }], accept: [{
1101
- type: i0.Input
1102
- }], fileName: [{
1103
- type: i0.Input
1104
- }], maintainAspectRatio: [{
1105
- type: i0.Input
1106
- }], aspectRatio: [{
1107
- type: i0.Input
1108
- }], resizeToWidth: [{
1109
- type: i0.Input
1110
- }], resizeToHeight: [{
1111
- type: i0.Input
1112
- }], onlyScaleDown: [{
1113
- type: i0.Input
1114
- }], containWithinAspectRatio: [{
1115
- type: i0.Input
1116
- }], backgroundColor: [{
1117
- type: i0.Input
1118
- }], format: [{
1119
- type: i0.Input
1120
- }], fileUploads: [{
1121
- type: i0.ViewChildren,
1122
- args: [i2.FileUpload]
1123
- }] } });
1124
-
1125
- var RESTWorldFileViewComponent = /** @class */ (function () {
1126
- function RESTWorldFileViewComponent() {
1127
- this.disabled = false;
1128
- }
1129
- RESTWorldFileViewComponent.prototype.writeValue = function (obj) {
1130
- this.uri = obj;
1131
- };
1132
- RESTWorldFileViewComponent.prototype.registerOnChange = function (fn) {
1133
- this.onChange = fn;
1134
- };
1135
- RESTWorldFileViewComponent.prototype.registerOnTouched = function () {
1136
- // not needed for this component, but needed to implement the interface
1137
- };
1138
- RESTWorldFileViewComponent.prototype.setDisabledState = function (isDisabled) {
1139
- this.disabled = isDisabled;
1140
- };
1141
- RESTWorldFileViewComponent.prototype.fileChanged = function (event) {
1142
- var _this = this;
1143
- var file = event.files[0];
1144
- var reader = new FileReader();
1145
- reader.onload = function () {
1146
- var _a;
1147
- _this.uri = reader.result;
1148
- (_a = _this.onChange) === null || _a === void 0 ? void 0 : _a.call(_this, _this.uri);
1149
- };
1150
- reader.readAsDataURL(file);
1151
- };
1152
- return RESTWorldFileViewComponent;
1153
- }());
1154
- RESTWorldFileViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldFileViewComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1155
- RESTWorldFileViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTWorldFileViewComponent, selector: "rw-file", inputs: { accept: "accept", fileName: "fileName" }, providers: [{
1156
- provide: i14.NG_VALUE_ACCESSOR,
1157
- useExisting: i0.forwardRef(function () { return RESTWorldFileViewComponent; }),
1158
- multi: true
1159
- }], viewQueries: [{ propertyName: "fileUploads", predicate: i2.FileUpload, descendants: true }], ngImport: i0__namespace, template: "<div class=\"flex align-items-center\">\r\n <p-button *ngIf=\"!uri\" [disabled]=\"true\" icon=\"pi pi-download\" class=\"mr-1\" pTooltip=\"No file present\"></p-button>\r\n <a *ngIf=\"uri\" [href]=\"uri | safeUrl\" [download]=\"fileName || 'download'\" class=\"mr-1\" pButton pTooltip=\"Download file\" icon=\"pi pi-download\"></a>\r\n <p-fileUpload chooseIcon=\"pi-upload fas fa-upload\" pTooltip=\"Upload new file\" mode=\"basic\" [auto]=\"true\" [accept]=\"accept || 'false'\" [customUpload]=\"true\" (uploadHandler)=\"fileChanged($event)\"></p-fileUpload>\r\n</div>\r\n", styles: ["a{text-decoration:none;height:calc(1rem + 2*8px + 2px)}a.p-button-icon-only span.p-button-label{height:1rem!important}\n"], components: [{ type: i1__namespace$3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i2__namespace.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }], pipes: { "safeUrl": SafeUrlPipe } });
1160
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTWorldFileViewComponent, decorators: [{
1161
- type: i0.Component,
1162
- args: [{
1163
- selector: 'rw-file',
1164
- templateUrl: './restworld-file-view.component.html',
1165
- styleUrls: ['./restworld-file-view.component.css'],
1166
- providers: [{
1167
- provide: i14.NG_VALUE_ACCESSOR,
1168
- useExisting: i0.forwardRef(function () { return RESTWorldFileViewComponent; }),
1169
- multi: true
1170
- }]
1171
- }]
1172
- }], propDecorators: { accept: [{
1173
- type: i0.Input
1174
- }], fileName: [{
1175
- type: i0.Input
1176
- }], fileUploads: [{
1177
- type: i0.ViewChildren,
1178
- args: [i2.FileUpload]
1179
- }] } });
1180
-
1181
- var RestworldEditFormComponent = /** @class */ (function () {
1182
- function RestworldEditFormComponent(_formService, _changeDetectorRef, _messageService, _clients) {
1183
- this._formService = _formService;
1184
- this._changeDetectorRef = _changeDetectorRef;
1185
- this._messageService = _messageService;
1186
- this._clients = _clients;
1187
- this.FormGroup = i14.FormGroup;
1188
- this.FormArray = i14.FormArray;
1189
- this.Number = Number;
1190
- }
1191
- Object.defineProperty(RestworldEditFormComponent.prototype, "PropertyType", {
1192
- get: function () {
1193
- return i1.PropertyType;
1194
- },
1195
- enumerable: false,
1196
- configurable: true
1197
- });
1198
- Object.defineProperty(RestworldEditFormComponent.prototype, "dateFormat", {
1199
- get: function () {
1200
- return new Date(3333, 10, 22)
1201
- .toLocaleDateString()
1202
- .replace("22", "dd")
1203
- .replace("11", "mm")
1204
- .replace("3333", "yy")
1205
- .replace("33", "y");
1206
- },
1207
- enumerable: false,
1208
- configurable: true
1209
- });
1210
- RestworldEditFormComponent.prototype.ngOnInit = function () {
1211
- if (!this.formGroup)
1212
- throw new Error("[formGroup] is required on <rw-form>");
1213
- if (!this.template)
1214
- throw new Error("[template] is required on <rw-form>");
1215
- if (!this.apiName)
1216
- throw new Error("[apiName] is required on <rw-form>");
1217
- };
1218
- RestworldEditFormComponent.prototype.getTooltip = function (resource, keysToExclude) {
1219
- var tooltip = Object.entries(resource)
1220
- .filter(function (_c) {
1221
- var _d = __read(_c, 1), key = _d[0];
1222
- return !(key.startsWith('_') || ['createdAt', 'createdBy', 'lastChangedAt', 'lastChangedBy', 'timestamp'].includes(key) || (keysToExclude === null || keysToExclude === void 0 ? void 0 : keysToExclude.includes(key)));
1223
- })
1224
- .reduce(function (prev, _c, index) {
1225
- var _d = __read(_c, 2), key = _d[0], value = _d[1];
1226
- return "" + prev + (index === 0 ? '' : '\n') + key + ": " + RestworldEditFormComponent.jsonStringifyWithElipsis(value);
1227
- }, '');
1228
- return tooltip;
1229
- };
1230
- RestworldEditFormComponent.jsonStringifyWithElipsis = function (value) {
1231
- var maxLength = 200;
1232
- var end = 10;
1233
- var start = maxLength - end - 2;
1234
- var json = JSON.stringify(value);
1235
- var shortened = json.length > maxLength ? json.substring(0, start) + '…' + json.substring(json.length - end) : json;
1236
- return shortened;
1237
- };
1238
- RestworldEditFormComponent.prototype.getCollectionEntryTemplates = function (property) {
1239
- if (!property)
1240
- return [];
1241
- return Object.entries(property._templates)
1242
- .filter(function (_c) {
1243
- var _d = __read(_c, 1), key = _d[0];
1244
- return Number.isInteger(Number.parseInt(key));
1245
- })
1246
- .map(function (_c) {
1247
- var _d = __read(_c, 2), value = _d[1];
1248
- return value;
1249
- });
1250
- };
1251
- RestworldEditFormComponent.prototype.addNewItemToCollection = function (property, formArray) {
1252
- if (!(formArray instanceof i14.FormArray))
1253
- throw new Error('formArray is not an instance of FormArray.');
1254
- var maxIndex = Math.max.apply(Math, __spreadArray([], __read(Object.keys(property._templates)
1255
- .map(function (key) { return Number.parseInt(key); })
1256
- .filter(function (key) { return Number.isSafeInteger(key); }))));
1257
- var nextIndex = maxIndex + 1;
1258
- var defaultTemplate = property._templates['default'];
1259
- var copiedTemplateDto = JSON.parse(JSON.stringify(defaultTemplate));
1260
- var copiedTemplate = new i1.Template(copiedTemplateDto);
1261
- copiedTemplate.title = nextIndex.toString();
1262
- property._templates[copiedTemplate.title] = copiedTemplate;
1263
- formArray.push(this._formService.createFormGroupFromTemplate(defaultTemplate));
1264
- };
1265
- RestworldEditFormComponent.prototype.deleteItemFromCollection = function (property, formArray, template) {
1266
- if (!template.title)
1267
- throw new Error("Cannot delete the item, because the template '" + template + "' does not have a title.");
1268
- if (!(formArray instanceof i14.FormArray))
1269
- throw new Error('formArray is not an instance of FormArray.');
1270
- var templates = property._templates;
1271
- delete templates[template.title];
1272
- formArray.removeAt(Number.parseInt(template.title));
1273
- };
1274
- RestworldEditFormComponent.prototype.collectionItemDropped = function ($event) {
1275
- var formArray = $event.container.data.formArray;
1276
- var previousIndex = $event.previousIndex;
1277
- var currentIndex = $event.currentIndex;
1278
- var movementDirection = currentIndex > previousIndex ? 1 : -1;
1279
- // Move in FormArray
1280
- // We do not need to move the item in the _templates object
1281
- var movedControl = formArray.at(previousIndex);
1282
- for (var i = previousIndex; i * movementDirection < currentIndex * movementDirection; i = i + movementDirection) {
1283
- formArray.setControl(i, formArray.at(i + movementDirection));
1284
- }
1285
- formArray.setControl(currentIndex, movedControl);
1286
- this._changeDetectorRef.markForCheck();
1287
- console.log($event);
1288
- };
1289
- RestworldEditFormComponent.prototype.onOptionsFiltered = function (property, event) {
1290
- var _a, _b;
1291
- return __awaiter(this, void 0, void 0, function () {
1292
- var options, templatedUri, filter, response, message, items;
1293
- return __generator(this, function (_c) {
1294
- switch (_c.label) {
1295
- case 0:
1296
- options = property === null || property === void 0 ? void 0 : property.options;
1297
- if (!((_a = options === null || options === void 0 ? void 0 : options.link) === null || _a === void 0 ? void 0 : _a.href) || !event.filter || event.filter === '')
1298
- return [2 /*return*/];
1299
- templatedUri = options.link.href;
1300
- filter = "contains(" + options.promptField + ", '" + event.filter + "')";
1301
- if (((_b = options.valueField) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'id' && !Number.isNaN(Number.parseInt(event.filter)))
1302
- filter = "(" + options.valueField + " eq " + event.filter + ") or (" + filter + ")";
1303
- return [4 /*yield*/, this.getClient().getListByUri(templatedUri, { $filter: filter, $top: 10 })];
1304
- case 1:
1305
- response = _c.sent();
1306
- if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1307
- message = "An error occurred while getting the filtered items.";
1308
- this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1309
- return [2 /*return*/];
1310
- }
1311
- items = response.body._embedded.items;
1312
- options.inline = items;
1313
- return [2 /*return*/];
1314
- }
1315
- });
1316
- });
1317
- };
1318
- RestworldEditFormComponent.prototype.getClient = function () {
1319
- if (!this.apiName)
1320
- throw new Error('Cannot get a client, because the apiName is not set.');
1321
- return this._clients.getClient(this.apiName);
1322
- };
1323
- return RestworldEditFormComponent;
1324
- }());
1325
- RestworldEditFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldEditFormComponent, deps: [{ token: FormService }, { token: i0__namespace.ChangeDetectorRef }, { token: i2__namespace$1.MessageService }, { token: RESTworldClientCollection }], target: i0__namespace.ɵɵFactoryTarget.Component });
1326
- RestworldEditFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RestworldEditFormComponent, selector: "rw-form", inputs: { formGroup: "formGroup", template: "template", apiName: "apiName" }, queries: [{ propertyName: "inputOptionsSingleRef", first: true, predicate: ["inputOptionsSingle"], descendants: true }, { propertyName: "inputOptionsMultipleRef", first: true, predicate: ["inputOptionsMultiple"], descendants: true }, { propertyName: "inputOptionsRef", first: true, predicate: ["inputOptions"], descendants: true }, { propertyName: "inputHiddenRef", first: true, predicate: ["inputHidden"], descendants: true }, { propertyName: "inputTextRef", first: true, predicate: ["inputText"], descendants: true }, { propertyName: "inputTextareaRef", first: true, predicate: ["inputTextarea"], descendants: true }, { propertyName: "inputSearchRef", first: true, predicate: ["inputSearch"], descendants: true }, { propertyName: "inputTelRef", first: true, predicate: ["inputTel"], descendants: true }, { propertyName: "inputUrlRef", first: true, predicate: ["inputUrl"], descendants: true }, { propertyName: "inputEmailRef", first: true, predicate: ["inputEmail"], descendants: true }, { propertyName: "inputPasswordRef", first: true, predicate: ["inputPassword"], descendants: true }, { propertyName: "inputDateRef", first: true, predicate: ["inputDate"], descendants: true }, { propertyName: "inputMonthRef", first: true, predicate: ["inputMonth"], descendants: true }, { propertyName: "inputWeekRef", first: true, predicate: ["inputWeek"], descendants: true }, { propertyName: "inputTimeRef", first: true, predicate: ["inputTime"], descendants: true }, { propertyName: "inputDatetimeLocalRef", first: true, predicate: ["inputDatetimeLocal"], descendants: true }, { propertyName: "inputNumberRef", first: true, predicate: ["inputNumber"], descendants: true }, { propertyName: "inputRangeRef", first: true, predicate: ["inputRange"], descendants: true }, { propertyName: "inputColorRef", first: true, predicate: ["inputColor"], descendants: true }, { propertyName: "inputBoolRef", first: true, predicate: ["inputBool"], descendants: true }, { propertyName: "inputDatetimeOffsetRef", first: true, predicate: ["inputDatetimeOffset"], descendants: true }, { propertyName: "inputDurationRef", first: true, predicate: ["inputDuration"], descendants: true }, { propertyName: "inputImageRef", first: true, predicate: ["inputImage"], descendants: true }, { propertyName: "inputFileRef", first: true, predicate: ["inputFile"], descendants: true }, { propertyName: "inputObjectRef", first: true, predicate: ["inputObject"], descendants: true }, { propertyName: "inputCollectionRef", first: true, predicate: ["inputCollection"], descendants: true }, { propertyName: "inputDefaultRef", first: true, predicate: ["inputDefault"], descendants: true }], ngImport: i0__namespace, template: "<div *ngFor=\"let property of template.properties\" class=\"grid field\" [formGroup]=\"formGroup\">\r\n <label *ngIf=\"property.type !== PropertyType.Hidden\" [attr.for]=\"property.name\" class=\"col-12 mb-2 md:col-2 md:mb-0\" [class.p-disabled]=\"property.readOnly\" [class.hasChildren]=\"property._templates\">{{property.prompt || property.name}}</label>\r\n <div class=\"col-12 md:col-10\">\r\n\r\n <ng-template #defaultInputOptions let-property=\"property\" let-template=\"template\">\r\n\r\n <ng-template #defaultInputOptionsSingle let-property=\"property\" let-template=\"template\">\r\n <p-dropdown [formControlName]=\"property.name\" [id]=\"property.name\" [options]=\"property.options.inline\" [filterBy]=\"(property.options.promptField || 'prompt') + ',' + (property.options.valueField || 'value')\" [optionValue]=\"property.options.valueField || 'value'\" [readonly]=\"property.readOnly\" [required]=\"property.required || property.options.minItems > 0\" [filter]=\"true\" [autoDisplayFirst]=\"false\" [showClear]=\"!property.required || property.options.minItems <= 0\" (onFilter)=\"onOptionsFiltered(property, $event)\" styleClass=\"w-full\" [filterPlaceholder]=\"property?.options?.link?.href ? 'search for more results' : ''\">\r\n <ng-template let-item pTemplate=\"selectedItem\">\r\n <span [pTooltip]=\"getTooltip(item, [property.options.promptField || 'prompt', property.options.valueField || 'value'])\">{{item[property.options.promptField || 'prompt']}} ({{item[property.options.valueField || 'value']}})</span>\r\n </ng-template>\r\n <ng-template let-item pTemplate=\"item\">\r\n <span [pTooltip]=\"getTooltip(item, [property.options.promptField || 'prompt', property.options.valueField || 'value'])\">{{item[property.options.promptField || 'prompt']}} ({{item[property.options.valueField || 'value']}})</span>\r\n </ng-template>\r\n </p-dropdown>\r\n </ng-template>\r\n <ng-container *ngIf=\"!property.options.maxItems || property.options.maxItems == 1\">\r\n <ng-container *ngTemplateOutlet=\"inputOptionsSingleRef || defaultInputOptionsSingle; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #defaultInputOptionsMultiple let-property=\"property\" let-template=\"template\">\r\n <p-multiSelect [formControlName]=\"property.name\" [id]=\"property.name\" [options]=\"property.options.inline\" [optionLabel]=\"property.options.promptField || 'prompt'\" [optionValue]=\"property.options.valueField || 'value'\" [readonly]=\"property.readOnly\" [selectionLimit]=\"property.options.maxItems\" [required]=\"property.required || property.options.minItems > 0\"></p-multiSelect>\r\n </ng-template>\r\n <ng-container *ngIf=\"property.options.maxItems > 1\">\r\n <ng-container *ngTemplateOutlet=\"inputOptionsMultipleRef || defaultInputOptionsMultiple; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n </ng-template>\r\n <ng-container *ngIf=\"property.options\">\r\n <ng-container *ngTemplateOutlet=\"inputOptionsRef || defaultInputOptions; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n <div *ngIf=\"!property.options\">\r\n <div [ngSwitch]=\"property.type\">\r\n\r\n <ng-template #defaultInputHidden let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"hidden\" [value]=\"property.value\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Hidden\">\r\n <ng-container *ngTemplateOutlet=\"inputHiddenRef || defaultInputHidden; context:{ property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #defaultInputText let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"text\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Text\">\r\n <ng-container *ngTemplateOutlet=\"inputTextRef || defaultInputText; context:{ property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputTextarea let-property=\"property\" let-template=\"template\">\r\n <textarea [formControlName]=\"property.name\" [id]=\"property.name\" pInputTextarea class=\"w-full p-inputtextarea p-inputtext p-component p-element\" [class.p-disabled]=\"property.readOnly\" [cols]=\"property.cols\" [rows]=\"property.rows\"></textarea>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Textarea\">\r\n <ng-container *ngTemplateOutlet=\"inputTextareaRef || defaultInputTextarea; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputSearch let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"search\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Search\">\r\n <ng-container *ngTemplateOutlet=\"inputSearchRef || defaultInputSearch; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputTel let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"tel\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Tel\">\r\n <ng-container *ngTemplateOutlet=\"inputTelRef || defaultInputTel; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputUrl let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"url\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Url\">\r\n <ng-container *ngTemplateOutlet=\"inputUrlRef || defaultInputUrl; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputEmail let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"email\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Email\">\r\n <ng-container *ngTemplateOutlet=\"inputEmailRef || defaultInputEmail; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputPassword let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"password\" pPassword class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Password\">\r\n <ng-container *ngTemplateOutlet=\"inputPasswordRef || defaultInputPassword; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDate let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showWeek]=\"true\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Date\">\r\n <ng-container *ngTemplateOutlet=\"inputDateRef || defaultInputDate; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputMonth let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showWeek]=\"false\" view=\"month\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Month\">\r\n <ng-container *ngTemplateOutlet=\"inputMonthRef || defaultInputMonth; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputWeek let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"week\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Week\">\r\n <ng-container *ngTemplateOutlet=\"inputWeekRef || defaultInputWeek; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputTime let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [timeOnly]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Time\">\r\n <ng-container *ngTemplateOutlet=\"inputTimeRef || defaultInputTime; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDatetimeLocal let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.DatetimeLocal\">\r\n <ng-container *ngTemplateOutlet=\"inputDatetimeLocalRef || defaultInputDatetimeLocal; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputNumber let-property=\"property\" let-template=\"template\">\r\n <p-inputNumber [formControlName]=\"property.name\" [id]=\"property.name\" mode=\"decimal\" [showButtons]=\"!property.readOnly\" class=\"w-full\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-inputNumber>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Number\">\r\n <ng-container *ngTemplateOutlet=\"inputNumberRef || defaultInputNumber; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputRange let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"range\" [min]=\"property.min\" [max]=\"property.max\" [step]=\"property.step\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Range\">\r\n <ng-container *ngTemplateOutlet=\"inputRangeRef || defaultInputRange; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputColor let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"color\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Color\">\r\n <ng-container *ngTemplateOutlet=\"inputColorRef || defaultInputColor; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputBool let-property=\"property\" let-template=\"template\" let-formGroup=\"formGroup\">\r\n <p-checkbox *ngIf=\"property.required\" [binary]=\"true\" [formControl]=\"formGroup.controls[property.name]\" [id]=\"property.name\" [readonly]=\"property.readOnly\"></p-checkbox>\r\n <p-triStateCheckbox *ngIf=\"!property.required\" [formControl]=\"formGroup.controls[property.name]\" [id]=\"property.name\" [readonly]=\"property.readOnly\"></p-triStateCheckbox>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Bool\">\r\n <ng-container *ngTemplateOutlet=\"inputBoolRef || defaultInputBool; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDatetimeOffset let-property=\"property\" let-template=\"template\">\r\n <p-calendar [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.DatetimeOffset\">\r\n <ng-container *ngTemplateOutlet=\"inputDatetimeOffsetRef || defaultInputDatetimeOffset; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDuration let-property=\"property\" let-template=\"template\">\r\n <p-calendar *ngSwitchCase=\"PropertyType.Duration\" [formControlName]=\"property.name\" [id]=\"property.name\" [dateFormat]=\"dateFormat\" [showTime]=\"true\" [timeOnly]=\"true\" [showWeek]=\"false\" [showIcon]=\"true\" styleClass=\"w-full\" [class.p-disabled]=\"property.readOnly\"></p-calendar>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Duration\">\r\n <ng-container *ngTemplateOutlet=\"inputDurationRef || defaultInputDuration; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputImage let-property=\"property\" let-template=\"template\">\r\n <rw-image [formControlName]=\"property.name\" [accept]=\"property.placeholder\"></rw-image>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Image\">\r\n <ng-container *ngTemplateOutlet=\"inputImageRef || defaultInputImage; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputFile let-property=\"property\" let-template=\"template\">\r\n <rw-file [formControlName]=\"property.name\" [fileName]=\"property.name\" [accept]=\"property.placeholder\"></rw-file>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.File\">\r\n <ng-container *ngTemplateOutlet=\"inputFileRef || defaultInputFile; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputObject let-property=\"property\" let-template=\"template\">\r\n <div class=\"flex align-items-center\">\r\n <div class=\"brace\">\r\n </div>\r\n <div class=\"w-full\">\r\n <rw-form [formGroup]=\"(formGroup.controls[property.name] | as : FormGroup)\" [template]=\"property._templates.default\" [apiName]=\"apiName\"></rw-form>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Object\">\r\n <ng-container *ngTemplateOutlet=\"inputObjectRef || defaultInputObject; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputCollection let-property=\"property\" let-template=\"template\">\r\n <div class=\"flex align-items-center\">\r\n <div class=\"brace\">\r\n </div>\r\n <div class=\"w-full\" cdkDropList [cdkDropListData]=\"{ property: property, formArray: (formGroup.controls[property.name] | as : FormArray)}\" (cdkDropListDropped)=\"collectionItemDropped($event)\">\r\n <div *ngFor=\"let template of getCollectionEntryTemplates(property)\" class=\"flex align-items-center\" cdkDrag>\r\n <i class=\"fas fa-grip-lines\" cdkDragHandle></i>\r\n <div class=\"brace\">\r\n </div>\r\n <div class=\"w-full flex justify-content-end\">\r\n <rw-form [formGroup]=\"((formGroup.controls[property.name] | as : FormArray).controls[Number.parseInt(template.title!)] | as : FormGroup)\" [template]=\"template\" [apiName]=\"apiName\" class=\"w-full\"></rw-form>\r\n <button pButton pRipple type=\"button\" icon=\"fas fa-trash\" class=\"p-button-outlined p-button-danger ml-2 mb-3\" (click)=\"deleteItemFromCollection(property, formGroup.controls[property.name], template)\"></button>\r\n </div>\r\n </div>\r\n <div class=\"flex justify-content-end w-full\">\r\n <button pButton pRipple type=\"button\" icon=\"fas fa-plus\" class=\"p-button-outlined p-button-info\" (click)=\"addNewItemToCollection(property, formGroup.controls[property.name])\"></button>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-container *ngSwitchCase=\"PropertyType.Collection\">\r\n <ng-container *ngTemplateOutlet=\"inputCollectionRef || defaultInputCollection; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n\r\n <ng-template #defaultInputDefault let-property=\"property\" let-template=\"template\">\r\n <input [formControlName]=\"property.name\" [id]=\"property.name\" type=\"text\" pInputText class=\"w-full\" [class.p-disabled]=\"property.readOnly\" />\r\n </ng-template>\r\n <ng-container *ngSwitchDefault>\r\n <ng-container *ngTemplateOutlet=\"inputDefaultRef || defaultInputDefault; context: { property: property, template: template, formGroup: formGroup, apiName: apiName }\"></ng-container>\r\n </ng-container>\r\n\r\n </div>\r\n </div>\r\n <val-errors [controlName]=\"property.name || null\">\r\n <ng-template valError=\"required\">The field '{{property.prompt || property.name}}' is required.</ng-template>\r\n <ng-template valError=\"email\">The email must be a valid email address.</ng-template>\r\n <ng-template valError=\"min\" let-error=\"error\">'{{property.prompt || property.name}}' must be equal or greater than or equal to {{ error.min }}.</ng-template>\r\n <ng-template valError=\"max\" let-error=\"error\">'{{property.prompt || property.name}}' must be smaller than or equal to {{ error.max }}.</ng-template>\r\n <ng-template valError=\"minlength\" let-error=\"error\">The length of '{{property.prompt || property.name}}' must be equal or greater than or equal to {{ error.requiredLength }}.</ng-template>\r\n <ng-template valError=\"maxlength\" let-error=\"error\">The length of '{{property.prompt || property.name}}' must be shorter than or equal to {{ error.requiredLength }}.</ng-template>\r\n <ng-template valError=\"pattern\" let-error=\"error\">The value for '{{property.prompt || property.name}}' does not match the pattern {{ error }}.</ng-template>\r\n <ng-template valError=\"remote\" let-error=\"error\">{{ error }}</ng-template>\r\n </val-errors>\r\n </div>\r\n</div>\r\n", styles: [".brace{align-self:stretch;margin:.2rem .5rem;border-left:1px solid rgb(206,212,218);border-top:1px solid rgb(206,212,218);border-bottom:1px solid rgb(206,212,218);width:1rem}.cdk-drag-handle{cursor:move}.cdk-drag-preview{background-color:#ffffffd0;border:2px dashed rgb(206,212,218);cursor:move}.cdk-drag-placeholder{border:2px dashed rgb(206,212,218);margin:-2px}\n"], components: [{ type: i4__namespace$1.Dropdown, selector: "p-dropdown", inputs: ["scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "filterPlaceholder", "filterLocale", "inputId", "selectId", "dataKey", "filterBy", "autofocus", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "virtualScroll", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "disabled", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear"] }, { type: i5__namespace$1.MultiSelect, selector: "p-multiSelect", inputs: ["style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "autoZIndex", "baseZIndex", "filterBy", "virtualScroll", "itemSize", "showTransitionOptions", "hideTransitionOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "scrollHeight", "defaultLabel", "placeholder", "options", "filterValue"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onPanelShow", "onPanelHide"] }, { type: i6__namespace.Calendar, selector: "p-calendar", inputs: ["style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "numberOfMonths", "view", "touchUI", "timeSeparator", "focusTrap", "firstDayOfWeek", "showTransitionOptions", "hideTransitionOptions", "tabindex", "defaultDate", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "locale"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { type: i7__namespace$1.InputNumber, selector: "p-inputNumber", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "disabled"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown"] }, { type: i8__namespace.Checkbox, selector: "p-checkbox", inputs: ["value", "name", "disabled", "binary", "label", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "styleClass", "labelStyleClass", "formControl", "checkboxIcon", "readonly", "required", "trueValue", "falseValue"], outputs: ["onChange"] }, { type: i9__namespace$1.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: RESTWorldImageViewComponent, selector: "rw-image", inputs: ["alt", "accept", "fileName", "maintainAspectRatio", "aspectRatio", "resizeToWidth", "resizeToHeight", "onlyScaleDown", "containWithinAspectRatio", "backgroundColor", "format"] }, { type: RESTWorldFileViewComponent, selector: "rw-file", inputs: ["accept", "fileName"] }, { type: RestworldEditFormComponent, selector: "rw-form", inputs: ["formGroup", "template", "apiName"] }, { type: i12__namespace.ValidationErrorsComponent, selector: "val-errors", inputs: ["control", "controlName", "label"] }], directives: [{ type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i14__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i14__namespace.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i3__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i14__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i3__namespace$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.InputText, selector: "[pInputText]" }, { type: i14__namespace.RangeValueAccessor, selector: "input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]" }, { type: i14__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i17__namespace.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "id", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListAutoScrollDisabled", "cdkDropListOrientation", "cdkDropListLockAxis", "cdkDropListData", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { type: i17__namespace.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragDisabled", "cdkDragStartDelay", "cdkDragLockAxis", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragBoundary", "cdkDragRootElement", "cdkDragPreviewContainer", "cdkDragData", "cdkDragFreeDragPosition"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { type: i17__namespace.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i3__namespace$1.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i12__namespace.ValidationErrorDirective, selector: "ng-template[valError]", inputs: ["valError"] }], pipes: { "as": AsPipe } });
1327
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldEditFormComponent, decorators: [{
1328
- type: i0.Component,
1329
- args: [{
1330
- selector: 'rw-form',
1331
- templateUrl: './restworld-edit-form.component.html',
1332
- styleUrls: ['./restworld-edit-form.component.css']
1333
- }]
1334
- }], ctorParameters: function () { return [{ type: FormService }, { type: i0__namespace.ChangeDetectorRef }, { type: i2__namespace$1.MessageService }, { type: RESTworldClientCollection }]; }, propDecorators: { formGroup: [{
1335
- type: i0.Input
1336
- }], template: [{
1337
- type: i0.Input
1338
- }], apiName: [{
1339
- type: i0.Input
1340
- }], inputOptionsSingleRef: [{
1341
- type: i0.ContentChild,
1342
- args: ['inputOptionsSingle', { static: false }]
1343
- }], inputOptionsMultipleRef: [{
1344
- type: i0.ContentChild,
1345
- args: ['inputOptionsMultiple', { static: false }]
1346
- }], inputOptionsRef: [{
1347
- type: i0.ContentChild,
1348
- args: ['inputOptions', { static: false }]
1349
- }], inputHiddenRef: [{
1350
- type: i0.ContentChild,
1351
- args: ['inputHidden', { static: false }]
1352
- }], inputTextRef: [{
1353
- type: i0.ContentChild,
1354
- args: ['inputText', { static: false }]
1355
- }], inputTextareaRef: [{
1356
- type: i0.ContentChild,
1357
- args: ['inputTextarea', { static: false }]
1358
- }], inputSearchRef: [{
1359
- type: i0.ContentChild,
1360
- args: ['inputSearch', { static: false }]
1361
- }], inputTelRef: [{
1362
- type: i0.ContentChild,
1363
- args: ['inputTel', { static: false }]
1364
- }], inputUrlRef: [{
1365
- type: i0.ContentChild,
1366
- args: ['inputUrl', { static: false }]
1367
- }], inputEmailRef: [{
1368
- type: i0.ContentChild,
1369
- args: ['inputEmail', { static: false }]
1370
- }], inputPasswordRef: [{
1371
- type: i0.ContentChild,
1372
- args: ['inputPassword', { static: false }]
1373
- }], inputDateRef: [{
1374
- type: i0.ContentChild,
1375
- args: ['inputDate', { static: false }]
1376
- }], inputMonthRef: [{
1377
- type: i0.ContentChild,
1378
- args: ['inputMonth', { static: false }]
1379
- }], inputWeekRef: [{
1380
- type: i0.ContentChild,
1381
- args: ['inputWeek', { static: false }]
1382
- }], inputTimeRef: [{
1383
- type: i0.ContentChild,
1384
- args: ['inputTime', { static: false }]
1385
- }], inputDatetimeLocalRef: [{
1386
- type: i0.ContentChild,
1387
- args: ['inputDatetimeLocal', { static: false }]
1388
- }], inputNumberRef: [{
1389
- type: i0.ContentChild,
1390
- args: ['inputNumber', { static: false }]
1391
- }], inputRangeRef: [{
1392
- type: i0.ContentChild,
1393
- args: ['inputRange', { static: false }]
1394
- }], inputColorRef: [{
1395
- type: i0.ContentChild,
1396
- args: ['inputColor', { static: false }]
1397
- }], inputBoolRef: [{
1398
- type: i0.ContentChild,
1399
- args: ['inputBool', { static: false }]
1400
- }], inputDatetimeOffsetRef: [{
1401
- type: i0.ContentChild,
1402
- args: ['inputDatetimeOffset', { static: false }]
1403
- }], inputDurationRef: [{
1404
- type: i0.ContentChild,
1405
- args: ['inputDuration', { static: false }]
1406
- }], inputImageRef: [{
1407
- type: i0.ContentChild,
1408
- args: ['inputImage', { static: false }]
1409
- }], inputFileRef: [{
1410
- type: i0.ContentChild,
1411
- args: ['inputFile', { static: false }]
1412
- }], inputObjectRef: [{
1413
- type: i0.ContentChild,
1414
- args: ['inputObject', { static: false }]
1415
- }], inputCollectionRef: [{
1416
- type: i0.ContentChild,
1417
- args: ['inputCollection', { static: false }]
1418
- }], inputDefaultRef: [{
1419
- type: i0.ContentChild,
1420
- args: ['inputDefault', { static: false }]
1421
- }] } });
1422
-
1423
- var RESTworldEditViewComponent = /** @class */ (function () {
1424
- function RESTworldEditViewComponent(_clients, _confirmationService, _messageService, _location, _router, _formService, valdemortConfig) {
1425
- this._clients = _clients;
1426
- this._confirmationService = _confirmationService;
1427
- this._messageService = _messageService;
1428
- this._location = _location;
1429
- this._router = _router;
1430
- this._formService = _formService;
1431
- this._templates = {};
1432
- this._formTabs = {};
1433
- this.isLoading = false;
1434
- valdemortConfig.errorClasses = 'p-error text-sm';
1435
- }
1436
- Object.defineProperty(RESTworldEditViewComponent.prototype, "PropertyType", {
1437
- get: function () {
1438
- return i1.PropertyType;
1439
- },
1440
- enumerable: false,
1441
- configurable: true
1442
- });
1443
- Object.defineProperty(RESTworldEditViewComponent.prototype, "templates", {
1444
- get: function () {
1445
- return this._templates;
1446
- },
1447
- enumerable: false,
1448
- configurable: true
1449
- });
1450
- Object.defineProperty(RESTworldEditViewComponent.prototype, "isLoadingForTheFirstTime", {
1451
- get: function () {
1452
- return Object.keys(this.templates).length === 0 && this.isLoading;
1453
- },
1454
- enumerable: false,
1455
- configurable: true
1456
- });
1457
- Object.defineProperty(RESTworldEditViewComponent.prototype, "formTabs", {
1458
- get: function () {
1459
- return this._formTabs;
1460
- },
1461
- enumerable: false,
1462
- configurable: true
1463
- });
1464
- Object.defineProperty(RESTworldEditViewComponent.prototype, "apiName", {
1465
- get: function () {
1466
- return this._apiName;
1467
- },
1468
- set: function (value) {
1469
- this._apiName = value;
1470
- this.load();
1471
- },
1472
- enumerable: false,
1473
- configurable: true
1474
- });
1475
- Object.defineProperty(RESTworldEditViewComponent.prototype, "uri", {
1476
- get: function () {
1477
- return this._uri;
1478
- },
1479
- //@Input()
1480
- //public set rel(value: string | undefined) {
1481
- // this._rel = value;
1482
- //}
1483
- //public get rel(): string | undefined {
1484
- // return this._rel;
1485
- //}
1486
- //private _rel?: string;
1487
- set: function (value) {
1488
- this._uri = value;
1489
- this.load();
1490
- },
1491
- enumerable: false,
1492
- configurable: true
1493
- });
1494
- Object.defineProperty(RESTworldEditViewComponent.prototype, "resource", {
1495
- get: function () {
1496
- return this._resource;
1497
- },
1498
- enumerable: false,
1499
- configurable: true
1500
- });
1501
- Object.defineProperty(RESTworldEditViewComponent.prototype, "canSave", {
1502
- get: function () {
1503
- var _a, _b;
1504
- var length = (_b = (_a = this.resource) === null || _a === void 0 ? void 0 : _a._links["save"]) === null || _b === void 0 ? void 0 : _b.length;
1505
- return length !== undefined && length > 0;
1506
- },
1507
- enumerable: false,
1508
- configurable: true
1509
- });
1510
- Object.defineProperty(RESTworldEditViewComponent.prototype, "canDelete", {
1511
- get: function () {
1512
- var _a, _b;
1513
- var length = (_b = (_a = this.resource) === null || _a === void 0 ? void 0 : _a._links["delete"]) === null || _b === void 0 ? void 0 : _b.length;
1514
- return length !== undefined && length > 0;
1515
- },
1516
- enumerable: false,
1517
- configurable: true
1518
- });
1519
- RESTworldEditViewComponent.prototype.canSubmit = function (templateName) {
1520
- var form = this.formTabs[templateName];
1521
- return form && form.valid;
1522
- };
1523
- RESTworldEditViewComponent.prototype.getTooltip = function (resource, keysToExclude) {
1524
- var tooltip = Object.entries(resource)
1525
- .filter(function (_c) {
1526
- var _d = __read(_c, 1), key = _d[0];
1527
- return !(key.startsWith('_') || ['createdAt', 'createdBy', 'lastChangedAt', 'lastChangedBy', 'timestamp'].includes(key) || (keysToExclude === null || keysToExclude === void 0 ? void 0 : keysToExclude.includes(key)));
1528
- })
1529
- .reduce(function (prev, _c, index) {
1530
- var _d = __read(_c, 2), key = _d[0], value = _d[1];
1531
- return "" + prev + (index === 0 ? '' : '\n') + key + ": " + RESTworldEditViewComponent.jsonStringifyWithElipsis(value);
1532
- }, '');
1533
- return tooltip;
1534
- };
1535
- RESTworldEditViewComponent.jsonStringifyWithElipsis = function (value) {
1536
- var maxLength = 200;
1537
- var end = 10;
1538
- var start = maxLength - end - 2;
1539
- var json = JSON.stringify(value);
1540
- var shortened = json.length > maxLength ? json.substring(0, start) + '…' + json.substring(json.length - end) : json;
1541
- return shortened;
1542
- };
1543
- RESTworldEditViewComponent.prototype.getClient = function () {
1544
- if (!this.apiName)
1545
- throw new Error('Cannot get a client, because the apiName is not set.');
1546
- return this._clients.getClient(this.apiName);
1547
- };
1548
- RESTworldEditViewComponent.prototype.submit = function (templateName, template, formValue) {
1549
- return __awaiter(this, void 0, void 0, function () {
1550
- var targetBeforeSave, response, summary, detail, problemDetails, form, _c, _d, _e, key, errorsForKey, path, formControl, responseResource, targetAfterSave, e_1;
1551
- var e_2, _f;
1552
- var _this = this;
1553
- return __generator(this, function (_g) {
1554
- switch (_g.label) {
1555
- case 0:
1556
- this.isLoading = true;
1557
- _g.label = 1;
1558
- case 1:
1559
- _g.trys.push([1, 3, , 4]);
1560
- targetBeforeSave = template.target;
1561
- return [4 /*yield*/, this.getClient().submit(template, formValue)];
1562
- case 2:
1563
- response = _g.sent();
1564
- if (!response.ok) {
1565
- summary = 'Error';
1566
- detail = 'Error while saving the resource.';
1567
- if (ProblemDetails.isProblemDetails(response.body)) {
1568
- problemDetails = response.body;
1569
- summary = problemDetails.title || summary;
1570
- detail = problemDetails.detail || detail;
1571
- // display validation errors
1572
- if (problemDetails['errors']) {
1573
- form = this.formTabs[templateName];
1574
- try {
1575
- for (_c = __values(Object.entries(problemDetails['errors'])), _d = _c.next(); !_d.done; _d = _c.next()) {
1576
- _e = __read(_d.value, 2), key = _e[0], errorsForKey = _e[1];
1577
- path = key.split(/\.|\[/).map(function (e) { return e.replace("]", ""); });
1578
- formControl = path.reduce(function (control, pathElement) { return (control instanceof i14.FormGroup ? control.controls[pathElement] : control) || control; }, form);
1579
- formControl.setErrors({ remote: errorsForKey });
1580
- }
1581
- }
1582
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1583
- finally {
1584
- try {
1585
- if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
1586
- }
1587
- finally { if (e_2) throw e_2.error; }
1588
- }
1589
- }
1590
- }
1591
- this._messageService.add({ severity: 'error', summary: summary, detail: detail, data: response, life: 10000 });
1592
- }
1593
- else {
1594
- responseResource = response.body;
1595
- targetAfterSave = responseResource._templates[templateName].target;
1596
- setTimeout(function () { return _this._messageService.add({ severity: 'success', summary: 'Saved', detail: 'The resource has been saved.' }); }, 100);
1597
- if (targetBeforeSave !== targetAfterSave) {
1598
- this._router.navigate(['/edit', this.apiName, responseResource._links.self[0].href]);
1599
- }
1600
- }
1601
- return [3 /*break*/, 4];
1602
- case 3:
1603
- e_1 = _g.sent();
1604
- this._messageService.add({ severity: 'error', summary: 'Error', detail: "An unknown error occurred. " + JSON.stringify(e_1), life: 10000 });
1605
- console.log(e_1);
1606
- return [3 /*break*/, 4];
1607
- case 4:
1608
- this.isLoading = false;
1609
- return [2 /*return*/];
1610
- }
1611
- });
1612
- });
1613
- };
1614
- RESTworldEditViewComponent.prototype.showDeleteConfirmatioModal = function () {
1615
- var _this = this;
1616
- this._confirmationService.confirm({
1617
- message: 'Do you really want to delete this resource?',
1618
- header: 'Confirm delete',
1619
- icon: 'far fa-trash-alt',
1620
- accept: function () { return _this.delete(); }
1621
- });
1622
- };
1623
- RESTworldEditViewComponent.prototype.delete = function () {
1624
- return __awaiter(this, void 0, void 0, function () {
1625
- var _this = this;
1626
- return __generator(this, function (_c) {
1627
- switch (_c.label) {
1628
- case 0:
1629
- if (!this.apiName || !this.uri || !this.resource)
1630
- return [2 /*return*/];
1631
- Object.assign(this.resource, this.formTabs.value);
1632
- return [4 /*yield*/, this.getClient().delete(this.resource)];
1633
- case 1:
1634
- _c.sent();
1635
- setTimeout(function () { return _this._messageService.add({ severity: 'success', summary: 'Deleted', detail: 'The resource has been deleted.' }); }, 100);
1636
- this._location.back();
1637
- return [2 /*return*/];
1638
- }
1639
- });
1640
- });
1641
- };
1642
- RESTworldEditViewComponent.prototype.load = function () {
1643
- return __awaiter(this, void 0, void 0, function () {
1644
- var response, _c;
1645
- return __generator(this, function (_d) {
1646
- switch (_d.label) {
1647
- case 0:
1648
- if (!this.apiName || !this.uri)
1649
- return [2 /*return*/];
1650
- this.isLoading = true;
1651
- return [4 /*yield*/, this.getClient().getSingle(this.uri)];
1652
- case 1:
1653
- response = _d.sent();
1654
- if (!(!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body)) return [3 /*break*/, 2];
1655
- this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
1656
- return [3 /*break*/, 4];
1657
- case 2:
1658
- this._resource = response.body;
1659
- _c = this;
1660
- return [4 /*yield*/, this.getAllTemplates(this._resource)];
1661
- case 3:
1662
- _c._templates = _d.sent();
1663
- this._formTabs = this._formService.createFormGroupsFromTemplates(this._templates);
1664
- _d.label = 4;
1665
- case 4:
1666
- this.isLoading = false;
1667
- return [2 /*return*/];
1668
- }
1669
- });
1670
- });
1671
- };
1672
- RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementsForTemplates = function (templates) {
1673
- return __awaiter(this, void 0, void 0, function () {
1674
- var _this = this;
1675
- return __generator(this, function (_c) {
1676
- return [2 /*return*/, Promise.all(Object.values(templates)
1677
- .map(function (template) { return _this.setInitialSelectedOptionsElementsForTemplate(template); }))];
1678
- });
1679
- });
1680
- };
1681
- RESTworldEditViewComponent.prototype.imageChanged = function (formControl, event) {
1682
- var file = event.files[0];
1683
- console.log(file);
1684
- var reader = new FileReader();
1685
- reader.onload = function () {
1686
- var uri = reader.result;
1687
- console.log(uri);
1688
- formControl.setValue(uri);
1689
- };
1690
- reader.readAsDataURL(file);
1691
- };
1692
- RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementsForTemplate = function (template) {
1693
- return __awaiter(this, void 0, void 0, function () {
1694
- var _this = this;
1695
- return __generator(this, function (_c) {
1696
- return [2 /*return*/, Promise.all(template.properties
1697
- .filter(function (property) { var _a, _b; return (_b = (_a = property === null || property === void 0 ? void 0 : property.options) === null || _a === void 0 ? void 0 : _a.link) === null || _b === void 0 ? void 0 : _b.href; })
1698
- .map(function (property) { return _this.setInitialSelectedOptionsElementForProperty(property); }))];
1699
- });
1700
- });
1701
- };
1702
- RESTworldEditViewComponent.prototype.setInitialSelectedOptionsElementForProperty = function (property) {
1703
- var _a;
1704
- return __awaiter(this, void 0, void 0, function () {
1705
- var options, templatedUri, filter, response, message, items;
1706
- return __generator(this, function (_c) {
1707
- switch (_c.label) {
1708
- case 0:
1709
- options = property === null || property === void 0 ? void 0 : property.options;
1710
- if (!((_a = options === null || options === void 0 ? void 0 : options.link) === null || _a === void 0 ? void 0 : _a.href))
1711
- return [2 /*return*/];
1712
- templatedUri = options.link.href;
1713
- filter = options.valueField + " eq " + property.value;
1714
- return [4 /*yield*/, this.getClient().getListByUri(templatedUri, { $filter: filter, $top: 10 })];
1715
- case 1:
1716
- response = _c.sent();
1717
- if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1718
- message = "An error occurred while getting the filtered items.";
1719
- this._messageService.add({ severity: 'error', summary: 'Error', detail: message, data: response });
1720
- return [2 /*return*/];
1721
- }
1722
- items = response.body._embedded.items;
1723
- options.inline = items;
1724
- return [2 /*return*/];
1725
- }
1726
- });
1727
- });
1728
- };
1729
- RESTworldEditViewComponent.prototype.getAllTemplates = function (resource) {
1730
- return __awaiter(this, void 0, void 0, function () {
1731
- var formResponses, failedResponses, failedResponses_1, failedResponses_1_1, response, formTemplates;
1732
- var e_3, _c;
1733
- return __generator(this, function (_d) {
1734
- switch (_d.label) {
1735
- case 0: return [4 /*yield*/, this.getClient().getAllForms(resource)];
1736
- case 1:
1737
- formResponses = _d.sent();
1738
- failedResponses = formResponses.filter(function (response) { return !response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body; });
1739
- if (failedResponses.length !== 0) {
1740
- try {
1741
- for (failedResponses_1 = __values(failedResponses), failedResponses_1_1 = failedResponses_1.next(); !failedResponses_1_1.done; failedResponses_1_1 = failedResponses_1.next()) {
1742
- response = failedResponses_1_1.value;
1743
- this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resource from the API.', data: response });
1744
- }
1745
- }
1746
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1747
- finally {
1748
- try {
1749
- if (failedResponses_1_1 && !failedResponses_1_1.done && (_c = failedResponses_1.return)) _c.call(failedResponses_1);
1750
- }
1751
- finally { if (e_3) throw e_3.error; }
1752
- }
1753
- return [2 /*return*/, Promise.resolve({})];
1754
- }
1755
- formTemplates = Object.assign.apply(Object, __spreadArray([{}], __read(formResponses.map(function (response) { return response.body._templates; }))));
1756
- return [4 /*yield*/, this.setInitialSelectedOptionsElementsForTemplates(formTemplates)];
1757
- case 2:
1758
- _d.sent();
1759
- return [2 /*return*/, formTemplates];
1760
- }
1761
- });
1762
- });
1763
- };
1764
- return RESTworldEditViewComponent;
1765
- }());
1766
- RESTworldEditViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldEditViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2__namespace$1.ConfirmationService }, { token: i2__namespace$1.MessageService }, { token: i3__namespace$1.Location }, { token: i4__namespace$2.Router }, { token: FormService }, { token: i12__namespace.ValdemortConfig }], target: i0__namespace.ɵɵFactoryTarget.Component });
1767
- RESTworldEditViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTworldEditViewComponent, selector: "rw-edit", inputs: { apiName: "apiName", uri: "uri" }, queries: [{ propertyName: "extraTabsRef", first: true, predicate: ["extraTabs"], descendants: true }, { propertyName: "buttonsRef", first: true, predicate: ["buttons"], descendants: true }, { propertyName: "inputOptionsSingleRef", first: true, predicate: ["inputOptionsSingle"], descendants: true }, { propertyName: "inputOptionsMultipleRef", first: true, predicate: ["inputOptionsMultiple"], descendants: true }, { propertyName: "inputOptionsRef", first: true, predicate: ["inputOptions"], descendants: true }, { propertyName: "inputHiddenRef", first: true, predicate: ["inputHidden"], descendants: true }, { propertyName: "inputTextRef", first: true, predicate: ["inputText"], descendants: true }, { propertyName: "inputTextareaRef", first: true, predicate: ["inputTextarea"], descendants: true }, { propertyName: "inputSearchRef", first: true, predicate: ["inputSearch"], descendants: true }, { propertyName: "inputTelRef", first: true, predicate: ["inputTel"], descendants: true }, { propertyName: "inputUrlRef", first: true, predicate: ["inputUrl"], descendants: true }, { propertyName: "inputEmailRef", first: true, predicate: ["inputEmail"], descendants: true }, { propertyName: "inputPasswordRef", first: true, predicate: ["inputPassword"], descendants: true }, { propertyName: "inputDateRef", first: true, predicate: ["inputDate"], descendants: true }, { propertyName: "inputMonthRef", first: true, predicate: ["inputMonth"], descendants: true }, { propertyName: "inputWeekRef", first: true, predicate: ["inputWeek"], descendants: true }, { propertyName: "inputTimeRef", first: true, predicate: ["inputTime"], descendants: true }, { propertyName: "inputDatetimeLocalRef", first: true, predicate: ["inputDatetimeLocal"], descendants: true }, { propertyName: "inputNumberRef", first: true, predicate: ["inputNumber"], descendants: true }, { propertyName: "inputRangeRef", first: true, predicate: ["inputRange"], descendants: true }, { propertyName: "inputColorRef", first: true, predicate: ["inputColor"], descendants: true }, { propertyName: "inputBoolRef", first: true, predicate: ["inputBool"], descendants: true }, { propertyName: "inputDatetimeOffsetRef", first: true, predicate: ["inputDatetimeOffset"], descendants: true }, { propertyName: "inputDurationRef", first: true, predicate: ["inputDuration"], descendants: true }, { propertyName: "inputImageRef", first: true, predicate: ["inputImage"], descendants: true }, { propertyName: "inputFileRef", first: true, predicate: ["inputFile"], descendants: true }, { propertyName: "inputDefaultRef", first: true, predicate: ["inputDefault"], descendants: true }], ngImport: i0__namespace, template: "<div class=\"grid\">\r\n <div class=\"col\">\r\n <h1>Edit resource</h1>\r\n </div>\r\n</div>\r\n\r\n<p-tabView>\r\n\r\n <p-tabPanel *ngIf=\"isLoadingForTheFirstTime\" header=\"Loading\">\r\n <div *ngFor=\"let i of [1, 2, 3, 4, 5]\" class=\"grid field\">\r\n <p-skeleton class=\"col-12 mb-2 md:col-2 md:mb-0\" height=\"39px\"></p-skeleton>\r\n <div class=\"col-12 md:col-10\">\r\n <p-skeleton class=\"w-full\" height=\"39px\"></p-skeleton>\r\n </div>\r\n </div>\r\n <div class=\"grid\">\r\n <div class=\"col\">\r\n <div class=\"flex justify-content-end w-full\">\r\n <p-skeleton width=\"120px\" height=\"39px\" class=\"mx-2\"></p-skeleton>\r\n <p-skeleton width=\"120px\" height=\"39px\" class=\"mx-2\"></p-skeleton>\r\n <p-skeleton width=\"120px\" height=\"39px\" class=\"mx-2\"></p-skeleton>\r\n </div>\r\n </div>\r\n </div>\r\n </p-tabPanel>\r\n\r\n <p-tabPanel *ngFor=\"let item of templates | keyvalue\" [header]=\"item.value.title || item.key\" [disabled]=\"isLoading\">\r\n <form [formGroup]=\"formTabs[item.key]\" (ngSubmit)=\"submit(item.key, item.value, formTabs[item.key].value)\">\r\n <div class=\"blockable-container\">\r\n <div class=\"blockable-element\">\r\n <rw-form [formGroup]=\"formTabs[item.key]\" [template]=\"item.value\" [apiName]=\"apiName\"></rw-form>\r\n </div>\r\n <div class=\"blockable-overlay\" *ngIf=\"isLoading\">\r\n <p-progressSpinner></p-progressSpinner>\r\n </div>\r\n </div>\r\n\r\n <div class=\"grid\">\r\n <div class=\"col\">\r\n <div class=\"flex justify-content-end w-full\">\r\n <ng-template #defaultButtons>\r\n <button pButton pRipple type=\"submit\" label=\"Save\" icon=\"far fa-save\" class=\"mx-2 p-button-success\" [disabled]=\"isLoading || !canSubmit(item.key)\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Reload\" icon=\"fas fa-redo\" class=\"mx-2 p-button-info\" (click)=\"load()\" [disabled]=\"isLoading\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Delete\" icon=\"far fa-trash-alt\" class=\"ml-2 p-button-danger\" (click)=\"showDeleteConfirmatioModal()\" [disabled]=\"!resource || isLoading || !canDelete\"></button>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"buttonsRef || defaultButtons\"></ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n </p-tabPanel>\r\n\r\n <ng-template #defaultExtraTabs>\r\n </ng-template>\r\n <ng-container *ngTemplateOutlet=\"extraTabsRef || defaultExtraTabs\"></ng-container>\r\n\r\n</p-tabView>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: ["::ng-deep .p-tooltip{max-width:-webkit-fit-content!important;max-width:-moz-fit-content!important;max-width:fit-content!important}.blockable-container{display:grid;place-items:center;grid-template-areas:\"inner\"}.blockable-element{grid-area:inner;width:100%}.blockable-overlay{grid-area:inner;height:100%;width:100%;background-color:#0006;display:flex;align-items:center;justify-content:center;z-index:1}.field.grid>label.hasChildren{border-right:1px solid rgba(0,0,0,.1)}\n"], components: [{ type: i7__namespace$2.TabView, selector: "p-tabView", inputs: ["orientation", "style", "styleClass", "controlClose", "scrollable", "activeIndex"], outputs: ["onChange", "onClose", "activeIndexChange"] }, { type: i7__namespace$2.TabPanel, selector: "p-tabPanel", inputs: ["closable", "headerStyle", "headerStyleClass", "cache", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "selected", "disabled", "header", "leftIcon", "rightIcon"] }, { type: i8__namespace$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { type: RestworldEditFormComponent, selector: "rw-form", inputs: ["formGroup", "template", "apiName"] }, { type: i10__namespace$1.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { type: i11__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12__namespace$1.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i14__namespace.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i14__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i14__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i3__namespace$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], pipes: { "keyvalue": i3__namespace$1.KeyValuePipe } });
1768
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldEditViewComponent, decorators: [{
1769
- type: i0.Component,
1770
- args: [{
1771
- selector: 'rw-edit',
1772
- templateUrl: './restworld-edit-view.component.html',
1773
- styleUrls: ['./restworld-edit-view.component.css']
1774
- }]
1775
- }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace$1.ConfirmationService }, { type: i2__namespace$1.MessageService }, { type: i3__namespace$1.Location }, { type: i4__namespace$2.Router }, { type: FormService }, { type: i12__namespace.ValdemortConfig }]; }, propDecorators: { apiName: [{
1776
- type: i0.Input
1777
- }], uri: [{
1778
- type: i0.Input
1779
- }], extraTabsRef: [{
1780
- type: i0.ContentChild,
1781
- args: ['extraTabs', { static: false }]
1782
- }], buttonsRef: [{
1783
- type: i0.ContentChild,
1784
- args: ['buttons', { static: false }]
1785
- }], inputOptionsSingleRef: [{
1786
- type: i0.ContentChild,
1787
- args: ['inputOptionsSingle', { static: false }]
1788
- }], inputOptionsMultipleRef: [{
1789
- type: i0.ContentChild,
1790
- args: ['inputOptionsMultiple', { static: false }]
1791
- }], inputOptionsRef: [{
1792
- type: i0.ContentChild,
1793
- args: ['inputOptions', { static: false }]
1794
- }], inputHiddenRef: [{
1795
- type: i0.ContentChild,
1796
- args: ['inputHidden', { static: false }]
1797
- }], inputTextRef: [{
1798
- type: i0.ContentChild,
1799
- args: ['inputText', { static: false }]
1800
- }], inputTextareaRef: [{
1801
- type: i0.ContentChild,
1802
- args: ['inputTextarea', { static: false }]
1803
- }], inputSearchRef: [{
1804
- type: i0.ContentChild,
1805
- args: ['inputSearch', { static: false }]
1806
- }], inputTelRef: [{
1807
- type: i0.ContentChild,
1808
- args: ['inputTel', { static: false }]
1809
- }], inputUrlRef: [{
1810
- type: i0.ContentChild,
1811
- args: ['inputUrl', { static: false }]
1812
- }], inputEmailRef: [{
1813
- type: i0.ContentChild,
1814
- args: ['inputEmail', { static: false }]
1815
- }], inputPasswordRef: [{
1816
- type: i0.ContentChild,
1817
- args: ['inputPassword', { static: false }]
1818
- }], inputDateRef: [{
1819
- type: i0.ContentChild,
1820
- args: ['inputDate', { static: false }]
1821
- }], inputMonthRef: [{
1822
- type: i0.ContentChild,
1823
- args: ['inputMonth', { static: false }]
1824
- }], inputWeekRef: [{
1825
- type: i0.ContentChild,
1826
- args: ['inputWeek', { static: false }]
1827
- }], inputTimeRef: [{
1828
- type: i0.ContentChild,
1829
- args: ['inputTime', { static: false }]
1830
- }], inputDatetimeLocalRef: [{
1831
- type: i0.ContentChild,
1832
- args: ['inputDatetimeLocal', { static: false }]
1833
- }], inputNumberRef: [{
1834
- type: i0.ContentChild,
1835
- args: ['inputNumber', { static: false }]
1836
- }], inputRangeRef: [{
1837
- type: i0.ContentChild,
1838
- args: ['inputRange', { static: false }]
1839
- }], inputColorRef: [{
1840
- type: i0.ContentChild,
1841
- args: ['inputColor', { static: false }]
1842
- }], inputBoolRef: [{
1843
- type: i0.ContentChild,
1844
- args: ['inputBool', { static: false }]
1845
- }], inputDatetimeOffsetRef: [{
1846
- type: i0.ContentChild,
1847
- args: ['inputDatetimeOffset', { static: false }]
1848
- }], inputDurationRef: [{
1849
- type: i0.ContentChild,
1850
- args: ['inputDuration', { static: false }]
1851
- }], inputImageRef: [{
1852
- type: i0.ContentChild,
1853
- args: ['inputImage', { static: false }]
1854
- }], inputFileRef: [{
1855
- type: i0.ContentChild,
1856
- args: ['inputFile', { static: false }]
1857
- }], inputDefaultRef: [{
1858
- type: i0.ContentChild,
1859
- args: ['inputDefault', { static: false }]
1860
- }] } });
1861
-
1862
- exports.ColumnType = void 0;
1863
- (function (ColumnType) {
1864
- ColumnType["text"] = "text";
1865
- ColumnType["numeric"] = "numeric";
1866
- ColumnType["boolean"] = "boolean";
1867
- ColumnType["date"] = "date";
1868
- })(exports.ColumnType || (exports.ColumnType = {}));
1869
- var RESTworldListViewComponent = /** @class */ (function () {
1870
- function RESTworldListViewComponent(_clients, _confirmationService, _messageService, avatarGenerator) {
1871
- this._clients = _clients;
1872
- this._confirmationService = _confirmationService;
1873
- this._messageService = _messageService;
1874
- this.avatarGenerator = avatarGenerator;
1875
- this._columns = [];
1876
- this._editLink = '/edit';
1877
- this.isLoading = false;
1878
- this._totalRecords = 0;
1879
- this.rowsPerPage = [10, 25, 50];
1880
- this._lastEvent = {
1881
- rows: this.rowsPerPage[0]
1882
- };
1883
- }
1884
- Object.defineProperty(RESTworldListViewComponent.prototype, "columns", {
1885
- get: function () {
1886
- return this._columns;
1887
- },
1888
- enumerable: false,
1889
- configurable: true
1890
- });
1891
- Object.defineProperty(RESTworldListViewComponent.prototype, "editLink", {
1892
- get: function () {
1893
- return this._editLink;
1894
- },
1895
- set: function (value) {
1896
- if (value)
1897
- this._editLink = value;
1898
- },
1899
- enumerable: false,
1900
- configurable: true
1901
- });
1902
- Object.defineProperty(RESTworldListViewComponent.prototype, "apiName", {
1903
- get: function () {
1904
- return this._apiName;
1905
- },
1906
- set: function (value) {
1907
- this._apiName = value;
1908
- if (this.apiName && this.rel && this._lastEvent)
1909
- this.load(this._lastEvent);
1910
- },
1911
- enumerable: false,
1912
- configurable: true
1913
- });
1914
- Object.defineProperty(RESTworldListViewComponent.prototype, "rel", {
1915
- get: function () {
1916
- return this._rel;
1917
- },
1918
- set: function (value) {
1919
- this._rel = value;
1920
- if (this.apiName && this.rel && this._lastEvent)
1921
- this.load(this._lastEvent);
1922
- },
1923
- enumerable: false,
1924
- configurable: true
1925
- });
1926
- Object.defineProperty(RESTworldListViewComponent.prototype, "value", {
1927
- get: function () {
1928
- var _a, _b;
1929
- return ((_b = (_a = this.resource) === null || _a === void 0 ? void 0 : _a._embedded) === null || _b === void 0 ? void 0 : _b.items) || [];
1930
- },
1931
- enumerable: false,
1932
- configurable: true
1933
- });
1934
- Object.defineProperty(RESTworldListViewComponent.prototype, "rows", {
1935
- get: function () {
1936
- var _a;
1937
- return ((_a = this._lastEvent) === null || _a === void 0 ? void 0 : _a.rows) || 0;
1938
- },
1939
- enumerable: false,
1940
- configurable: true
1941
- });
1942
- Object.defineProperty(RESTworldListViewComponent.prototype, "totalRecords", {
1943
- get: function () {
1944
- return this._totalRecords;
1945
- },
1946
- set: function (value) {
1947
- this._totalRecords = value || 0;
1948
- },
1949
- enumerable: false,
1950
- configurable: true
1951
- });
1952
- Object.defineProperty(RESTworldListViewComponent.prototype, "sortOrder", {
1953
- get: function () {
1954
- return this._lastEvent.sortOrder || 0;
1955
- },
1956
- enumerable: false,
1957
- configurable: true
1958
- });
1959
- Object.defineProperty(RESTworldListViewComponent.prototype, "newHref", {
1960
- get: function () {
1961
- var _a, _b;
1962
- return (_b = (_a = this.resource) === null || _a === void 0 ? void 0 : _a.findLink('new')) === null || _b === void 0 ? void 0 : _b.href;
1963
- },
1964
- enumerable: false,
1965
- configurable: true
1966
- });
1967
- Object.defineProperty(RESTworldListViewComponent.prototype, "dateFormat", {
1968
- get: function () {
1969
- return RESTworldListViewComponent._dateFormat;
1970
- },
1971
- enumerable: false,
1972
- configurable: true
1973
- });
1974
- RESTworldListViewComponent.prototype.getClient = function () {
1975
- if (!this.apiName)
1976
- throw new Error('Cannot get a client, because the apiName is not set.');
1977
- return this._clients.getClient(this.apiName);
1978
- };
1979
- RESTworldListViewComponent.prototype.load = function (event) {
1980
- return __awaiter(this, void 0, void 0, function () {
1981
- var parameters, response;
1982
- return __generator(this, function (_c) {
1983
- switch (_c.label) {
1984
- case 0:
1985
- if (!this.apiName || !this.rel)
1986
- return [2 /*return*/];
1987
- this.isLoading = true;
1988
- this._lastEvent = event;
1989
- parameters = this.createParametersFromEvent(event);
1990
- return [4 /*yield*/, this.getClient().getList(this.rel, parameters)];
1991
- case 1:
1992
- response = _c.sent();
1993
- if (!response.ok || ProblemDetails.isProblemDetails(response.body) || !response.body) {
1994
- this._messageService.add({ severity: 'error', summary: 'Error', detail: 'Error while loading the resources from the API.', data: response });
1995
- }
1996
- else if (response.body) {
1997
- this.resource = response.body;
1998
- this.totalRecords = this.resource.totalPages && parameters.$top ? this.resource.totalPages * parameters.$top : undefined;
1999
- this._columns = this.createColumns();
2000
- }
2001
- this.isLoading = false;
2002
- return [2 /*return*/];
2003
- }
2004
- });
2005
- });
2006
- };
2007
- RESTworldListViewComponent.prototype.showDeleteConfirmatioModal = function (resource) {
2008
- var _this = this;
2009
- this._confirmationService.confirm({
2010
- message: 'Do you really want to delete this resource?',
2011
- header: 'Confirm delete',
2012
- icon: 'far fa-trash-alt',
2013
- accept: function () { return _this.delete(resource); }
2014
- });
2015
- };
2016
- RESTworldListViewComponent.prototype.delete = function (resource) {
2017
- return __awaiter(this, void 0, void 0, function () {
2018
- return __generator(this, function (_c) {
2019
- switch (_c.label) {
2020
- case 0:
2021
- if (!this.apiName || !this.rel)
2022
- return [2 /*return*/];
2023
- return [4 /*yield*/, this.getClient().delete(resource)];
2024
- case 1:
2025
- _c.sent();
2026
- this._messageService.add({ severity: 'success', summary: 'Deleted', detail: 'The resource has been deleted.' });
2027
- this.load(this._lastEvent);
2028
- return [2 /*return*/];
2029
- }
2030
- });
2031
- });
2032
- };
2033
- RESTworldListViewComponent.prototype.createColumns = function () {
2034
- var e_1, _c, e_2, _d;
2035
- if (this.value.length === 0)
2036
- return this.columns;
2037
- // Get all distinct properties from all rows
2038
- // We look at all rows to eliminate possible undefined values
2039
- var rowsWithProperties = this.value
2040
- .map(function (resource) { return Object.entries(resource)
2041
- .filter(function (p) { return p[0] !== '_links' &&
2042
- p[0] !== '_embedded' &&
2043
- p[0] !== 'id' &&
2044
- p[0] !== 'timestamp'; }); });
2045
- var distinctProperties = rowsWithProperties[0];
2046
- try {
2047
- for (var rowsWithProperties_1 = __values(rowsWithProperties), rowsWithProperties_1_1 = rowsWithProperties_1.next(); !rowsWithProperties_1_1.done; rowsWithProperties_1_1 = rowsWithProperties_1.next()) {
2048
- var propertiesOfRow = rowsWithProperties_1_1.value;
2049
- var _loop_1 = function (property) {
2050
- var propertyName = property[0];
2051
- var propertyValue = property[1];
2052
- var alreadyFoundPropertyWithSameName = distinctProperties.find(function (p) { return p[0] === propertyName; });
2053
- if (!alreadyFoundPropertyWithSameName) // Add new property
2054
- distinctProperties.push(property);
2055
- else if (!alreadyFoundPropertyWithSameName[1] && propertyValue) // Use defined value instead of existing undefined value
2056
- alreadyFoundPropertyWithSameName[1] = propertyValue;
2057
- };
2058
- try {
2059
- for (var propertiesOfRow_1 = (e_2 = void 0, __values(propertiesOfRow)), propertiesOfRow_1_1 = propertiesOfRow_1.next(); !propertiesOfRow_1_1.done; propertiesOfRow_1_1 = propertiesOfRow_1.next()) {
2060
- var property = propertiesOfRow_1_1.value;
2061
- _loop_1(property);
2062
- }
2063
- }
2064
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2065
- finally {
2066
- try {
2067
- if (propertiesOfRow_1_1 && !propertiesOfRow_1_1.done && (_d = propertiesOfRow_1.return)) _d.call(propertiesOfRow_1);
2068
- }
2069
- finally { if (e_2) throw e_2.error; }
2070
- }
2071
- }
2072
- }
2073
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2074
- finally {
2075
- try {
2076
- if (rowsWithProperties_1_1 && !rowsWithProperties_1_1.done && (_c = rowsWithProperties_1.return)) _c.call(rowsWithProperties_1);
2077
- }
2078
- finally { if (e_1) throw e_1.error; }
2079
- }
2080
- // Check if the rows are entities with change tracking
2081
- var withoutChangeTrackingProperties = distinctProperties.filter(function (p) { return p[0] !== 'createdAt' &&
2082
- p[0] !== 'createdBy' &&
2083
- p[0] !== 'lastChangedAt' &&
2084
- p[0] !== 'lastChangedBy'; });
2085
- var hasChangeTrackingProperties = withoutChangeTrackingProperties.length < distinctProperties.length;
2086
- // First the id, then all other properties
2087
- var sortedProperties = __spreadArray([
2088
- ['id', 0]
2089
- ], __read(withoutChangeTrackingProperties));
2090
- // And change tracking properties at the end
2091
- if (hasChangeTrackingProperties) {
2092
- sortedProperties.push(['createdAt', new Date()]);
2093
- sortedProperties.push(['createdBy', '']);
2094
- sortedProperties.push(['lastChangedAt', new Date()]);
2095
- sortedProperties.push(['lastChangedBy', '']);
2096
- }
2097
- var columns = sortedProperties
2098
- .map(function (p) { return ({
2099
- header: RESTworldListViewComponent.toTitleCase(p[0]),
2100
- field: p[0],
2101
- type: RESTworldListViewComponent.getColumnType(p[1]),
2102
- }); });
2103
- return columns;
2104
- };
2105
- RESTworldListViewComponent.getColumnType = function (value) {
2106
- if (value === null || value === undefined)
2107
- return exports.ColumnType.text;
2108
- if (___namespace.isNumber(value))
2109
- return exports.ColumnType.numeric;
2110
- if (___namespace.isDate(value))
2111
- return exports.ColumnType.date;
2112
- if (___namespace.isString(value))
2113
- return exports.ColumnType.text;
2114
- if (___namespace.isBoolean(value))
2115
- return exports.ColumnType.boolean;
2116
- return exports.ColumnType.text;
2117
- };
2118
- RESTworldListViewComponent.toTitleCase = function (anyCase) {
2119
- return anyCase
2120
- .replace(/(_)+/g, ' ') // underscore to whitespace
2121
- .replace(/([a-z])([A-Z][a-z])/g, "$1 $2") // insert space before each new word if there is none
2122
- .replace(/([A-Z][a-z])([A-Z])/g, "$1 $2") // insert space after each word if there is none
2123
- .replace(/([a-z])([A-Z]+[a-z])/g, "$1 $2") // insert space after single letter word if there is none
2124
- .replace(/([A-Z]+)([A-Z][a-z][a-z])/g, "$1 $2") // insert space before single letter word if there is none
2125
- .replace(/([a-z]+)([A-Z0-9]+)/g, "$1 $2") // insert space after numbers
2126
- .replace(/^./, function (match) { return match.toUpperCase(); }); // change first letter to be upper case
2127
- };
2128
- RESTworldListViewComponent.prototype.createParametersFromEvent = function (event) {
2129
- var oDataParameters = {
2130
- $filter: this.createFilterFromEvent(event),
2131
- $orderby: RESTworldListViewComponent.createOrderByFromEvent(event),
2132
- $top: RESTworldListViewComponent.createTopFromEvent(event),
2133
- $skip: RESTworldListViewComponent.createSkipFromEvent(event)
2134
- };
2135
- return oDataParameters;
2136
- };
2137
- RESTworldListViewComponent.createSkipFromEvent = function (event) {
2138
- return event.first;
2139
- };
2140
- RESTworldListViewComponent.createTopFromEvent = function (event) {
2141
- return event.rows;
2142
- };
2143
- RESTworldListViewComponent.createOrderByFromEvent = function (event) {
2144
- if (event.sortField) {
2145
- var order = !event.sortOrder || event.sortOrder > 0 ? 'asc' : 'desc';
2146
- return event.sortField + " " + order;
2147
- }
2148
- return undefined;
2149
- };
2150
- RESTworldListViewComponent.prototype.createFilterFromEvent = function (event) {
2151
- var _this = this;
2152
- if (!event.filters)
2153
- return undefined;
2154
- var filter = Object.entries(event.filters)
2155
- // The type definition is wrong, event.filters has values of type FilterMetadata[] and not FilterMetadata.
2156
- .map(function (_c) {
2157
- var _d = __read(_c, 2), property = _d[0], filter = _d[1];
2158
- return ({ property: property, filters: filter });
2159
- })
2160
- .map(function (f) { return _this.createFilterForPropertyArray(f.property, f.filters); })
2161
- .filter(function (f) { return !!f; })
2162
- .join(' and ');
2163
- if (filter === '')
2164
- return undefined;
2165
- return "(" + filter + ")";
2166
- };
2167
- RESTworldListViewComponent.prototype.createFilterForPropertyArray = function (property, filters) {
2168
- var _this = this;
2169
- var filter = filters
2170
- .map(function (f) { return _this.createFilterForProperty(property, f); })
2171
- .filter(function (f) { return !!f; })
2172
- .join(" " + filters[0].operator + " ");
2173
- if (filter === '')
2174
- return undefined;
2175
- return "(" + filter + ")";
2176
- };
2177
- RESTworldListViewComponent.prototype.createFilterForProperty = function (property, filter) {
2178
- if (!filter.value)
2179
- return undefined;
2180
- var oDataOperator = RESTworldListViewComponent.createODataOperator(filter.matchMode);
2181
- var comparisonValue = this.createComparisonValue(property, filter.value);
2182
- switch (oDataOperator) {
2183
- case 'contains':
2184
- case 'not contains':
2185
- case 'startswith':
2186
- case 'endswith':
2187
- return oDataOperator + "(" + property + ", " + comparisonValue + ")";
2188
- default:
2189
- return property + " " + oDataOperator + " " + comparisonValue;
2190
- }
2191
- };
2192
- RESTworldListViewComponent.createODataOperator = function (matchMode) {
2193
- switch (matchMode) {
2194
- case i2$1.FilterMatchMode.STARTS_WITH:
2195
- return 'startswith';
2196
- case i2$1.FilterMatchMode.CONTAINS:
2197
- return 'contains';
2198
- case i2$1.FilterMatchMode.NOT_CONTAINS:
2199
- return 'not contains';
2200
- case i2$1.FilterMatchMode.ENDS_WITH:
2201
- return 'endswith';
2202
- case i2$1.FilterMatchMode.EQUALS:
2203
- return 'eq';
2204
- case i2$1.FilterMatchMode.NOT_EQUALS:
2205
- return 'ne';
2206
- case i2$1.FilterMatchMode.IN:
2207
- return 'in';
2208
- case i2$1.FilterMatchMode.LESS_THAN:
2209
- return 'lt';
2210
- case i2$1.FilterMatchMode.LESS_THAN_OR_EQUAL_TO:
2211
- return 'le';
2212
- case i2$1.FilterMatchMode.GREATER_THAN:
2213
- return 'gt';
2214
- case i2$1.FilterMatchMode.GREATER_THAN_OR_EQUAL_TO:
2215
- return 'ge';
2216
- case i2$1.FilterMatchMode.IS:
2217
- return 'eq';
2218
- case i2$1.FilterMatchMode.IS_NOT:
2219
- return 'ne';
2220
- case i2$1.FilterMatchMode.BEFORE:
2221
- return 'lt';
2222
- case i2$1.FilterMatchMode.AFTER:
2223
- return 'gt';
2224
- case i2$1.FilterMatchMode.DATE_AFTER:
2225
- return 'ge';
2226
- case i2$1.FilterMatchMode.DATE_BEFORE:
2227
- return 'lt';
2228
- case i2$1.FilterMatchMode.DATE_IS:
2229
- return 'eq';
2230
- case i2$1.FilterMatchMode.DATE_IS_NOT:
2231
- return 'ne';
2232
- default:
2233
- throw Error("Unknown matchMode " + matchMode);
2234
- }
2235
- };
2236
- RESTworldListViewComponent.prototype.createComparisonValue = function (property, value) {
2237
- if (value === null || value === undefined)
2238
- return 'null';
2239
- var columns = this.columns.filter(function (c) { return c.field === property; });
2240
- if (columns.length !== 1)
2241
- throw new Error("Cannot find the column for the property " + property + " which is specified in the filter.");
2242
- var type = columns[0].type;
2243
- switch (type) {
2244
- case exports.ColumnType.boolean:
2245
- return "" + value;
2246
- case exports.ColumnType.date:
2247
- return "cast(" + value.toISOString() + ", Edm.DateTimeOffset)";
2248
- case exports.ColumnType.numeric:
2249
- return "" + value;
2250
- case exports.ColumnType.text:
2251
- return "'" + value + "'";
2252
- default:
2253
- throw new Error("Unknown column type '" + type + "'");
2254
- }
2255
- };
2256
- return RESTworldListViewComponent;
2257
- }());
2258
- RESTworldListViewComponent._dateFormat = new Date(3333, 10, 22)
2259
- .toLocaleDateString()
2260
- .replace("22", "dd")
2261
- .replace("11", "MM")
2262
- .replace("3333", "y")
2263
- .replace("33", "yy");
2264
- RESTworldListViewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldListViewComponent, deps: [{ token: RESTworldClientCollection }, { token: i2__namespace$1.ConfirmationService }, { token: i2__namespace$1.MessageService }, { token: AvatarGenerator }], target: i0__namespace.ɵɵFactoryTarget.Component });
2265
- RESTworldListViewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.11", type: RESTworldListViewComponent, selector: "rw-list", inputs: { editLink: "editLink", apiName: "apiName", rel: "rel", rowsPerPage: "rowsPerPage" }, ngImport: i0__namespace, template: "<p-table [value]=\"value\"\r\n [lazy]=\"true\"\r\n [lazyLoadOnInit]=\"false\"\r\n (onLazyLoad)=\"load($event)\"\r\n responsiveLayout=\"scroll\"\r\n [paginator]=\"true\"\r\n [rows]=\"rows\"\r\n [rowsPerPageOptions]=\"rowsPerPage\"\r\n [totalRecords]=\"totalRecords\"\r\n [loading]=\"isLoading\"\r\n [showInitialSortBadge]=\"true\"\r\n [columns]=\"columns\">\r\n\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\" [pSortableColumn]=\"col.field\">\r\n <div class=\"p-d-flex p-jc-between p-ai-center\">\r\n {{col.header}}\r\n <p-sortIcon [field]=\"col.field\"></p-sortIcon>\r\n <p-columnFilter [type]=\"col.type\" [field]=\"col.field\" display=\"menu\"></p-columnFilter>\r\n </div>\r\n </th>\r\n <th>\r\n <div class=\"flex justify-content-end\">\r\n <div class=\"mx-2\" pTooltip=\"Create new\" tooltipPosition=\"left\">\r\n <a class=\"p-button-success\" icon=\"fas fa-plus\" pButton [routerLink]=\"['/edit', apiName, newHref]\"></a>\r\n </div>\r\n </div>\r\n </th>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"body\" let-entity let-columns=\"columns\">\r\n <tr>\r\n <td [ngSwitch]=\"col.type\" *ngFor=\"let col of columns\">\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <p-avatar *ngIf=\"col.field === 'createdBy' || col.field === 'lastChangedBy'\" [pTooltip]=\"entity[col.field]\" tooltipPosition=\"top\" [image]=\"avatarGenerator.getImage(entity[col.field])\" [label]=\"avatarGenerator.getLabel(entity[col.field])\" [style]=\"avatarGenerator.getStyle(entity[col.field])\" shape=\"circle\"></p-avatar>\r\n <span *ngIf=\"col.field !== 'createdBy' && col.field !== 'lastChangedBy'\">{{entity[col.field]}}</span>\r\n </ng-container>\r\n <span *ngSwitchCase=\"'numeric'\" class=\"flex justify-content-end\">{{entity[col.field]}}</span>\r\n <span *ngSwitchCase=\"'boolean'\" class=\"flex justify-content-center\"><p-triStateCheckbox [(ngModel)]=\"entity[col.field]\" [readonly]=\"true\"></p-triStateCheckbox></span>\r\n <span *ngSwitchCase=\"'date'\" [pTooltip]=\"entity[col.field]\">{{entity[col.field] | date:dateFormat}}</span>\r\n </td>\r\n <td>\r\n <div class=\"flex justify-content-end\">\r\n <a pButton pTooltip=\"View/Edit\" tooltipPosition=\"left\" [routerLink]=\"[editLink, apiName, entity._links?.self[0].href]\" icon=\"fas fa-edit\"></a>\r\n <button pTooltip=\"Delete\" tooltipPosition=\"left\" pButton *ngIf=\"entity._links.delete\" (click)=\"showDeleteConfirmatioModal(entity)\" icon=\"fas fa-trash-alt\" type=\"button\" class=\"mx-2 p-button-danger\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"emptymessage\">\r\n <tr>\r\n <td colspan=\"8\">No entries found.</td>\r\n </tr>\r\n </ng-template>\r\n\r\n</p-table>\r\n\r\n<p-toast></p-toast>\r\n<p-confirmDialog></p-confirmDialog>\r\n", styles: [".p-tooltip{max-width:-webkit-fit-content;max-width:-moz-fit-content;max-width:fit-content}a.p-button{text-decoration:none}\n"], components: [{ type: i4__namespace$3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollDelay", "virtualRowHeight", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "minBufferPx", "maxBufferPx", "responsiveLayout", "breakpoint", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection"], outputs: ["selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { type: i4__namespace$3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { type: i4__namespace$3.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping"] }, { type: i5__namespace$2.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "style", "styleClass"] }, { type: i9__namespace$1.TriStateCheckbox, selector: "p-triStateCheckbox", inputs: ["disabled", "name", "ariaLabelledBy", "tabindex", "inputId", "style", "styleClass", "label", "readonly", "checkboxTrueIcon", "checkboxFalseIcon"], outputs: ["onChange"] }, { type: i11__namespace.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: i12__namespace$1.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }], directives: [{ type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i3__namespace$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace$3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { type: i7__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i4__namespace$2.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i1__namespace$3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i3__namespace$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i3__namespace$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i3__namespace$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], pipes: { "date": i3__namespace$1.DatePipe } });
2266
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RESTworldListViewComponent, decorators: [{
2267
- type: i0.Component,
2268
- args: [{
2269
- selector: 'rw-list',
2270
- templateUrl: './restworld-list-view.component.html',
2271
- styleUrls: ['./restworld-list-view.component.css']
2272
- }]
2273
- }], ctorParameters: function () { return [{ type: RESTworldClientCollection }, { type: i2__namespace$1.ConfirmationService }, { type: i2__namespace$1.MessageService }, { type: AvatarGenerator }]; }, propDecorators: { editLink: [{
2274
- type: i0.Input
2275
- }], apiName: [{
2276
- type: i0.Input
2277
- }], rel: [{
2278
- type: i0.Input
2279
- }], rowsPerPage: [{
2280
- type: i0.Input
2281
- }] } });
2282
-
2283
- function initializeSettings(settingsService) {
2284
- var _this = this;
2285
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
2286
- switch (_a.label) {
2287
- case 0: return [4 /*yield*/, settingsService.initialize()];
2288
- case 1: return [2 /*return*/, _a.sent()];
2289
- }
2290
- }); }); };
2291
- }
2292
- var RestworldClientModule = /** @class */ (function () {
2293
- function RestworldClientModule() {
2294
- }
2295
- return RestworldClientModule;
2296
- }());
2297
- RestworldClientModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2298
- RestworldClientModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, declarations: [RESTworldListViewComponent,
2299
- RESTworldEditViewComponent,
2300
- RESTWorldImageViewComponent,
2301
- RESTWorldFileViewComponent,
2302
- SafeUrlPipe,
2303
- AsPipe,
2304
- RestworldEditFormComponent], imports: [i3$1.CommonModule,
2305
- i4$2.RouterModule,
2306
- i14.FormsModule,
2307
- i14.ReactiveFormsModule,
2308
- i4$3.TableModule,
2309
- i7.TooltipModule,
2310
- scrolling.ScrollingModule,
2311
- i9.InputTextModule,
2312
- i7$1.InputNumberModule,
2313
- i6.CalendarModule,
2314
- i8.CheckboxModule,
2315
- i12$1.ConfirmDialogModule,
2316
- i11.ToastModule,
2317
- messages.MessagesModule,
2318
- panel.PanelModule,
2319
- i7$2.TabViewModule,
2320
- i8$1.SkeletonModule,
2321
- i10$1.ProgressSpinnerModule,
2322
- i10.RippleModule,
2323
- i9$1.TriStateCheckboxModule,
2324
- i5$2.AvatarModule,
2325
- i4$1.DropdownModule,
2326
- i5$1.MultiSelectModule,
2327
- i2.FileUploadModule,
2328
- i12.ValdemortModule,
2329
- i4.ImageCropperModule,
2330
- i3.DialogModule,
2331
- i1$3.ButtonModule,
2332
- i5.ColorPickerModule,
2333
- i17.DragDropModule], exports: [RESTworldListViewComponent,
2334
- RESTworldEditViewComponent,
2335
- RESTWorldImageViewComponent,
2336
- RESTWorldFileViewComponent,
2337
- SafeUrlPipe] });
2338
- RestworldClientModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, providers: [
2339
- RESTworldClientCollection,
2340
- AvatarGenerator,
2341
- i2$1.ConfirmationService,
2342
- FormService,
2343
- i2$1.MessageService,
2344
- {
2345
- provide: i0.APP_INITIALIZER,
2346
- useFactory: initializeSettings,
2347
- deps: [SettingsService],
2348
- multi: true,
2349
- }
2350
- ], imports: [[
2351
- i3$1.CommonModule,
2352
- i4$2.RouterModule,
2353
- i14.FormsModule,
2354
- i14.ReactiveFormsModule,
2355
- i4$3.TableModule,
2356
- i7.TooltipModule,
2357
- scrolling.ScrollingModule,
2358
- i9.InputTextModule,
2359
- i7$1.InputNumberModule,
2360
- i6.CalendarModule,
2361
- i8.CheckboxModule,
2362
- i12$1.ConfirmDialogModule,
2363
- i11.ToastModule,
2364
- messages.MessagesModule,
2365
- panel.PanelModule,
2366
- i7$2.TabViewModule,
2367
- i8$1.SkeletonModule,
2368
- i10$1.ProgressSpinnerModule,
2369
- i10.RippleModule,
2370
- i9$1.TriStateCheckboxModule,
2371
- i5$2.AvatarModule,
2372
- i4$1.DropdownModule,
2373
- i5$1.MultiSelectModule,
2374
- i2.FileUploadModule,
2375
- i12.ValdemortModule,
2376
- i4.ImageCropperModule,
2377
- i3.DialogModule,
2378
- i1$3.ButtonModule,
2379
- i5.ColorPickerModule,
2380
- i17.DragDropModule
2381
- ]] });
2382
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.11", ngImport: i0__namespace, type: RestworldClientModule, decorators: [{
2383
- type: i0.NgModule,
2384
- args: [{
2385
- declarations: [
2386
- RESTworldListViewComponent,
2387
- RESTworldEditViewComponent,
2388
- RESTWorldImageViewComponent,
2389
- RESTWorldFileViewComponent,
2390
- SafeUrlPipe,
2391
- AsPipe,
2392
- RestworldEditFormComponent
2393
- ],
2394
- imports: [
2395
- i3$1.CommonModule,
2396
- i4$2.RouterModule,
2397
- i14.FormsModule,
2398
- i14.ReactiveFormsModule,
2399
- i4$3.TableModule,
2400
- i7.TooltipModule,
2401
- scrolling.ScrollingModule,
2402
- i9.InputTextModule,
2403
- i7$1.InputNumberModule,
2404
- i6.CalendarModule,
2405
- i8.CheckboxModule,
2406
- i12$1.ConfirmDialogModule,
2407
- i11.ToastModule,
2408
- messages.MessagesModule,
2409
- panel.PanelModule,
2410
- i7$2.TabViewModule,
2411
- i8$1.SkeletonModule,
2412
- i10$1.ProgressSpinnerModule,
2413
- i10.RippleModule,
2414
- i9$1.TriStateCheckboxModule,
2415
- i5$2.AvatarModule,
2416
- i4$1.DropdownModule,
2417
- i5$1.MultiSelectModule,
2418
- i2.FileUploadModule,
2419
- i12.ValdemortModule,
2420
- i4.ImageCropperModule,
2421
- i3.DialogModule,
2422
- i1$3.ButtonModule,
2423
- i5.ColorPickerModule,
2424
- i17.DragDropModule
2425
- ],
2426
- exports: [
2427
- RESTworldListViewComponent,
2428
- RESTworldEditViewComponent,
2429
- RESTWorldImageViewComponent,
2430
- RESTWorldFileViewComponent,
2431
- SafeUrlPipe
2432
- ],
2433
- providers: [
2434
- RESTworldClientCollection,
2435
- AvatarGenerator,
2436
- i2$1.ConfirmationService,
2437
- FormService,
2438
- i2$1.MessageService,
2439
- {
2440
- provide: i0.APP_INITIALIZER,
2441
- useFactory: initializeSettings,
2442
- deps: [SettingsService],
2443
- multi: true,
2444
- }
2445
- ]
2446
- }]
2447
- }] });
2448
-
2449
- /*
2450
- * Public API Surface of ngx-restworld-client
2451
- */
2452
-
2453
- /**
2454
- * Generated bundle index. Do not edit.
2455
- */
2456
-
2457
- exports.AsPipe = AsPipe;
2458
- exports.AvatarGenerator = AvatarGenerator;
2459
- exports.FormService = FormService;
2460
- exports.ProblemDetails = ProblemDetails;
2461
- exports.RESTWorldFileViewComponent = RESTWorldFileViewComponent;
2462
- exports.RESTWorldImageViewComponent = RESTWorldImageViewComponent;
2463
- exports.RESTworldClient = RESTworldClient;
2464
- exports.RESTworldClientCollection = RESTworldClientCollection;
2465
- exports.RESTworldEditViewComponent = RESTworldEditViewComponent;
2466
- exports.RESTworldListViewComponent = RESTworldListViewComponent;
2467
- exports.RESTworldOptions = RESTworldOptions;
2468
- exports.RestworldClientModule = RestworldClientModule;
2469
- exports.RestworldEditFormComponent = RestworldEditFormComponent;
2470
- exports.SafeUrlPipe = SafeUrlPipe;
2471
- exports.SettingsService = SettingsService;
2472
- exports.initializeSettings = initializeSettings;
2473
-
2474
- Object.defineProperty(exports, '__esModule', { value: true });
2475
-
2476
- }));
2477
- //# sourceMappingURL=wertzui-ngx-restworld-client.umd.js.map