@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/fesm2020/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 } 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,
|
@@ -497,9 +497,19 @@ _SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMa
|
|
497
497
|
let isAffixedElementFullyVisible = false;
|
498
498
|
let offset;
|
499
499
|
let placement = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement;
|
500
|
+
const autoFitOverflowOffset = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset || {
|
501
|
+
bottom: 0,
|
502
|
+
left: 0,
|
503
|
+
right: 0,
|
504
|
+
top: 0,
|
505
|
+
};
|
506
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).position === 'absolute') {
|
507
|
+
autoFitOverflowOffset.top =
|
508
|
+
(autoFitOverflowOffset.top || 0) + window.scrollY;
|
509
|
+
}
|
500
510
|
do {
|
501
511
|
offset = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getPreferredOffset).call(this, placement);
|
502
|
-
isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(parent, offset,
|
512
|
+
isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(parent, offset, autoFitOverflowOffset);
|
503
513
|
if (!__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit) {
|
504
514
|
break;
|
505
515
|
}
|
@@ -525,12 +535,27 @@ _SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMa
|
|
525
535
|
}
|
526
536
|
// No suitable placement was found, so revert to preferred placement.
|
527
537
|
return __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getPreferredOffset).call(this, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).placement);
|
538
|
+
}, _SkyAffixer_getRect = function _SkyAffixer_getRect(baseElement) {
|
539
|
+
const baseDomRect = baseElement.getBoundingClientRect();
|
540
|
+
const baseRect = {
|
541
|
+
top: baseDomRect.top,
|
542
|
+
bottom: baseDomRect.bottom,
|
543
|
+
left: baseDomRect.left,
|
544
|
+
right: baseDomRect.right,
|
545
|
+
width: baseDomRect.width,
|
546
|
+
height: baseDomRect.height,
|
547
|
+
};
|
548
|
+
if (__classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).position === 'absolute') {
|
549
|
+
baseRect.top += window.scrollY;
|
550
|
+
baseRect.bottom = baseRect.top + baseDomRect.height;
|
551
|
+
}
|
552
|
+
return baseRect;
|
528
553
|
}, _SkyAffixer_getPreferredOffset = function _SkyAffixer_getPreferredOffset(placement) {
|
529
554
|
if (!__classPrivateFieldGet(this, _SkyAffixer_baseElement, "f")) {
|
530
555
|
return { top: 0, left: 0, bottom: 0, right: 0 };
|
531
556
|
}
|
532
|
-
const affixedRect = __classPrivateFieldGet(this,
|
533
|
-
const baseRect = __classPrivateFieldGet(this,
|
557
|
+
const affixedRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, __classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f"));
|
558
|
+
const baseRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, __classPrivateFieldGet(this, _SkyAffixer_baseElement, "f"));
|
534
559
|
const horizontalAlignment = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).horizontalAlignment;
|
535
560
|
const verticalAlignment = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).verticalAlignment;
|
536
561
|
const enableAutoFit = __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).enableAutoFit;
|
@@ -610,8 +635,8 @@ _SkyAffixer_affixedElement = new WeakMap(), _SkyAffixer_baseElement = new WeakMa
|
|
610
635
|
}, _SkyAffixer_adjustOffsetToOverflowParent = function _SkyAffixer_adjustOffsetToOverflowParent(offset, placement, baseElement) {
|
611
636
|
const parent = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getAutoFitContextParent).call(this);
|
612
637
|
const parentOffset = getElementOffset(parent, __classPrivateFieldGet(this, _SkyAffixer_instances, "a", _SkyAffixer_config_get).autoFitOverflowOffset);
|
613
|
-
const affixedRect = __classPrivateFieldGet(this,
|
614
|
-
const baseRect =
|
638
|
+
const affixedRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, __classPrivateFieldGet(this, _SkyAffixer_affixedElement, "f"));
|
639
|
+
const baseRect = __classPrivateFieldGet(this, _SkyAffixer_instances, "m", _SkyAffixer_getRect).call(this, baseElement);
|
615
640
|
// A pixel value representing the leeway between the edge of the overflow parent and the edge
|
616
641
|
// of the base element before it disappears from view.
|
617
642
|
// If the visible portion of the base element is less than this pixel value, the auto-fit
|
@@ -793,6 +818,7 @@ class SkyAffixDirective {
|
|
793
818
|
changes.affixHorizontalAlignment ||
|
794
819
|
changes.affixIsSticky ||
|
795
820
|
changes.affixPlacement ||
|
821
|
+
changes.affixPosition ||
|
796
822
|
changes.affixVerticalAlignment) {
|
797
823
|
__classPrivateFieldGet(this, _SkyAffixDirective_instances, "m", _SkyAffixDirective_updateAlignment).call(this);
|
798
824
|
}
|
@@ -819,12 +845,13 @@ _SkyAffixDirective_affixer = new WeakMap(), _SkyAffixDirective_affixService = ne
|
|
819
845
|
horizontalAlignment: this.affixHorizontalAlignment,
|
820
846
|
isSticky: this.affixIsSticky,
|
821
847
|
placement: this.affixPlacement,
|
848
|
+
position: this.affixPosition,
|
822
849
|
verticalAlignment: this.affixVerticalAlignment,
|
823
850
|
});
|
824
851
|
}
|
825
852
|
};
|
826
853
|
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 });
|
827
|
-
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 });
|
854
|
+
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 });
|
828
855
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyAffixDirective, decorators: [{
|
829
856
|
type: Directive,
|
830
857
|
args: [{
|
@@ -844,6 +871,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
844
871
|
type: Input
|
845
872
|
}], affixPlacement: [{
|
846
873
|
type: Input
|
874
|
+
}], affixPosition: [{
|
875
|
+
type: Input
|
847
876
|
}], affixVerticalAlignment: [{
|
848
877
|
type: Input
|
849
878
|
}], affixOffsetChange: [{
|
@@ -1487,6 +1516,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
1487
1516
|
}]
|
1488
1517
|
}] });
|
1489
1518
|
|
1519
|
+
var _SkyLiveAnnouncerService_instances, _SkyLiveAnnouncerService_announcerElement, _SkyLiveAnnouncerService_document, _SkyLiveAnnouncerService_idService, _SkyLiveAnnouncerService_createLiveElement;
|
1520
|
+
/**
|
1521
|
+
* Allows for announcing messages to screen reader users through the use of a common `aria-live` element.
|
1522
|
+
* @internal
|
1523
|
+
*/
|
1524
|
+
class SkyLiveAnnouncerService {
|
1525
|
+
constructor() {
|
1526
|
+
_SkyLiveAnnouncerService_instances.add(this);
|
1527
|
+
this.announcerElementChanged = new ReplaySubject(1);
|
1528
|
+
_SkyLiveAnnouncerService_announcerElement.set(this, void 0);
|
1529
|
+
_SkyLiveAnnouncerService_document.set(this, inject(DOCUMENT));
|
1530
|
+
_SkyLiveAnnouncerService_idService.set(this, inject(SkyIdService));
|
1531
|
+
__classPrivateFieldSet(this, _SkyLiveAnnouncerService_announcerElement, __classPrivateFieldGet(this, _SkyLiveAnnouncerService_instances, "m", _SkyLiveAnnouncerService_createLiveElement).call(this), "f");
|
1532
|
+
this.announcerElementChanged.next(__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f"));
|
1533
|
+
}
|
1534
|
+
/**
|
1535
|
+
* Announces a message to screen readers.
|
1536
|
+
* @param message Message to be announced to the screen reader.
|
1537
|
+
* @param args Options for the announcement of the message.
|
1538
|
+
*/
|
1539
|
+
announce(message, args) {
|
1540
|
+
/* safety-check */
|
1541
|
+
/* istanbul ignore if */
|
1542
|
+
if (!__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f")) {
|
1543
|
+
__classPrivateFieldSet(this, _SkyLiveAnnouncerService_announcerElement, __classPrivateFieldGet(this, _SkyLiveAnnouncerService_instances, "m", _SkyLiveAnnouncerService_createLiveElement).call(this), "f");
|
1544
|
+
this.announcerElementChanged.next(__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f"));
|
1545
|
+
}
|
1546
|
+
const politeness = args?.politeness ?? 'polite';
|
1547
|
+
this.clear();
|
1548
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f").setAttribute('aria-live', politeness);
|
1549
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f").textContent = message;
|
1550
|
+
}
|
1551
|
+
/**
|
1552
|
+
* Clears the current text from the announcer element. Can be used to prevent
|
1553
|
+
* screen readers from reading the text out again while the user is going
|
1554
|
+
* through the page landmarks.
|
1555
|
+
*/
|
1556
|
+
clear() {
|
1557
|
+
if (__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f")) {
|
1558
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f").textContent = '';
|
1559
|
+
}
|
1560
|
+
}
|
1561
|
+
/**
|
1562
|
+
* @internal
|
1563
|
+
*/
|
1564
|
+
ngOnDestroy() {
|
1565
|
+
__classPrivateFieldGet(this, _SkyLiveAnnouncerService_announcerElement, "f")?.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
|
+
|
1490
1593
|
/**
|
1491
1594
|
* @deprecated The `SkyLogService` no longer needs the `SkyLogModule`.
|
1492
1595
|
* The `SkyLogModule` can be removed from your project.
|
@@ -1831,6 +1934,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
1831
1934
|
/**
|
1832
1935
|
* Provides arguments for the number to format.
|
1833
1936
|
* @deprecated Use the `SkyNumericOptions` interface instead.
|
1937
|
+
* @internal
|
1834
1938
|
*/
|
1835
1939
|
class NumericOptions {
|
1836
1940
|
constructor() {
|
@@ -1840,6 +1944,14 @@ class NumericOptions {
|
|
1840
1944
|
this.iso = 'USD';
|
1841
1945
|
this.truncate = true;
|
1842
1946
|
this.truncateAfter = 1000;
|
1947
|
+
const logService = new SkyLogService(new SkyAppFormat());
|
1948
|
+
logService
|
1949
|
+
.deprecated('NumericOptions', {
|
1950
|
+
deprecationMajorVersion: 7,
|
1951
|
+
moreInfoUrl: 'https://developer.blackbaud.com/skyux/components/numeric',
|
1952
|
+
replacementRecommendation: 'Use the `SkyNumericOptions` interface instead.',
|
1953
|
+
})
|
1954
|
+
.then();
|
1843
1955
|
}
|
1844
1956
|
}
|
1845
1957
|
|
@@ -1942,9 +2054,17 @@ class SkyNumericService {
|
|
1942
2054
|
if (isNaN(value) || value === null) {
|
1943
2055
|
return '';
|
1944
2056
|
}
|
2057
|
+
const numericOptions = {
|
2058
|
+
digits: 0,
|
2059
|
+
format: 'number',
|
2060
|
+
currencySign: 'standard',
|
2061
|
+
iso: 'USD',
|
2062
|
+
truncateAfter: 1000,
|
2063
|
+
...options,
|
2064
|
+
};
|
1945
2065
|
const decimalPlaceRegExp = /\.0+$|(\.[0-9]*[1-9])0+$/;
|
1946
|
-
const locale =
|
1947
|
-
const digits =
|
2066
|
+
const locale = numericOptions.locale || this.currentLocale;
|
2067
|
+
const digits = numericOptions.digits || 0;
|
1948
2068
|
// Get the symbol for the number after rounding, since rounding could push the number
|
1949
2069
|
// into a different symbol range.
|
1950
2070
|
let roundedNumber = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_roundNumber).call(this, value, digits);
|
@@ -1952,9 +2072,9 @@ class SkyNumericService {
|
|
1952
2072
|
let suffix = '';
|
1953
2073
|
for (let i = 0; i < __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f").length; i++) {
|
1954
2074
|
let symbol = __classPrivateFieldGet(this, _SkyNumericService_symbolIndex, "f")[i];
|
1955
|
-
if (
|
1956
|
-
|
1957
|
-
roundedNumberAbs >=
|
2075
|
+
if (numericOptions.truncate &&
|
2076
|
+
numericOptions.truncateAfter !== undefined &&
|
2077
|
+
roundedNumberAbs >= numericOptions.truncateAfter &&
|
1958
2078
|
roundedNumberAbs >= symbol.value) {
|
1959
2079
|
roundedNumber = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_roundNumber).call(this, value / symbol.value, digits);
|
1960
2080
|
if (Math.abs(roundedNumber) === 1000 && i > 0) {
|
@@ -1971,7 +2091,7 @@ class SkyNumericService {
|
|
1971
2091
|
let digitsFormatted;
|
1972
2092
|
let isDecimal = false;
|
1973
2093
|
// Checks the string entered for format. Using toLowerCase to ignore case.
|
1974
|
-
switch (
|
2094
|
+
switch (numericOptions.format?.toLowerCase()) {
|
1975
2095
|
// In a case where a decimal value was not shortened and
|
1976
2096
|
// the digit input is 2 or higher, it forces 2 digits.
|
1977
2097
|
// For example, this prevents a value like $15.50 from displaying as $15.5.
|
@@ -1979,8 +2099,8 @@ class SkyNumericService {
|
|
1979
2099
|
// three decimal digits.
|
1980
2100
|
case 'currency':
|
1981
2101
|
isDecimal = value % 1 !== 0;
|
1982
|
-
if (
|
1983
|
-
digitsFormatted = `1.${
|
2102
|
+
if (numericOptions.minDigits) {
|
2103
|
+
digitsFormatted = `1.${numericOptions.minDigits}-${digits}`;
|
1984
2104
|
}
|
1985
2105
|
else if (isDecimal && digits >= 2) {
|
1986
2106
|
digitsFormatted = `1.2-${digits}`;
|
@@ -1988,12 +2108,12 @@ class SkyNumericService {
|
|
1988
2108
|
else {
|
1989
2109
|
digitsFormatted = `1.0-${digits}`;
|
1990
2110
|
}
|
1991
|
-
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency, digitsFormatted,
|
2111
|
+
output = SkyNumberFormatUtility.formatNumber(locale, parseFloat(output), SkyIntlNumberFormatStyle.Currency, digitsFormatted, numericOptions.iso,
|
1992
2112
|
// Angular 5+ needs a string for this parameter, but Angular 4 needs a boolean.
|
1993
2113
|
// To support both versions we can supply 'symbol' which will evaluate truthy for Angular 4
|
1994
2114
|
// and the appropriate string value for Angular 5+.
|
1995
2115
|
// See: https://angular.io/api/common/CurrencyPipe#parameters
|
1996
|
-
'symbol',
|
2116
|
+
'symbol', numericOptions.currencySign);
|
1997
2117
|
// ^^^^^^ Result can't be null since the sanitized input is always a number.
|
1998
2118
|
break;
|
1999
2119
|
// The following is a catch-all to ensure that if
|
@@ -2002,10 +2122,10 @@ class SkyNumericService {
|
|
2002
2122
|
default:
|
2003
2123
|
// Ensures localization of the number to ensure comma and
|
2004
2124
|
// decimal separator
|
2005
|
-
if (
|
2006
|
-
digitsFormatted = `1.${
|
2125
|
+
if (numericOptions.minDigits) {
|
2126
|
+
digitsFormatted = `1.${numericOptions.minDigits}-${digits}`;
|
2007
2127
|
}
|
2008
|
-
else if (
|
2128
|
+
else if (numericOptions.truncate) {
|
2009
2129
|
digitsFormatted = `1.0-${digits}`;
|
2010
2130
|
}
|
2011
2131
|
else {
|
@@ -2015,7 +2135,7 @@ class SkyNumericService {
|
|
2015
2135
|
// ^^^^^^ Result can't be null since the sanitized input is always a number.
|
2016
2136
|
break;
|
2017
2137
|
}
|
2018
|
-
if (
|
2138
|
+
if (numericOptions.truncate) {
|
2019
2139
|
output = __classPrivateFieldGet(this, _SkyNumericService_instances, "m", _SkyNumericService_replaceShortenSymbol).call(this, output);
|
2020
2140
|
}
|
2021
2141
|
return output;
|
@@ -2245,6 +2365,7 @@ class SkyOverlayContext {
|
|
2245
2365
|
}
|
2246
2366
|
|
2247
2367
|
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;
|
2368
|
+
const POSITION_DEFAULT = 'fixed';
|
2248
2369
|
/**
|
2249
2370
|
* Omnibar is 1000.
|
2250
2371
|
* See: https://github.com/blackbaud/auth-client/blob/master/src/omnibar/omnibar.ts#L139
|
@@ -2276,6 +2397,7 @@ class SkyOverlayComponent {
|
|
2276
2397
|
this.showBackdrop = false;
|
2277
2398
|
this.zIndex = `${++uniqueZIndex}`;
|
2278
2399
|
this.clipPath$ = new ReplaySubject(1);
|
2400
|
+
this.position = POSITION_DEFAULT;
|
2279
2401
|
_SkyOverlayComponent_backdropClick.set(this, void 0);
|
2280
2402
|
_SkyOverlayComponent_backdropClickObs.set(this, void 0);
|
2281
2403
|
_SkyOverlayComponent_changeDetector.set(this, void 0);
|
@@ -2358,6 +2480,7 @@ _SkyOverlayComponent_backdropClick = new WeakMap(), _SkyOverlayComponent_backdro
|
|
2358
2480
|
this.wrapperClass = config.wrapperClass || '';
|
2359
2481
|
this.showBackdrop = !!config.showBackdrop;
|
2360
2482
|
this.enablePointerEvents = !!config.enablePointerEvents;
|
2483
|
+
this.position = config.position || POSITION_DEFAULT;
|
2361
2484
|
__classPrivateFieldGet(this, _SkyOverlayComponent_changeDetector, "f").markForCheck();
|
2362
2485
|
}, _SkyOverlayComponent_addBackdropClickListener = function _SkyOverlayComponent_addBackdropClickListener() {
|
2363
2486
|
fromEvent(window.document, 'click')
|
@@ -2392,10 +2515,10 @@ _SkyOverlayComponent_backdropClick = new WeakMap(), _SkyOverlayComponent_backdro
|
|
2392
2515
|
}
|
2393
2516
|
};
|
2394
2517
|
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 });
|
2395
|
-
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{
|
2518
|
+
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 });
|
2396
2519
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: SkyOverlayComponent, decorators: [{
|
2397
2520
|
type: Component,
|
2398
|
-
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{
|
2521
|
+
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"] }]
|
2399
2522
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: SkyCoreAdapterService }, { type: SkyOverlayContext }, { type: SkyIdService }, { type: i4.Router, decorators: [{
|
2400
2523
|
type: Optional
|
2401
2524
|
}] }]; }, propDecorators: { id: [{
|
@@ -3642,5 +3765,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
3642
3765
|
* Generated bundle index. Do not edit.
|
3643
3766
|
*/
|
3644
3767
|
|
3645
|
-
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 };
|
3768
|
+
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 };
|
3646
3769
|
//# sourceMappingURL=skyux-core.mjs.map
|