@skyux/core 8.0.0-alpha.8 → 8.0.0-beta.0
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/documentation.json +1199 -1461
- package/esm2020/index.mjs +6 -1
- package/esm2020/lib/modules/affix/affix-config.mjs +1 -1
- package/esm2020/lib/modules/affix/affix-position.mjs +2 -0
- package/esm2020/lib/modules/affix/affix-rect.mjs +2 -0
- package/esm2020/lib/modules/affix/affix.directive.mjs +6 -2
- package/esm2020/lib/modules/affix/affixer.mjs +32 -7
- package/esm2020/lib/modules/live-announcer/live-announcer.service.mjs +80 -0
- package/esm2020/lib/modules/live-announcer/types/live-announcer-args.mjs +2 -0
- package/esm2020/lib/modules/live-announcer/types/live-announcer-politeness.mjs +2 -0
- package/esm2020/lib/modules/numeric/numeric.options.mjs +12 -1
- package/esm2020/lib/modules/numeric/numeric.service.mjs +23 -15
- package/esm2020/lib/modules/overlay/overlay-config.mjs +1 -1
- package/esm2020/lib/modules/overlay/overlay-position.mjs +2 -0
- package/esm2020/lib/modules/overlay/overlay.component.mjs +6 -3
- package/fesm2015/skyux-core.mjs +145 -27
- package/fesm2015/skyux-core.mjs.map +1 -1
- package/fesm2020/skyux-core.mjs +150 -27
- package/fesm2020/skyux-core.mjs.map +1 -1
- package/index.d.ts +5 -0
- package/lib/modules/affix/affix-config.d.ts +5 -0
- package/lib/modules/affix/affix-position.d.ts +1 -0
- package/lib/modules/affix/affix-rect.d.ts +11 -0
- package/lib/modules/affix/affix.directive.d.ts +6 -1
- package/lib/modules/live-announcer/live-announcer.service.d.ts +31 -0
- package/lib/modules/live-announcer/types/live-announcer-args.d.ts +8 -0
- package/lib/modules/live-announcer/types/live-announcer-politeness.d.ts +5 -0
- package/lib/modules/numeric/numeric.options.d.ts +2 -0
- package/lib/modules/overlay/overlay-config.d.ts +5 -0
- package/lib/modules/overlay/overlay-position.d.ts +1 -0
- package/lib/modules/overlay/overlay.component.d.ts +2 -0
- package/package.json +2 -2
package/fesm2015/skyux-core.mjs
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { NgModule, Injectable, EventEmitter, Directive, Input, Output, Injector, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, createComponent, InjectionToken, Optional, Inject, Pipe, ElementRef, HostBinding } from '@angular/core';
|
2
|
+
import { NgModule, Injectable, EventEmitter, Directive, Input, Output, Injector, ViewContainerRef, Component, ChangeDetectionStrategy, ViewChild, createComponent, inject, InjectionToken, Optional, Inject, Pipe, ElementRef, HostBinding } from '@angular/core';
|
3
3
|
import { __classPrivateFieldSet, __classPrivateFieldGet, __awaiter } from 'tslib';
|
4
4
|
import * as i5 from '@angular/common';
|
5
|
-
import { CommonModule } from '@angular/common';
|
6
|
-
import { Subject, fromEvent,
|
5
|
+
import { CommonModule, DOCUMENT } from '@angular/common';
|
6
|
+
import { Subject, fromEvent, ReplaySubject, BehaviorSubject, Observable, of, concat, animationFrameScheduler } from 'rxjs';
|
7
7
|
import { takeUntil, debounceTime, finalize, switchMap, map } from 'rxjs/operators';
|
8
8
|
import * as i1 from '@skyux/i18n';
|
9
9
|
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, SkyIntlNumberFormatStyle, SkyIntlNumberFormatter } from '@skyux/i18n';
|
@@ -375,7 +375,7 @@ function isOffsetPartiallyVisibleWithinParent(parent, offset, bufferOffset) {
|
|
375
375
|
parentOffset.left >= offset.right);
|
376
376
|
}
|
377
377
|
|
378
|
-
var _SkyAffixer_instances, _SkyAffixer_config_get, _SkyAffixer_config_set, _SkyAffixer_affixedElement, _SkyAffixer_baseElement, _SkyAffixer_currentOffset, _SkyAffixer_currentPlacement, _SkyAffixer_offsetChange, _SkyAffixer_offsetChangeObs, _SkyAffixer_overflowParents, _SkyAffixer_overflowScroll, _SkyAffixer_overflowScrollObs, _SkyAffixer_placementChange, _SkyAffixer_placementChangeObs, _SkyAffixer_renderer, _SkyAffixer_resizeListener, _SkyAffixer_scrollListeners, _SkyAffixer__config, _SkyAffixer_affix, _SkyAffixer_getOffset, _SkyAffixer_getPreferredOffset, _SkyAffixer_adjustOffsetToOverflowParent, _SkyAffixer_getImmediateOverflowParent, _SkyAffixer_getAutoFitContextParent, _SkyAffixer_notifyPlacementChange, _SkyAffixer_reset, _SkyAffixer_isNewOffset, _SkyAffixer_isBaseElementVisible, _SkyAffixer_addScrollListeners, _SkyAffixer_addResizeListener, _SkyAffixer_removeResizeListener, _SkyAffixer_removeScrollListeners;
|
378
|
+
var _SkyAffixer_instances, _SkyAffixer_config_get, _SkyAffixer_config_set, _SkyAffixer_affixedElement, _SkyAffixer_baseElement, _SkyAffixer_currentOffset, _SkyAffixer_currentPlacement, _SkyAffixer_offsetChange, _SkyAffixer_offsetChangeObs, _SkyAffixer_overflowParents, _SkyAffixer_overflowScroll, _SkyAffixer_overflowScrollObs, _SkyAffixer_placementChange, _SkyAffixer_placementChangeObs, _SkyAffixer_renderer, _SkyAffixer_resizeListener, _SkyAffixer_scrollListeners, _SkyAffixer__config, _SkyAffixer_affix, _SkyAffixer_getOffset, _SkyAffixer_getRect, _SkyAffixer_getPreferredOffset, _SkyAffixer_adjustOffsetToOverflowParent, _SkyAffixer_getImmediateOverflowParent, _SkyAffixer_getAutoFitContextParent, _SkyAffixer_notifyPlacementChange, _SkyAffixer_reset, _SkyAffixer_isNewOffset, _SkyAffixer_isBaseElementVisible, _SkyAffixer_addScrollListeners, _SkyAffixer_addResizeListener, _SkyAffixer_removeResizeListener, _SkyAffixer_removeScrollListeners;
|
379
379
|
const DEFAULT_AFFIX_CONFIG = {
|
380
380
|
autoFitContext: SkyAffixAutoFitContext.OverflowParent,
|
381
381
|
enableAutoFit: false,
|
@@ -494,9 +494,19 @@ _SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMa
|
|
494
494
|
let isAffixedElementFullyVisible = false;
|
495
495
|
let offset;
|
496
496
|
let placement = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement;
|
497
|
+
const autoFitOverflowOffset = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset || {
|
498
|
+
bottom: 0,
|
499
|
+
left: 0,
|
500
|
+
right: 0,
|
501
|
+
top: 0,
|
502
|
+
};
|
503
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).position === 'absolute') {
|
504
|
+
autoFitOverflowOffset.top =
|
505
|
+
(autoFitOverflowOffset.top || 0) + window.scrollY;
|
506
|
+
}
|
497
507
|
do {
|
498
508
|
offset = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getPreferredOffset).call(this, placement);
|
499
|
-
isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(parent, offset,
|
509
|
+
isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(parent, offset, autoFitOverflowOffset);
|
500
510
|
if (!__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit) {
|
501
511
|
break;
|
502
512
|
}
|
@@ -522,12 +532,27 @@ _SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMa
|
|
522
532
|
}
|
523
533
|
// No suitable placement was found, so revert to preferred placement.
|
524
534
|
return __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getPreferredOffset).call(this, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement);
|
535
|
+
}, _SkyAffixer_getRect = function _SkyAffixer_getRect(baseElement) {
|
536
|
+
const baseDomRect = baseElement.getBoundingClientRect();
|
537
|
+
const baseRect = {
|
538
|
+
top: baseDomRect.top,
|
539
|
+
bottom: baseDomRect.bottom,
|
540
|
+
left: baseDomRect.left,
|
541
|
+
right: baseDomRect.right,
|
542
|
+
width: baseDomRect.width,
|
543
|
+
height: baseDomRect.height,
|
544
|
+
};
|
545
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).position === 'absolute') {
|
546
|
+
baseRect.top += window.scrollY;
|
547
|
+
baseRect.bottom = baseRect.top + baseDomRect.height;
|
548
|
+
}
|
549
|
+
return baseRect;
|
525
550
|
}, _SkyAffixer_getPreferredOffset = function _SkyAffixer_getPreferredOffset(placement) {
|
526
551
|
if (!__classPrivateFieldGet(this, _SkyAffixer_baseElement, "f")) {
|
527
552
|
return { top: 0, left: 0, bottom: 0, right: 0 };
|
528
553
|
}
|
529
|
-
const affixedRect = __classPrivateFieldGet(this,
|
530
|
-
const baseRect = __classPrivateFieldGet(this,
|
554
|
+
const affixedRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, __classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f"));
|
555
|
+
const baseRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, __classPrivateFieldGet(this, _SkyAffixer_baseElement, "f"));
|
531
556
|
const horizontalAlignment = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).horizontalAlignment;
|
532
557
|
const verticalAlignment = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).verticalAlignment;
|
533
558
|
const enableAutoFit = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit;
|
@@ -607,8 +632,8 @@ _SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMa
|
|
607
632
|
}, _SkyAffixer_adjustOffsetToOverflowParent = function _SkyAffixer_adjustOffsetToOverflowParent(offset, placement, baseElement) {
|
608
633
|
const parent = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getAutoFitContextParent).call(this);
|
609
634
|
const parentOffset = getElementOffset(parent, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset);
|
610
|
-
const affixedRect = __classPrivateFieldGet(this,
|
611
|
-
const baseRect =
|
635
|
+
const affixedRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, __classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f"));
|
636
|
+
const baseRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, baseElement);
|
612
637
|
// A pixel value representing the leeway between the edge of the overflow parent and the edge
|
613
638
|
// of the base element before it disappears from view.
|
614
639
|
// If the visible portion of the base element is less than this pixel value, the auto-fit
|
@@ -790,6 +815,7 @@ class SkyAffixDirective {
|
|
790
815
|
changes.affixHorizontalAlignment ||
|
791
816
|
changes.affixIsSticky ||
|
792
817
|
changes.affixPlacement ||
|
818
|
+
changes.affixPosition ||
|
793
819
|
changes.affixVerticalAlignment) {
|
794
820
|
__classPrivateFieldGet(this, _SkyAffixDirective_instances, "m", _SkyAffixDirective_updateAlignment).call(this);
|
795
821
|
}
|
@@ -816,12 +842,13 @@ _SkyAffixDirective_affixer = new WeakMap(), _SkyAffixDirective_affixService = ne
|
|
816
842
|
horizontalAlignment: this.affixHorizontalAlignment,
|
817
843
|
isSticky: this.affixIsSticky,
|
818
844
|
placement: this.affixPlacement,
|
845
|
+
position: this.affixPosition,
|
819
846
|
verticalAlignment: this.affixVerticalAlignment,
|
820
847
|
});
|
821
848
|
}
|
822
849
|
};
|
823
850
|
SkyAffixDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyAffixDirective, deps: [{ token: i0.ElementRef }, { token: SkyAffixService }], target: i0.ɵɵFactoryTarget.Directive });
|
824
|
-
SkyAffixDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: SkyAffixDirective, selector: "[skyAffixTo]", inputs: { skyAffixTo: "skyAffixTo", affixAutoFitContext: "affixAutoFitContext", affixAutoFitOverflowOffset: "affixAutoFitOverflowOffset", affixEnableAutoFit: "affixEnableAutoFit", affixHorizontalAlignment: "affixHorizontalAlignment", affixIsSticky: "affixIsSticky", affixPlacement: "affixPlacement", affixVerticalAlignment: "affixVerticalAlignment" }, outputs: { affixOffsetChange: "affixOffsetChange", affixOverflowScroll: "affixOverflowScroll", affixPlacementChange: "affixPlacementChange" }, usesOnChanges: true, ngImport: i0 });
|
851
|
+
SkyAffixDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: SkyAffixDirective, selector: "[skyAffixTo]", inputs: { skyAffixTo: "skyAffixTo", affixAutoFitContext: "affixAutoFitContext", affixAutoFitOverflowOffset: "affixAutoFitOverflowOffset", affixEnableAutoFit: "affixEnableAutoFit", affixHorizontalAlignment: "affixHorizontalAlignment", affixIsSticky: "affixIsSticky", affixPlacement: "affixPlacement", affixPosition: "affixPosition", affixVerticalAlignment: "affixVerticalAlignment" }, outputs: { affixOffsetChange: "affixOffsetChange", affixOverflowScroll: "affixOverflowScroll", affixPlacementChange: "affixPlacementChange" }, usesOnChanges: true, ngImport: i0 });
|
825
852
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyAffixDirective, decorators: [{
|
826
853
|
type: Directive,
|
827
854
|
args: [{
|
@@ -841,6 +868,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
841
868
|
type: Input
|
842
869
|
}], affixPlacement: [{
|
843
870
|
type: Input
|
871
|
+
}], affixPosition: [{
|
872
|
+
type: Input
|
844
873
|
}], affixVerticalAlignment: [{
|
845
874
|
type: Input
|
846
875
|
}], affixOffsetChange: [{
|
@@ -1485,6 +1514,82 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
1485
1514
|
}]
|
1486
1515
|
}] });
|
1487
1516
|
|
1517
|
+
var _SkyLiveAnnouncerService_instances, _SkyLiveAnnouncerService_announcerElement, _SkyLiveAnnouncerService_document, _SkyLiveAnnouncerService_idService, _SkyLiveAnnouncerService_createLiveElement;
|
1518
|
+
/**
|
1519
|
+
* Allows for announcing messages to screen reader users through the use of a common `aria-live` element.
|
1520
|
+
* @internal
|
1521
|
+
*/
|
1522
|
+
class SkyLiveAnnouncerService {
|
1523
|
+
constructor() {
|
1524
|
+
_SkyLiveAnnouncerService_instances.add(this);
|
1525
|
+
this.announcerElementChanged = new ReplaySubject(1);
|
1526
|
+
_SkyLiveAnnouncerService_announcerElement.set(this, void 0);
|
1527
|
+
_SkyLiveAnnouncerService_document.set(this, inject(DOCUMENT));
|
1528
|
+
_SkyLiveAnnouncerService_idService.set(this, inject(SkyIdService));
|
1529
|
+
__classPrivateFieldSet(this, _SkyLiveAnnouncerService_announcerElement, __classPrivateFieldGet(this, _SkyLiveAnnouncerService_instances, "m", _SkyLiveAnnouncerService_createLiveElement).call(this), "f");
|
1530
|
+
this.announcerElementChanged.next(__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f"));
|
1531
|
+
}
|
1532
|
+
/**
|
1533
|
+
* Announces a message to screen readers.
|
1534
|
+
* @param message Message to be announced to the screen reader.
|
1535
|
+
* @param args Options for the announcement of the message.
|
1536
|
+
*/
|
1537
|
+
announce(message, args) {
|
1538
|
+
var _a;
|
1539
|
+
/* safety-check */
|
1540
|
+
/* istanbul ignore if */
|
1541
|
+
if (!__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f")) {
|
1542
|
+
__classPrivateFieldSet(this, _SkyLiveAnnouncerService_announcerElement, __classPrivateFieldGet(this, _SkyLiveAnnouncerService_instances, "m", _SkyLiveAnnouncerService_createLiveElement).call(this), "f");
|
1543
|
+
this.announcerElementChanged.next(__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f"));
|
1544
|
+
}
|
1545
|
+
const politeness = (_a = args === null || args === void 0 ? void 0 : args.politeness) !== null && _a !== void 0 ? _a : 'polite';
|
1546
|
+
this.clear();
|
1547
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f").setAttribute('aria-live', politeness);
|
1548
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f").textContent = message;
|
1549
|
+
}
|
1550
|
+
/**
|
1551
|
+
* Clears the current text from the announcer element. Can be used to prevent
|
1552
|
+
* screen readers from reading the text out again while the user is going
|
1553
|
+
* through the page landmarks.
|
1554
|
+
*/
|
1555
|
+
clear() {
|
1556
|
+
if (__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f")) {
|
1557
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f").textContent = '';
|
1558
|
+
}
|
1559
|
+
}
|
1560
|
+
/**
|
1561
|
+
* @internal
|
1562
|
+
*/
|
1563
|
+
ngOnDestroy() {
|
1564
|
+
var _a;
|
1565
|
+
(_a = __classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f")) === null || _a === void 0 ? void 0 : _a.remove();
|
1566
|
+
__classPrivateFieldSet(this, _SkyLiveAnnouncerService_announcerElement, undefined, "f");
|
1567
|
+
this.announcerElementChanged.next(undefined);
|
1568
|
+
}
|
1569
|
+
}
|
1570
|
+
_SkyLiveAnnouncerService_announcerElement = new WeakMap(), _SkyLiveAnnouncerService_document = new WeakMap(), _SkyLiveAnnouncerService_idService = new WeakMap(), _SkyLiveAnnouncerService_instances = new WeakSet(), _SkyLiveAnnouncerService_createLiveElement = function _SkyLiveAnnouncerService_createLiveElement() {
|
1571
|
+
const elementClass = 'sky-live-announcer-element';
|
1572
|
+
const previousElements = __classPrivateFieldGet(this, _SkyLiveAnnouncerService_document, "f").getElementsByClassName(elementClass);
|
1573
|
+
const liveEl = __classPrivateFieldGet(this, _SkyLiveAnnouncerService_document, "f").createElement('div');
|
1574
|
+
// Remove any old containers. This can happen when coming in from a server-side-rendered page.
|
1575
|
+
for (let i = 0; i < previousElements.length; i++) {
|
1576
|
+
previousElements[i].remove();
|
1577
|
+
}
|
1578
|
+
liveEl.classList.add(elementClass);
|
1579
|
+
liveEl.classList.add('sky-screen-reader-only');
|
1580
|
+
liveEl.setAttribute('aria-atomic', 'true');
|
1581
|
+
liveEl.setAttribute('aria-live', 'polite');
|
1582
|
+
liveEl.id = __classPrivateFieldGet(this, _SkyLiveAnnouncerService_idService, "f").generateId();
|
1583
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_document, "f").body.appendChild(liveEl);
|
1584
|
+
return liveEl;
|
1585
|
+
};
|
1586
|
+
SkyLiveAnnouncerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyLiveAnnouncerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1587
|
+
SkyLiveAnnouncerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyLiveAnnouncerService, providedIn: 'root' });
|
1588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyLiveAnnouncerService, decorators: [{
|
1589
|
+
type: Injectable,
|
1590
|
+
args: [{ providedIn: 'root' }]
|
1591
|
+
}], ctorParameters: function () { return []; } });
|
1592
|
+
|
1488
1593
|
/**
|
1489
1594
|
* @deprecated The `SkyLogService` no longer needs the `SkyLogModule`.
|
1490
1595
|
* The `SkyLogModule` can be removed from your project.
|
@@ -1834,6 +1939,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
1834
1939
|
/**
|
1835
1940
|
* Provides arguments for the number to format.
|
1836
1941
|
* @deprecated Use the `SkyNumericOptions` interface instead.
|
1942
|
+
* @internal
|
1837
1943
|
*/
|
1838
1944
|
class NumericOptions {
|
1839
1945
|
constructor() {
|
@@ -1843,6 +1949,14 @@ class NumericOptions {
|
|
1843
1949
|
this.iso = 'USD';
|
1844
1950
|
this.truncate = true;
|
1845
1951
|
this.truncateAfter = 1000;
|
1952
|
+
const logService = new SkyLogService(new SkyAppFormat());
|
1953
|
+
logService
|
1954
|
+
.deprecated('NumericOptions', {
|
1955
|
+
deprecationMajorVersion: 7,
|
1956
|
+
moreInfoUrl: 'https://developer.blackbaud.com/skyux/components/numeric',
|
1957
|
+
replacementRecommendation: 'Use the `SkyNumericOptions` interface instead.',
|
1958
|
+
})
|
1959
|
+
.then();
|
1846
1960
|
}
|
1847
1961
|
}
|
1848
1962
|
|
@@ -1946,9 +2060,10 @@ class SkyNumericService {
|
|
1946
2060
|
if (isNaN(value) || value === null) {
|
1947
2061
|
return '';
|
1948
2062
|
}
|
2063
|
+
const numericOptions = Object.assign({ digits: 0, format: 'number', currencySign: 'standard', iso: 'USD', truncateAfter: 1000 }, options);
|
1949
2064
|
const decimalPlaceRegExp = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
1950
|
-
const locale =
|
1951
|
-
const digits =
|
2065
|
+
const locale = numericOptions.locale || this.currentLocale;
|
2066
|
+
const digits = numericOptions.digits || 0;
|
1952
2067
|
// Get the symbol for the number after rounding, since rounding could push the number
|
1953
2068
|
// into a different symbol range.
|
1954
2069
|
let roundedNumber = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_roundNumber).call(this, value, digits);
|
@@ -1956,9 +2071,9 @@ class SkyNumericService {
|
|
1956
2071
|
let suffix = '';
|
1957
2072
|
for (let i = 0; i < __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f").length; i++) {
|
1958
2073
|
let symbol = __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f")[i];
|
1959
|
-
if (
|
1960
|
-
|
1961
|
-
roundedNumberAbs >=
|
2074
|
+
if (numericOptions.truncate &&
|
2075
|
+
numericOptions.truncateAfter !== undefined &&
|
2076
|
+
roundedNumberAbs >= numericOptions.truncateAfter &&
|
1962
2077
|
roundedNumberAbs >= symbol.value) {
|
1963
2078
|
roundedNumber = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_roundNumber).call(this, value / symbol.value, digits);
|
1964
2079
|
if (Math.abs(roundedNumber) === 1000 && i > 0) {
|
@@ -1975,7 +2090,7 @@ class SkyNumericService {
|
|
1975
2090
|
let digitsFormatted;
|
1976
2091
|
let isDecimal = false;
|
1977
2092
|
// Checks the string entered for format. Using toLowerCase to ignore case.
|
1978
|
-
switch ((_a =
|
2093
|
+
switch ((_a = numericOptions.format) === null || _a === void 0 ? void 0 : _a.toLowerCase()) {
|
1979
2094
|
// In a case where a decimal value was not shortened and
|
1980
2095
|
// the digit input is 2 or higher, it forces 2 digits.
|
1981
2096
|
// For example, this prevents a value like $15.50 from displaying as $15.5.
|
@@ -1983,8 +2098,8 @@ class SkyNumericService {
|
|
1983
2098
|
// three decimal digits.
|
1984
2099
|
case 'currency':
|
1985
2100
|
isDecimal = value % 1 !== 0;
|
1986
|
-
if (
|
1987
|
-
digitsFormatted = `1.${
|
2101
|
+
if (numericOptions.minDigits) {
|
2102
|
+
digitsFormatted = `1.${numericOptions.minDigits}-${digits}`;
|
1988
2103
|
}
|
1989
2104
|
else if (isDecimal && digits >= 2) {
|
1990
2105
|
digitsFormatted = `1.2-${digits}`;
|
@@ -1992,12 +2107,12 @@ class SkyNumericService {
|
|
1992
2107
|
else {
|
1993
2108
|
digitsFormatted = `1.0-${digits}`;
|
1994
2109
|
}
|
1995
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency, digitsFormatted,
|
2110
|
+
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency, digitsFormatted, numericOptions.iso,
|
1996
2111
|
// Angular 5+ needs a string for this parameter, but Angular 4 needs a boolean.
|
1997
2112
|
// To support both versions we can supply 'symbol' which will evaluate truthy for Angular 4
|
1998
2113
|
// and the appropriate string value for Angular 5+.
|
1999
2114
|
// See: https://angular.io/api/common/CurrencyPipe#parameters
|
2000
|
-
'symbol',
|
2115
|
+
'symbol', numericOptions.currencySign);
|
2001
2116
|
// ^^^^^^ Result can't be null since the sanitized input is always a number.
|
2002
2117
|
break;
|
2003
2118
|
// The following is a catch-all to ensure that if
|
@@ -2006,10 +2121,10 @@ class SkyNumericService {
|
|
2006
2121
|
default:
|
2007
2122
|
// Ensures localization of the number to ensure comma and
|
2008
2123
|
// decimal separator
|
2009
|
-
if (
|
2010
|
-
digitsFormatted = `1.${
|
2124
|
+
if (numericOptions.minDigits) {
|
2125
|
+
digitsFormatted = `1.${numericOptions.minDigits}-${digits}`;
|
2011
2126
|
}
|
2012
|
-
else if (
|
2127
|
+
else if (numericOptions.truncate) {
|
2013
2128
|
digitsFormatted = `1.0-${digits}`;
|
2014
2129
|
}
|
2015
2130
|
else {
|
@@ -2019,7 +2134,7 @@ class SkyNumericService {
|
|
2019
2134
|
// ^^^^^^ Result can't be null since the sanitized input is always a number.
|
2020
2135
|
break;
|
2021
2136
|
}
|
2022
|
-
if (
|
2137
|
+
if (numericOptions.truncate) {
|
2023
2138
|
output = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_replaceShortenSymbol).call(this, output);
|
2024
2139
|
}
|
2025
2140
|
return output;
|
@@ -2249,6 +2364,7 @@ class SkyOverlayContext {
|
|
2249
2364
|
}
|
2250
2365
|
|
2251
2366
|
var _SkyOverlayComponent_instances, _SkyOverlayComponent_backdropClick, _SkyOverlayComponent_backdropClickObs, _SkyOverlayComponent_changeDetector, _SkyOverlayComponent_closed, _SkyOverlayComponent_closedObs, _SkyOverlayComponent_context, _SkyOverlayComponent_coreAdapter, _SkyOverlayComponent_injector, _SkyOverlayComponent_ngUnsubscribe, _SkyOverlayComponent_router, _SkyOverlayComponent_routerSubscription, _SkyOverlayComponent_applyConfig, _SkyOverlayComponent_addBackdropClickListener, _SkyOverlayComponent_addRouteListener, _SkyOverlayComponent_removeRouteListener;
|
2367
|
+
const POSITION_DEFAULT = 'fixed';
|
2252
2368
|
/**
|
2253
2369
|
* Omnibar is 1000.
|
2254
2370
|
* See: https://github.com/blackbaud/auth-client/blob/master/src/omnibar/omnibar.ts#L139
|
@@ -2280,6 +2396,7 @@ class SkyOverlayComponent {
|
|
2280
2396
|
this.showBackdrop = false;
|
2281
2397
|
this.zIndex = `${++uniqueZIndex}`;
|
2282
2398
|
this.clipPath$ = new ReplaySubject(1);
|
2399
|
+
this.position = POSITION_DEFAULT;
|
2283
2400
|
_SkyOverlayComponent_backdropClick.set(this, void 0);
|
2284
2401
|
_SkyOverlayComponent_backdropClickObs.set(this, void 0);
|
2285
2402
|
_SkyOverlayComponent_changeDetector.set(this, void 0);
|
@@ -2362,6 +2479,7 @@ _SkyOverlayComponent_backdropClick = new WeakMap(), _SkyOverlayComponent_backdro
|
|
2362
2479
|
this.wrapperClass = config.wrapperClass || '';
|
2363
2480
|
this.showBackdrop = !!config.showBackdrop;
|
2364
2481
|
this.enablePointerEvents = !!config.enablePointerEvents;
|
2482
|
+
this.position = config.position || POSITION_DEFAULT;
|
2365
2483
|
__classPrivateFieldGet(this, _SkyOverlayComponent_changeDetector, "f").markForCheck();
|
2366
2484
|
}, _SkyOverlayComponent_addBackdropClickListener = function _SkyOverlayComponent_addBackdropClickListener() {
|
2367
2485
|
fromEvent(window.document, 'click')
|
@@ -2396,10 +2514,10 @@ _SkyOverlayComponent_backdropClick = new WeakMap(), _SkyOverlayComponent_backdro
|
|
2396
2514
|
}
|
2397
2515
|
};
|
2398
2516
|
SkyOverlayComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyOverlayComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: SkyCoreAdapterService }, { token: SkyOverlayContext }, { token: SkyIdService }, { token: i4.Router, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
2399
|
-
SkyOverlayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: SkyOverlayComponent, selector: "sky-overlay", host: { properties: { "id": "this.id" } }, viewQueries: [{ propertyName: "overlayContentRef", first: true, predicate: ["overlayContentRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "overlayRef", first: true, predicate: ["overlayRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "targetRef", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div\n [class]=\"wrapperClass\"\n [style.z-index]=\"zIndex\"\n [style.clip-path]=\"clipPath$ | async\"\n [ngClass]=\"{\n 'enable-pointer-events-pass-through': enablePointerEvents,\n 'sky-overlay': true\n }\"\n #overlayRef\n>\n <div class=\"sky-overlay-content\" #overlayContentRef>\n <ng-template #target> </ng-template>\n </div>\n <div *ngIf=\"showBackdrop\" class=\"sky-overlay-backdrop\"></div>\n</div>\n", styles: [".sky-overlay{
|
2517
|
+
SkyOverlayComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.1", type: SkyOverlayComponent, selector: "sky-overlay", host: { properties: { "id": "this.id" } }, viewQueries: [{ propertyName: "overlayContentRef", first: true, predicate: ["overlayContentRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "overlayRef", first: true, predicate: ["overlayRef"], descendants: true, read: ElementRef, static: true }, { propertyName: "targetRef", first: true, predicate: ["target"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div\n [class]=\"'sky-overlay-position-' + position + ' ' + wrapperClass\"\n [style.z-index]=\"zIndex\"\n [style.clip-path]=\"clipPath$ | async\"\n [ngClass]=\"{\n 'enable-pointer-events-pass-through': enablePointerEvents,\n 'sky-overlay': true\n }\"\n #overlayRef\n>\n <div class=\"sky-overlay-content\" #overlayContentRef>\n <ng-template #target> </ng-template>\n </div>\n <div *ngIf=\"showBackdrop\" class=\"sky-overlay-backdrop\"></div>\n</div>\n", styles: [".sky-overlay{inset:0;width:100%;height:100%;display:flex;pointer-events:auto}.sky-overlay-position-absolute{position:absolute}.sky-overlay-position-fixed{position:fixed}.sky-overlay-content{position:relative;z-index:1;display:inline-flex;align-self:start;pointer-events:auto}.sky-overlay-backdrop{background:rgba(0,0,0,.5);inset:0;width:100%;height:100%;position:absolute}.enable-pointer-events-pass-through,.enable-pointer-events-pass-through .sky-overlay-backdrop{pointer-events:none}.enable-pointer-events-pass-through .sky-overlay-content{pointer-events:auto}\n"], dependencies: [{ kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
2400
2518
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyOverlayComponent, decorators: [{
|
2401
2519
|
type: Component,
|
2402
|
-
args: [{ selector: 'sky-overlay', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [class]=\"wrapperClass\"\n [style.z-index]=\"zIndex\"\n [style.clip-path]=\"clipPath$ | async\"\n [ngClass]=\"{\n 'enable-pointer-events-pass-through': enablePointerEvents,\n 'sky-overlay': true\n }\"\n #overlayRef\n>\n <div class=\"sky-overlay-content\" #overlayContentRef>\n <ng-template #target> </ng-template>\n </div>\n <div *ngIf=\"showBackdrop\" class=\"sky-overlay-backdrop\"></div>\n</div>\n", styles: [".sky-overlay{
|
2520
|
+
args: [{ selector: 'sky-overlay', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [class]=\"'sky-overlay-position-' + position + ' ' + wrapperClass\"\n [style.z-index]=\"zIndex\"\n [style.clip-path]=\"clipPath$ | async\"\n [ngClass]=\"{\n 'enable-pointer-events-pass-through': enablePointerEvents,\n 'sky-overlay': true\n }\"\n #overlayRef\n>\n <div class=\"sky-overlay-content\" #overlayContentRef>\n <ng-template #target> </ng-template>\n </div>\n <div *ngIf=\"showBackdrop\" class=\"sky-overlay-backdrop\"></div>\n</div>\n", styles: [".sky-overlay{inset:0;width:100%;height:100%;display:flex;pointer-events:auto}.sky-overlay-position-absolute{position:absolute}.sky-overlay-position-fixed{position:fixed}.sky-overlay-content{position:relative;z-index:1;display:inline-flex;align-self:start;pointer-events:auto}.sky-overlay-backdrop{background:rgba(0,0,0,.5);inset:0;width:100%;height:100%;position:absolute}.enable-pointer-events-pass-through,.enable-pointer-events-pass-through .sky-overlay-backdrop{pointer-events:none}.enable-pointer-events-pass-through .sky-overlay-content{pointer-events:auto}\n"] }]
|
2403
2521
|
}], ctorParameters: function () {
|
2404
2522
|
return [{ type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: SkyCoreAdapterService }, { type: SkyOverlayContext }, { type: SkyIdService }, { type: i4.Router, decorators: [{
|
2405
2523
|
type: Optional
|
@@ -3657,5 +3775,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
3657
3775
|
* Generated bundle index. Do not edit.
|
3658
3776
|
*/
|
3659
3777
|
|
3660
|
-
export { NumericOptions, SKY_LOG_LEVEL, SKY_STACKING_CONTEXT, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyIdModule, SkyIdService, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyMutationObserverService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, getWindow, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
|
3778
|
+
export { NumericOptions, SKY_LOG_LEVEL, SKY_STACKING_CONTEXT, SkyAffixAutoFitContext, SkyAffixModule, SkyAffixService, SkyAffixer, SkyAppFormat, SkyAppTitleService, SkyAppWindowRef, SkyCoreAdapterModule, SkyCoreAdapterService, SkyDockItem, SkyDockLocation, SkyDockModule, SkyDockService, SkyDynamicComponentLocation, SkyDynamicComponentModule, SkyDynamicComponentService, SkyIdModule, SkyIdService, SkyLiveAnnouncerService, SkyLogModule, SkyLogService, SkyMediaBreakpoints, SkyMediaQueryModule, SkyMediaQueryService, SkyMutationObserverService, SkyNumericModule, SkyNumericPipe, SkyNumericService, SkyOverlayInstance, SkyOverlayModule, SkyOverlayService, SkyPercentPipe, SkyPercentPipeModule, SkyResizeObserverMediaQueryService, SkyResizeObserverService, SkyScrollableHostService, SkyTrimModule, SkyUIConfigService, SkyViewkeeperHostOptions, SkyViewkeeperModule, SkyViewkeeperService, getWindow, SkyAffixDirective as λ1, SkyIdDirective as λ2, SkyViewkeeperDirective as λ3, SkyTrimDirective as λ4 };
|
3661
3779
|
//# sourceMappingURL=skyux-core.mjs.map
|