@tft/crispr-forms 12.2.19 → 12.2.20

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.
@@ -1462,7 +1462,7 @@
1462
1462
  };
1463
1463
 
1464
1464
  var defaultConfig = {
1465
- addItemLabel: 'ADD ITEM',
1465
+ addButtonLabel: 'ADD ITEM',
1466
1466
  minListLength: 1,
1467
1467
  };
1468
1468
  var FormGroupListMixin = crisprControlMixin(CrisprFieldComponent);
@@ -1481,7 +1481,7 @@
1481
1481
  FormGroupListComponent.prototype.setControlValue = function (values) {
1482
1482
  var _this = this;
1483
1483
  if (this.control) {
1484
- if (values) {
1484
+ if ((values === null || values === void 0 ? void 0 : values.length) > 0) {
1485
1485
  values.forEach(function (value) { return _this.addGroup(value); });
1486
1486
  }
1487
1487
  else if (this.config.displayInitialItem) {
@@ -1501,7 +1501,7 @@
1501
1501
  FormGroupListComponent.decorators = [
1502
1502
  { type: core.Component, args: [{
1503
1503
  selector: 'crispr-form-group-list',
1504
- template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- TODO: add sortBy function -->\n <div *ngFor=\"let control of formArray?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\" *ngIf=\"config.itemLabelBuilder\"> {{ config.itemLabelBuilder(i) }} </span>\n <button\n mat-icon-button\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"deleteGroup(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroupName]=\"i\">\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [config]=\"field\"\n [value]=\"value && value[i] | initialControlValue : field\"\n [group]=\"control\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"addGroup()\">\n {{config.addItemLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n",
1504
+ template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- TODO: add sortBy function -->\n <div *ngFor=\"let control of formArray?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\" *ngIf=\"config.itemLabelBuilder\"> {{ config.itemLabelBuilder(i) }} </span>\n <button\n mat-icon-button\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"deleteGroup(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroupName]=\"i\">\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [config]=\"field\"\n [value]=\"value && value[i] | initialControlValue : field\"\n [group]=\"control\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"addGroup()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n",
1505
1505
  changeDetection: core.ChangeDetectionStrategy.OnPush,
1506
1506
  styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}"]
1507
1507
  },] }