@osovitny/anatoly 2.14.21 → 2.14.23

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.
@@ -3890,32 +3890,46 @@ class UrlSlugComponent extends BaseEditComponent {
3890
3890
  constructor() {
3891
3891
  super();
3892
3892
  //Inputs
3893
- this.title = 'Permalink';
3893
+ this.title = 'Permalink:';
3894
3894
  this.isTitleVisible = true;
3895
+ this.isButtonVisible = true;
3896
+ //Outputs
3897
+ this.generating = new EventEmitter();
3895
3898
  }
3896
3899
  ngOnInit() {
3897
3900
  this.setWatchers();
3898
3901
  }
3899
3902
  setWatchers() {
3900
- this.formGroup.get(this.watchedControlName).valueChanges.subscribe(val => {
3901
- this.generateUrlSlug();
3902
- });
3903
+ if (this.watchedControlName) {
3904
+ this.formGroup.get(this.watchedControlName).valueChanges.subscribe(val => {
3905
+ let text = this.getFormValue(this.watchedControlName);
3906
+ this.generateUrlSlug(text);
3907
+ });
3908
+ }
3903
3909
  }
3904
- generateUrlSlug() {
3905
- let name = this.getFormValue(this.watchedControlName);
3906
- let slugedText = Utils.slugify(name);
3907
- this.setFormValue(this.controlName, slugedText);
3910
+ generateUrlSlug(text) {
3911
+ let slugedText = Utils.slugify(text);
3912
+ let event = { urlSlug: slugedText };
3913
+ this.generating.emit(event);
3914
+ this.setFormValue(this.controlName, event.urlSlug);
3915
+ this.hrefGo = `${event.urlSlug}`;
3916
+ }
3917
+ onUrlSlugChange() {
3918
+ let text = this.getFormValue(this.controlName);
3919
+ this.generateUrlSlug(text);
3908
3920
  }
3909
3921
  }
3910
3922
  UrlSlugComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: UrlSlugComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3911
- UrlSlugComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: UrlSlugComponent, selector: "anatoly-forms-urlslug", inputs: { title: "title", isTitleVisible: "isTitleVisible", controlName: "controlName", controlTitle: "controlTitle", class: "class", watchedControlName: "watchedControlName", urlPrefix: "urlPrefix" }, usesInheritance: true, ngImport: i0, template: "<div [formGroup]='formGroup' class=\"{'has-error': isControlInvalid(controlName)} form-group {{class}}\">\r\n <label *ngIf='isTitleVisible' class='col-form-label'>{{ title }} <strong>{{ urlPrefix }} </strong></label>\r\n <input [formControlName]='controlName' type='text' placeholder='Type url slug here' class='form-control' />\r\n <anatoly-item-validation-summary [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'\r\n [controlName]='controlName'\r\n [controlTitle]='controlTitle'>\r\n </anatoly-item-validation-summary>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: NativeElementDirective, selector: "[formControl], [formControlName]" }, { kind: "component", type: ItemValidationSummaryComponent, selector: "anatoly-item-validation-summary", inputs: ["controlName", "controlTitle"] }] });
3923
+ UrlSlugComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.6", type: UrlSlugComponent, selector: "anatoly-forms-urlslug", inputs: { title: "title", isTitleVisible: "isTitleVisible", isButtonVisible: "isButtonVisible", controlName: "controlName", controlTitle: "controlTitle", class: "class", watchedControlName: "watchedControlName", urlPrefix: "urlPrefix" }, outputs: { generating: "generating" }, usesInheritance: true, ngImport: i0, template: "<div [formGroup]='formGroup' class=\"d-flex permalink form-group {'has-error': isControlInvalid(controlName)} {{class}}\">\r\n <label *ngIf='isTitleVisible' class='col-form-label'> {{ title }} <span> {{ urlPrefix }} </span></label>\r\n <input [formControlName]='controlName' type='text' placeholder='Type url slug here' class='form-control' (keyup)=onUrlSlugChange()/>\r\n <a *ngIf=\"isButtonVisible\" href=\"{{urlPrefix}}{{hrefGo}}\" target=\"_blank\" class=\"btn btn-outline-primary\">Go</a>\r\n <anatoly-item-validation-summary [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'\r\n [controlName]='controlName'\r\n [controlTitle]='controlTitle'>\r\n </anatoly-item-validation-summary>\r\n</div>\r\n\r\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$5.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$5.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$5.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: NativeElementDirective, selector: "[formControl], [formControlName]" }, { kind: "component", type: ItemValidationSummaryComponent, selector: "anatoly-item-validation-summary", inputs: ["controlName", "controlTitle"] }] });
3912
3924
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: UrlSlugComponent, decorators: [{
3913
3925
  type: Component,
3914
- args: [{ selector: 'anatoly-forms-urlslug', template: "<div [formGroup]='formGroup' class=\"{'has-error': isControlInvalid(controlName)} form-group {{class}}\">\r\n <label *ngIf='isTitleVisible' class='col-form-label'>{{ title }} <strong>{{ urlPrefix }} </strong></label>\r\n <input [formControlName]='controlName' type='text' placeholder='Type url slug here' class='form-control' />\r\n <anatoly-item-validation-summary [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'\r\n [controlName]='controlName'\r\n [controlTitle]='controlTitle'>\r\n </anatoly-item-validation-summary>\r\n</div>\r\n" }]
3926
+ args: [{ selector: 'anatoly-forms-urlslug', template: "<div [formGroup]='formGroup' class=\"d-flex permalink form-group {'has-error': isControlInvalid(controlName)} {{class}}\">\r\n <label *ngIf='isTitleVisible' class='col-form-label'> {{ title }} <span> {{ urlPrefix }} </span></label>\r\n <input [formControlName]='controlName' type='text' placeholder='Type url slug here' class='form-control' (keyup)=onUrlSlugChange()/>\r\n <a *ngIf=\"isButtonVisible\" href=\"{{urlPrefix}}{{hrefGo}}\" target=\"_blank\" class=\"btn btn-outline-primary\">Go</a>\r\n <anatoly-item-validation-summary [formGroup]='formGroup'\r\n [formSubmitted]='formSubmitted'\r\n [controlName]='controlName'\r\n [controlTitle]='controlTitle'>\r\n </anatoly-item-validation-summary>\r\n</div>\r\n\r\n" }]
3915
3927
  }], ctorParameters: function () { return []; }, propDecorators: { title: [{
3916
3928
  type: Input
3917
3929
  }], isTitleVisible: [{
3918
3930
  type: Input
3931
+ }], isButtonVisible: [{
3932
+ type: Input
3919
3933
  }], controlName: [{
3920
3934
  type: Input
3921
3935
  }], controlTitle: [{
@@ -3926,6 +3940,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
3926
3940
  type: Input
3927
3941
  }], urlPrefix: [{
3928
3942
  type: Input
3943
+ }], generating: [{
3944
+ type: Output
3929
3945
  }] } });
3930
3946
 
3931
3947
  /*