@osovitny/anatoly 3.16.95 → 3.16.97

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.
@@ -3112,16 +3112,16 @@ class CoreApiService extends ApiServiceBase {
3112
3112
  }
3113
3113
  });
3114
3114
  }
3115
- getUSStatesJsonFile(done) {
3116
- this.getExternalJsonFile('anatoly', 'usStates.json').subscribe({
3115
+ getCountriesJsonFile(done) {
3116
+ this.getExternalJsonFile('anatoly', 'countries.json').subscribe({
3117
3117
  next: (data) => {
3118
3118
  if (done)
3119
3119
  done(data);
3120
3120
  }
3121
3121
  });
3122
3122
  }
3123
- getCountriesJsonFile(done) {
3124
- this.getExternalJsonFile('anatoly', 'countries.json').subscribe({
3123
+ getUSStatesJsonFile(done) {
3124
+ this.getExternalJsonFile('anatoly', 'usStates.json').subscribe({
3125
3125
  next: (data) => {
3126
3126
  if (done)
3127
3127
  done(data);
@@ -4625,6 +4625,147 @@ class Copy2ClipboardComponent {
4625
4625
  type: Input
4626
4626
  }] }); })();
4627
4627
 
4628
+ /*
4629
+ <file>
4630
+ Project:
4631
+ @osovitny/anatoly
4632
+
4633
+ Authors:
4634
+ Vadim Osovitny vadim@osovitny.com
4635
+ Anatoly Osovitny anatoly@osovitny.com
4636
+
4637
+ Created:
4638
+ 28 Jun 2020
4639
+
4640
+ Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
4641
+ </file>
4642
+ */
4643
+ //Node
4644
+ class NativeElementDirective {
4645
+ el;
4646
+ control;
4647
+ constructor(el, control) {
4648
+ this.el = el;
4649
+ this.control = control;
4650
+ }
4651
+ ngOnInit() {
4652
+ // sets the localization key to the control
4653
+ this.control.control.nativeElement = this.el.nativeElement;
4654
+ }
4655
+ static ɵfac = function NativeElementDirective_Factory(t) { return new (t || NativeElementDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i2.NgControl)); };
4656
+ static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NativeElementDirective, selectors: [["", "formControl", ""], ["", "formControlName", ""]] });
4657
+ }
4658
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NativeElementDirective, [{
4659
+ type: Directive,
4660
+ args: [{
4661
+ selector: '[formControl], [formControlName]'
4662
+ }]
4663
+ }], function () { return [{ type: i0.ElementRef }, { type: i2.NgControl }]; }, null); })();
4664
+
4665
+ /*
4666
+ <file>
4667
+ Project:
4668
+ @osovitny/anatoly
4669
+
4670
+ Authors:
4671
+ Vadim Osovitny vadim@osovitny.com
4672
+ Anatoly Osovitny anatoly@osovitny.com
4673
+
4674
+ Created:
4675
+ 02 Aug 2022
4676
+
4677
+ Copyright (c) 2017-2022 Osovitny Inc. All rights reserved.
4678
+ </file>
4679
+ */
4680
+ //Node
4681
+ function TimezoneDropdownlist_div_0_Template(rf, ctx) { if (rf & 1) {
4682
+ i0.ɵɵelement(0, "div");
4683
+ } }
4684
+ function TimezoneDropdownlist_div_1_label_1_Template(rf, ctx) { if (rf & 1) {
4685
+ i0.ɵɵelementStart(0, "label", 6);
4686
+ i0.ɵɵtext(1, "Timezone");
4687
+ i0.ɵɵelementEnd();
4688
+ } }
4689
+ function TimezoneDropdownlist_div_1_option_3_Template(rf, ctx) { if (rf & 1) {
4690
+ i0.ɵɵelementStart(0, "option", 7);
4691
+ i0.ɵɵtext(1);
4692
+ i0.ɵɵelementEnd();
4693
+ } if (rf & 2) {
4694
+ const timezone_r4 = ctx.$implicit;
4695
+ i0.ɵɵproperty("value", timezone_r4.code);
4696
+ i0.ɵɵadvance(1);
4697
+ i0.ɵɵtextInterpolate2(" (", timezone_r4.offset, ") ", timezone_r4.name, " ");
4698
+ } }
4699
+ function TimezoneDropdownlist_div_1_Template(rf, ctx) { if (rf & 1) {
4700
+ i0.ɵɵelementStart(0, "div", 2);
4701
+ i0.ɵɵtemplate(1, TimezoneDropdownlist_div_1_label_1_Template, 2, 0, "label", 3);
4702
+ i0.ɵɵelementStart(2, "select", 4);
4703
+ i0.ɵɵtemplate(3, TimezoneDropdownlist_div_1_option_3_Template, 2, 3, "option", 5);
4704
+ i0.ɵɵelementEnd()();
4705
+ } if (rf & 2) {
4706
+ const ctx_r1 = i0.ɵɵnextContext();
4707
+ i0.ɵɵproperty("formGroup", ctx_r1.formGroup);
4708
+ i0.ɵɵadvance(1);
4709
+ i0.ɵɵproperty("ngIf", ctx_r1.isTitleVisible);
4710
+ i0.ɵɵadvance(1);
4711
+ i0.ɵɵproperty("formControlName", ctx_r1.controlName);
4712
+ i0.ɵɵadvance(1);
4713
+ i0.ɵɵproperty("ngForOf", ctx_r1.timezones);
4714
+ } }
4715
+ class TimezoneDropdownlist extends EditComponentBase {
4716
+ api;
4717
+ appContext;
4718
+ timezones;
4719
+ constructor(api, appContext) {
4720
+ super();
4721
+ this.api = api;
4722
+ this.appContext = appContext;
4723
+ this.title = 'Timezone';
4724
+ }
4725
+ ngOnInit() {
4726
+ this.setValues();
4727
+ }
4728
+ setValues() {
4729
+ this.api.getTimezonesJsonFile(data => {
4730
+ this.timezones = data.reverse();
4731
+ });
4732
+ if (this.isNgModelBased) {
4733
+ }
4734
+ else {
4735
+ let timezone = this.getFormValue(this.controlName);
4736
+ if (timezone) {
4737
+ return;
4738
+ }
4739
+ //1. Try to set client timezone
4740
+ try {
4741
+ timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
4742
+ this.setFormValue(this.controlName, timezone);
4743
+ }
4744
+ catch {
4745
+ }
4746
+ //2. Try to set context timeZone
4747
+ let context = this.appContext.current;
4748
+ timezone = context?.user?.timezone;
4749
+ if (timezone) {
4750
+ this.setFormValue(this.controlName, timezone);
4751
+ }
4752
+ }
4753
+ }
4754
+ static ɵfac = function TimezoneDropdownlist_Factory(t) { return new (t || TimezoneDropdownlist)(i0.ɵɵdirectiveInject(CoreApiService), i0.ɵɵdirectiveInject(AppContextService)); };
4755
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TimezoneDropdownlist, selectors: [["anatoly-timezone-dropdownlist"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 2, vars: 2, consts: [[4, "ngIf"], [3, "formGroup", 4, "ngIf"], [3, "formGroup"], ["class", "col-form-label", 4, "ngIf"], [1, "form-control", 3, "formControlName"], [3, "value", 4, "ngFor", "ngForOf"], [1, "col-form-label"], [3, "value"]], template: function TimezoneDropdownlist_Template(rf, ctx) { if (rf & 1) {
4756
+ i0.ɵɵtemplate(0, TimezoneDropdownlist_div_0_Template, 1, 0, "div", 0);
4757
+ i0.ɵɵtemplate(1, TimezoneDropdownlist_div_1_Template, 4, 4, "div", 1);
4758
+ } if (rf & 2) {
4759
+ i0.ɵɵproperty("ngIf", ctx.isNgModelBased);
4760
+ i0.ɵɵadvance(1);
4761
+ i0.ɵɵproperty("ngIf", !ctx.isNgModelBased);
4762
+ } }, dependencies: [i1$2.NgForOf, i1$2.NgIf, i2.NgSelectOption, i2.ɵNgSelectMultipleOption, i2.SelectControlValueAccessor, i2.NgControlStatus, i2.NgControlStatusGroup, i2.FormGroupDirective, i2.FormControlName, NativeElementDirective], encapsulation: 2 });
4763
+ }
4764
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimezoneDropdownlist, [{
4765
+ type: Component,
4766
+ args: [{ selector: 'anatoly-timezone-dropdownlist', template: "<div *ngIf='isNgModelBased'>\r\n</div>\r\n\r\n<div [formGroup]='formGroup' *ngIf='!isNgModelBased'>\r\n <label *ngIf='isTitleVisible' class='col-form-label'>Timezone</label>\r\n <select [formControlName]='controlName' class='form-control'>\r\n <option *ngFor='let timezone of timezones' [value]='timezone.code'>\r\n ({{ timezone.offset }}) {{ timezone.name }}\r\n </option>\r\n </select>\r\n</div>\r\n" }]
4767
+ }], function () { return [{ type: CoreApiService }, { type: AppContextService }]; }, null); })();
4768
+
4628
4769
  /*
4629
4770
  <file>
4630
4771
  Project:
@@ -4949,43 +5090,6 @@ class HtmlEditorComponentBase extends EditComponentBase {
4949
5090
  type: Input
4950
5091
  }] }); })();
4951
5092
 
4952
- /*
4953
- <file>
4954
- Project:
4955
- @osovitny/anatoly
4956
-
4957
- Authors:
4958
- Vadim Osovitny vadim@osovitny.com
4959
- Anatoly Osovitny anatoly@osovitny.com
4960
-
4961
- Created:
4962
- 28 Jun 2020
4963
-
4964
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
4965
- </file>
4966
- */
4967
- //Node
4968
- class NativeElementDirective {
4969
- el;
4970
- control;
4971
- constructor(el, control) {
4972
- this.el = el;
4973
- this.control = control;
4974
- }
4975
- ngOnInit() {
4976
- // sets the localization key to the control
4977
- this.control.control.nativeElement = this.el.nativeElement;
4978
- }
4979
- static ɵfac = function NativeElementDirective_Factory(t) { return new (t || NativeElementDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i2.NgControl)); };
4980
- static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: NativeElementDirective, selectors: [["", "formControl", ""], ["", "formControlName", ""]] });
4981
- }
4982
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NativeElementDirective, [{
4983
- type: Directive,
4984
- args: [{
4985
- selector: '[formControl], [formControlName]'
4986
- }]
4987
- }], function () { return [{ type: i0.ElementRef }, { type: i2.NgControl }]; }, null); })();
4988
-
4989
5093
  /*
4990
5094
  <file>
4991
5095
  Project:
@@ -6195,95 +6299,6 @@ class UrlSlugComponent extends EditComponentBase {
6195
6299
  type: Output
6196
6300
  }] }); })();
6197
6301
 
6198
- /*
6199
- <file>
6200
- Project:
6201
- @osovitny/anatoly
6202
-
6203
- Authors:
6204
- Vadim Osovitny vadim@osovitny.com
6205
- Anatoly Osovitny anatoly@osovitny.com
6206
-
6207
- Created:
6208
- 02 Aug 2022
6209
-
6210
- Copyright (c) 2017-2022 Osovitny Inc. All rights reserved.
6211
- </file>
6212
- */
6213
- //Node
6214
- function TimezoneDropdownlist_label_1_Template(rf, ctx) { if (rf & 1) {
6215
- i0.ɵɵelementStart(0, "label", 4);
6216
- i0.ɵɵtext(1, "Timezone");
6217
- i0.ɵɵelementEnd();
6218
- } }
6219
- function TimezoneDropdownlist_option_3_Template(rf, ctx) { if (rf & 1) {
6220
- i0.ɵɵelementStart(0, "option", 5);
6221
- i0.ɵɵtext(1);
6222
- i0.ɵɵelementEnd();
6223
- } if (rf & 2) {
6224
- const timezone_r2 = ctx.$implicit;
6225
- i0.ɵɵproperty("value", timezone_r2.code);
6226
- i0.ɵɵadvance(1);
6227
- i0.ɵɵtextInterpolate2(" (", timezone_r2.offset, ") ", timezone_r2.name, " ");
6228
- } }
6229
- class TimezoneDropdownlist extends EditComponentBase {
6230
- api;
6231
- appContext;
6232
- timezoneListItems;
6233
- constructor(api, appContext) {
6234
- super();
6235
- this.api = api;
6236
- this.appContext = appContext;
6237
- this.title = 'Timezone';
6238
- this.controlName = 'timezone';
6239
- }
6240
- ngOnInit() {
6241
- this.setValues();
6242
- }
6243
- setValues() {
6244
- this.api.getTimezonesJsonFile(data => {
6245
- this.timezoneListItems = data.reverse();
6246
- });
6247
- let timeZone = this.getFormValue(this.controlName);
6248
- if (timeZone) {
6249
- return;
6250
- }
6251
- //1. Try to set client timeZone
6252
- try {
6253
- timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
6254
- this.setFormValue(this.controlName, timeZone);
6255
- }
6256
- catch {
6257
- }
6258
- //2. Try to set context timeZone
6259
- let context = this.appContext.current;
6260
- timeZone = context?.user?.timeZone;
6261
- if (timeZone) {
6262
- this.setFormValue(this.controlName, timeZone);
6263
- }
6264
- }
6265
- static ɵfac = function TimezoneDropdownlist_Factory(t) { return new (t || TimezoneDropdownlist)(i0.ɵɵdirectiveInject(CoreApiService), i0.ɵɵdirectiveInject(AppContextService)); };
6266
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: TimezoneDropdownlist, selectors: [["anatoly-forms-timezone-dropdownlist"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 4, consts: [[1, "form-group", 3, "formGroup"], ["class", "col-form-label", 4, "ngIf"], [1, "form-control", 3, "formControlName"], [3, "value", 4, "ngFor", "ngForOf"], [1, "col-form-label"], [3, "value"]], template: function TimezoneDropdownlist_Template(rf, ctx) { if (rf & 1) {
6267
- i0.ɵɵelementStart(0, "div", 0);
6268
- i0.ɵɵtemplate(1, TimezoneDropdownlist_label_1_Template, 2, 0, "label", 1);
6269
- i0.ɵɵelementStart(2, "select", 2);
6270
- i0.ɵɵtemplate(3, TimezoneDropdownlist_option_3_Template, 2, 3, "option", 3);
6271
- i0.ɵɵelementEnd()();
6272
- } if (rf & 2) {
6273
- i0.ɵɵproperty("formGroup", ctx.formGroup);
6274
- i0.ɵɵadvance(1);
6275
- i0.ɵɵproperty("ngIf", ctx.isTitleVisible);
6276
- i0.ɵɵadvance(1);
6277
- i0.ɵɵproperty("formControlName", ctx.controlName);
6278
- i0.ɵɵadvance(1);
6279
- i0.ɵɵproperty("ngForOf", ctx.timezoneListItems);
6280
- } }, dependencies: [i1$2.NgForOf, i1$2.NgIf, i2.NgSelectOption, i2.ɵNgSelectMultipleOption, i2.SelectControlValueAccessor, i2.NgControlStatus, i2.NgControlStatusGroup, i2.FormGroupDirective, i2.FormControlName, NativeElementDirective], encapsulation: 2 });
6281
- }
6282
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TimezoneDropdownlist, [{
6283
- type: Component,
6284
- args: [{ selector: 'anatoly-forms-timezone-dropdownlist', template: "<div [formGroup]='formGroup' class='form-group'>\r\n <label *ngIf='isTitleVisible' class='col-form-label'>Timezone</label>\r\n <select [formControlName]='controlName' class='form-control'>\r\n <option *ngFor='let timezone of timezoneListItems'\r\n [value]='timezone.code'>\r\n ({{timezone.offset}}) {{timezone.name}}\r\n </option>\r\n </select>\r\n</div>\r\n" }]
6285
- }], function () { return [{ type: CoreApiService }, { type: AppContextService }]; }, null); })();
6286
-
6287
6302
  /*
6288
6303
  <file>
6289
6304
  Project:
@@ -7072,6 +7087,8 @@ const COMPONENTS = [
7072
7087
  PageSpinnerComponent,
7073
7088
  LoadingComponent,
7074
7089
  Copy2ClipboardComponent,
7090
+ //Dropdownlists
7091
+ TimezoneDropdownlist,
7075
7092
  //Cards
7076
7093
  CardComponent,
7077
7094
  CardHeaderComponent,
@@ -7089,7 +7106,6 @@ const COMPONENTS = [
7089
7106
  AddressComponent,
7090
7107
  CompanyComponent,
7091
7108
  UrlSlugComponent,
7092
- TimezoneDropdownlist,
7093
7109
  ContactUsForm,
7094
7110
  //Pipes
7095
7111
  SafeHtmlPipe,
@@ -7143,6 +7159,8 @@ class AnatolyUIModule {
7143
7159
  PageSpinnerComponent,
7144
7160
  LoadingComponent,
7145
7161
  Copy2ClipboardComponent,
7162
+ //Dropdownlists
7163
+ TimezoneDropdownlist,
7146
7164
  //Cards
7147
7165
  CardComponent,
7148
7166
  CardHeaderComponent,
@@ -7160,7 +7178,6 @@ class AnatolyUIModule {
7160
7178
  AddressComponent,
7161
7179
  CompanyComponent,
7162
7180
  UrlSlugComponent,
7163
- TimezoneDropdownlist,
7164
7181
  ContactUsForm,
7165
7182
  //Pipes
7166
7183
  SafeHtmlPipe,
@@ -7186,6 +7203,8 @@ class AnatolyUIModule {
7186
7203
  PageSpinnerComponent,
7187
7204
  LoadingComponent,
7188
7205
  Copy2ClipboardComponent,
7206
+ //Dropdownlists
7207
+ TimezoneDropdownlist,
7189
7208
  //Cards
7190
7209
  CardComponent,
7191
7210
  CardHeaderComponent,
@@ -7203,7 +7222,6 @@ class AnatolyUIModule {
7203
7222
  AddressComponent,
7204
7223
  CompanyComponent,
7205
7224
  UrlSlugComponent,
7206
- TimezoneDropdownlist,
7207
7225
  ContactUsForm,
7208
7226
  //Pipes
7209
7227
  SafeHtmlPipe,