@pepperi-addons/ngx-composite-lib 0.0.13-beta.4 → 0.0.13-beta.8

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 (27) hide show
  1. package/bundles/pepperi-addons-ngx-composite-lib-generic-form.umd.js +722 -0
  2. package/bundles/pepperi-addons-ngx-composite-lib-generic-form.umd.js.map +1 -0
  3. package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js +0 -1
  4. package/bundles/pepperi-addons-ngx-composite-lib-generic-list.umd.js.map +1 -1
  5. package/bundles/pepperi-addons-ngx-composite-lib.umd.js.map +1 -1
  6. package/esm2015/core/common/directives/reset-configuration-field.directive.js +4 -4
  7. package/esm2015/generic-form/generic-form.component.js +94 -0
  8. package/esm2015/generic-form/generic-form.model.js +2 -0
  9. package/esm2015/generic-form/generic-form.module.js +74 -0
  10. package/esm2015/generic-form/generic-form.service.js +165 -0
  11. package/esm2015/generic-form/pepperi-addons-ngx-composite-lib-generic-form.js +5 -0
  12. package/esm2015/generic-form/public-api.js +8 -0
  13. package/esm2015/generic-list/generic-list.service.js +1 -2
  14. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-form.js +331 -0
  15. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-form.js.map +1 -0
  16. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js +0 -1
  17. package/fesm2015/pepperi-addons-ngx-composite-lib-generic-list.js.map +1 -1
  18. package/fesm2015/pepperi-addons-ngx-composite-lib.js +3 -3
  19. package/fesm2015/pepperi-addons-ngx-composite-lib.js.map +1 -1
  20. package/generic-form/generic-form.component.d.ts +28 -0
  21. package/generic-form/generic-form.model.d.ts +35 -0
  22. package/generic-form/generic-form.module.d.ts +13 -0
  23. package/generic-form/generic-form.service.d.ts +44 -0
  24. package/generic-form/package.json +10 -0
  25. package/generic-form/pepperi-addons-ngx-composite-lib-generic-form.d.ts +5 -0
  26. package/generic-form/public-api.d.ts +4 -0
  27. package/package.json +2 -2
@@ -0,0 +1,722 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@pepperi-addons/ngx-lib'), require('@pepperi-addons/ngx-lib/form'), require('@pepperi-addons/ngx-lib/menu'), require('@pepperi-addons/ngx-lib/page-layout'), require('@pepperi-addons/ngx-lib/top-bar'), require('@pepperi-addons/data-views')) :
3
+ typeof define === 'function' && define.amd ? define('@pepperi-addons/ngx-composite-lib/generic-form', ['exports', '@angular/core', '@angular/common', '@pepperi-addons/ngx-lib', '@pepperi-addons/ngx-lib/form', '@pepperi-addons/ngx-lib/menu', '@pepperi-addons/ngx-lib/page-layout', '@pepperi-addons/ngx-lib/top-bar', '@pepperi-addons/data-views'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["pepperi-addons"] = global["pepperi-addons"] || {}, global["pepperi-addons"]["ngx-composite-lib"] = global["pepperi-addons"]["ngx-composite-lib"] || {}, global["pepperi-addons"]["ngx-composite-lib"]["generic-form"] = {}), global.ng.core, global.ng.common, global["ngx-lib"], global["ngx-lib/form"], global["ngx-lib/menu"], global["ngx-lib/page-layout"], global["ngx-lib/top-bar"], global.dataViews));
5
+ })(this, (function (exports, i0, i6, i1, i5, menu, i3, i4, dataViews) { '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 i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
27
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
29
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
30
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
31
+
32
+ /*! *****************************************************************************
33
+ Copyright (c) Microsoft Corporation.
34
+
35
+ Permission to use, copy, modify, and/or distribute this software for any
36
+ purpose with or without fee is hereby granted.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
+ PERFORMANCE OF THIS SOFTWARE.
45
+ ***************************************************************************** */
46
+ /* global Reflect, Promise */
47
+ var extendStatics = function (d, b) {
48
+ extendStatics = Object.setPrototypeOf ||
49
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50
+ function (d, b) { for (var p in b)
51
+ if (Object.prototype.hasOwnProperty.call(b, p))
52
+ d[p] = b[p]; };
53
+ return extendStatics(d, b);
54
+ };
55
+ function __extends(d, b) {
56
+ if (typeof b !== "function" && b !== null)
57
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
+ extendStatics(d, b);
59
+ function __() { this.constructor = d; }
60
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
61
+ }
62
+ var __assign = function () {
63
+ __assign = Object.assign || function __assign(t) {
64
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
65
+ s = arguments[i];
66
+ for (var p in s)
67
+ if (Object.prototype.hasOwnProperty.call(s, p))
68
+ t[p] = s[p];
69
+ }
70
+ return t;
71
+ };
72
+ return __assign.apply(this, arguments);
73
+ };
74
+ function __rest(s, e) {
75
+ var t = {};
76
+ for (var p in s)
77
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
+ t[p] = s[p];
79
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
+ t[p[i]] = s[p[i]];
83
+ }
84
+ return t;
85
+ }
86
+ function __decorate(decorators, target, key, desc) {
87
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
88
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
89
+ r = Reflect.decorate(decorators, target, key, desc);
90
+ else
91
+ for (var i = decorators.length - 1; i >= 0; i--)
92
+ if (d = decorators[i])
93
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
94
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
95
+ }
96
+ function __param(paramIndex, decorator) {
97
+ return function (target, key) { decorator(target, key, paramIndex); };
98
+ }
99
+ function __metadata(metadataKey, metadataValue) {
100
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
101
+ return Reflect.metadata(metadataKey, metadataValue);
102
+ }
103
+ function __awaiter(thisArg, _arguments, P, generator) {
104
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
105
+ return new (P || (P = Promise))(function (resolve, reject) {
106
+ function fulfilled(value) { try {
107
+ step(generator.next(value));
108
+ }
109
+ catch (e) {
110
+ reject(e);
111
+ } }
112
+ function rejected(value) { try {
113
+ step(generator["throw"](value));
114
+ }
115
+ catch (e) {
116
+ reject(e);
117
+ } }
118
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
119
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
120
+ });
121
+ }
122
+ function __generator(thisArg, body) {
123
+ var _ = { label: 0, sent: function () { if (t[0] & 1)
124
+ throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
125
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
126
+ function verb(n) { return function (v) { return step([n, v]); }; }
127
+ function step(op) {
128
+ if (f)
129
+ throw new TypeError("Generator is already executing.");
130
+ while (_)
131
+ try {
132
+ 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)
133
+ return t;
134
+ if (y = 0, t)
135
+ op = [op[0] & 2, t.value];
136
+ switch (op[0]) {
137
+ case 0:
138
+ case 1:
139
+ t = op;
140
+ break;
141
+ case 4:
142
+ _.label++;
143
+ return { value: op[1], done: false };
144
+ case 5:
145
+ _.label++;
146
+ y = op[1];
147
+ op = [0];
148
+ continue;
149
+ case 7:
150
+ op = _.ops.pop();
151
+ _.trys.pop();
152
+ continue;
153
+ default:
154
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
155
+ _ = 0;
156
+ continue;
157
+ }
158
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
159
+ _.label = op[1];
160
+ break;
161
+ }
162
+ if (op[0] === 6 && _.label < t[1]) {
163
+ _.label = t[1];
164
+ t = op;
165
+ break;
166
+ }
167
+ if (t && _.label < t[2]) {
168
+ _.label = t[2];
169
+ _.ops.push(op);
170
+ break;
171
+ }
172
+ if (t[2])
173
+ _.ops.pop();
174
+ _.trys.pop();
175
+ continue;
176
+ }
177
+ op = body.call(thisArg, _);
178
+ }
179
+ catch (e) {
180
+ op = [6, e];
181
+ y = 0;
182
+ }
183
+ finally {
184
+ f = t = 0;
185
+ }
186
+ if (op[0] & 5)
187
+ throw op[1];
188
+ return { value: op[0] ? op[1] : void 0, done: true };
189
+ }
190
+ }
191
+ var __createBinding = Object.create ? (function (o, m, k, k2) {
192
+ if (k2 === undefined)
193
+ k2 = k;
194
+ Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
195
+ }) : (function (o, m, k, k2) {
196
+ if (k2 === undefined)
197
+ k2 = k;
198
+ o[k2] = m[k];
199
+ });
200
+ function __exportStar(m, o) {
201
+ for (var p in m)
202
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
203
+ __createBinding(o, m, p);
204
+ }
205
+ function __values(o) {
206
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
207
+ if (m)
208
+ return m.call(o);
209
+ if (o && typeof o.length === "number")
210
+ return {
211
+ next: function () {
212
+ if (o && i >= o.length)
213
+ o = void 0;
214
+ return { value: o && o[i++], done: !o };
215
+ }
216
+ };
217
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
218
+ }
219
+ function __read(o, n) {
220
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
221
+ if (!m)
222
+ return o;
223
+ var i = m.call(o), r, ar = [], e;
224
+ try {
225
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
226
+ ar.push(r.value);
227
+ }
228
+ catch (error) {
229
+ e = { error: error };
230
+ }
231
+ finally {
232
+ try {
233
+ if (r && !r.done && (m = i["return"]))
234
+ m.call(i);
235
+ }
236
+ finally {
237
+ if (e)
238
+ throw e.error;
239
+ }
240
+ }
241
+ return ar;
242
+ }
243
+ /** @deprecated */
244
+ function __spread() {
245
+ for (var ar = [], i = 0; i < arguments.length; i++)
246
+ ar = ar.concat(__read(arguments[i]));
247
+ return ar;
248
+ }
249
+ /** @deprecated */
250
+ function __spreadArrays() {
251
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++)
252
+ s += arguments[i].length;
253
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
254
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
255
+ r[k] = a[j];
256
+ return r;
257
+ }
258
+ function __spreadArray(to, from, pack) {
259
+ if (pack || arguments.length === 2)
260
+ for (var i = 0, l = from.length, ar; i < l; i++) {
261
+ if (ar || !(i in from)) {
262
+ if (!ar)
263
+ ar = Array.prototype.slice.call(from, 0, i);
264
+ ar[i] = from[i];
265
+ }
266
+ }
267
+ return to.concat(ar || Array.prototype.slice.call(from));
268
+ }
269
+ function __await(v) {
270
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
271
+ }
272
+ function __asyncGenerator(thisArg, _arguments, generator) {
273
+ if (!Symbol.asyncIterator)
274
+ throw new TypeError("Symbol.asyncIterator is not defined.");
275
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
276
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
277
+ function verb(n) { if (g[n])
278
+ i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
279
+ function resume(n, v) { try {
280
+ step(g[n](v));
281
+ }
282
+ catch (e) {
283
+ settle(q[0][3], e);
284
+ } }
285
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
286
+ function fulfill(value) { resume("next", value); }
287
+ function reject(value) { resume("throw", value); }
288
+ function settle(f, v) { if (f(v), q.shift(), q.length)
289
+ resume(q[0][0], q[0][1]); }
290
+ }
291
+ function __asyncDelegator(o) {
292
+ var i, p;
293
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
294
+ 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; }
295
+ }
296
+ function __asyncValues(o) {
297
+ if (!Symbol.asyncIterator)
298
+ throw new TypeError("Symbol.asyncIterator is not defined.");
299
+ var m = o[Symbol.asyncIterator], i;
300
+ 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);
301
+ 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); }); }; }
302
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
303
+ }
304
+ function __makeTemplateObject(cooked, raw) {
305
+ if (Object.defineProperty) {
306
+ Object.defineProperty(cooked, "raw", { value: raw });
307
+ }
308
+ else {
309
+ cooked.raw = raw;
310
+ }
311
+ return cooked;
312
+ }
313
+ ;
314
+ var __setModuleDefault = Object.create ? (function (o, v) {
315
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
316
+ }) : function (o, v) {
317
+ o["default"] = v;
318
+ };
319
+ function __importStar(mod) {
320
+ if (mod && mod.__esModule)
321
+ return mod;
322
+ var result = {};
323
+ if (mod != null)
324
+ for (var k in mod)
325
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
326
+ __createBinding(result, mod, k);
327
+ __setModuleDefault(result, mod);
328
+ return result;
329
+ }
330
+ function __importDefault(mod) {
331
+ return (mod && mod.__esModule) ? mod : { default: mod };
332
+ }
333
+ function __classPrivateFieldGet(receiver, state, kind, f) {
334
+ if (kind === "a" && !f)
335
+ throw new TypeError("Private accessor was defined without a getter");
336
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
337
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
338
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
339
+ }
340
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
341
+ if (kind === "m")
342
+ throw new TypeError("Private method is not writable");
343
+ if (kind === "a" && !f)
344
+ throw new TypeError("Private accessor was defined without a setter");
345
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
346
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
347
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
348
+ }
349
+
350
+ var PepGenericFormService = /** @class */ (function () {
351
+ function PepGenericFormService() {
352
+ this._uiControl = new i1.UIControl();
353
+ this._formData = new i1.ObjectsDataRow();
354
+ this._optionalValues = [];
355
+ this._isLocked = false;
356
+ //
357
+ }
358
+ Object.defineProperty(PepGenericFormService.prototype, "uiControl", {
359
+ get: function () {
360
+ return this._uiControl;
361
+ },
362
+ enumerable: false,
363
+ configurable: true
364
+ });
365
+ Object.defineProperty(PepGenericFormService.prototype, "data", {
366
+ get: function () {
367
+ return this._formData;
368
+ },
369
+ enumerable: false,
370
+ configurable: true
371
+ });
372
+ Object.defineProperty(PepGenericFormService.prototype, "isLocked", {
373
+ get: function () {
374
+ return this._isLocked;
375
+ },
376
+ set: function (val) {
377
+ this._isLocked = val;
378
+ },
379
+ enumerable: false,
380
+ configurable: true
381
+ });
382
+ PepGenericFormService.prototype.setDataSource = function (data) {
383
+ if (data) {
384
+ this._data = data;
385
+ this.createFormFields();
386
+ }
387
+ };
388
+ PepGenericFormService.prototype.setUiControl = function (view) {
389
+ var _this = this;
390
+ var _a;
391
+ if (view) {
392
+ this._formData.IsEditable = !this._isLocked;
393
+ this._formData.UID = view.UID || i1.PepGuid.newGuid();
394
+ var uiControlData = dataViews.DataViewConverter.toUIControlData(view);
395
+ if (uiControlData) {
396
+ if (uiControlData === null || uiControlData === void 0 ? void 0 : uiControlData.ControlFields) {
397
+ (_a = view.Fields) === null || _a === void 0 ? void 0 : _a.forEach(function (field) {
398
+ var _a;
399
+ if ((_a = field.OptionalValues) === null || _a === void 0 ? void 0 : _a.length) {
400
+ _this._optionalValues.push({
401
+ fieldId: field.FieldID,
402
+ optionalValues: field.OptionalValues
403
+ });
404
+ }
405
+ });
406
+ this._uiControl.ControlFields = uiControlData.ControlFields.map(function (field) { return _this.convertToUiControlField(field); });
407
+ }
408
+ this._uiControl.Columns = uiControlData.Columns;
409
+ this.createFormFields();
410
+ }
411
+ }
412
+ };
413
+ PepGenericFormService.prototype.createFormFields = function () {
414
+ var _this = this;
415
+ var _a, _b;
416
+ if (this._data && ((_b = (_a = this._uiControl) === null || _a === void 0 ? void 0 : _a.ControlFields) === null || _b === void 0 ? void 0 : _b.length)) {
417
+ this._formData.Fields = [];
418
+ this._uiControl.ControlFields.forEach(function (item) {
419
+ var value = '';
420
+ if (_this.hasProperty(_this._data, item.ApiName)) {
421
+ value = _this._data[item.ApiName];
422
+ }
423
+ _this._formData.Fields.push(_this.createFormField(item, value));
424
+ });
425
+ }
426
+ };
427
+ PepGenericFormService.prototype.getData = function () {
428
+ return {
429
+ UID: this._formData.UID,
430
+ Values: this._data
431
+ };
432
+ };
433
+ /**
434
+ * updates form field(s) params
435
+ * @param fields
436
+ */
437
+ PepGenericFormService.prototype.updateFields = function (fields) {
438
+ var _this = this;
439
+ fields.forEach(function (field) {
440
+ var e_1, _c;
441
+ var index = _this._formData.Fields.findIndex(function (item) { return item.ApiName === field.FieldId; });
442
+ if (index >= 0) {
443
+ try {
444
+ for (var _d = __values(Object.entries(field.Params)), _e = _d.next(); !_e.done; _e = _d.next()) {
445
+ var _f = __read(_e.value, 2), key = _f[0], value = _f[1];
446
+ if (_this.hasProperty(_this._formData.Fields[index], key)) {
447
+ var item = _this._formData.Fields[index];
448
+ item[key] = value;
449
+ }
450
+ }
451
+ }
452
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
453
+ finally {
454
+ try {
455
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
456
+ }
457
+ finally { if (e_1) throw e_1.error; }
458
+ }
459
+ }
460
+ });
461
+ };
462
+ /**
463
+ * updates form field's value
464
+ * @param field object containing the data of the required update
465
+ */
466
+ PepGenericFormService.prototype.updateFieldValue = function (fieldChanged) {
467
+ this._data[fieldChanged.apiName] = fieldChanged.value;
468
+ };
469
+ /**
470
+ * checks if the object contains property
471
+ * @param obj object
472
+ * @param prop property name
473
+ * @returns true if contains, false otherwise
474
+ */
475
+ PepGenericFormService.prototype.hasProperty = function (obj, prop) {
476
+ return Object.prototype.hasOwnProperty.call(obj, prop);
477
+ };
478
+ PepGenericFormService.prototype.createFormField = function (controlField, value) {
479
+ var field = new i1.ObjectsDataRowCell();
480
+ field.ApiName = controlField.ApiName;
481
+ field.Value = value;
482
+ field.FieldType = controlField.FieldType;
483
+ field.Enabled = !controlField.ReadOnly;
484
+ field.Visible = !controlField.Hidden;
485
+ field.Accessory = "";
486
+ field.AdditionalValue = "";
487
+ field.BackgroundColor = "";
488
+ field.FormattedValue = "";
489
+ field.GroupFields = [];
490
+ field.Highlighted = false;
491
+ field.NotificationInfo = "";
492
+ field.OptionalValues = this.getOptionalValues(controlField.ApiName);
493
+ field.ReferenceObjectInternalType = "";
494
+ field.ReferenceObjectSubType = "";
495
+ field.ReferenceObjectType = '0';
496
+ field.TextColor = "";
497
+ field.UiPageKey = "";
498
+ return field;
499
+ };
500
+ PepGenericFormService.prototype.getOptionalValues = function (fieldId) {
501
+ var item = this._optionalValues.find(function (item) { return item.fieldId === fieldId; });
502
+ return (item === null || item === void 0 ? void 0 : item.optionalValues) || [];
503
+ };
504
+ PepGenericFormService.prototype.convertToUiControlField = function (field) {
505
+ return {
506
+ ApiName: field.ApiName,
507
+ FieldType: field.FieldType,
508
+ Title: field.Title,
509
+ ReadOnly: field.ReadOnlyField,
510
+ Mandatory: field.MandatoryField,
511
+ Hidden: field.Hidden,
512
+ ColumnWidth: field.ColumnWidth,
513
+ ColumnWidthType: 1,
514
+ MaxFieldCharacters: field.MaxCharacters,
515
+ MinValue: field.MinValue,
516
+ MaxValue: field.MaxValue,
517
+ Layout: {
518
+ X: field.Layout.X,
519
+ Y: field.Layout.Y,
520
+ Width: field.Layout.Width,
521
+ Height: field.Layout.Field_Height,
522
+ XAlignment: field.Layout.xAlignment,
523
+ YAlignment: field.Layout.yAlignment,
524
+ }
525
+ };
526
+ };
527
+ return PepGenericFormService;
528
+ }());
529
+ PepGenericFormService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
530
+ PepGenericFormService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormService, providedIn: 'root' });
531
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormService, decorators: [{
532
+ type: i0.Injectable,
533
+ args: [{
534
+ providedIn: 'root'
535
+ }]
536
+ }], ctorParameters: function () { return []; } });
537
+
538
+ var GenericFormComponent = /** @class */ (function () {
539
+ function GenericFormComponent(layoutService, _genericFormService) {
540
+ this.layoutService = layoutService;
541
+ this._genericFormService = _genericFormService;
542
+ this.inline = false;
543
+ this.showTopBar = false;
544
+ this.addPadding = false;
545
+ this.valueChange = new i0.EventEmitter();
546
+ this.fieldClick = new i0.EventEmitter();
547
+ this.formValidationChange = new i0.EventEmitter();
548
+ this.layoutService.onResize$.pipe().subscribe(function (size) {
549
+ //
550
+ });
551
+ }
552
+ Object.defineProperty(GenericFormComponent.prototype, "dataSource", {
553
+ set: function (val) {
554
+ this._genericFormService.setDataSource(val);
555
+ },
556
+ enumerable: false,
557
+ configurable: true
558
+ });
559
+ Object.defineProperty(GenericFormComponent.prototype, "dataView", {
560
+ set: function (val) {
561
+ this._genericFormService.setUiControl(val);
562
+ },
563
+ enumerable: false,
564
+ configurable: true
565
+ });
566
+ Object.defineProperty(GenericFormComponent.prototype, "isLocked", {
567
+ get: function () {
568
+ return this._genericFormService.isLocked;
569
+ },
570
+ set: function (val) {
571
+ this._genericFormService.isLocked = val;
572
+ },
573
+ enumerable: false,
574
+ configurable: true
575
+ });
576
+ Object.defineProperty(GenericFormComponent.prototype, "uiControl", {
577
+ get: function () {
578
+ return this._genericFormService.uiControl;
579
+ },
580
+ enumerable: false,
581
+ configurable: true
582
+ });
583
+ Object.defineProperty(GenericFormComponent.prototype, "data", {
584
+ get: function () {
585
+ return this._genericFormService.data;
586
+ },
587
+ enumerable: false,
588
+ configurable: true
589
+ });
590
+ GenericFormComponent.prototype.ngOnInit = function () {
591
+ //
592
+ };
593
+ GenericFormComponent.prototype.onValueChanged = function (event) {
594
+ var field = {
595
+ uid: event.id,
596
+ apiName: event.key,
597
+ value: event.value
598
+ };
599
+ this._genericFormService.updateFieldValue(field);
600
+ this.valueChange.emit(field);
601
+ };
602
+ GenericFormComponent.prototype.onfieldClicked = function (event) {
603
+ var field = {
604
+ uid: event.id,
605
+ apiName: event.key,
606
+ value: event.value
607
+ };
608
+ this._genericFormService.updateFieldValue(field);
609
+ this.fieldClick.emit(field);
610
+ };
611
+ GenericFormComponent.prototype.onFormValidationChanged = function (event) {
612
+ this.formValidationChange.emit(event);
613
+ };
614
+ return GenericFormComponent;
615
+ }());
616
+ GenericFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: GenericFormComponent, deps: [{ token: i1__namespace.PepLayoutService }, { token: PepGenericFormService }], target: i0__namespace.ɵɵFactoryTarget.Component });
617
+ GenericFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.0.5", type: GenericFormComponent, selector: "pep-generic-form", inputs: { dataSource: "dataSource", dataView: "dataView", isLocked: "isLocked", inline: "inline", showTopBar: "showTopBar", addPadding: "addPadding" }, outputs: { valueChange: "valueChange", fieldClick: "fieldClick", formValidationChange: "formValidationChange" }, ngImport: i0__namespace, template: "<div *ngIf=\"inline\" class=\"inline-container form-view\" [ngClass]=\"{ 'add-padding': addPadding }\">\n <div *ngIf=\"showTopBar\" class=\"inline-top-bar-container\">\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </div>\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n</div>\n\n<pep-page-layout *ngIf=\"!inline\" [addPadding]=\"addPadding\">\n <ng-container *ngIf=\"showTopBar\" pep-top-area>\n <ng-container *ngTemplateOutlet=\"topBarTemplate\"></ng-container>\n </ng-container>\n <div pep-main-area class=\"main-area-container form-view\">\n <ng-container *ngTemplateOutlet=\"formTemplate\"></ng-container>\n </div>\n</pep-page-layout>\n\n<ng-template #topBarTemplate>\n <pep-top-bar [inline]=\"inline\"> \n <div header-start-content>\n <ng-content select=\"[left-buttons]\"></ng-content>\n </div>\n <div header-end-content>\n <ng-content select=\"[right-buttons]\"></ng-content>\n </div>\n\n <!-- <div footer-start-content>\n <ng-content select=\"[bottom-left-buttons]\"></ng-content>\n </div>\n <div footer-end-content>\n <ng-content select=\"[bottom-right-buttons]\"></ng-content>\n </div> -->\n </pep-top-bar>\n</ng-template>\n\n<ng-template #formTemplate>\n <pep-form [layoutType]=\"'form'\" [layout]=\"uiControl\" [data]=\"data\" [isInternal]=\"false\" [lockFields]=\"isLocked\"\n (valueChange)=\"onValueChanged($event)\" (fieldClick)=\"onfieldClicked($event)\"\n (formValidationChange)=\"onFormValidationChanged($event)\">\n </pep-form>\n</ng-template>\n", styles: [":host{height:inherit;display:block}.main-area-container{display:grid;height:inherit}.inline-container{height:inherit;display:grid;grid-template-rows:auto 1fr}.inline-container.add-padding{padding-inline:var(--pep-spacing-lg, 1rem)}\n"], components: [{ type: i3__namespace.PepPageLayoutComponent, selector: "pep-page-layout", inputs: ["addPadding", "showShadow"] }, { type: i4__namespace.PepTopBarComponent, selector: "pep-top-bar", inputs: ["inline", "title"], outputs: ["footerStateChange"] }, { type: i5__namespace.PepFormComponent, selector: "pep-form", inputs: ["isInternal", "isReport", "lockEvents", "canEditObject", "isActive", "layoutType", "objectId", "parentId", "searchCode", "showTitle", "firstFieldAsLink", "checkForChanges", "data", "lockFields", "layout"], outputs: ["valueChange", "formValidationChange", "fieldClick", "internalFormFieldClick", "internalFormFieldChange"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
618
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: GenericFormComponent, decorators: [{
619
+ type: i0.Component,
620
+ args: [{
621
+ selector: 'pep-generic-form',
622
+ templateUrl: './generic-form.component.html',
623
+ styleUrls: ['./generic-form.component.scss'],
624
+ }]
625
+ }], ctorParameters: function () { return [{ type: i1__namespace.PepLayoutService }, { type: PepGenericFormService }]; }, propDecorators: { dataSource: [{
626
+ type: i0.Input
627
+ }], dataView: [{
628
+ type: i0.Input
629
+ }], isLocked: [{
630
+ type: i0.Input
631
+ }], inline: [{
632
+ type: i0.Input
633
+ }], showTopBar: [{
634
+ type: i0.Input
635
+ }], addPadding: [{
636
+ type: i0.Input
637
+ }], valueChange: [{
638
+ type: i0.Output
639
+ }], fieldClick: [{
640
+ type: i0.Output
641
+ }], formValidationChange: [{
642
+ type: i0.Output
643
+ }] } });
644
+
645
+ var PepGenericFormModule = /** @class */ (function () {
646
+ function PepGenericFormModule() {
647
+ }
648
+ return PepGenericFormModule;
649
+ }());
650
+ PepGenericFormModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
651
+ PepGenericFormModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormModule, declarations: [GenericFormComponent], imports: [i6.CommonModule,
652
+ // MatFormFieldModule,
653
+ // ReactiveFormsModule,
654
+ i1.PepNgxLibModule,
655
+ // PepListModule,
656
+ i5.PepFormModule,
657
+ menu.PepMenuModule,
658
+ i3.PepPageLayoutModule,
659
+ i4.PepTopBarModule], exports: [GenericFormComponent] });
660
+ PepGenericFormModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormModule, providers: [
661
+ PepGenericFormService
662
+ ], imports: [[
663
+ i6.CommonModule,
664
+ // MatFormFieldModule,
665
+ // ReactiveFormsModule,
666
+ i1.PepNgxLibModule,
667
+ // PepListModule,
668
+ i5.PepFormModule,
669
+ menu.PepMenuModule,
670
+ i3.PepPageLayoutModule,
671
+ i4.PepTopBarModule,
672
+ // PepTextboxModule,
673
+ // PepDateModule
674
+ // PepSearchModule,
675
+ // PepBreadCrumbsModule
676
+ ]] });
677
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.5", ngImport: i0__namespace, type: PepGenericFormModule, decorators: [{
678
+ type: i0.NgModule,
679
+ args: [{
680
+ declarations: [
681
+ GenericFormComponent
682
+ ],
683
+ imports: [
684
+ i6.CommonModule,
685
+ // MatFormFieldModule,
686
+ // ReactiveFormsModule,
687
+ i1.PepNgxLibModule,
688
+ // PepListModule,
689
+ i5.PepFormModule,
690
+ menu.PepMenuModule,
691
+ i3.PepPageLayoutModule,
692
+ i4.PepTopBarModule,
693
+ // PepTextboxModule,
694
+ // PepDateModule
695
+ // PepSearchModule,
696
+ // PepBreadCrumbsModule
697
+ ],
698
+ exports: [
699
+ GenericFormComponent
700
+ ],
701
+ providers: [
702
+ PepGenericFormService
703
+ ]
704
+ }]
705
+ }] });
706
+
707
+ /*
708
+ * Public API Surface of ngx-composite-lib/generic-form
709
+ */
710
+
711
+ /**
712
+ * Generated bundle index. Do not edit.
713
+ */
714
+
715
+ exports.GenericFormComponent = GenericFormComponent;
716
+ exports.PepGenericFormModule = PepGenericFormModule;
717
+ exports.PepGenericFormService = PepGenericFormService;
718
+
719
+ Object.defineProperty(exports, '__esModule', { value: true });
720
+
721
+ }));
722
+ //# sourceMappingURL=pepperi-addons-ngx-composite-lib-generic-form.umd.js.map