@skyux/core 5.6.1 → 5.6.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/bundles/skyux-core.umd.js +0 -1
- package/documentation.json +488 -943
- package/esm2015/lib/modules/affix/affixer.js.map +1 -1
- package/esm2015/lib/modules/shared/number-format/number-format-utility.js +0 -2
- package/esm2015/lib/modules/shared/number-format/number-format-utility.js.map +1 -1
- package/fesm2015/skyux-core.js +0 -2
- package/fesm2015/skyux-core.js.map +1 -1
- package/lib/modules/shared/number-format/number-format-utility.d.ts +0 -1
- package/package.json +2 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"affixer.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/affix/affixer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,OAAO,EAAgB,SAAS,EAAE,MAAM,MAAM,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,aAAa,CAAC;AAErB,MAAM,oBAAoB,GAAmB;IAC3C,cAAc,EAAE,sBAAsB,CAAC,cAAc;IACrD,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,QAAQ;IAC7B,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,OAAO;CACnB,CAAC;AAEF,MAAM,OAAO,UAAU;IAkErB,YACU,cAA2B,EAC3B,QAAmB;QADnB,mBAAc,GAAd,cAAc,CAAa;QAC3B,aAAQ,GAAR,QAAQ,CAAW;QARrB,kBAAa,GAAG,IAAI,OAAO,EAAwB,CAAC;QAEpD,oBAAe,GAAG,IAAI,OAAO,EAAQ,CAAC;QAEtC,qBAAgB,GAAG,IAAI,OAAO,EAA2B,CAAC;IAK/D,CAAC;IApE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C;gBACb,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAC/D,IAAI,CAAC,KAAK,EAAE,CACb,CAAC;IACJ,CAAC;IAEO,oBAAoB;QAC1B,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;SACjC;IACH,CAAC;IAEO,qBAAqB;QAC3B,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,sEAAsE;YACtE,wEAAwE;YACxE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;SAClC;IACH,CAAC;CACF","sourcesContent":["import { Renderer2 } from '@angular/core';\n\nimport { Observable, Subject, Subscription, fromEvent } from 'rxjs';\n\nimport { SkyAffixAutoFitContext } from './affix-auto-fit-context';\nimport { SkyAffixConfig } from './affix-config';\nimport { SkyAffixOffset } from './affix-offset';\nimport { SkyAffixOffsetChange } from './affix-offset-change';\nimport { SkyAffixPlacement } from './affix-placement';\nimport { SkyAffixPlacementChange } from './affix-placement-change';\nimport { getInversePlacement, getNextPlacement } from './affix-utils';\nimport {\n getElementOffset,\n getOverflowParents,\n isOffsetFullyVisibleWithinParent,\n isOffsetPartiallyVisibleWithinParent,\n} from './dom-utils';\n\nconst DEFAULT_AFFIX_CONFIG: SkyAffixConfig = {\n autoFitContext: SkyAffixAutoFitContext.OverflowParent,\n enableAutoFit: false,\n horizontalAlignment: 'center',\n isSticky: false,\n placement: 'above',\n};\n\nexport class SkyAffixer {\n /**\n * Fires when the affixed element's offset changes.\n */\n public get offsetChange(): Observable<SkyAffixOffsetChange> {\n return this._offsetChange.asObservable();\n }\n\n /**\n * Fires when the base element's nearest overflow parent is scrolling. This is useful if you need\n * to perform an additional action during the scroll event but don't want to generate another\n * event listener.\n */\n public get overflowScroll(): Observable<void> {\n return this._overflowScroll.asObservable();\n }\n\n /**\n * Fires when the placement value changes. A `null` value indicates that a suitable\n * placement could not be found.\n */\n public get placementChange(): Observable<SkyAffixPlacementChange> {\n return this._placementChange.asObservable();\n }\n\n private get config(): SkyAffixConfig {\n return this._config;\n }\n\n private set config(value: SkyAffixConfig) {\n const merged = { ...DEFAULT_AFFIX_CONFIG, ...value };\n\n // Make sure none of the values are undefined.\n Object.keys(merged).forEach((k: keyof SkyAffixConfig) => {\n if (merged[k] === undefined) {\n (merged as any)[k] = DEFAULT_AFFIX_CONFIG[k];\n }\n });\n\n this._config = merged;\n }\n\n private affixedRect: ClientRect;\n\n private baseElement: HTMLElement;\n\n private baseRect: ClientRect;\n\n private currentOffset: SkyAffixOffset;\n\n private currentPlacement: SkyAffixPlacement;\n\n private overflowParents: HTMLElement[];\n\n private resizeListener: Subscription;\n\n private scrollListeners: Function[];\n\n private _config: SkyAffixConfig;\n\n private _offsetChange = new Subject<SkyAffixOffsetChange>();\n\n private _overflowScroll = new Subject<void>();\n\n private _placementChange = new Subject<SkyAffixPlacementChange>();\n\n constructor(\n private affixedElement: HTMLElement,\n private renderer: Renderer2\n ) {}\n\n /**\n * Affixes an element to a base element.\n * @param baseElement The base element.\n * @param config Configuration for the affix action.\n */\n public affixTo(baseElement: HTMLElement, config?: SkyAffixConfig): void {\n this.reset();\n\n this.config = config;\n this.baseElement = baseElement;\n this.overflowParents = getOverflowParents(baseElement);\n\n this.affix();\n\n if (this.config.isSticky) {\n this.addScrollListeners();\n this.addResizeListener();\n }\n }\n\n /**\n * Re-runs the affix calculation.\n */\n public reaffix(): void {\n // Reset current placement to preferred placement.\n this.currentPlacement = this.config.placement;\n this.affix();\n }\n\n /**\n * Destroys the affixer.\n */\n public destroy(): void {\n this.reset();\n this._placementChange.complete();\n this._offsetChange.complete();\n this._overflowScroll.complete();\n\n this._offsetChange =\n this._placementChange =\n this._overflowScroll =\n undefined;\n }\n\n private affix(): void {\n this.baseRect = this.baseElement.getBoundingClientRect();\n this.affixedRect = this.affixedElement.getBoundingClientRect();\n\n const offset = this.getOffset();\n\n if (this.isNewOffset(offset)) {\n this.renderer.setStyle(this.affixedElement, 'top', `${offset.top}px`);\n this.renderer.setStyle(this.affixedElement, 'left', `${offset.left}px`);\n this._offsetChange.next({ offset });\n }\n }\n\n private getOffset(): SkyAffixOffset {\n const parent = this.getAutoFitContextParent();\n\n const maxAttempts = 4;\n let attempts = 0;\n\n let isAffixedElementFullyVisible = false;\n let offset: SkyAffixOffset;\n let placement = this.config.placement;\n\n do {\n offset = this.getPreferredOffset(placement);\n isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(\n parent,\n offset,\n this.config.autoFitOverflowOffset\n );\n\n if (!this.config.enableAutoFit) {\n break;\n }\n\n if (!isAffixedElementFullyVisible) {\n placement =\n attempts % 2 === 0\n ? getInversePlacement(placement)\n : getNextPlacement(placement);\n }\n\n attempts++;\n } while (!isAffixedElementFullyVisible && attempts < maxAttempts);\n\n if (isAffixedElementFullyVisible) {\n if (this.isBaseElementVisible()) {\n this.notifyPlacementChange(placement);\n } else {\n /* tslint:disable-next-line:no-null-keyword */\n this.notifyPlacementChange(null);\n }\n\n return offset;\n }\n\n if (this.config.enableAutoFit) {\n /* tslint:disable-next-line:no-null-keyword */\n this.notifyPlacementChange(null);\n }\n\n // No suitable placement was found, so revert to preferred placement.\n return this.getPreferredOffset(this.config.placement);\n }\n\n private getPreferredOffset(placement: SkyAffixPlacement): SkyAffixOffset {\n const affixedRect = this.affixedRect;\n const baseRect = this.baseRect;\n\n const horizontalAlignment = this.config.horizontalAlignment;\n const verticalAlignment = this.config.verticalAlignment;\n const enableAutoFit = this.config.enableAutoFit;\n\n let top: number;\n let left: number;\n\n if (placement === 'above' || placement === 'below') {\n if (placement === 'above') {\n top = baseRect.top - affixedRect.height;\n\n switch (verticalAlignment) {\n case 'top':\n top = top + affixedRect.height;\n break;\n case 'middle':\n top = top + affixedRect.height / 2;\n break;\n case 'bottom':\n default:\n break;\n }\n } else {\n top = baseRect.bottom;\n\n switch (verticalAlignment) {\n case 'top':\n default:\n break;\n case 'middle':\n top = top - affixedRect.height / 2;\n break;\n case 'bottom':\n top = top - affixedRect.height;\n break;\n }\n }\n\n switch (horizontalAlignment) {\n case 'left':\n left = baseRect.left;\n break;\n\n case 'center':\n default:\n left = baseRect.left + baseRect.width / 2 - affixedRect.width / 2;\n break;\n\n case 'right':\n left = baseRect.right - affixedRect.width;\n break;\n }\n } else {\n if (placement === 'left') {\n left = baseRect.left - affixedRect.width;\n } else {\n left = baseRect.right;\n }\n\n switch (verticalAlignment) {\n case 'top':\n top = baseRect.top;\n break;\n\n case 'middle':\n default:\n top = baseRect.top + baseRect.height / 2 - affixedRect.height / 2;\n break;\n\n case 'bottom':\n top = baseRect.bottom - affixedRect.height;\n break;\n }\n }\n\n let offset: SkyAffixOffset = { left, top };\n if (enableAutoFit) {\n offset = this.adjustOffsetToOverflowParent({ ...offset }, placement);\n }\n\n offset.bottom = offset.top + affixedRect.height;\n offset.right = offset.left + affixedRect.width;\n\n return offset;\n }\n\n /**\n * Slightly adjust the offset to fit within the scroll parent's boundaries if\n * the affixed element would otherwise be clipped.\n */\n private adjustOffsetToOverflowParent(\n offset: SkyAffixOffset,\n placement: SkyAffixPlacement\n ): SkyAffixOffset {\n const parent = this.getAutoFitContextParent();\n const parentOffset = getElementOffset(\n parent,\n this.config.autoFitOverflowOffset\n );\n\n const affixedRect = this.affixedRect;\n const baseRect = this.baseRect;\n\n // A pixel value representing the leeway between the edge of the overflow parent and the edge\n // of the base element before it dissapears from view.\n // If the visible portion of the base element is less than this pixel value, the auto-fit\n // functionality attempts to find another placement.\n const defaultPixelTolerance = 40;\n let pixelTolerance: number;\n\n const originalOffsetTop = offset.top;\n const originalOffsetLeft = offset.left;\n\n /* tslint:disable-next-line:switch-default */\n switch (placement) {\n case 'above':\n case 'below':\n // Keep the affixed element within the overflow parent.\n if (offset.left < parentOffset.left) {\n offset.left = parentOffset.left;\n } else if (offset.left + affixedRect.width > parentOffset.right) {\n offset.left = parentOffset.right - affixedRect.width;\n }\n\n // Use a smaller pixel tolerance if the base element width is less than the default.\n pixelTolerance = Math.min(defaultPixelTolerance, baseRect.width);\n\n // Make sure the affixed element never detaches from the base element.\n if (\n offset.left + pixelTolerance > baseRect.right ||\n offset.left + affixedRect.width - pixelTolerance < baseRect.left\n ) {\n offset.left = originalOffsetLeft;\n }\n\n break;\n\n case 'left':\n case 'right':\n // Keep the affixed element within the overflow parent.\n if (offset.top < parentOffset.top) {\n offset.top = parentOffset.top;\n } else if (offset.top + affixedRect.height > parentOffset.bottom) {\n offset.top = parentOffset.bottom - affixedRect.height;\n }\n\n // Use a smaller pixel tolerance if the base element height is less than the default.\n pixelTolerance = Math.min(defaultPixelTolerance, baseRect.height);\n\n // Make sure the affixed element never detaches from the base element.\n if (\n offset.top + pixelTolerance > baseRect.bottom ||\n offset.top + affixedRect.height - pixelTolerance < baseRect.top\n ) {\n offset.top = originalOffsetTop;\n }\n\n break;\n }\n\n return offset;\n }\n\n private getImmediateOverflowParent(): HTMLElement {\n return this.overflowParents[this.overflowParents.length - 1];\n }\n\n private getAutoFitContextParent(): HTMLElement {\n const bodyElement = this.overflowParents[0];\n\n return this.config.autoFitContext === SkyAffixAutoFitContext.OverflowParent\n ? this.getImmediateOverflowParent()\n : bodyElement;\n }\n\n private notifyPlacementChange(placement: SkyAffixPlacement | null): void {\n if (this.currentPlacement !== placement) {\n this.currentPlacement = placement;\n this._placementChange.next({\n placement,\n });\n }\n }\n\n private reset(): void {\n this.removeScrollListeners();\n this.removeResizeListener();\n\n this._config =\n this.affixedRect =\n this.baseElement =\n this.baseRect =\n this.currentPlacement =\n this.currentOffset =\n this.overflowParents =\n undefined;\n }\n\n private isNewOffset(offset: SkyAffixOffset): boolean {\n if (this.currentOffset === undefined) {\n this.currentOffset = offset;\n return true;\n }\n\n if (\n this.currentOffset.top === offset.top &&\n this.currentOffset.left === offset.left\n ) {\n return false;\n }\n\n this.currentOffset = offset;\n\n return true;\n }\n\n private isBaseElementVisible(): boolean {\n return isOffsetPartiallyVisibleWithinParent(\n this.getImmediateOverflowParent(),\n {\n top: this.baseRect.top,\n left: this.baseRect.left,\n right: this.baseRect.right,\n bottom: this.baseRect.bottom,\n },\n this.config.autoFitOverflowOffset\n );\n }\n\n private addScrollListeners(): void {\n this.scrollListeners = this.overflowParents.map((parentElement) => {\n const overflow =\n parentElement === document.body ? 'window' : parentElement;\n return this.renderer.listen(overflow, 'scroll', () => {\n this.affix();\n this._overflowScroll.next();\n });\n });\n }\n\n private addResizeListener(): void {\n this.resizeListener = fromEvent(window, 'resize').subscribe(() =>\n this.affix()\n );\n }\n\n private removeResizeListener(): void {\n if (this.resizeListener) {\n this.resizeListener.unsubscribe();\n this.resizeListener = undefined;\n }\n }\n\n private removeScrollListeners(): void {\n if (this.scrollListeners) {\n // Remove renderer-generated listeners by calling the listener itself.\n // https://github.com/angular/angular/issues/9368#issuecomment-227199778\n this.scrollListeners.forEach((listener) => listener());\n this.scrollListeners = undefined;\n }\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"affixer.js","sourceRoot":"","sources":["../../../../../../../../libs/components/core/src/lib/modules/affix/affixer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,OAAO,EAAgB,SAAS,EAAE,MAAM,MAAM,CAAC;AAEpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAMlE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,aAAa,CAAC;AAErB,MAAM,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AAE,IAAI,CAAC,QAAQ,CAAC,MAAM;SAC7B,EACD,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAClC,CAAC;IACJ,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE;YAChE,MAAM,QAAQ,GACZ,aAAa,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;YAC7D,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE;gBACnD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAC/D,IAAI,CAAC,KAAK,EAAE,CACb,CAAC;IACJ,CAAC;IAEO,oBAAoB;QAC1B,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;SACjC;IACH,CAAC;IAEO,qBAAqB;QAC3B,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,sEAAsE;YACtE,wEAAwE;YACxE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;SAClC;IACH,CAAC;CACF","sourcesContent":["import { Renderer2 } from '@angular/core';\n\nimport { Observable, Subject, Subscription, fromEvent } from 'rxjs';\n\nimport { SkyAffixAutoFitContext } from './affix-auto-fit-context';\nimport { SkyAffixConfig } from './affix-config';\nimport { SkyAffixOffset } from './affix-offset';\nimport { SkyAffixOffsetChange } from './affix-offset-change';\nimport { SkyAffixPlacement } from './affix-placement';\nimport { SkyAffixPlacementChange } from './affix-placement-change';\nimport { getInversePlacement, getNextPlacement } from './affix-utils';\nimport {\n getElementOffset,\n getOverflowParents,\n isOffsetFullyVisibleWithinParent,\n isOffsetPartiallyVisibleWithinParent,\n} from './dom-utils';\n\nconst DEFAULT_AFFIX_CONFIG: SkyAffixConfig = {\n autoFitContext: SkyAffixAutoFitContext.OverflowParent,\n enableAutoFit: false,\n horizontalAlignment: 'center',\n isSticky: false,\n placement: 'above',\n};\n\nexport class SkyAffixer {\n /**\n * Fires when the affixed element's offset changes.\n */\n public get offsetChange(): Observable<SkyAffixOffsetChange> {\n return this._offsetChange.asObservable();\n }\n\n /**\n * Fires when the base element's nearest overflow parent is scrolling. This is useful if you need\n * to perform an additional action during the scroll event but don't want to generate another\n * event listener.\n */\n public get overflowScroll(): Observable<void> {\n return this._overflowScroll.asObservable();\n }\n\n /**\n * Fires when the placement value changes. A `null` value indicates that a suitable\n * placement could not be found.\n */\n public get placementChange(): Observable<SkyAffixPlacementChange> {\n return this._placementChange.asObservable();\n }\n\n private get config(): SkyAffixConfig {\n return this._config;\n }\n\n private set config(value: SkyAffixConfig) {\n const merged = { ...DEFAULT_AFFIX_CONFIG, ...value };\n\n // Make sure none of the values are undefined.\n Object.keys(merged).forEach((k: keyof SkyAffixConfig) => {\n if (merged[k] === undefined) {\n (merged as any)[k] = DEFAULT_AFFIX_CONFIG[k];\n }\n });\n\n this._config = merged;\n }\n\n private affixedRect: ClientRect;\n\n private baseElement: HTMLElement;\n\n private baseRect: ClientRect;\n\n private currentOffset: SkyAffixOffset;\n\n private currentPlacement: SkyAffixPlacement;\n\n private overflowParents: HTMLElement[];\n\n private resizeListener: Subscription;\n\n private scrollListeners: (() => void)[];\n\n private _config: SkyAffixConfig;\n\n private _offsetChange = new Subject<SkyAffixOffsetChange>();\n\n private _overflowScroll = new Subject<void>();\n\n private _placementChange = new Subject<SkyAffixPlacementChange>();\n\n constructor(\n private affixedElement: HTMLElement,\n private renderer: Renderer2\n ) {}\n\n /**\n * Affixes an element to a base element.\n * @param baseElement The base element.\n * @param config Configuration for the affix action.\n */\n public affixTo(baseElement: HTMLElement, config?: SkyAffixConfig): void {\n this.reset();\n\n this.config = config;\n this.baseElement = baseElement;\n this.overflowParents = getOverflowParents(baseElement);\n\n this.affix();\n\n if (this.config.isSticky) {\n this.addScrollListeners();\n this.addResizeListener();\n }\n }\n\n /**\n * Re-runs the affix calculation.\n */\n public reaffix(): void {\n // Reset current placement to preferred placement.\n this.currentPlacement = this.config.placement;\n this.affix();\n }\n\n /**\n * Destroys the affixer.\n */\n public destroy(): void {\n this.reset();\n this._placementChange.complete();\n this._offsetChange.complete();\n this._overflowScroll.complete();\n\n this._offsetChange =\n this._placementChange =\n this._overflowScroll =\n undefined;\n }\n\n private affix(): void {\n this.baseRect = this.baseElement.getBoundingClientRect();\n this.affixedRect = this.affixedElement.getBoundingClientRect();\n\n const offset = this.getOffset();\n\n if (this.isNewOffset(offset)) {\n this.renderer.setStyle(this.affixedElement, 'top', `${offset.top}px`);\n this.renderer.setStyle(this.affixedElement, 'left', `${offset.left}px`);\n this._offsetChange.next({ offset });\n }\n }\n\n private getOffset(): SkyAffixOffset {\n const parent = this.getAutoFitContextParent();\n\n const maxAttempts = 4;\n let attempts = 0;\n\n let isAffixedElementFullyVisible = false;\n let offset: SkyAffixOffset;\n let placement = this.config.placement;\n\n do {\n offset = this.getPreferredOffset(placement);\n isAffixedElementFullyVisible = isOffsetFullyVisibleWithinParent(\n parent,\n offset,\n this.config.autoFitOverflowOffset\n );\n\n if (!this.config.enableAutoFit) {\n break;\n }\n\n if (!isAffixedElementFullyVisible) {\n placement =\n attempts % 2 === 0\n ? getInversePlacement(placement)\n : getNextPlacement(placement);\n }\n\n attempts++;\n } while (!isAffixedElementFullyVisible && attempts < maxAttempts);\n\n if (isAffixedElementFullyVisible) {\n if (this.isBaseElementVisible()) {\n this.notifyPlacementChange(placement);\n } else {\n /* tslint:disable-next-line:no-null-keyword */\n this.notifyPlacementChange(null);\n }\n\n return offset;\n }\n\n if (this.config.enableAutoFit) {\n /* tslint:disable-next-line:no-null-keyword */\n this.notifyPlacementChange(null);\n }\n\n // No suitable placement was found, so revert to preferred placement.\n return this.getPreferredOffset(this.config.placement);\n }\n\n private getPreferredOffset(placement: SkyAffixPlacement): SkyAffixOffset {\n const affixedRect = this.affixedRect;\n const baseRect = this.baseRect;\n\n const horizontalAlignment = this.config.horizontalAlignment;\n const verticalAlignment = this.config.verticalAlignment;\n const enableAutoFit = this.config.enableAutoFit;\n\n let top: number;\n let left: number;\n\n if (placement === 'above' || placement === 'below') {\n if (placement === 'above') {\n top = baseRect.top - affixedRect.height;\n\n switch (verticalAlignment) {\n case 'top':\n top = top + affixedRect.height;\n break;\n case 'middle':\n top = top + affixedRect.height / 2;\n break;\n case 'bottom':\n default:\n break;\n }\n } else {\n top = baseRect.bottom;\n\n switch (verticalAlignment) {\n case 'top':\n default:\n break;\n case 'middle':\n top = top - affixedRect.height / 2;\n break;\n case 'bottom':\n top = top - affixedRect.height;\n break;\n }\n }\n\n switch (horizontalAlignment) {\n case 'left':\n left = baseRect.left;\n break;\n\n case 'center':\n default:\n left = baseRect.left + baseRect.width / 2 - affixedRect.width / 2;\n break;\n\n case 'right':\n left = baseRect.right - affixedRect.width;\n break;\n }\n } else {\n if (placement === 'left') {\n left = baseRect.left - affixedRect.width;\n } else {\n left = baseRect.right;\n }\n\n switch (verticalAlignment) {\n case 'top':\n top = baseRect.top;\n break;\n\n case 'middle':\n default:\n top = baseRect.top + baseRect.height / 2 - affixedRect.height / 2;\n break;\n\n case 'bottom':\n top = baseRect.bottom - affixedRect.height;\n break;\n }\n }\n\n let offset: SkyAffixOffset = { left, top };\n if (enableAutoFit) {\n offset = this.adjustOffsetToOverflowParent({ ...offset }, placement);\n }\n\n offset.bottom = offset.top + affixedRect.height;\n offset.right = offset.left + affixedRect.width;\n\n return offset;\n }\n\n /**\n * Slightly adjust the offset to fit within the scroll parent's boundaries if\n * the affixed element would otherwise be clipped.\n */\n private adjustOffsetToOverflowParent(\n offset: SkyAffixOffset,\n placement: SkyAffixPlacement\n ): SkyAffixOffset {\n const parent = this.getAutoFitContextParent();\n const parentOffset = getElementOffset(\n parent,\n this.config.autoFitOverflowOffset\n );\n\n const affixedRect = this.affixedRect;\n const baseRect = this.baseRect;\n\n // A pixel value representing the leeway between the edge of the overflow parent and the edge\n // of the base element before it dissapears from view.\n // If the visible portion of the base element is less than this pixel value, the auto-fit\n // functionality attempts to find another placement.\n const defaultPixelTolerance = 40;\n let pixelTolerance: number;\n\n const originalOffsetTop = offset.top;\n const originalOffsetLeft = offset.left;\n\n /* tslint:disable-next-line:switch-default */\n switch (placement) {\n case 'above':\n case 'below':\n // Keep the affixed element within the overflow parent.\n if (offset.left < parentOffset.left) {\n offset.left = parentOffset.left;\n } else if (offset.left + affixedRect.width > parentOffset.right) {\n offset.left = parentOffset.right - affixedRect.width;\n }\n\n // Use a smaller pixel tolerance if the base element width is less than the default.\n pixelTolerance = Math.min(defaultPixelTolerance, baseRect.width);\n\n // Make sure the affixed element never detaches from the base element.\n if (\n offset.left + pixelTolerance > baseRect.right ||\n offset.left + affixedRect.width - pixelTolerance < baseRect.left\n ) {\n offset.left = originalOffsetLeft;\n }\n\n break;\n\n case 'left':\n case 'right':\n // Keep the affixed element within the overflow parent.\n if (offset.top < parentOffset.top) {\n offset.top = parentOffset.top;\n } else if (offset.top + affixedRect.height > parentOffset.bottom) {\n offset.top = parentOffset.bottom - affixedRect.height;\n }\n\n // Use a smaller pixel tolerance if the base element height is less than the default.\n pixelTolerance = Math.min(defaultPixelTolerance, baseRect.height);\n\n // Make sure the affixed element never detaches from the base element.\n if (\n offset.top + pixelTolerance > baseRect.bottom ||\n offset.top + affixedRect.height - pixelTolerance < baseRect.top\n ) {\n offset.top = originalOffsetTop;\n }\n\n break;\n }\n\n return offset;\n }\n\n private getImmediateOverflowParent(): HTMLElement {\n return this.overflowParents[this.overflowParents.length - 1];\n }\n\n private getAutoFitContextParent(): HTMLElement {\n const bodyElement = this.overflowParents[0];\n\n return this.config.autoFitContext === SkyAffixAutoFitContext.OverflowParent\n ? this.getImmediateOverflowParent()\n : bodyElement;\n }\n\n private notifyPlacementChange(placement: SkyAffixPlacement | null): void {\n if (this.currentPlacement !== placement) {\n this.currentPlacement = placement;\n this._placementChange.next({\n placement,\n });\n }\n }\n\n private reset(): void {\n this.removeScrollListeners();\n this.removeResizeListener();\n\n this._config =\n this.affixedRect =\n this.baseElement =\n this.baseRect =\n this.currentPlacement =\n this.currentOffset =\n this.overflowParents =\n undefined;\n }\n\n private isNewOffset(offset: SkyAffixOffset): boolean {\n if (this.currentOffset === undefined) {\n this.currentOffset = offset;\n return true;\n }\n\n if (\n this.currentOffset.top === offset.top &&\n this.currentOffset.left === offset.left\n ) {\n return false;\n }\n\n this.currentOffset = offset;\n\n return true;\n }\n\n private isBaseElementVisible(): boolean {\n return isOffsetPartiallyVisibleWithinParent(\n this.getImmediateOverflowParent(),\n {\n top: this.baseRect.top,\n left: this.baseRect.left,\n right: this.baseRect.right,\n bottom: this.baseRect.bottom,\n },\n this.config.autoFitOverflowOffset\n );\n }\n\n private addScrollListeners(): void {\n this.scrollListeners = this.overflowParents.map((parentElement) => {\n const overflow =\n parentElement === document.body ? 'window' : parentElement;\n return this.renderer.listen(overflow, 'scroll', () => {\n this.affix();\n this._overflowScroll.next();\n });\n });\n }\n\n private addResizeListener(): void {\n this.resizeListener = fromEvent(window, 'resize').subscribe(() =>\n this.affix()\n );\n }\n\n private removeResizeListener(): void {\n if (this.resizeListener) {\n this.resizeListener.unsubscribe();\n this.resizeListener = undefined;\n }\n }\n\n private removeScrollListeners(): void {\n if (this.scrollListeners) {\n // Remove renderer-generated listeners by calling the listener itself.\n // https://github.com/angular/angular/issues/9368#issuecomment-227199778\n this.scrollListeners.forEach((listener) => listener());\n this.scrollListeners = undefined;\n }\n }\n}\n"]}
|
@@ -19,8 +19,6 @@ function parseIntAutoRadix(text) {
|
|
19
19
|
// See: https://github.com/ng-packagr/ng-packagr/issues/641
|
20
20
|
// @dynamic
|
21
21
|
export class SkyNumberFormatUtility {
|
22
|
-
/* istanbul ignore next */
|
23
|
-
constructor() { }
|
24
22
|
static formatNumber(locale, value, style, digits, currency = null, currencyAsSymbol = false, currencySign) {
|
25
23
|
if (value == null) {
|
26
24
|
return null;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"number-format-utility.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/core/src/lib/modules/shared/number-format/number-format-utility.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0FAA0F;AAC1F,+FAA+F;AAC/F,oBAAoB;AACpB,yFAAyF;AACzF,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE/E,SAAS,SAAS,CAAC,KAAU;IAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,MAAM,GAAW,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE1C,0BAA0B;IAC1B,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,IAAI,CAAC,CAAC;KACjE;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qEAAqE;AACrE,2DAA2D;AAC3D,WAAW;AACX,MAAM,OAAO,sBAAsB;
|
1
|
+
{"version":3,"file":"number-format-utility.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/core/src/lib/modules/shared/number-format/number-format-utility.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0FAA0F;AAC1F,+FAA+F;AAC/F,oBAAoB;AACpB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,CAAC,CAAC;SACjB;QAED,IAAI,MAAM,EAAE;YACV,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAEvD,IAAI,KAAK,KAAK,IAAI,EAAE;gBAClB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,6CAA6C,CAAC,CAAC;aACzE;YAED,0BAA0B;YAC1B,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;gBACpB,qBAAqB;gBACrB,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACtC;YAED,0BAA0B;YAC1B,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;gBACpB,sBAAsB;gBACtB,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3C;YAED,0BAA0B;YAC1B,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;gBACpB,sBAAsB;gBACtB,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3C;SACF;QAED,OAAO,sBAAsB,CAAC,MAAM,CAAC,KAAe,EAAE,MAAM,EAAE,KAAK,EAAE;YACnE,oBAAoB,EAAE,MAAM;YAC5B,qBAAqB,EAAE,WAAW;YAClC,qBAAqB,EAAE,WAAW;YAClC,QAAQ,EAAE,QAAQ;YAClB,gBAAgB,EAAE,gBAAgB;YAClC,YAAY,EAAE,YAAY;SAC3B,CAAC,CAAC;IACL,CAAC;;AAjEc,4CAAqB,GAAG,6BAA6B,CAAC","sourcesContent":["/* tslint:disable:no-null-keyword */\n// This file is mostly ported from the Angular 4.x NumberPipe in order to maintain the old\n// behavior of using the `Intl` API for formatting numbers rather than having to register every\n// supported locale.\n// https://github.com/angular/angular/blob/4.4.x/packages/common/src/pipes/number_pipe.ts\nimport { SkyIntlNumberFormatStyle, SkyIntlNumberFormatter } from '@skyux/i18n';\n\nfunction isNumeric(value: any): boolean {\n return !isNaN(value - parseFloat(value));\n}\n\nfunction parseIntAutoRadix(text: string): number {\n const result: number = parseInt(text, 10);\n\n /* istanbul ignore next */\n if (isNaN(result)) {\n throw new Error('Invalid integer literal when parsing ' + text);\n }\n\n return result;\n}\n\n// Need to add the following to classes which contain static methods.\n// See: https://github.com/ng-packagr/ng-packagr/issues/641\n// @dynamic\nexport class SkyNumberFormatUtility {\n private static _NUMBER_FORMAT_REGEXP = /^(\\d+)?\\.((\\d+)(-(\\d+))?)?$/;\n\n public static formatNumber(\n locale: string,\n value: number | string,\n style: SkyIntlNumberFormatStyle,\n digits?: string | null,\n currency: string | null = null,\n currencyAsSymbol: boolean = false,\n currencySign?: 'accounting' | 'standard'\n ): string | null {\n if (value == null) {\n return null;\n }\n\n // Convert strings to numbers\n value = typeof value === 'string' && isNumeric(value) ? +value : value;\n if (typeof value !== 'number') {\n throw Error(`SkyInvalidPipeArgument: '${value}'`);\n }\n\n let minInt: number | undefined = undefined;\n let minFraction: number | undefined = undefined;\n let maxFraction: number | undefined = undefined;\n if (style !== SkyIntlNumberFormatStyle.Currency) {\n // rely on Intl default for currency\n minInt = 1;\n minFraction = 0;\n maxFraction = 3;\n }\n\n if (digits) {\n const parts = digits.match(this._NUMBER_FORMAT_REGEXP);\n\n if (parts === null) {\n throw new Error(`${digits} is not a valid digit info for number pipes`);\n }\n\n /* istanbul ignore else */\n if (parts[1] != null) {\n // min integer digits\n minInt = parseIntAutoRadix(parts[1]);\n }\n\n /* istanbul ignore else */\n if (parts[3] != null) {\n // min fraction digits\n minFraction = parseIntAutoRadix(parts[3]);\n }\n\n /* istanbul ignore else */\n if (parts[5] != null) {\n // max fraction digits\n maxFraction = parseIntAutoRadix(parts[5]);\n }\n }\n\n return SkyIntlNumberFormatter.format(value as number, locale, style, {\n minimumIntegerDigits: minInt,\n minimumFractionDigits: minFraction,\n maximumFractionDigits: maxFraction,\n currency: currency,\n currencyAsSymbol: currencyAsSymbol,\n currencySign: currencySign,\n });\n }\n}\n"]}
|
package/fesm2015/skyux-core.js
CHANGED
@@ -1653,8 +1653,6 @@ function parseIntAutoRadix(text) {
|
|
1653
1653
|
// See: https://github.com/ng-packagr/ng-packagr/issues/641
|
1654
1654
|
// @dynamic
|
1655
1655
|
class SkyNumberFormatUtility {
|
1656
|
-
/* istanbul ignore next */
|
1657
|
-
constructor() { }
|
1658
1656
|
static formatNumber(locale, value, style, digits, currency = null, currencyAsSymbol = false, currencySign) {
|
1659
1657
|
if (value == null) {
|
1660
1658
|
return null;
|