@stemy/ngx-dynamic-form 10.2.27 → 10.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/bundles/stemy-ngx-dynamic-form.umd.js +141 -18
  2. package/bundles/stemy-ngx-dynamic-form.umd.js.map +1 -1
  3. package/bundles/stemy-ngx-dynamic-form.umd.min.js +1 -1
  4. package/bundles/stemy-ngx-dynamic-form.umd.min.js.map +1 -1
  5. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-array.component.js +53 -0
  6. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-control-container.component.js +13 -2
  7. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form-group.component.js +53 -0
  8. package/esm2015/ngx-dynamic-form/components/base/dynamic-base-form.component.js +12 -2
  9. package/esm2015/ngx-dynamic-form/ngx-dynamic-form.module.js +8 -10
  10. package/esm2015/ngx-dynamic-form/utils/misc.js +15 -1
  11. package/esm2015/public_api.js +3 -1
  12. package/esm2015/stemy-ngx-dynamic-form.js +1 -2
  13. package/fesm2015/stemy-ngx-dynamic-form.js +138 -17
  14. package/fesm2015/stemy-ngx-dynamic-form.js.map +1 -1
  15. package/ngx-dynamic-form/components/base/dynamic-base-form-array.component.d.ts +20 -0
  16. package/ngx-dynamic-form/components/base/dynamic-base-form-control-container.component.d.ts +1 -0
  17. package/ngx-dynamic-form/components/base/dynamic-base-form-group.component.d.ts +20 -0
  18. package/ngx-dynamic-form/components/base/dynamic-base-form.component.d.ts +2 -1
  19. package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +3 -1
  20. package/ngx-dynamic-form/utils/misc.d.ts +2 -0
  21. package/package.json +1 -1
  22. package/public_api.d.ts +2 -0
  23. package/stemy-ngx-dynamic-form.d.ts +0 -1
  24. package/stemy-ngx-dynamic-form.metadata.json +1 -1
  25. package/esm2015/ngx-dynamic-form/services/dynamic-form-validation.service.js +0 -11
  26. package/ngx-dynamic-form/services/dynamic-form-validation.service.d.ts +0 -5
@@ -574,6 +574,20 @@
574
574
 
575
575
  function isStringWithVal(val) {
576
576
  return typeof val == "string" && val.length > 0;
577
+ }
578
+ function collectPathAble(start, getter) {
579
+ if (!start || !getter(start))
580
+ return [];
581
+ var parts = [];
582
+ var currentPath = start;
583
+ while (currentPath) {
584
+ var val = getter(currentPath);
585
+ if (val) {
586
+ parts.unshift(val);
587
+ }
588
+ currentPath = currentPath.parent;
589
+ }
590
+ return parts;
577
591
  }
578
592
 
579
593
  var DynamicFormArrayModel = /** @class */ (function (_super) {
@@ -1271,6 +1285,15 @@
1271
1285
  this.formService.clearFormArray(formArray, formArrayModel);
1272
1286
  this.changeDetectorRef.detectChanges();
1273
1287
  };
1288
+ DynamicBaseFormComponent.prototype.getClass = function (model) {
1289
+ var parts = collectPathAble(model, function (p) { return p.id; });
1290
+ if (parts.length == 0)
1291
+ return "";
1292
+ if (model instanceof core.DynamicFormGroupModel) {
1293
+ return "form-group-" + parts.join("-");
1294
+ }
1295
+ return "form-control-" + parts.join("-");
1296
+ };
1274
1297
  DynamicBaseFormComponent.prototype.validate = function (showErrors) {
1275
1298
  var _this = this;
1276
1299
  if (showErrors === void 0) { showErrors = true; }
@@ -1339,6 +1362,59 @@
1339
1362
  ngForm: [{ type: core$1.ViewChild, args: [forms.NgForm,] }]
1340
1363
  };
1341
1364
 
1365
+ var DynamicBaseFormArrayComponent = /** @class */ (function (_super) {
1366
+ __extends(DynamicBaseFormArrayComponent, _super);
1367
+ function DynamicBaseFormArrayComponent(layoutService, validationService) {
1368
+ var _this = _super.call(this, layoutService, validationService) || this;
1369
+ _this.layoutService = layoutService;
1370
+ _this.validationService = validationService;
1371
+ _this.blur = new core$1.EventEmitter();
1372
+ _this.change = new core$1.EventEmitter();
1373
+ _this.customEvent = new core$1.EventEmitter();
1374
+ _this.focus = new core$1.EventEmitter();
1375
+ return _this;
1376
+ }
1377
+ DynamicBaseFormArrayComponent.prototype.getClass = function (context, place, model) {
1378
+ return [
1379
+ context == "element" ? this.getModelClass(model) : null,
1380
+ _super.prototype.getClass.call(this, context, place, model)
1381
+ ].filter(function (cls) { return !!cls; }).join(" ");
1382
+ };
1383
+ DynamicBaseFormArrayComponent.prototype.getModelClass = function (model) {
1384
+ var parts = collectPathAble(model, function (p) { return p.id; });
1385
+ if (parts.length == 0)
1386
+ return "";
1387
+ if (model instanceof core.DynamicFormGroupModel) {
1388
+ return "form-group-" + parts.join("-");
1389
+ }
1390
+ return "form-control-" + parts.join("-");
1391
+ };
1392
+ return DynamicBaseFormArrayComponent;
1393
+ }(core.DynamicFormArrayComponent));
1394
+ DynamicBaseFormArrayComponent.decorators = [
1395
+ { type: core$1.Component, args: [{
1396
+ selector: "dynamic-base-form-array",
1397
+ template: "",
1398
+ changeDetection: core$1.ChangeDetectionStrategy.OnPush
1399
+ },] }
1400
+ ];
1401
+ DynamicBaseFormArrayComponent.ctorParameters = function () { return [
1402
+ { type: core.DynamicFormLayoutService },
1403
+ { type: core.DynamicFormValidationService }
1404
+ ]; };
1405
+ DynamicBaseFormArrayComponent.propDecorators = {
1406
+ formLayout: [{ type: core$1.Input }],
1407
+ group: [{ type: core$1.Input }],
1408
+ layout: [{ type: core$1.Input }],
1409
+ model: [{ type: core$1.Input }],
1410
+ templates: [{ type: core$1.Input }],
1411
+ blur: [{ type: core$1.Output }],
1412
+ change: [{ type: core$1.Output }],
1413
+ customEvent: [{ type: core$1.Output }],
1414
+ focus: [{ type: core$1.Output }],
1415
+ components: [{ type: core$1.ViewChildren, args: [core$1.forwardRef(function () { return core.DynamicFormControlContainerComponent; }),] }]
1416
+ };
1417
+
1342
1418
  var DynamicBaseFormControlContainerComponent = /** @class */ (function (_super) {
1343
1419
  __extends(DynamicBaseFormControlContainerComponent, _super);
1344
1420
  function DynamicBaseFormControlContainerComponent(form, changeDetectorRef, componentFactoryResolver, layoutService, validationService, componentService, relationService) {
@@ -1402,6 +1478,16 @@
1402
1478
  _super.prototype.ngOnDestroy.call(this);
1403
1479
  this.onDetectChanges.unsubscribe();
1404
1480
  };
1481
+ DynamicBaseFormControlContainerComponent.prototype.getLabel = function () {
1482
+ var _a;
1483
+ var label = collectPathAble(this.model, function (p) { return p.label; });
1484
+ if (label.length == 0)
1485
+ return "";
1486
+ if ((_a = this.form) === null || _a === void 0 ? void 0 : _a.labelPrefix) {
1487
+ label.unshift(this.form.labelPrefix);
1488
+ }
1489
+ return label.join(".");
1490
+ };
1405
1491
  DynamicBaseFormControlContainerComponent.prototype.createFormControlComponent = function () {
1406
1492
  var _a;
1407
1493
  _super.prototype.createFormControlComponent.call(this);
@@ -1446,24 +1532,65 @@
1446
1532
  componentViewContainerRef: [{ type: core$1.ViewChild, args: ["componentViewContainer", { read: core$1.ViewContainerRef, static: true },] }]
1447
1533
  };
1448
1534
 
1449
- var DynamicFormValidationService = /** @class */ (function (_super) {
1450
- __extends(DynamicFormValidationService, _super);
1451
- function DynamicFormValidationService() {
1452
- return _super !== null && _super.apply(this, arguments) || this;
1535
+ var DynamicBaseFormGroupComponent = /** @class */ (function (_super) {
1536
+ __extends(DynamicBaseFormGroupComponent, _super);
1537
+ function DynamicBaseFormGroupComponent(layoutService, validationService) {
1538
+ var _this = _super.call(this, layoutService, validationService) || this;
1539
+ _this.layoutService = layoutService;
1540
+ _this.validationService = validationService;
1541
+ _this.blur = new core$1.EventEmitter();
1542
+ _this.change = new core$1.EventEmitter();
1543
+ _this.customEvent = new core$1.EventEmitter();
1544
+ _this.focus = new core$1.EventEmitter();
1545
+ return _this;
1453
1546
  }
1454
- DynamicFormValidationService.prototype.showErrorMessages = function (control, model, hasFocus) {
1455
- return _super.prototype.showErrorMessages.call(this, control, model, hasFocus);
1547
+ DynamicBaseFormGroupComponent.prototype.getClass = function (context, place, model) {
1548
+ return [
1549
+ context == "element" ? this.getModelClass(model) : null,
1550
+ _super.prototype.getClass.call(this, context, place, model)
1551
+ ].filter(function (cls) { return !!cls; }).join(" ");
1456
1552
  };
1457
- return DynamicFormValidationService;
1458
- }(core.DynamicFormValidationService));
1459
- DynamicFormValidationService.decorators = [
1460
- { type: core$1.Injectable }
1461
- ];
1553
+ DynamicBaseFormGroupComponent.prototype.getModelClass = function (model) {
1554
+ var parts = collectPathAble(model, function (p) { return p.id; });
1555
+ if (parts.length == 0)
1556
+ return "";
1557
+ if (model instanceof core.DynamicFormGroupModel) {
1558
+ return "form-group-" + parts.join("-");
1559
+ }
1560
+ return "form-control-" + parts.join("-");
1561
+ };
1562
+ return DynamicBaseFormGroupComponent;
1563
+ }(core.DynamicFormGroupComponent));
1564
+ DynamicBaseFormGroupComponent.decorators = [
1565
+ { type: core$1.Component, args: [{
1566
+ selector: "dynamic-base-form-group",
1567
+ template: "",
1568
+ changeDetection: core$1.ChangeDetectionStrategy.OnPush
1569
+ },] }
1570
+ ];
1571
+ DynamicBaseFormGroupComponent.ctorParameters = function () { return [
1572
+ { type: core.DynamicFormLayoutService },
1573
+ { type: core.DynamicFormValidationService }
1574
+ ]; };
1575
+ DynamicBaseFormGroupComponent.propDecorators = {
1576
+ formLayout: [{ type: core$1.Input }],
1577
+ group: [{ type: core$1.Input }],
1578
+ layout: [{ type: core$1.Input }],
1579
+ model: [{ type: core$1.Input }],
1580
+ templates: [{ type: core$1.Input }],
1581
+ blur: [{ type: core$1.Output }],
1582
+ change: [{ type: core$1.Output }],
1583
+ customEvent: [{ type: core$1.Output }],
1584
+ focus: [{ type: core$1.Output }],
1585
+ components: [{ type: core$1.ViewChildren, args: [core$1.forwardRef(function () { return core.DynamicFormControlContainerComponent; }),] }]
1586
+ };
1462
1587
 
1463
1588
  // --- Components ---
1464
1589
  var components = [
1465
1590
  DynamicBaseFormComponent,
1466
- DynamicBaseFormControlContainerComponent
1591
+ DynamicBaseFormArrayComponent,
1592
+ DynamicBaseFormControlContainerComponent,
1593
+ DynamicBaseFormGroupComponent
1467
1594
  ];
1468
1595
  // --- Directives ---
1469
1596
  var directives = [
@@ -1488,14 +1615,9 @@
1488
1615
  ngModule: NgxDynamicFormModule,
1489
1616
  providers: [
1490
1617
  DynamicFormService,
1491
- DynamicFormValidationService,
1492
1618
  {
1493
1619
  provide: core.DynamicFormService,
1494
1620
  useExisting: DynamicFormService
1495
- },
1496
- {
1497
- provide: core.DynamicFormValidationService,
1498
- useExisting: DynamicFormValidationService
1499
1621
  }
1500
1622
  ]
1501
1623
  };
@@ -1537,8 +1659,10 @@
1537
1659
  */
1538
1660
 
1539
1661
  exports.AsyncSubmitDirective = AsyncSubmitDirective;
1662
+ exports.DynamicBaseFormArrayComponent = DynamicBaseFormArrayComponent;
1540
1663
  exports.DynamicBaseFormComponent = DynamicBaseFormComponent;
1541
1664
  exports.DynamicBaseFormControlContainerComponent = DynamicBaseFormControlContainerComponent;
1665
+ exports.DynamicBaseFormGroupComponent = DynamicBaseFormGroupComponent;
1542
1666
  exports.DynamicFormService = DynamicFormService;
1543
1667
  exports.FormFieldSet = FormFieldSet;
1544
1668
  exports.FormFile = FormFile;
@@ -1570,7 +1694,6 @@
1570
1694
  exports.ɵa = components;
1571
1695
  exports.ɵb = directives;
1572
1696
  exports.ɵc = pipes;
1573
- exports.ɵd = DynamicFormValidationService;
1574
1697
 
1575
1698
  Object.defineProperty(exports, '__esModule', { value: true });
1576
1699