@osovitny/anatoly 2.15.6 → 2.15.8

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.
@@ -1,3 +1,4 @@
1
+ import js_beautify from 'js-beautify';
1
2
  import * as i0 from '@angular/core';
2
3
  import { Injectable, Pipe, APP_INITIALIZER, Injector, NgModule, Inject, Component, Input, EventEmitter, Output, ViewEncapsulation, Directive, ViewChild, HostBinding, HostListener, Optional, SkipSelf } from '@angular/core';
3
4
  import * as i1 from '@angular/router';
@@ -19,7 +20,6 @@ import { v4 } from 'uuid';
19
20
  import * as i1$2 from 'ngx-toastr';
20
21
  import { ToastrModule } from 'ngx-toastr';
21
22
  import * as i1$4 from '@angular/platform-browser';
22
- import js_beautify from 'js-beautify';
23
23
  import * as i1$6 from '@fortawesome/angular-fontawesome';
24
24
  import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
25
25
  import * as i1$7 from '@progress/kendo-angular-pager';
@@ -76,6 +76,143 @@ const Urls = {
76
76
  notificationsSocketUrl: '/hubs/notifications'
77
77
  };
78
78
 
79
+ /*
80
+ <file>
81
+ Project:
82
+ @osovitny/anatoly
83
+
84
+ Authors:
85
+ Vadim Osovitny vadim@osovitny.com
86
+ Anatoly Osovitny anatoly@osovitny.com
87
+
88
+ Created:
89
+ 29 June 2020
90
+
91
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
92
+ </file>
93
+ */
94
+ class Convert {
95
+ static pad(number) {
96
+ if (number < 10) {
97
+ return '0' + number;
98
+ }
99
+ return number;
100
+ }
101
+ static toLocalizedDateTime(value) {
102
+ if (value) {
103
+ return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
104
+ }
105
+ return null;
106
+ }
107
+ static enumToString(enumeration, value) {
108
+ for (let k in enumeration)
109
+ if (enumeration[k] == value)
110
+ return k;
111
+ return null;
112
+ }
113
+ static enumToArray(enumeration, notIncludes) {
114
+ const notIncludeFiler = (value) => {
115
+ if (isNaN(Number(value))) {
116
+ return false;
117
+ }
118
+ if (notIncludes) {
119
+ for (let i in notIncludes) {
120
+ if (notIncludes[i] == value)
121
+ return false;
122
+ }
123
+ }
124
+ return true;
125
+ };
126
+ return Object.keys(enumeration)
127
+ .filter(notIncludeFiler)
128
+ .map(key => ({
129
+ value: key,
130
+ text: enumeration[key]
131
+ }));
132
+ }
133
+ static stringToArray(str, separator = ',') {
134
+ if (str) {
135
+ return str.split(separator).filter(element => element);
136
+ }
137
+ return [];
138
+ }
139
+ static stringToIntArray(str, separator = ',') {
140
+ if (str) {
141
+ return str.split(separator).filter(element => element).map(value => parseInt(value));
142
+ }
143
+ return [];
144
+ }
145
+ static company2String(comp) {
146
+ let company = JSON.parse(comp);
147
+ if (company) {
148
+ return `${company.name} ${company.phone} ${company.email} ${company.websiteUrl}`;
149
+ }
150
+ }
151
+ static address2String(adr) {
152
+ let address = JSON.parse(adr);
153
+ return `${address.street} ${address.street2} ${address.city} ${address.stateOrRegion} ${address.zipcode} ${address.country}`;
154
+ }
155
+ static dateToString(date) {
156
+ return date.getFullYear() +
157
+ '-' + this.pad(date.getMonth() + 1) +
158
+ '-' + this.pad(date.getDate()) +
159
+ ' ' + this.pad(date.getHours()) +
160
+ ':' + this.pad(date.getMinutes()) +
161
+ ':' + this.pad(date.getSeconds());
162
+ }
163
+ static utcDateToLocalDate(d) {
164
+ let date = new Date(d);
165
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
166
+ }
167
+ static stringToBoolean(value) {
168
+ switch (value.toLowerCase().trim()) {
169
+ case "true":
170
+ case "yes":
171
+ case "1":
172
+ return true;
173
+ case "false":
174
+ case "no":
175
+ case "0":
176
+ case null:
177
+ return false;
178
+ default:
179
+ return Boolean(value);
180
+ }
181
+ }
182
+ }
183
+
184
+ /*
185
+ <file>
186
+ Project:
187
+ @osovitny/anatoly
188
+
189
+ Authors:
190
+ Vadim Osovitny vadim@osovitny.com
191
+ Anatoly Osovitny anatoly@osovitny.com
192
+
193
+ Created:
194
+ 10 Sep 2022
195
+
196
+ Code:
197
+ https://www.npmjs.com/package/js-beautify
198
+ https://beautifier.io
199
+
200
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
201
+ </file>
202
+ */
203
+ class XmlFormatter {
204
+ static toPrettyXML(s, options) {
205
+ if (!options) {
206
+ options = {
207
+ indent_size: 2,
208
+ indent_char: " ",
209
+ wrap_line_length: 110
210
+ };
211
+ }
212
+ return js_beautify.html(s, options);
213
+ }
214
+ }
215
+
79
216
  /*
80
217
  <file>
81
218
  Project:
@@ -341,111 +478,6 @@ AnatolyHttpInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: A
341
478
  }], function () { return [{ type: LoadingService }, { type: LoggingService }]; }, null);
342
479
  })();
343
480
 
344
- /*
345
- <file>
346
- Project:
347
- @osovitny/anatoly
348
-
349
- Authors:
350
- Vadim Osovitny vadim@osovitny.com
351
- Anatoly Osovitny anatoly@osovitny.com
352
-
353
- Created:
354
- 29 June 2020
355
-
356
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
357
- </file>
358
- */
359
- class Convert {
360
- static pad(number) {
361
- if (number < 10) {
362
- return '0' + number;
363
- }
364
- return number;
365
- }
366
- static toLocalizedDateTime(value) {
367
- if (value) {
368
- return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
369
- }
370
- return null;
371
- }
372
- static enumToString(enumeration, value) {
373
- for (let k in enumeration)
374
- if (enumeration[k] == value)
375
- return k;
376
- return null;
377
- }
378
- static enumToArray(enumeration, notIncludes) {
379
- const notIncludeFiler = (value) => {
380
- if (isNaN(Number(value))) {
381
- return false;
382
- }
383
- if (notIncludes) {
384
- for (let i in notIncludes) {
385
- if (notIncludes[i] == value)
386
- return false;
387
- }
388
- }
389
- return true;
390
- };
391
- return Object.keys(enumeration)
392
- .filter(notIncludeFiler)
393
- .map(key => ({
394
- value: key,
395
- text: enumeration[key]
396
- }));
397
- }
398
- static stringToArray(str, separator = ',') {
399
- if (str) {
400
- return str.split(separator).filter(element => element);
401
- }
402
- return [];
403
- }
404
- static stringToIntArray(str, separator = ',') {
405
- if (str) {
406
- return str.split(separator).filter(element => element).map(value => parseInt(value));
407
- }
408
- return [];
409
- }
410
- static company2String(comp) {
411
- let company = JSON.parse(comp);
412
- if (company) {
413
- return `${company.name} ${company.phone} ${company.email} ${company.websiteUrl}`;
414
- }
415
- }
416
- static address2String(adr) {
417
- let address = JSON.parse(adr);
418
- return `${address.street} ${address.street2} ${address.city} ${address.stateOrRegion} ${address.zipcode} ${address.country}`;
419
- }
420
- static dateToString(date) {
421
- return date.getFullYear() +
422
- '-' + this.pad(date.getMonth() + 1) +
423
- '-' + this.pad(date.getDate()) +
424
- ' ' + this.pad(date.getHours()) +
425
- ':' + this.pad(date.getMinutes()) +
426
- ':' + this.pad(date.getSeconds());
427
- }
428
- static utcDateToLocalDate(d) {
429
- let date = new Date(d);
430
- return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()));
431
- }
432
- static stringToBoolean(value) {
433
- switch (value.toLowerCase().trim()) {
434
- case "true":
435
- case "yes":
436
- case "1":
437
- return true;
438
- case "false":
439
- case "no":
440
- case "0":
441
- case null:
442
- return false;
443
- default:
444
- return Boolean(value);
445
- }
446
- }
447
- }
448
-
449
481
  /*
450
482
  <file>
451
483
  Project:
@@ -1232,6 +1264,56 @@ NotificationService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: Noti
1232
1264
  }], function () { return [{ type: i1$2.ToastrService }]; }, null);
1233
1265
  })();
1234
1266
 
1267
+ /*
1268
+ <file>
1269
+ Project:
1270
+ @osovitny/anatoly
1271
+
1272
+ Authors:
1273
+ Vadim Osovitny vadim@osovitny.com
1274
+ Anatoly Osovitny anatoly@osovitny.com
1275
+
1276
+ Created:
1277
+ 17 Apr 2023
1278
+
1279
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1280
+ </file>
1281
+ */
1282
+ class Stopwatch {
1283
+ constructor(name) {
1284
+ this.name = name;
1285
+ this.startTime = 0;
1286
+ this.stopTime = 0;
1287
+ this.running = false;
1288
+ this.performance = !!window.performance;
1289
+ console.log(this.name + ' started.');
1290
+ }
1291
+ currentTime() {
1292
+ return this.performance ? window.performance.now() : new Date().getTime();
1293
+ }
1294
+ start() {
1295
+ this.startTime = this.currentTime();
1296
+ this.running = true;
1297
+ }
1298
+ stop() {
1299
+ this.stopTime = this.currentTime();
1300
+ this.running = false;
1301
+ }
1302
+ getElapsedMilliseconds() {
1303
+ if (this.running) {
1304
+ this.stopTime = this.currentTime();
1305
+ }
1306
+ return this.stopTime - this.startTime;
1307
+ }
1308
+ getElapsedSeconds() {
1309
+ return this.getElapsedMilliseconds() / 1000;
1310
+ }
1311
+ printElapsedAsMilliseconds() {
1312
+ let elapsed = this.getElapsedMilliseconds();
1313
+ console.log(`${this.name} stopped. Execution time: ${elapsed} ms`);
1314
+ }
1315
+ }
1316
+
1235
1317
  /*
1236
1318
  <file>
1237
1319
  Project:
@@ -1714,38 +1796,6 @@ GoogleAnalyticsService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: G
1714
1796
  }], function () { return [{ type: i1.Router }]; }, null);
1715
1797
  })();
1716
1798
 
1717
- /*
1718
- <file>
1719
- Project:
1720
- @osovitny/anatoly
1721
-
1722
- Authors:
1723
- Vadim Osovitny vadim@osovitny.com
1724
- Anatoly Osovitny anatoly@osovitny.com
1725
-
1726
- Created:
1727
- 10 Sep 2022
1728
-
1729
- Code:
1730
- https://www.npmjs.com/package/js-beautify
1731
- https://beautifier.io
1732
-
1733
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
1734
- </file>
1735
- */
1736
- class XmlFormatter {
1737
- static toPrettyXML(s, options) {
1738
- if (!options) {
1739
- options = {
1740
- indent_size: 2,
1741
- indent_char: " ",
1742
- wrap_line_length: 110
1743
- };
1744
- }
1745
- return js_beautify.html(s, options);
1746
- }
1747
- }
1748
-
1749
1799
  /*
1750
1800
  <file>
1751
1801
  Project:
@@ -2019,6 +2069,9 @@ class Utils {
2019
2069
  static generateRandom(start, end) {
2020
2070
  return Math.floor(Math.random() * (end - start + 1)) + start;
2021
2071
  }
2072
+ static isObjectNullOrEmpty(obj) {
2073
+ return !obj || Object.keys(obj).length == 0;
2074
+ }
2022
2075
  }
2023
2076
 
2024
2077
  /*
@@ -4616,7 +4669,7 @@ ContactUsDialog.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ContactUsDi
4616
4669
  let _t;
4617
4670
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.contactUsForm = _t.first);
4618
4671
  }
4619
- }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["title", "Contact Us", 3, "width", "close", 4, "ngIf"], ["title", "Contact Us", 3, "width", "close"], [1, "k-content", "k-window-content", "k-dialog-content"], [3, "showActionButtons", "submit"], ["contactusform", ""], [1, "k-actions"], [1, "d-flex", "justify-content-end"], ["type", "button", 1, "btn", "btn-success", 3, "click"], ["type", "button", 1, "btn", "btn-danger", 3, "click"]], template: function ContactUsDialog_Template(rf, ctx) {
4672
+ }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["title", "Contact Us", 3, "width", "close", 4, "ngIf"], ["title", "Contact Us", 3, "width", "close"], [1, "k-content", "k-window-content", "k-dialog-content"], [3, "showActionButtons", "submit"], ["contactusform", ""], [1, "k-actions"], [1, "d-flex", "justify-content-end"], ["type", "button", 1, "btn", "btn-sm", "btn-success", 3, "click"], ["type", "button", 1, "btn", "btn-sm", "btn-danger", 3, "click"]], template: function ContactUsDialog_Template(rf, ctx) {
4620
4673
  if (rf & 1) {
4621
4674
  i0.ɵɵtemplate(0, ContactUsDialog_kendo_dialog_0_Template, 10, 2, "kendo-dialog", 0);
4622
4675
  }
@@ -4627,7 +4680,7 @@ ContactUsDialog.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ContactUsDi
4627
4680
  (function () {
4628
4681
  (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ContactUsDialog, [{
4629
4682
  type: Component,
4630
- args: [{ selector: 'anatoly-contactus-dialog', template: "<kendo-dialog (close)='onClose()' *ngIf='isOpen' [width]='700' title='Contact Us'>\r\n <div class=\"k-content k-window-content k-dialog-content\">\r\n <anatoly-forms-contactus-form #contactusform [showActionButtons]='false' (submit)='onSubmit()'>\r\n </anatoly-forms-contactus-form>\r\n </div>\r\n <kendo-dialog-actions class=\"k-actions\">\r\n <div class=\"d-flex justify-content-end\">\r\n <button (click)='onSubmitFire()' class='btn btn-success' type='button'>Submit</button>\r\n <button (click)='onClose()' class='btn btn-danger' type='button'>Cancel </button>\r\n </div>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>\r\n" }]
4683
+ args: [{ selector: 'anatoly-contactus-dialog', template: "<kendo-dialog (close)='onClose()' *ngIf='isOpen' [width]='700' title='Contact Us'>\r\n <div class=\"k-content k-window-content k-dialog-content\">\r\n <anatoly-forms-contactus-form #contactusform [showActionButtons]='false' (submit)='onSubmit()'>\r\n </anatoly-forms-contactus-form>\r\n </div>\r\n <kendo-dialog-actions class=\"k-actions\">\r\n <div class=\"d-flex justify-content-end\">\r\n <button (click)='onSubmitFire()' class='btn btn-sm btn-success' type='button'>Submit</button>\r\n <button (click)='onClose()' class='btn btn-sm btn-danger' type='button'>Cancel </button>\r\n </div>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>" }]
4631
4684
  }], function () { return []; }, { contactUsForm: [{
4632
4685
  type: ViewChild,
4633
4686
  args: ['contactusform']
@@ -5970,5 +6023,5 @@ AnatolyModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModu
5970
6023
  * Generated bundle index. Do not edit.
5971
6024
  */
5972
6025
 
5973
- export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyModule, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BaseList, BasePage, BasePagedPage, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, CompanyComponent, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, DOM, DatapagerComponent, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, GoogleAnalyticsService, Guid, HoveringDirective, 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, UrlSlugComponent, Urls, Utils, ValidationSummaryComponent, XmlFormatter, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
6026
+ export { AddressComponent, Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyModule, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BaseList, BasePage, BasePagedPage, BuyAccessButtonComponent, CardBodyComponent, CardComponent, CardFooterComponent, CardHeaderComponent, CheckIconComponent, CompanyComponent, ContactUsDialog, ContactUsForm, Convert, Copy2ClipboardComponent, CoreApiService, DOM, DatapagerComponent, DefaultEditorOptions, DigitalMarketingService, EmailsApiService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, GoogleAnalyticsService, Guid, HoveringDirective, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NodataComponent, NotificationService, NotificationsApiService, PageSpinnerComponent, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Stopwatch, Subs, SubscribePlanButtonComponent, TimezoneDropdownlist, TranslateModuleAtRoot, UrlSlugComponent, Urls, Utils, ValidationSummaryComponent, XmlFormatter, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
5974
6027
  //# sourceMappingURL=osovitny-anatoly.mjs.map