@dotglitch/ngx-common 1.0.3 → 1.0.7
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/components/tooltip/tooltip.component.d.ts +2 -0
- package/directives/menu.directive.d.ts +6 -2
- package/directives/tooltip.directive.d.ts +10 -5
- package/esm2020/components/menu/menu.component.mjs +3 -3
- package/esm2020/components/tooltip/tooltip.component.mjs +9 -4
- package/esm2020/directives/menu.directive.mjs +20 -9
- package/esm2020/directives/tooltip.directive.mjs +35 -5
- package/esm2020/public-api.mjs +6 -1
- package/esm2020/types/tooltip.mjs +2 -0
- package/fesm2015/dotglitch-ngx-common.mjs +70 -21
- package/fesm2015/dotglitch-ngx-common.mjs.map +1 -1
- package/fesm2020/dotglitch-ngx-common.mjs +64 -18
- package/fesm2020/dotglitch-ngx-common.mjs.map +1 -1
- package/package.json +2 -10
- package/public-api.d.ts +5 -0
- package/types/tooltip.d.ts +15 -0
package/esm2020/public-api.mjs
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Public API Surface of package
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
** Types
|
|
6
|
+
*/
|
|
7
|
+
export * from './types/menu';
|
|
8
|
+
export * from './types/popup';
|
|
4
9
|
/**
|
|
5
10
|
** Directives
|
|
6
11
|
*/
|
|
@@ -36,4 +41,4 @@ export * from './components/dynamic-html/dynamic-html.service';
|
|
|
36
41
|
export * from './components/dynamic-html/dynamic-html.module';
|
|
37
42
|
export * from './components/dynamic-html/dynamic-html.component';
|
|
38
43
|
export * from './components/dynamic-html/types';
|
|
39
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
44
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3BhY2thZ2VzL2NvbW1vbi9zcm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lbGF5OiBudW1iZXIsXG5cbiAgICAvKipcbiAgICAgKiBBIGtleSB0aGUgdXNlciBjYW4gcHJlc3MgdG8ga2VlcCBhIHRvb2x0aXAgdmlzaWJsZS5cbiAgICAgKiBEZWZhdWx0IGBGMmBcbiAgICAgKi9cbiAgICBmcmVlemVPbktleUNvZGU6IHN0cmluZyxcbn0+O1xuIl19
|
|
@@ -177,6 +177,7 @@ class TooltipComponent {
|
|
|
177
177
|
this.dialogRef = dialogRef;
|
|
178
178
|
this.hasBootstrapped = false;
|
|
179
179
|
this.pointerIsOnVoid = false;
|
|
180
|
+
this.isLockedOpen = false;
|
|
180
181
|
this.coverRectCords = {
|
|
181
182
|
top: 0,
|
|
182
183
|
left: 0,
|
|
@@ -210,7 +211,7 @@ class TooltipComponent {
|
|
|
210
211
|
this.hasBootstrapped = true;
|
|
211
212
|
if (this.pointerIsOnVoid)
|
|
212
213
|
this.dialogRef.close();
|
|
213
|
-
},
|
|
214
|
+
}, 200);
|
|
214
215
|
}
|
|
215
216
|
/**
|
|
216
217
|
* Close the tooltip if these actions occur
|
|
@@ -223,9 +224,13 @@ class TooltipComponent {
|
|
|
223
224
|
var _a;
|
|
224
225
|
(_a = this.dialogRef) === null || _a === void 0 ? void 0 : _a.close();
|
|
225
226
|
}
|
|
227
|
+
closeOnVoid() {
|
|
228
|
+
console.log("fuck you");
|
|
229
|
+
this.dialogRef.close();
|
|
230
|
+
}
|
|
226
231
|
}
|
|
227
232
|
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TooltipComponent, deps: [{ token: i0.ViewContainerRef }, { token: MAT_DIALOG_DATA, optional: true }, { token: i1.MatDialog, optional: true }, { token: i1.MatDialogRef, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
228
|
-
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TooltipComponent, isStandalone: true, selector: "ngx-tooltip", inputs: { data: "data", config: "config", ownerCords: "ownerCords", selfCords: "selfCords", template: "template" }, host: { listeners: { "window:resize": "onClose()", "window:blur": "onClose()", "pointerleave": "onPointerLeave()" } }, ngImport: i0, template: "<!-- Mouse event blocker for pointer leave -->\n<div\n *ngIf=\"coverRectCords\"\n class=\"owner-mask\"\n [style.top]=\"coverRectCords.top + 'px'\"\n [style.left]=\"coverRectCords.left + 'px'\"\n [style.height]=\"coverRectCords.height + 'px'\"\n [style.width]=\"coverRectCords.width + 'px'\"\n style=\"z-index: -1;\"\n></div>\n\n<div class=\"void\"\n (pointerenter)=\"pointerIsOnVoid = true; hasBootstrapped &&
|
|
233
|
+
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: TooltipComponent, isStandalone: true, selector: "ngx-tooltip", inputs: { data: "data", config: "config", ownerCords: "ownerCords", selfCords: "selfCords", template: "template" }, host: { listeners: { "window:resize": "onClose()", "window:blur": "onClose()", "pointerleave": "onPointerLeave()" } }, ngImport: i0, template: "<!-- Mouse event blocker for pointer leave -->\n<div\n *ngIf=\"coverRectCords\"\n class=\"owner-mask\"\n [style.top]=\"coverRectCords.top + 'px'\"\n [style.left]=\"coverRectCords.left + 'px'\"\n [style.height]=\"coverRectCords.height + 'px'\"\n [style.width]=\"coverRectCords.width + 'px'\"\n style=\"z-index: -1;\"\n></div>\n\n<div class=\"void\"\n (pointerenter)=\"pointerIsOnVoid = true; hasBootstrapped && !isLockedOpen && closeOnVoid()\"\n (pointerleave)=\"pointerIsOnVoid = false\"\n (pointerdown)=\"hasBootstrapped && dialogRef.close()\"\n></div>\n\n<div class=\"container\">\n <ng-container\n *ngIf=\"isTemplate == false\"\n [ngComponentOutlet]=\"$any(template)\"\n >\n </ng-container>\n\n <ng-container\n *ngIf=\"isTemplate == true\"\n >\n <ng-container\n [ngTemplateOutlet]=\"$any(template)\"\n [ngTemplateOutletContext]=\"{ '$implicit': data }\"\n ></ng-container>\n </ng-container>\n</div>\n", styles: ["::ng-deep .cdk-overlay-container .ngx-tooltip{--mdc-dialog-container-color: var(--ngx-tooltip-background-color, #2f2f2f)}::ng-deep .cdk-overlay-container .ngx-tooltip .mdc-dialog__container{transform-origin:top left}::ng-deep .cdk-overlay-container .ngx-tooltip .mdc-dialog--open .mdc-dialog__container{transform:none}::ng-deep .cdk-overlay-container .ngx-tooltip .mdc-dialog__surface{overflow:visible;background-color:#0000}::ng-deep .cdk-overlay-container .context-menu-backdrop.cdk-overlay-backdrop-showing{opacity:0}::ng-deep .cdk-overlay-pane.ngx-tooltip .mat-dialog-container{padding:0}:host{min-width:2px;min-height:2px;display:block}.void,.owner-mask{position:absolute}.void{top:-100vh;right:-100vw;bottom:-100vh;left:-100vw;z-index:-2}.container{width:100%;height:100%;background:var(--ngx-tooltip-background-color, #333);border-radius:6px;overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type:
|
|
229
234
|
// NgIf,
|
|
230
235
|
// NgTemplateOutlet,
|
|
231
236
|
// NgComponentOutlet,
|
|
@@ -237,7 +242,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
237
242
|
// NgTemplateOutlet,
|
|
238
243
|
// NgComponentOutlet,
|
|
239
244
|
CommonModule,
|
|
240
|
-
], standalone: true, template: "<!-- Mouse event blocker for pointer leave -->\n<div\n *ngIf=\"coverRectCords\"\n class=\"owner-mask\"\n [style.top]=\"coverRectCords.top + 'px'\"\n [style.left]=\"coverRectCords.left + 'px'\"\n [style.height]=\"coverRectCords.height + 'px'\"\n [style.width]=\"coverRectCords.width + 'px'\"\n style=\"z-index: -1;\"\n></div>\n\n<div class=\"void\"\n (pointerenter)=\"pointerIsOnVoid = true; hasBootstrapped &&
|
|
245
|
+
], standalone: true, template: "<!-- Mouse event blocker for pointer leave -->\n<div\n *ngIf=\"coverRectCords\"\n class=\"owner-mask\"\n [style.top]=\"coverRectCords.top + 'px'\"\n [style.left]=\"coverRectCords.left + 'px'\"\n [style.height]=\"coverRectCords.height + 'px'\"\n [style.width]=\"coverRectCords.width + 'px'\"\n style=\"z-index: -1;\"\n></div>\n\n<div class=\"void\"\n (pointerenter)=\"pointerIsOnVoid = true; hasBootstrapped && !isLockedOpen && closeOnVoid()\"\n (pointerleave)=\"pointerIsOnVoid = false\"\n (pointerdown)=\"hasBootstrapped && dialogRef.close()\"\n></div>\n\n<div class=\"container\">\n <ng-container\n *ngIf=\"isTemplate == false\"\n [ngComponentOutlet]=\"$any(template)\"\n >\n </ng-container>\n\n <ng-container\n *ngIf=\"isTemplate == true\"\n >\n <ng-container\n [ngTemplateOutlet]=\"$any(template)\"\n [ngTemplateOutletContext]=\"{ '$implicit': data }\"\n ></ng-container>\n </ng-container>\n</div>\n", styles: ["::ng-deep .cdk-overlay-container .ngx-tooltip{--mdc-dialog-container-color: var(--ngx-tooltip-background-color, #2f2f2f)}::ng-deep .cdk-overlay-container .ngx-tooltip .mdc-dialog__container{transform-origin:top left}::ng-deep .cdk-overlay-container .ngx-tooltip .mdc-dialog--open .mdc-dialog__container{transform:none}::ng-deep .cdk-overlay-container .ngx-tooltip .mdc-dialog__surface{overflow:visible;background-color:#0000}::ng-deep .cdk-overlay-container .context-menu-backdrop.cdk-overlay-backdrop-showing{opacity:0}::ng-deep .cdk-overlay-pane.ngx-tooltip .mat-dialog-container{padding:0}:host{min-width:2px;min-height:2px;display:block}.void,.owner-mask{position:absolute}.void{top:-100vh;right:-100vw;bottom:-100vh;left:-100vw;z-index:-2}.container{width:100%;height:100%;background:var(--ngx-tooltip-background-color, #333);border-radius:6px;overflow:hidden}\n"] }]
|
|
241
246
|
}], ctorParameters: function () {
|
|
242
247
|
return [{ type: i0.ViewContainerRef }, { type: undefined, decorators: [{
|
|
243
248
|
type: Optional
|
|
@@ -282,22 +287,52 @@ class TooltipDirective {
|
|
|
282
287
|
* Arbitrary data to pass into the template
|
|
283
288
|
*/
|
|
284
289
|
this.data = {};
|
|
290
|
+
this.isCursorOverTarget = false;
|
|
291
|
+
this.isFreezeOnKeyCodeBound = false;
|
|
292
|
+
this.onKeyDownEvt = this.onKeyDown.bind(this);
|
|
293
|
+
if (this.config.freezeOnKeyCode !== null) {
|
|
294
|
+
this.isFreezeOnKeyCodeBound = true;
|
|
295
|
+
document.body.addEventListener("keydown", this.onKeyDownEvt);
|
|
296
|
+
}
|
|
285
297
|
}
|
|
286
|
-
|
|
298
|
+
ngOnDestroy() {
|
|
299
|
+
if (this.isFreezeOnKeyCodeBound) {
|
|
300
|
+
document.body.removeEventListener("keydown", this.onKeyDownEvt);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
onKeyDown(evt) {
|
|
304
|
+
// TODO: fade message 'tooltip is locked open'
|
|
305
|
+
if (evt.code == ("F2")) {
|
|
306
|
+
this.dialogInstance.componentInstance.isLockedOpen = true;
|
|
307
|
+
}
|
|
287
308
|
}
|
|
288
309
|
// Needs to be public so we can manually open the dialog
|
|
289
310
|
onPointerEnter(evt) {
|
|
311
|
+
var _a;
|
|
290
312
|
return __awaiter(this, void 0, void 0, function* () {
|
|
291
313
|
// If the template is not a template ref, do nothing.
|
|
292
314
|
if (!(this.template instanceof TemplateRef))
|
|
293
315
|
return;
|
|
294
|
-
|
|
295
|
-
|
|
316
|
+
this.isCursorOverTarget = true;
|
|
317
|
+
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
318
|
+
// If the cursor moved away in the time
|
|
319
|
+
if (!this.isCursorOverTarget)
|
|
320
|
+
return;
|
|
321
|
+
if (!this.dialogInstance) {
|
|
322
|
+
const el = this.viewContainer.element.nativeElement;
|
|
323
|
+
this.dialogInstance = yield openTooltip(this.dialog, this.template, this.data, el, this.config);
|
|
324
|
+
}
|
|
325
|
+
}), (_a = this.config.delay) !== null && _a !== void 0 ? _a : 250);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
onPointerLeave(evt) {
|
|
329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
+
this.isCursorOverTarget = false;
|
|
296
331
|
});
|
|
297
332
|
}
|
|
298
333
|
}
|
|
299
334
|
TooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TooltipDirective, deps: [{ token: i1.MatDialog }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
300
|
-
TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: TooltipDirective, isStandalone: true, selector: "[ngxTooltip],[ngx-tooltip]", inputs: { template: ["ngx-tooltip", "template"], config: ["ngx-tooltip-config", "config"], data: ["ngx-tooltip-context", "data"] }, host: { listeners: { "pointerenter": "onPointerEnter($event)" } }, providers: [
|
|
335
|
+
TooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: TooltipDirective, isStandalone: true, selector: "[ngxTooltip],[ngx-tooltip]", inputs: { template: ["ngx-tooltip", "template"], config: ["ngx-tooltip-config", "config"], data: ["ngx-tooltip-context", "data"] }, host: { listeners: { "pointerenter": "onPointerEnter($event)", "pointerleave": "onPointerLeave($event)" } }, providers: [
|
|
301
336
|
MatDialog
|
|
302
337
|
], ngImport: i0 });
|
|
303
338
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TooltipDirective, decorators: [{
|
|
@@ -330,6 +365,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
330
365
|
}], onPointerEnter: [{
|
|
331
366
|
type: HostListener,
|
|
332
367
|
args: ['pointerenter', ['$event']]
|
|
368
|
+
}], onPointerLeave: [{
|
|
369
|
+
type: HostListener,
|
|
370
|
+
args: ['pointerleave', ['$event']]
|
|
333
371
|
}] } });
|
|
334
372
|
// Helper to open the context menu without using the directive.
|
|
335
373
|
const openTooltip = (dialog, template, data, el, config) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -459,7 +497,7 @@ class MenuComponent {
|
|
|
459
497
|
this.id = (_e = this._data) === null || _e === void 0 ? void 0 : _e.id;
|
|
460
498
|
}
|
|
461
499
|
ngOnInit() {
|
|
462
|
-
var _a;
|
|
500
|
+
var _a, _b, _c;
|
|
463
501
|
(_a = this.items) === null || _a === void 0 ? void 0 : _a.forEach(i => {
|
|
464
502
|
if (typeof i == "string")
|
|
465
503
|
return;
|
|
@@ -496,12 +534,12 @@ class MenuComponent {
|
|
|
496
534
|
}
|
|
497
535
|
});
|
|
498
536
|
// Show the icon column if there are any items with an icon
|
|
499
|
-
this.showIconColumn = !!this.items.find(i => typeof i == "object" &&
|
|
537
|
+
this.showIconColumn = !!((_b = this.items) === null || _b === void 0 ? void 0 : _b.find(i => typeof i == "object" &&
|
|
500
538
|
typeof i['icon'] == "string" &&
|
|
501
|
-
i['icon'].length > 2);
|
|
502
|
-
this.showShortcutColumn = !!this.items.find(i => typeof i == "object" &&
|
|
539
|
+
i['icon'].length > 2));
|
|
540
|
+
this.showShortcutColumn = !!((_c = this.items) === null || _c === void 0 ? void 0 : _c.find(i => typeof i == "object" &&
|
|
503
541
|
typeof i['shortcut'] == "string" &&
|
|
504
|
-
i['shortcut'].length > 2);
|
|
542
|
+
i['shortcut'].length > 2));
|
|
505
543
|
// setTimeout(() => {
|
|
506
544
|
// this.closeOnLeave = true
|
|
507
545
|
// }, 300);
|
|
@@ -695,7 +733,6 @@ class MenuDirective {
|
|
|
695
733
|
});
|
|
696
734
|
}
|
|
697
735
|
if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.trigger)) {
|
|
698
|
-
el.onclick = this.openMenu.bind(this);
|
|
699
736
|
el.addEventListener('click', this.openMenu.bind(this));
|
|
700
737
|
}
|
|
701
738
|
else {
|
|
@@ -717,7 +754,7 @@ class MenuDirective {
|
|
|
717
754
|
return __awaiter(this, void 0, void 0, function* () {
|
|
718
755
|
const el = this.viewContainer.element.nativeElement;
|
|
719
756
|
el.classList.add("ngx-menu-open");
|
|
720
|
-
return openMenu(this.dialog, this.menuItems, this.data, evt, this.config)
|
|
757
|
+
return openMenu(this.dialog, this.menuItems, this.data, evt, this.config, el)
|
|
721
758
|
.then((...res) => {
|
|
722
759
|
el.classList.remove("ngx-menu-open");
|
|
723
760
|
return res;
|
|
@@ -730,36 +767,48 @@ class MenuDirective {
|
|
|
730
767
|
}
|
|
731
768
|
}
|
|
732
769
|
MenuDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MenuDirective, deps: [{ token: i1.MatDialog }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
733
|
-
MenuDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: MenuDirective, isStandalone: true, selector: "[ngx-
|
|
770
|
+
MenuDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: MenuDirective, isStandalone: true, selector: "[ngx-contextmenu],[ngx-menu],[ngxContextmenu],[ngxMenu]", inputs: { data: ["ngx-menu-context", "data"], ctxMenuItems: ["ngx-contextmenu", "ctxMenuItems"], menuItems: ["ngx-menu", "menuItems"], config: ["ngx-menu-config", "config"] }, providers: [
|
|
734
771
|
MatDialog
|
|
735
772
|
], ngImport: i0 });
|
|
736
773
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MenuDirective, decorators: [{
|
|
737
774
|
type: Directive,
|
|
738
775
|
args: [{
|
|
739
|
-
selector: '[ngx-
|
|
776
|
+
selector: '[ngx-contextmenu],[ngx-menu],[ngxContextmenu],[ngxMenu]',
|
|
740
777
|
providers: [
|
|
741
778
|
MatDialog
|
|
742
779
|
],
|
|
743
780
|
standalone: true
|
|
744
781
|
}]
|
|
745
782
|
}], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i0.ViewContainerRef }]; }, propDecorators: { data: [{
|
|
783
|
+
type: Input,
|
|
784
|
+
args: ["ngxMenuContext"]
|
|
785
|
+
}, {
|
|
746
786
|
type: Input,
|
|
747
787
|
args: ["ngx-menu-context"]
|
|
748
788
|
}], ctxMenuItems: [{
|
|
749
789
|
type: Input,
|
|
750
|
-
args: ["
|
|
790
|
+
args: ["ngxContextmenu"]
|
|
791
|
+
}, {
|
|
792
|
+
type: Input,
|
|
793
|
+
args: ["ngx-contextmenu"]
|
|
751
794
|
}], menuItems: [{
|
|
795
|
+
type: Input,
|
|
796
|
+
args: ["ngxMenu"]
|
|
797
|
+
}, {
|
|
752
798
|
type: Input,
|
|
753
799
|
args: ["ngx-menu"]
|
|
754
800
|
}], config: [{
|
|
801
|
+
type: Input,
|
|
802
|
+
args: ["ngxMenuConfig"]
|
|
803
|
+
}, {
|
|
755
804
|
type: Input,
|
|
756
805
|
args: ["ngx-menu-config"]
|
|
757
806
|
}] } });
|
|
758
|
-
// Helper to open the
|
|
759
|
-
const openMenu = (dialog, menuItems, data, evt, config = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
807
|
+
// Helper to open the menu without using the directive.
|
|
808
|
+
const openMenu = (dialog, menuItems, data, evt, config = {}, el) => __awaiter(void 0, void 0, void 0, function* () {
|
|
760
809
|
evt.preventDefault();
|
|
761
810
|
evt.stopPropagation();
|
|
762
|
-
const cords = getPosition(evt, config, yield calcMenuItemBounds(menuItems, data));
|
|
811
|
+
const cords = getPosition(el || evt, config, yield calcMenuItemBounds(menuItems, data));
|
|
763
812
|
const specificId = crypto.randomUUID();
|
|
764
813
|
if (!config.alignment)
|
|
765
814
|
config.alignment = "start";
|
|
@@ -1986,7 +2035,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1986
2035
|
* Public API Surface of package
|
|
1987
2036
|
*/
|
|
1988
2037
|
/**
|
|
1989
|
-
**
|
|
2038
|
+
** Types
|
|
1990
2039
|
*/
|
|
1991
2040
|
|
|
1992
2041
|
/**
|