@osovitny/anatoly 2.14.20 → 2.14.22

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.
@@ -18,6 +18,7 @@ import Swal from 'sweetalert2';
18
18
  import { v4 } from 'uuid';
19
19
  import * as i1$2 from 'ngx-toastr';
20
20
  import * as i1$4 from '@angular/platform-browser';
21
+ import * as $$1 from 'jquery';
21
22
  import * as i1$5 from '@angular/forms';
22
23
  import { FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
23
24
  import * as i1$6 from 'angular-froala-wysiwyg';
@@ -1650,6 +1651,159 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
1650
1651
  type: Injectable
1651
1652
  }], ctorParameters: function () { return [{ type: i1.Router }]; } });
1652
1653
 
1654
+ /*
1655
+ <file>
1656
+ Project:
1657
+ @osovitny/anatoly
1658
+
1659
+ Authors:
1660
+ Vadim Osovitny
1661
+ Anatoly Osovitny
1662
+
1663
+ Created:
1664
+ 8 Aug 2022
1665
+
1666
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1667
+ </file>
1668
+ */
1669
+ class DOM {
1670
+ //Private
1671
+ static dir(elem, dir, until = null, selector = null) {
1672
+ let matched = [];
1673
+ let truncate = until !== undefined && until != null;
1674
+ while ((elem = elem[dir]) && elem.nodeType !== 9) {
1675
+ if (elem.nodeType === 1) {
1676
+ /*
1677
+ if (truncate && jQuery(elem).is(until)) {
1678
+ break;
1679
+ }
1680
+ */
1681
+ if (selector) {
1682
+ let className = selector.replace('.', '');
1683
+ if (elem.classList.contains(className)) {
1684
+ matched.push(elem);
1685
+ }
1686
+ }
1687
+ else {
1688
+ matched.push(elem);
1689
+ }
1690
+ }
1691
+ }
1692
+ return matched;
1693
+ }
1694
+ //Public
1695
+ static first(elements) {
1696
+ if (!elements || elements.length == 0) {
1697
+ return null;
1698
+ }
1699
+ return elements[0];
1700
+ }
1701
+ static any(elements) {
1702
+ if (!elements || elements.length == 0) {
1703
+ return false;
1704
+ }
1705
+ return true;
1706
+ }
1707
+ static parent(elem) {
1708
+ let parentElement = elem.parentElement;
1709
+ let parentNode = elem.parentNode;
1710
+ return parentNode && parentNode.nodeType !== 11 ? parentElement : null;
1711
+ }
1712
+ static parents(elem, selector = null) {
1713
+ return this.dir(elem, "parentNode", null, selector);
1714
+ }
1715
+ static findInDocument(selector) {
1716
+ let parent = $$1(document);
1717
+ return $$1(parent).find(selector).get();
1718
+ }
1719
+ static find(elem, selector) {
1720
+ return $$1(elem).find(selector).get();
1721
+ }
1722
+ static remove(nodes) {
1723
+ if (nodes == null) {
1724
+ return;
1725
+ }
1726
+ if (!Array.isArray(nodes)) {
1727
+ if (nodes.parentNode) {
1728
+ nodes.parentNode.removeChild(nodes);
1729
+ }
1730
+ return;
1731
+ }
1732
+ if (nodes.length == 0) {
1733
+ return;
1734
+ }
1735
+ let node;
1736
+ let i = 0;
1737
+ for (; (node = nodes[i]) != null; i++) {
1738
+ if (node.parentNode) {
1739
+ node.parentNode.removeChild(node);
1740
+ }
1741
+ }
1742
+ }
1743
+ static findAndRemove(element, selector) {
1744
+ this.remove(this.find(element, selector));
1745
+ }
1746
+ static show(elem) {
1747
+ $$1(elem).show();
1748
+ }
1749
+ static hide(elem) {
1750
+ $$1(elem).hide();
1751
+ }
1752
+ static each(selector, action) {
1753
+ let parent = $$1(document);
1754
+ let elems = DOM.find(parent, selector);
1755
+ for (let i = 0; i < elems.length; i++) {
1756
+ let elem = elems[i];
1757
+ action(elem);
1758
+ }
1759
+ }
1760
+ //Css
1761
+ /*
1762
+ public static addClass(e: Element, className: string): Element {
1763
+ const class = e.getAttribute('class');
1764
+ if (class === null || class === '') {
1765
+ e.setAttribute('class', className);
1766
+ } else if (!DOM.hasClass(e, className)) {
1767
+ e.setAttribute('class', `${class} ${className}`);
1768
+ }
1769
+
1770
+ return e;
1771
+ }
1772
+
1773
+ public static removeClass(e: Element, className: string): Element {
1774
+ const class = e.getAttribute('class')
1775
+ if (class !== null && class !== '') {
1776
+ if (class === className) {
1777
+ e.setAttribute('class', '');
1778
+ } else {
1779
+ const result = class
1780
+ .split(' ')
1781
+ .filter((s: any) => s !== className)
1782
+ .join(' ');
1783
+ e.setAttribute('class', result);
1784
+ }
1785
+ }
1786
+
1787
+ return e;
1788
+ }
1789
+
1790
+ public static hasClass(e: Element, className: string): boolean {
1791
+ const class = e.getAttribute('class') || '';
1792
+ const r = new RegExp(`\\b${className}\\b`, '');
1793
+ return r.test(class);
1794
+ }
1795
+ */
1796
+ static addClass(elem, classNames) {
1797
+ $$1(elem).addClass(classNames);
1798
+ }
1799
+ static removeClass(elem, classNames) {
1800
+ $$1(elem).removeClass(classNames);
1801
+ }
1802
+ static hasClass(elem, className) {
1803
+ $$1(elem).hasClass(className);
1804
+ }
1805
+ }
1806
+
1653
1807
  /*
1654
1808
  <file>
1655
1809
  Project:
@@ -3736,28 +3890,34 @@ class UrlSlugComponent extends BaseEditComponent {
3736
3890
  constructor() {
3737
3891
  super();
3738
3892
  //Inputs
3739
- this.title = 'Permalink';
3893
+ this.title = 'Permalink:';
3740
3894
  this.isTitleVisible = true;
3895
+ //Outputs
3896
+ this.generating = new EventEmitter();
3741
3897
  }
3742
3898
  ngOnInit() {
3743
3899
  this.setWatchers();
3744
3900
  }
3745
3901
  setWatchers() {
3746
- this.formGroup.get(this.watchedControlName).valueChanges.subscribe(val => {
3747
- this.generateUrlSlug();
3748
- });
3902
+ if (this.watchedControlName) {
3903
+ this.formGroup.get(this.watchedControlName).valueChanges.subscribe(val => {
3904
+ this.generateUrlSlug();
3905
+ });
3906
+ }
3749
3907
  }
3750
3908
  generateUrlSlug() {
3751
3909
  let name = this.getFormValue(this.watchedControlName);
3752
3910
  let slugedText = Utils.slugify(name);
3753
- this.setFormValue(this.controlName, slugedText);
3911
+ let event = { urlSlug: slugedText };
3912
+ this.generating.emit(event);
3913
+ this.setFormValue(this.controlName, event.urlSlug);
3754
3914
  }
3755
3915
  }
3756
3916
  UrlSlugComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: UrlSlugComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3757
- 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"] }] });
3917
+ 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" }, 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' (generating)='generateUrlSlug()'/>\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"] }] });
3758
3918
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImport: i0, type: UrlSlugComponent, decorators: [{
3759
3919
  type: Component,
3760
- 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" }]
3920
+ 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' (generating)='generateUrlSlug()'/>\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" }]
3761
3921
  }], ctorParameters: function () { return []; }, propDecorators: { title: [{
3762
3922
  type: Input
3763
3923
  }], isTitleVisible: [{
@@ -3772,6 +3932,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
3772
3932
  type: Input
3773
3933
  }], urlPrefix: [{
3774
3934
  type: Input
3935
+ }], generating: [{
3936
+ type: Output
3775
3937
  }] } });
3776
3938
 
3777
3939
  /*
@@ -4287,5 +4449,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.6", ngImpor
4287
4449
  * Generated bundle index. Do not edit.
4288
4450
  */
4289
4451
 
4290
- export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BillingApiService, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CompanyComponent, ContactUsDialog, ContactUsForm, ContextInitState, Convert, CoreApiService, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, GoogleAnalyticsService, Guid, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, NotificationsApiService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, TranslateModuleAtRoot, UpgradePlanButtonComponent, UrlSlugComponent, Urls, Utils, ValidationSummaryComponent, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
4452
+ export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BillingApiService, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CompanyComponent, ContactUsDialog, ContactUsForm, ContextInitState, Convert, CoreApiService, DOM, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, GoogleAnalyticsService, Guid, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, NotificationsApiService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, TranslateModuleAtRoot, UpgradePlanButtonComponent, UrlSlugComponent, Urls, Utils, ValidationSummaryComponent, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
4291
4453
  //# sourceMappingURL=osovitny-anatoly.mjs.map