@stratusjs/angular 0.9.0 → 0.9.2
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.
- package/dist/angular.bundle.js +5438 -5420
- package/dist/angular.bundle.min.js +1 -1
- package/package.json +2 -2
- package/src/timezone-selector/timezone-selector.component.html +3 -3
- package/src/timezone-selector/timezone-selector.component.js +19 -3
- package/src/timezone-selector/timezone-selector.component.js.map +1 -1
- package/src/timezone-selector/timezone-selector.component.min.html +1 -1
- package/src/timezone-selector/timezone-selector.component.min.js +1 -1
- package/src/timezone-selector/timezone-selector.component.ts +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stratusjs/angular",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "This is the angular package for StratusJS.",
|
|
5
5
|
"scripts": {},
|
|
6
6
|
"repository": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@angular/platform-browser-dynamic": "^12.2.16",
|
|
57
57
|
"@angular/router": "^12.2.16",
|
|
58
58
|
"@codemirror/lang-html": "^6.4.0",
|
|
59
|
-
"@stratusjs/boot": "^
|
|
59
|
+
"@stratusjs/boot": "^1.2.0",
|
|
60
60
|
"@stratusjs/core": "^0.6.2",
|
|
61
61
|
"@stratusjs/runtime": "^0.12.1",
|
|
62
62
|
"angular-froala-wysiwyg": "^3.2.7",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<mat-form-field>
|
|
2
|
-
<mat-label>
|
|
1
|
+
<mat-form-field [style.width.px]=330>
|
|
2
|
+
<mat-label>{{label}}</mat-label>
|
|
3
3
|
<input type="text"
|
|
4
|
-
placeholder="Timezone"
|
|
4
|
+
placeholder="Select Timezone"
|
|
5
5
|
matInput
|
|
6
6
|
[formControl]="inputTimezone"
|
|
7
7
|
[matAutocomplete]="auto">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
System.register(["@angular/core", "@angular/platform-browser", "@angular/forms", "rxjs", "rxjs/operators", "toastify-js", "@stratusjs/core/misc", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "@stratusjs/core/events/eventManager", "../core/root.component", "@stratusjs/angularjs/services/registry"], function (exports_1, context_1) {
|
|
1
|
+
System.register(["@angular/core", "@angular/platform-browser", "@angular/forms", "rxjs", "rxjs/operators", "toastify-js", "@stratusjs/core/misc", "@stratusjs/runtime/stratus", "@stratusjs/core/environment", "@stratusjs/core/events/eventManager", "../core/root.component", "lodash", "@stratusjs/angularjs/services/registry"], function (exports_1, context_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
4
4
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -9,7 +9,7 @@ System.register(["@angular/core", "@angular/platform-browser", "@angular/forms",
|
|
|
9
9
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
10
10
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11
11
|
};
|
|
12
|
-
var core_1, platform_browser_1, forms_1, rxjs_1, operators_1, toastify_js_1, misc_1, stratus_1, environment_1, eventManager_1, root_component_1, registry_1, systemDir, moduleName, min, localDir, TimezoneSelectorComponent;
|
|
12
|
+
var core_1, platform_browser_1, forms_1, rxjs_1, operators_1, toastify_js_1, misc_1, stratus_1, environment_1, eventManager_1, root_component_1, lodash_1, registry_1, systemDir, moduleName, min, localDir, TimezoneSelectorComponent;
|
|
13
13
|
var __moduleName = context_1 && context_1.id;
|
|
14
14
|
return {
|
|
15
15
|
setters: [
|
|
@@ -46,6 +46,9 @@ System.register(["@angular/core", "@angular/platform-browser", "@angular/forms",
|
|
|
46
46
|
function (root_component_1_1) {
|
|
47
47
|
root_component_1 = root_component_1_1;
|
|
48
48
|
},
|
|
49
|
+
function (lodash_1_1) {
|
|
50
|
+
lodash_1 = lodash_1_1;
|
|
51
|
+
},
|
|
49
52
|
function (registry_1_1) {
|
|
50
53
|
registry_1 = registry_1_1;
|
|
51
54
|
}
|
|
@@ -65,13 +68,15 @@ System.register(["@angular/core", "@angular/platform-browser", "@angular/forms",
|
|
|
65
68
|
this.Stratus = stratus_1.Stratus;
|
|
66
69
|
this.registry = new registry_1.Registry();
|
|
67
70
|
this.onChange = new rxjs_1.Subject();
|
|
71
|
+
this.label = 'Select Timezone';
|
|
68
72
|
this.inputTimezone = new forms_1.FormControl('');
|
|
69
73
|
this.timezoneList = [];
|
|
70
74
|
this.initialized = false;
|
|
71
75
|
this.uid = misc_1.safeUniqueId('sa', moduleName, 'component');
|
|
72
76
|
stratus_1.Stratus.Instances[this.uid] = this;
|
|
73
77
|
this.timezoneList = Intl.supportedValuesOf('timeZone');
|
|
74
|
-
this.
|
|
78
|
+
this.currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
79
|
+
this.hydrate(elementRef, sanitizer, ["title", "uid", "target", "targetSuffix", "id", "manifest", "decouple", "direct", "api", "urlRoot", "type", "property", "endpoint", "Stratus", "registry", "fetched", "data", "model", "dataSub", "onChange", "subscriber", "label", "timezone", "currentTimezone", "inputTimezone", "timezoneList", "filteredTimezones", "initialized", "elementRef", "ref", "sanitizer", "ngOnInit", "updateLabel", "_filter", "fetchData", "dataDefer", "dataRef", "valueChanged", "handleObservableError", "timezoneSelected", "hydrate", "disableRefresh", "stagger", "reloading", "refresh", "ngOnDestroy"]);
|
|
75
80
|
this.filteredTimezones = this.inputTimezone.valueChanges.pipe(operators_1.startWith(''), operators_1.map(value => this._filter(value || '')));
|
|
76
81
|
this.fetchData()
|
|
77
82
|
.then(data => {
|
|
@@ -99,14 +104,24 @@ System.register(["@angular/core", "@angular/platform-browser", "@angular/forms",
|
|
|
99
104
|
return;
|
|
100
105
|
}
|
|
101
106
|
this.timezone = evt;
|
|
107
|
+
this.updateLabel();
|
|
102
108
|
this.inputTimezone.setValue(this.timezone);
|
|
103
109
|
this.refresh().then();
|
|
104
110
|
});
|
|
105
111
|
}
|
|
106
112
|
async ngOnInit() {
|
|
107
113
|
this.inputTimezone.valueChanges.forEach((value) => this.valueChanged(value)).then();
|
|
114
|
+
this.updateLabel();
|
|
108
115
|
this.initialized = true;
|
|
109
116
|
}
|
|
117
|
+
updateLabel() {
|
|
118
|
+
if (lodash_1.isEmpty(this.timezone) || this.timezone === 'local') {
|
|
119
|
+
this.label = `(local - Currently displayed in ${this.currentTimezone})`;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.label = 'Select Timezone';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
110
125
|
_filter(value) {
|
|
111
126
|
const filterValue = value.toLowerCase();
|
|
112
127
|
return this.timezoneList.filter(timezone => timezone.toLowerCase().includes(filterValue));
|
|
@@ -136,6 +151,7 @@ System.register(["@angular/core", "@angular/platform-browser", "@angular/forms",
|
|
|
136
151
|
return;
|
|
137
152
|
}
|
|
138
153
|
this.timezone = value;
|
|
154
|
+
this.updateLabel();
|
|
139
155
|
this.inputTimezone.setValue(this.timezone);
|
|
140
156
|
if (!this.model || !this.model.completed) {
|
|
141
157
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["timezone-selector.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["timezone-selector.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkCM,SAAS,GAAG,oBAAoB,CAAA;YAChC,UAAU,GAAG,mBAAmB,CAAA;YAChC,GAAG,GAAG,CAAC,oBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;YAClC,QAAQ,GAAG,GAAG,iBAAO,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,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C,KAAK,CAAC,CAAA;gBAC5B,CAAC;aACJ,CAAA;YAhNG;gBAAC,YAAK,EAAE;;qEAAe;YACvB;gBAAC,YAAK,EAAE;;2EAAqB;YAC7B;gBAAC,YAAK,EAAE;;iEAAW;YACnB;gBAAC,YAAK,EAAE;;uEAAkB;YAC1B;gBAAC,YAAK,EAAE;;uEAAkB;YAC1B;gBAAC,YAAK,EAAE;;qEAAgB;YACxB;gBAAC,YAAK,EAAE;;kEAAY;YACpB;gBAAC,YAAK,EAAE;;sEAAgB;YAIxB;gBAAC,YAAK,EAAE;;mEAAa;YACrB;gBAAC,YAAK,EAAE;;uEAAiB;YACzB;gBAAC,YAAK,EAAE;;uEAAiB;YApBhB,yBAAyB;gBAZrC,gBAAS,CAAC;oBACP,QAAQ,EAAE,MAAM,UAAU,EAAE;oBAE5B,WAAW,EAAE,GAAG,QAAQ,IAAI,UAAU,IAAI,UAAU,aAAa,GAAG,OAAO;oBAM3E,eAAe,EAAE,8BAAuB,CAAC,MAAM;iBAClD,CAAC;iDA4D0B,iBAAU;oBACf,wBAAiB;oBACb,+BAAY;eA5D1B,yBAAyB,CAuNrC;;QACD,CAAC","file":"timezone-selector.component.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<mat-form-field><mat-label>
|
|
1
|
+
<mat-form-field [style.width.px]="330"><mat-label>{{label}}</mat-label><input type="text" placeholder="Select Timezone" matInput [formControl]="inputTimezone" [matAutocomplete]="auto"><mat-autocomplete autoActiveFirstOption #auto="matAutocomplete" (optionSelected)="timezoneSelected($event.option.value)"><mat-option *ngFor="let timezone of filteredTimezones | async" [value]="timezone">{{timezone}}</mat-option></mat-autocomplete></mat-form-field>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["@angular/core","@angular/platform-browser","@angular/forms","rxjs","rxjs/operators","toastify-js","@stratusjs/core/misc","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/core/events/eventManager","../core/root.component","@stratusjs/angularjs/services/registry"],function(e,t){"use strict";var i,n,s,r,o,a,u,h,c,p,d,
|
|
1
|
+
System.register(["@angular/core","@angular/platform-browser","@angular/forms","rxjs","rxjs/operators","toastify-js","@stratusjs/core/misc","@stratusjs/runtime/stratus","@stratusjs/core/environment","@stratusjs/core/events/eventManager","../core/root.component","lodash","@stratusjs/angularjs/services/registry"],function(e,t){"use strict";var i,n,s,r,o,a,u,h,l,c,p,d,f,m,g,y,b,z=this&&this.__decorate||function(e,t,i,n){var s,r=arguments.length,o=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,i,o):s(t,i))||o);return r>3&&o&&Object.defineProperty(t,i,o),o},v=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};t&&t.id;return{setters:[function(e){i=e},function(e){n=e},function(e){s=e},function(e){r=e},function(e){o=e},function(e){a=e},function(e){u=e},function(e){h=e},function(e){l=e},function(e){c=e},function(e){p=e},function(e){d=e},function(e){f=e}],execute:function(){"@stratusjs/angular",m="timezone-selector",g=l.cookie("env")?"":".min",y=`${h.Stratus.BaseUrl}${boot.configuration.paths["@stratusjs/angular/*"].replace(/[^/]*$/,"").replace(/\/dist\/$/,"/src/")}`,b=class extends p.RootComponent{constructor(e,t,i){super(),this.elementRef=e,this.ref=t,this.sanitizer=i,this.title=m+"_component",this.Stratus=h.Stratus,this.registry=new f.Registry,this.onChange=new r.Subject,this.label="Select Timezone",this.inputTimezone=new s.FormControl(""),this.timezoneList=[],this.initialized=!1,this.uid=u.safeUniqueId("sa",m,"component"),h.Stratus.Instances[this.uid]=this,this.timezoneList=Intl.supportedValuesOf("timeZone"),this.currentTimezone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.hydrate(e,i,["title","uid","target","targetSuffix","id","manifest","decouple","direct","api","urlRoot","type","property","endpoint","Stratus","registry","fetched","data","model","dataSub","onChange","subscriber","label","timezone","currentTimezone","inputTimezone","timezoneList","filteredTimezones","initialized","elementRef","ref","sanitizer","ngOnInit","updateLabel","_filter","fetchData","dataDefer","dataRef","valueChanged","handleObservableError","timezoneSelected","hydrate","disableRefresh","stagger","reloading","refresh","ngOnDestroy"]),this.filteredTimezones=this.inputTimezone.valueChanges.pipe(o.startWith(""),o.map(e=>this._filter(e||""))),this.fetchData().then(e=>{if(!(e&&e instanceof c.EventManager))return void console.warn("Unable to bind data from Registry!");const t=()=>{e.completed&&this.dataDefer(this.subscriber)};e.on("change",t),t()}),this.dataSub=new r.Observable(e=>this.dataDefer(e)),this.dataSub.pipe(o.debounce(()=>r.timer(500)),o.catchError(this.handleObservableError)).subscribe(e=>{this.inputTimezone.value!==e?(this.timezone=e,this.updateLabel(),this.inputTimezone.setValue(this.timezone),this.refresh().then()):this.initialized&&this.refresh().then()})}async ngOnInit(){this.inputTimezone.valueChanges.forEach(e=>this.valueChanged(e)).then(),this.updateLabel(),this.initialized=!0}updateLabel(){d.isEmpty(this.timezone)||"local"===this.timezone?this.label=`(local - Currently displayed in ${this.currentTimezone})`:this.label="Select Timezone"}_filter(e){const t=e.toLowerCase();return this.timezoneList.filter(e=>e.toLowerCase().includes(t))}fetchData(){return this.fetched?this.fetched:this.fetched=this.registry.fetch(h.Stratus.Select(this.elementRef.nativeElement),this)}dataDefer(e){if(this.subscriber=this.subscriber||e,!this.subscriber)return;const t=this.dataRef();this.subscriber.next(t)}dataRef(){return this.model?this.model.get(this.property):""}valueChanged(e){e&&(this.timezone=e,this.updateLabel(),this.inputTimezone.setValue(this.timezone),this.model&&this.model.completed&&this.model.set(this.property,this.timezone))}handleObservableError(e){return console.error(e),a.default({text:e.toString(),duration:3e3,close:!0,stopOnFocus:!0,style:{background:"#E14D45"}}).showToast(),e}timezoneSelected(e){e&&this.valueChanged(e)}},z([i.Input(),v("design:type",String)],b.prototype,"target",void 0),z([i.Input(),v("design:type",String)],b.prototype,"targetSuffix",void 0),z([i.Input(),v("design:type",Number)],b.prototype,"id",void 0),z([i.Input(),v("design:type",Boolean)],b.prototype,"manifest",void 0),z([i.Input(),v("design:type",Boolean)],b.prototype,"decouple",void 0),z([i.Input(),v("design:type",Boolean)],b.prototype,"direct",void 0),z([i.Input(),v("design:type",Object)],b.prototype,"api",void 0),z([i.Input(),v("design:type",String)],b.prototype,"urlRoot",void 0),z([i.Input(),v("design:type",String)],b.prototype,"type",void 0),z([i.Input(),v("design:type",String)],b.prototype,"property",void 0),z([i.Input(),v("design:type",String)],b.prototype,"endpoint",void 0),b=z([i.Component({selector:`sa-${m}`,templateUrl:`${y}/${m}/${m}.component${g}.html`,changeDetection:i.ChangeDetectionStrategy.OnPush}),v("design:paramtypes",[i.ElementRef,i.ChangeDetectorRef,n.DomSanitizer])],b),e("TimezoneSelectorComponent",b)}}});
|
|
@@ -24,6 +24,7 @@ import {Stratus} from '@stratusjs/runtime/stratus'
|
|
|
24
24
|
import {cookie} from '@stratusjs/core/environment'
|
|
25
25
|
import {EventManager} from '@stratusjs/core/events/eventManager'
|
|
26
26
|
import {RootComponent} from '../core/root.component'
|
|
27
|
+
import {isEmpty} from 'lodash'
|
|
27
28
|
|
|
28
29
|
// AngularJS Classes
|
|
29
30
|
import {Registry} from '@stratusjs/angularjs/services/registry'
|
|
@@ -98,7 +99,9 @@ export class TimezoneSelectorComponent extends RootComponent implements OnInit {
|
|
|
98
99
|
// Note: It may be better to LifeCycle::tick(), but this works for now
|
|
99
100
|
|
|
100
101
|
// Multi-Framework Event Connectivity
|
|
102
|
+
label = 'Select Timezone'
|
|
101
103
|
timezone: string
|
|
104
|
+
currentTimezone: string
|
|
102
105
|
inputTimezone = new FormControl('')
|
|
103
106
|
timezoneList: string[] = []
|
|
104
107
|
filteredTimezones: Observable<string[]>
|
|
@@ -122,6 +125,9 @@ export class TimezoneSelectorComponent extends RootComponent implements OnInit {
|
|
|
122
125
|
// Prepare all possible timezones
|
|
123
126
|
this.timezoneList = (Intl as any).supportedValuesOf('timeZone')
|
|
124
127
|
|
|
128
|
+
// Get our own timezone
|
|
129
|
+
this.currentTimezone = (Intl as any).DateTimeFormat().resolvedOptions().timeZone
|
|
130
|
+
|
|
125
131
|
// Hydrate Root App Inputs
|
|
126
132
|
this.hydrate(elementRef, sanitizer, keys<TimezoneSelectorComponent>())
|
|
127
133
|
|
|
@@ -165,6 +171,7 @@ export class TimezoneSelectorComponent extends RootComponent implements OnInit {
|
|
|
165
171
|
return
|
|
166
172
|
}
|
|
167
173
|
this.timezone = evt
|
|
174
|
+
this.updateLabel()
|
|
168
175
|
this.inputTimezone.setValue(this.timezone)
|
|
169
176
|
this.refresh().then()
|
|
170
177
|
})
|
|
@@ -172,9 +179,18 @@ export class TimezoneSelectorComponent extends RootComponent implements OnInit {
|
|
|
172
179
|
async ngOnInit() {
|
|
173
180
|
// Watch for input box changes
|
|
174
181
|
this.inputTimezone.valueChanges.forEach((value?: string) => this.valueChanged(value)).then()
|
|
182
|
+
this.updateLabel()
|
|
175
183
|
this.initialized = true
|
|
176
184
|
}
|
|
177
185
|
|
|
186
|
+
private updateLabel() {
|
|
187
|
+
if (isEmpty(this.timezone) || this.timezone === 'local') {
|
|
188
|
+
this.label = `(local - Currently displayed in ${this.currentTimezone})`
|
|
189
|
+
} else {
|
|
190
|
+
this.label = 'Select Timezone'
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
178
194
|
/** Filter the inout box and output similar possible options */
|
|
179
195
|
private _filter(value: string): string[] {
|
|
180
196
|
const filterValue = value.toLowerCase()
|
|
@@ -210,13 +226,14 @@ export class TimezoneSelectorComponent extends RootComponent implements OnInit {
|
|
|
210
226
|
return this.model.get(this.property)
|
|
211
227
|
}
|
|
212
228
|
|
|
213
|
-
/** Any time the value of the
|
|
229
|
+
/** Any time the value of the input box is changed */
|
|
214
230
|
valueChanged(value: string) {
|
|
215
231
|
if (!value) {
|
|
216
232
|
return
|
|
217
233
|
}
|
|
218
234
|
// Update the field to allow external apps to read
|
|
219
235
|
this.timezone = value
|
|
236
|
+
this.updateLabel()
|
|
220
237
|
this.inputTimezone.setValue(this.timezone)
|
|
221
238
|
if (!this.model || !this.model.completed) {
|
|
222
239
|
return
|