@osovitny/anatoly 3.16.79 → 3.16.81

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.
@@ -3299,9 +3299,9 @@ class EditComponentBase extends ComponentBase {
3299
3299
  if (!fg) {
3300
3300
  return false;
3301
3301
  }
3302
- if (fg.get(name)) {
3303
- return ((this.formSubmitted && fg.get(name).invalid) ||
3304
- (fg.get(name).touched && fg.get(name).invalid));
3302
+ let control = fg.get(name);
3303
+ if (control) {
3304
+ return ((this.formSubmitted && control.invalid) || (control.touched && control.invalid));
3305
3305
  }
3306
3306
  return false;
3307
3307
  }
@@ -4990,9 +4990,7 @@ class ValidationSummaryComponent extends EditComponentBase {
4990
4990
  getControlTitle(control) {
4991
4991
  if (control?.nativeElement) {
4992
4992
  let controlTitle = this.getTitleAttribute(control.nativeElement);
4993
- if (controlTitle) {
4994
- return controlTitle;
4995
- }
4993
+ return controlTitle;
4996
4994
  }
4997
4995
  return undefined;
4998
4996
  }
@@ -5060,27 +5058,24 @@ function ItemValidationSummaryComponent_ul_0_Template(rf, ctx) { if (rf & 1) {
5060
5058
  } if (rf & 2) {
5061
5059
  const ctx_r0 = i0.ɵɵnextContext();
5062
5060
  i0.ɵɵadvance(1);
5063
- i0.ɵɵproperty("ngForOf", ctx_r0.getValidationMessages(ctx_r0.formGroup.get(ctx_r0.controlName), ctx_r0.controlTitle));
5061
+ i0.ɵɵproperty("ngForOf", ctx_r0.getValidationMessages(ctx_r0.formGroup.get(ctx_r0.formControlName), ctx_r0.formControlTitle));
5064
5062
  } }
5065
5063
  class ItemValidationSummaryComponent extends ValidationSummaryComponent {
5066
- controlName;
5067
- controlTitle;
5068
- constructor() {
5069
- super();
5070
- }
5071
- static ɵfac = function ItemValidationSummaryComponent_Factory(t) { return new (t || ItemValidationSummaryComponent)(); };
5072
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ItemValidationSummaryComponent, selectors: [["anatoly-item-validation-summary"]], inputs: { controlName: "controlName", controlTitle: "controlTitle" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["class", "list-unstyled", 4, "ngIf"], [1, "list-unstyled"], [4, "ngFor", "ngForOf"], [1, "help-block"]], template: function ItemValidationSummaryComponent_Template(rf, ctx) { if (rf & 1) {
5064
+ formControlName;
5065
+ formControlTitle;
5066
+ static ɵfac = /*@__PURE__*/ function () { let ɵItemValidationSummaryComponent_BaseFactory; return function ItemValidationSummaryComponent_Factory(t) { return (ɵItemValidationSummaryComponent_BaseFactory || (ɵItemValidationSummaryComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ItemValidationSummaryComponent)))(t || ItemValidationSummaryComponent); }; }();
5067
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ItemValidationSummaryComponent, selectors: [["anatoly-item-validation-summary"]], inputs: { formControlName: "formControlName", formControlTitle: "formControlTitle" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["class", "list-unstyled", 4, "ngIf"], [1, "list-unstyled"], [4, "ngFor", "ngForOf"], [1, "help-block"]], template: function ItemValidationSummaryComponent_Template(rf, ctx) { if (rf & 1) {
5073
5068
  i0.ɵɵtemplate(0, ItemValidationSummaryComponent_ul_0_Template, 2, 1, "ul", 0);
5074
5069
  } if (rf & 2) {
5075
- i0.ɵɵproperty("ngIf", ctx.isControlInvalid(ctx.controlName));
5070
+ i0.ɵɵproperty("ngIf", ctx.isControlInvalid(ctx.formControlName));
5076
5071
  } }, dependencies: [i1$2.NgForOf, i1$2.NgIf], encapsulation: 2 });
5077
5072
  }
5078
5073
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ItemValidationSummaryComponent, [{
5079
5074
  type: Component,
5080
- args: [{ selector: "anatoly-item-validation-summary", template: "<ul class=\"list-unstyled\" *ngIf=\"isControlInvalid(controlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(controlName), controlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n\r\n" }]
5081
- }], function () { return []; }, { controlName: [{
5075
+ args: [{ selector: "anatoly-item-validation-summary", template: "<ul class=\"list-unstyled\" *ngIf=\"isControlInvalid(formControlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(formControlName), formControlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n\r\n" }]
5076
+ }], null, { formControlName: [{
5082
5077
  type: Input
5083
- }], controlTitle: [{
5078
+ }], formControlTitle: [{
5084
5079
  type: Input
5085
5080
  }] }); })();
5086
5081
 
@@ -5112,7 +5107,7 @@ class FormsHtmlEditorComponent extends HtmlEditorComponentBase {
5112
5107
  });
5113
5108
  }
5114
5109
  static ɵfac = function FormsHtmlEditorComponent_Factory(t) { return new (t || FormsHtmlEditorComponent)(); };
5115
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormsHtmlEditorComponent, selectors: [["anatoly-forms-html-editor"]], inputs: { editorFormKey: "editorFormKey" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 11, consts: [[1, "form-group", 3, "formGroup", "ngClass"], [1, "col-form-label"], [3, "formControlName", "froalaEditor", "froalaInit"], [3, "formGroup", "formSubmitted", "controlName", "controlTitle"]], template: function FormsHtmlEditorComponent_Template(rf, ctx) { if (rf & 1) {
5110
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormsHtmlEditorComponent, selectors: [["anatoly-forms-html-editor"]], inputs: { editorFormKey: "editorFormKey" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 11, consts: [[1, "form-group", 3, "formGroup", "ngClass"], [1, "col-form-label"], [3, "formControlName", "froalaEditor", "froalaInit"], [3, "formGroup", "formSubmitted", "formControlName", "formControlTitle"]], template: function FormsHtmlEditorComponent_Template(rf, ctx) { if (rf & 1) {
5116
5111
  i0.ɵɵelementStart(0, "div", 0)(1, "label", 1);
5117
5112
  i0.ɵɵtext(2);
5118
5113
  i0.ɵɵelementEnd();
@@ -5128,12 +5123,12 @@ class FormsHtmlEditorComponent extends HtmlEditorComponentBase {
5128
5123
  i0.ɵɵadvance(1);
5129
5124
  i0.ɵɵproperty("formControlName", ctx.editorFormKey)("froalaEditor", ctx.options);
5130
5125
  i0.ɵɵadvance(1);
5131
- i0.ɵɵproperty("formGroup", ctx.formGroup)("formSubmitted", ctx.formSubmitted)("controlName", ctx.editorFormKey)("controlTitle", ctx.editorLabelText);
5126
+ i0.ɵɵproperty("formGroup", ctx.formGroup)("formSubmitted", ctx.formSubmitted)("formControlName", ctx.editorFormKey)("formControlTitle", ctx.editorLabelText);
5132
5127
  } }, dependencies: [i1$2.NgClass, i2.DefaultValueAccessor, i2.NgControlStatus, i2.NgControlStatusGroup, i2.FormGroupDirective, i2.FormControlName, i3.FroalaEditorDirective, NativeElementDirective, ItemValidationSummaryComponent], encapsulation: 2 });
5133
5128
  }
5134
5129
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormsHtmlEditorComponent, [{
5135
5130
  type: Component,
5136
- args: [{ selector: "anatoly-forms-html-editor", template: "<div [formGroup]=\"formGroup\" [ngClass]=\"{'has-error': isControlInvalid(editorFormKey) }\" class=\"form-group\" >\r\n <label class=\"col-form-label\">{{ editorLabelText }}</label>\r\n <textarea [formControlName]=\"editorFormKey\" [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\"></textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [controlName]=\"editorFormKey\"\r\n [controlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n</div>\r\n" }]
5131
+ args: [{ selector: "anatoly-forms-html-editor", template: "<div [formGroup]=\"formGroup\" [ngClass]=\"{'has-error': isControlInvalid(editorFormKey) }\" class=\"form-group\" >\r\n <label class=\"col-form-label\">{{ editorLabelText }}</label>\r\n <textarea [formControlName]=\"editorFormKey\" [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\"></textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [formControlName]=\"editorFormKey\"\r\n [formControlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n</div>\r\n" }]
5137
5132
  }], function () { return []; }, { editorFormKey: [{
5138
5133
  type: Input
5139
5134
  }] }); })();
@@ -5252,28 +5247,28 @@ class FormValidationSummaryComponent extends ValidationSummaryComponent {
5252
5247
  visible = false;
5253
5248
  customerrors = [];
5254
5249
  /*
5255
- 0 - only FormValidation messages
5256
- 1 - only Custom messages
5257
- 2 - all
5250
+ 0 - all
5251
+ 1 - only FormValidation messages
5252
+ 2 - only Custom messages
5258
5253
  */
5259
5254
  viewtype = 0;
5260
5255
  constructor() {
5261
5256
  super();
5262
5257
  }
5263
5258
  getErrors() {
5264
- if (this.viewtype == 1) {
5265
- return this.customerrors;
5266
- }
5259
+ let messages = [];
5267
5260
  let formValidationMessages = this.getFormValidationMessages();
5268
- if (this.viewtype == 0) {
5269
- return formValidationMessages;
5270
- }
5271
- var messages = [];
5272
- if (formValidationMessages.length > 0) {
5273
- messages.push(...formValidationMessages);
5274
- }
5275
- if (this.customerrors.length > 0) {
5276
- messages.push(...this.customerrors);
5261
+ switch (this.viewtype) {
5262
+ case 1:
5263
+ messages.push(...formValidationMessages);
5264
+ break;
5265
+ case 2:
5266
+ messages.push(...this.customerrors);
5267
+ break;
5268
+ default:
5269
+ messages.push(...formValidationMessages);
5270
+ messages.push(...this.customerrors);
5271
+ break;
5277
5272
  }
5278
5273
  return messages;
5279
5274
  }
@@ -6065,12 +6060,13 @@ class UrlSlugComponent extends EditComponentBase {
6065
6060
  //Inputs
6066
6061
  title = 'Permalink:';
6067
6062
  isTitleVisible = true;
6068
- controlName;
6069
- controlTitle;
6070
6063
  class;
6071
6064
  watchedControlName;
6072
6065
  urlPrefix;
6073
6066
  isGoButtonVisible = true;
6067
+ //Validation
6068
+ formControlName;
6069
+ formControlTitle;
6074
6070
  //Outputs
6075
6071
  generating = new EventEmitter();
6076
6072
  constructor() {
@@ -6083,7 +6079,7 @@ class UrlSlugComponent extends EditComponentBase {
6083
6079
  let slugedText = Utils.slugify(text);
6084
6080
  let event = { urlSlug: slugedText };
6085
6081
  this.generating.emit(event);
6086
- this.setFormValue(this.controlName, event.urlSlug);
6082
+ this.setFormValue(this.formControlName, event.urlSlug);
6087
6083
  }
6088
6084
  startWatching() {
6089
6085
  this.subs.sink = this.formGroup.get(this.watchedControlName).valueChanges.subscribe({
@@ -6095,7 +6091,7 @@ class UrlSlugComponent extends EditComponentBase {
6095
6091
  this.generateUrlSlug(value);
6096
6092
  }
6097
6093
  });
6098
- this.subs.sink = this.formGroup.get(this.controlName).valueChanges.subscribe({
6094
+ this.subs.sink = this.formGroup.get(this.formControlName).valueChanges.subscribe({
6099
6095
  next: (value) => {
6100
6096
  this.hrefGo = value;
6101
6097
  }
@@ -6103,11 +6099,11 @@ class UrlSlugComponent extends EditComponentBase {
6103
6099
  }
6104
6100
  //Events
6105
6101
  onUrlSlugChange() {
6106
- let text = this.getFormValue(this.controlName);
6102
+ let text = this.getFormValue(this.formControlName);
6107
6103
  this.generateUrlSlug(text);
6108
6104
  }
6109
6105
  static ɵfac = function UrlSlugComponent_Factory(t) { return new (t || UrlSlugComponent)(); };
6110
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UrlSlugComponent, selectors: [["anatoly-forms-urlslug"]], inputs: { title: "title", isTitleVisible: "isTitleVisible", controlName: "controlName", controlTitle: "controlTitle", class: "class", watchedControlName: "watchedControlName", urlPrefix: "urlPrefix", isGoButtonVisible: "isGoButtonVisible" }, outputs: { generating: "generating" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 7, vars: 14, consts: [[3, "formGroup", "ngClass"], [1, "d-flex", "align-items-end"], [3, "formGroup", "formSubmitted", "controlName", "controlTitle"], [1, "form-group"], ["class", "col-form-label", 4, "ngIf"], ["type", "text", "placeholder", "Type url slug here", 1, "form-control", 3, "formControlName", "focusout"], ["class", "form-group flex-shrink-1", 4, "ngIf"], [1, "col-form-label"], [1, "urlPrefix"], [1, "form-group", "flex-shrink-1"], ["target", "_blank", 1, "btn", "btn-primary", 3, "href"]], template: function UrlSlugComponent_Template(rf, ctx) { if (rf & 1) {
6106
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UrlSlugComponent, selectors: [["anatoly-forms-urlslug"]], inputs: { title: "title", isTitleVisible: "isTitleVisible", class: "class", watchedControlName: "watchedControlName", urlPrefix: "urlPrefix", isGoButtonVisible: "isGoButtonVisible", formControlName: "formControlName", formControlTitle: "formControlTitle" }, outputs: { generating: "generating" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 7, vars: 14, consts: [[3, "formGroup", "ngClass"], [1, "d-flex", "align-items-end"], [3, "formGroup", "formSubmitted", "formControlName", "formControlTitle"], [1, "form-group"], ["class", "col-form-label", 4, "ngIf"], ["type", "text", "placeholder", "Type url slug here", 1, "form-control", 3, "formControlName", "focusout"], ["class", "form-group flex-shrink-1", 4, "ngIf"], [1, "col-form-label"], [1, "urlPrefix"], [1, "form-group", "flex-shrink-1"], ["target", "_blank", 1, "btn", "btn-primary", 3, "href"]], template: function UrlSlugComponent_Template(rf, ctx) { if (rf & 1) {
6111
6107
  i0.ɵɵelementStart(0, "div", 0)(1, "div", 1);
6112
6108
  i0.ɵɵelement(2, "anatoly-item-validation-summary", 2);
6113
6109
  i0.ɵɵelementStart(3, "div", 3);
@@ -6119,28 +6115,24 @@ class UrlSlugComponent extends EditComponentBase {
6119
6115
  i0.ɵɵelementEnd()();
6120
6116
  } if (rf & 2) {
6121
6117
  i0.ɵɵclassMapInterpolate1("permalink form-group ", ctx.class, "");
6122
- i0.ɵɵproperty("formGroup", ctx.formGroup)("ngClass", i0.ɵɵpureFunction1(12, _c0, ctx.isControlInvalid(ctx.controlName)));
6118
+ i0.ɵɵproperty("formGroup", ctx.formGroup)("ngClass", i0.ɵɵpureFunction1(12, _c0, ctx.isControlInvalid(ctx.formControlName)));
6123
6119
  i0.ɵɵadvance(2);
6124
- i0.ɵɵproperty("formGroup", ctx.formGroup)("formSubmitted", ctx.formSubmitted)("controlName", ctx.controlName)("controlTitle", ctx.controlTitle);
6120
+ i0.ɵɵproperty("formGroup", ctx.formGroup)("formSubmitted", ctx.formSubmitted)("formControlName", ctx.formControlName)("formControlTitle", ctx.formControlTitle);
6125
6121
  i0.ɵɵadvance(2);
6126
6122
  i0.ɵɵproperty("ngIf", ctx.isTitleVisible);
6127
6123
  i0.ɵɵadvance(1);
6128
- i0.ɵɵproperty("formControlName", ctx.controlName);
6124
+ i0.ɵɵproperty("formControlName", ctx.formControlName);
6129
6125
  i0.ɵɵadvance(1);
6130
6126
  i0.ɵɵproperty("ngIf", ctx.isGoButtonVisible);
6131
6127
  } }, dependencies: [i1$2.NgClass, i1$2.NgIf, i2.DefaultValueAccessor, i2.NgControlStatus, i2.NgControlStatusGroup, i2.FormGroupDirective, i2.FormControlName, NativeElementDirective, ItemValidationSummaryComponent], encapsulation: 2 });
6132
6128
  }
6133
6129
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UrlSlugComponent, [{
6134
6130
  type: Component,
6135
- args: [{ selector: 'anatoly-forms-urlslug', template: "<div [formGroup]='formGroup' [ngClass]=\"{'has-error': isControlInvalid(controlName)}\"\r\n class=\"permalink form-group {{class}}\">\r\n <div class=\"d-flex align-items-end\">\r\n <anatoly-item-validation-summary [formGroup]='formGroup' [formSubmitted]='formSubmitted' [controlName]='controlName'\r\n [controlTitle]='controlTitle'>\r\n </anatoly-item-validation-summary>\r\n <div class=\"form-group\">\r\n <label *ngIf='isTitleVisible' class='col-form-label'>\r\n {{ title }}\r\n <span class=\"urlPrefix\">{{ urlPrefix }}</span>\r\n </label>\r\n <input type='text' class='form-control' [formControlName]='controlName' placeholder='Type url slug here'\r\n (focusout)='onUrlSlugChange()' />\r\n </div>\r\n\r\n <div class=\"form-group flex-shrink-1\" *ngIf=\"isGoButtonVisible\">\r\n <a href=\"{{urlPrefix}}{{hrefGo}}\" target=\"_blank\" class=\"btn btn-primary\">Go</a>\r\n </div>\r\n </div>\r\n</div>\r\n" }]
6131
+ args: [{ selector: 'anatoly-forms-urlslug', template: "<div [formGroup]='formGroup' [ngClass]=\"{'has-error': isControlInvalid(formControlName)}\"\r\n class=\"permalink form-group {{class}}\">\r\n <div class=\"d-flex align-items-end\">\r\n <anatoly-item-validation-summary\r\n [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'\r\n [formControlName]='formControlName'\r\n [formControlTitle]='formControlTitle'>\r\n </anatoly-item-validation-summary>\r\n\r\n <div class=\"form-group\">\r\n <label *ngIf='isTitleVisible' class='col-form-label'>\r\n {{ title }}\r\n <span class=\"urlPrefix\">{{ urlPrefix }}</span>\r\n </label>\r\n <input type='text' class='form-control' placeholder='Type url slug here'\r\n [formControlName]='formControlName' (focusout)='onUrlSlugChange()' />\r\n </div>\r\n\r\n <div class=\"form-group flex-shrink-1\" *ngIf=\"isGoButtonVisible\">\r\n <a href=\"{{urlPrefix}}{{hrefGo}}\" target=\"_blank\" class=\"btn btn-primary\">Go</a>\r\n </div>\r\n </div>\r\n</div>\r\n" }]
6136
6132
  }], function () { return []; }, { title: [{
6137
6133
  type: Input
6138
6134
  }], isTitleVisible: [{
6139
6135
  type: Input
6140
- }], controlName: [{
6141
- type: Input
6142
- }], controlTitle: [{
6143
- type: Input
6144
6136
  }], class: [{
6145
6137
  type: Input
6146
6138
  }], watchedControlName: [{
@@ -6149,6 +6141,10 @@ class UrlSlugComponent extends EditComponentBase {
6149
6141
  type: Input
6150
6142
  }], isGoButtonVisible: [{
6151
6143
  type: Input
6144
+ }], formControlName: [{
6145
+ type: Input
6146
+ }], formControlTitle: [{
6147
+ type: Input
6152
6148
  }], generating: [{
6153
6149
  type: Output
6154
6150
  }] }); })();