@koobiq/components 18.13.0 → 18.15.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/LICENSE +1 -1
- package/accordion/accordion.component.d.ts +5 -5
- package/button/button.component.d.ts +3 -2
- package/button-toggle/_button-toggle-theme.scss +0 -4
- package/button-toggle/button-toggle-tokens.scss +1 -4
- package/button-toggle/button-toggle.component.d.ts +3 -2
- package/button-toggle/button-toggle.scss +11 -0
- package/core/locales/formatters.d.ts +36 -0
- package/core/locales/index.d.ts +1 -0
- package/core/locales/locale-service.d.ts +79 -0
- package/core/locales/tk-TM.d.ts +45 -0
- package/core/pop-up/constants.d.ts +6 -0
- package/core/pop-up/pop-up-trigger.d.ts +6 -0
- package/core/select/common.d.ts +17 -0
- package/core/select/constants.d.ts +0 -18
- package/esm2022/accordion/accordion.component.mjs +11 -10
- package/esm2022/button/button.component.mjs +3 -1
- package/esm2022/button-toggle/button-toggle.component.mjs +6 -4
- package/esm2022/core/locales/formatters.mjs +37 -1
- package/esm2022/core/locales/index.mjs +2 -1
- package/esm2022/core/locales/locale-service.mjs +7 -4
- package/esm2022/core/locales/tk-TM.mjs +44 -0
- package/esm2022/core/option/action.mjs +3 -4
- package/esm2022/core/pop-up/constants.mjs +8 -1
- package/esm2022/core/pop-up/pop-up-trigger.mjs +50 -3
- package/esm2022/core/select/common.mjs +63 -1
- package/esm2022/core/select/constants.mjs +1 -19
- package/esm2022/core/version.mjs +2 -2
- package/esm2022/form-field/form-field.mjs +5 -5
- package/esm2022/icon/icon-button.component.mjs +3 -1
- package/esm2022/link/link.component.mjs +4 -2
- package/esm2022/navbar/navbar-item.component.mjs +4 -2
- package/esm2022/navbar/navbar.component.mjs +6 -4
- package/esm2022/overflow-items/index.mjs +3 -0
- package/esm2022/overflow-items/koobiq-components-overflow-items.mjs +5 -0
- package/esm2022/overflow-items/module.mjs +25 -0
- package/esm2022/overflow-items/overflow-items.mjs +269 -0
- package/esm2022/popover/popover.component.mjs +4 -2
- package/esm2022/select/select-option.directive.mjs +17 -19
- package/esm2022/select/select.component.mjs +4 -78
- package/esm2022/tabs/tab-header.component.mjs +2 -2
- package/esm2022/tabs/tab-nav-bar.mjs +18 -18
- package/esm2022/timezone/timezone-option.directive.mjs +15 -12
- package/esm2022/title/title.directive.mjs +9 -18
- package/esm2022/toggle/toggle.component.mjs +12 -10
- package/esm2022/tooltip/tooltip.component.mjs +30 -27
- package/esm2022/tree-select/tree-select.component.mjs +21 -56
- package/fesm2022/koobiq-components-accordion.mjs +9 -7
- package/fesm2022/koobiq-components-accordion.mjs.map +1 -1
- package/fesm2022/koobiq-components-button-toggle.mjs +5 -3
- package/fesm2022/koobiq-components-button-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-button.mjs +2 -0
- package/fesm2022/koobiq-components-button.mjs.map +1 -1
- package/fesm2022/koobiq-components-core.mjs +219 -41
- package/fesm2022/koobiq-components-core.mjs.map +1 -1
- package/fesm2022/koobiq-components-form-field.mjs +4 -4
- package/fesm2022/koobiq-components-form-field.mjs.map +1 -1
- package/fesm2022/koobiq-components-icon.mjs +2 -0
- package/fesm2022/koobiq-components-icon.mjs.map +1 -1
- package/fesm2022/koobiq-components-link.mjs +3 -1
- package/fesm2022/koobiq-components-link.mjs.map +1 -1
- package/fesm2022/koobiq-components-navbar.mjs +8 -4
- package/fesm2022/koobiq-components-navbar.mjs.map +1 -1
- package/fesm2022/koobiq-components-overflow-items.mjs +298 -0
- package/fesm2022/koobiq-components-overflow-items.mjs.map +1 -0
- package/fesm2022/koobiq-components-popover.mjs +3 -1
- package/fesm2022/koobiq-components-popover.mjs.map +1 -1
- package/fesm2022/koobiq-components-select.mjs +19 -95
- package/fesm2022/koobiq-components-select.mjs.map +1 -1
- package/fesm2022/koobiq-components-tabs.mjs +19 -19
- package/fesm2022/koobiq-components-tabs.mjs.map +1 -1
- package/fesm2022/koobiq-components-timezone.mjs +14 -11
- package/fesm2022/koobiq-components-timezone.mjs.map +1 -1
- package/fesm2022/koobiq-components-title.mjs +8 -17
- package/fesm2022/koobiq-components-title.mjs.map +1 -1
- package/fesm2022/koobiq-components-toggle.mjs +11 -9
- package/fesm2022/koobiq-components-toggle.mjs.map +1 -1
- package/fesm2022/koobiq-components-tooltip.mjs +30 -27
- package/fesm2022/koobiq-components-tooltip.mjs.map +1 -1
- package/fesm2022/koobiq-components-tree-select.mjs +19 -54
- package/fesm2022/koobiq-components-tree-select.mjs.map +1 -1
- package/form-field/_form-field-theme.scss +2 -2
- package/icon/icon-button.component.d.ts +3 -2
- package/link/_link-theme.scss +6 -4
- package/link/link.component.d.ts +3 -2
- package/navbar/navbar-item.component.d.ts +2 -1
- package/navbar/navbar.component.d.ts +2 -1
- package/overflow-items/index.d.ts +2 -0
- package/overflow-items/module.d.ts +7 -0
- package/overflow-items/overflow-items.d.ts +132 -0
- package/overflow-items/overflow-items.scss +20 -0
- package/package.json +10 -4
- package/popover/popover.component.d.ts +1 -0
- package/prebuilt-themes/dark-theme.css +1 -1
- package/prebuilt-themes/light-theme.css +1 -1
- package/prebuilt-themes/theme.css +1 -1
- package/schematics/ng-add/index.js +4 -4
- package/select/select-option.directive.d.ts +3 -1
- package/select/select.component.d.ts +2 -15
- package/tabs/_tabs-common.scss +14 -0
- package/tabs/tab-header.scss +0 -14
- package/tabs/tab-nav-bar.d.ts +0 -1
- package/timezone/timezone-option.directive.d.ts +1 -0
- package/title/title.directive.d.ts +2 -2
- package/toggle/toggle.component.d.ts +6 -5
- package/tooltip/tooltip.component.d.ts +3 -3
- package/tree-select/tree-select.component.d.ts +5 -16
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ContentObserver } from '@angular/cdk/observers';
|
|
2
|
+
import { SharedResizeObserver } from '@angular/cdk/observers/private';
|
|
1
3
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, InjectionToken,
|
|
4
|
+
import { inject, Directive, InjectionToken, EventEmitter, DestroyRef, isDevMode, booleanAttribute, numberAttribute, ElementRef, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Self, Inject, ViewChild, ContentChild, ViewChildren, ContentChildren, Input, Output, NgModule } from '@angular/core';
|
|
3
5
|
import * as i1 from '@koobiq/components/core';
|
|
4
|
-
import { mixinTabIndex, mixinDisabled, mixinErrorState, getKbqSelectDynamicMultipleError, getKbqSelectNonFunctionValueError, defaultOffsetY, getKbqSelectNonArrayValueError, KbqVirtualOption,
|
|
6
|
+
import { KbqAbstractSelect, mixinTabIndex, mixinDisabled, mixinErrorState, getKbqSelectDynamicMultipleError, getKbqSelectNonFunctionValueError, defaultOffsetY, getKbqSelectNonArrayValueError, KbqVirtualOption, KBQ_SELECT_SCROLL_STRATEGY, KBQ_LOCALE_SERVICE, KBQ_OPTION_PARENT_COMPONENT, KBQ_PARENT_POPUP, KbqSelectFooter, KbqSelectTrigger, KbqSelectMatcher, KbqSelectSearch, KbqOption, KbqOptgroup, kbqSelectAnimations, KbqOptionModule, KbqSelectSearchEmptyResult, KBQ_SELECT_SCROLL_STRATEGY_PROVIDER } from '@koobiq/components/core';
|
|
5
7
|
import { KbqTooltipTrigger, KbqToolTipModule } from '@koobiq/components/tooltip';
|
|
6
8
|
import * as i3 from '@angular/cdk/bidi';
|
|
7
9
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
@@ -36,34 +38,30 @@ class KbqOptionTooltip extends KbqTooltipTrigger {
|
|
|
36
38
|
constructor(option) {
|
|
37
39
|
super();
|
|
38
40
|
this.option = option;
|
|
41
|
+
this.resizeObserver = inject(SharedResizeObserver);
|
|
42
|
+
this.resizeObserverSubscription = null;
|
|
43
|
+
this.contentObserver = inject(ContentObserver);
|
|
44
|
+
this.contentObserverSubscription = null;
|
|
39
45
|
}
|
|
40
46
|
ngAfterViewInit() {
|
|
41
47
|
this.content = this.option.viewValue;
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
characterData: true,
|
|
46
|
-
attributes: false,
|
|
47
|
-
childList: true,
|
|
48
|
-
subtree: true
|
|
49
|
-
});
|
|
48
|
+
this.contentObserverSubscription = this.contentObserver
|
|
49
|
+
.observe(this.textElement)
|
|
50
|
+
.subscribe(() => (this.content = this.option.viewValue));
|
|
50
51
|
}
|
|
51
52
|
ngOnDestroy() {
|
|
52
53
|
super.ngOnDestroy();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.resizeObserver.disconnect();
|
|
56
|
-
}
|
|
57
|
-
if (this.mutationObserver) {
|
|
58
|
-
this.mutationObserver.disconnect();
|
|
59
|
-
}
|
|
54
|
+
this.resizeObserverSubscription?.unsubscribe();
|
|
55
|
+
this.contentObserverSubscription?.unsubscribe();
|
|
60
56
|
}
|
|
61
57
|
onMouseEnter() {
|
|
62
|
-
this.
|
|
58
|
+
this.resizeObserverSubscription = this.resizeObserver
|
|
59
|
+
.observe(this.textElement)
|
|
60
|
+
.subscribe(() => (this.disabled = !this.isOverflown));
|
|
63
61
|
this.disabled = !this.isOverflown;
|
|
64
62
|
}
|
|
65
63
|
onMouseLeave() {
|
|
66
|
-
this.
|
|
64
|
+
this.resizeObserverSubscription?.unsubscribe();
|
|
67
65
|
this.disabled = true;
|
|
68
66
|
}
|
|
69
67
|
onFocus() {
|
|
@@ -110,8 +108,9 @@ const kbqSelectOptionsProvider = (options) => {
|
|
|
110
108
|
};
|
|
111
109
|
};
|
|
112
110
|
/** @docs-private */
|
|
113
|
-
class KbqSelectBase {
|
|
111
|
+
class KbqSelectBase extends KbqAbstractSelect {
|
|
114
112
|
constructor(elementRef, defaultErrorStateMatcher, parentForm, parentFormGroup, ngControl) {
|
|
113
|
+
super();
|
|
115
114
|
this.elementRef = elementRef;
|
|
116
115
|
this.defaultErrorStateMatcher = defaultErrorStateMatcher;
|
|
117
116
|
this.parentForm = parentForm;
|
|
@@ -334,8 +333,6 @@ class KbqSelect extends KbqSelectMixinBase {
|
|
|
334
333
|
/** Unique id for this input. */
|
|
335
334
|
this.uid = `kbq-select-${nextUniqueId++}`;
|
|
336
335
|
this.visibleChanges = new BehaviorSubject(false);
|
|
337
|
-
/** Overlay panel class. */
|
|
338
|
-
this.overlayPanelClass = 'kbq-select-overlay';
|
|
339
336
|
this.destroyRef = inject(DestroyRef);
|
|
340
337
|
/** `View -> model callback called when value changes` */
|
|
341
338
|
this.onChange = () => { };
|
|
@@ -957,79 +954,6 @@ class KbqSelect extends KbqSelectMixinBase {
|
|
|
957
954
|
scrollActiveOptionIntoView() {
|
|
958
955
|
this.keyManager.activeItem?.focus();
|
|
959
956
|
}
|
|
960
|
-
/**
|
|
961
|
-
* Sets the x-offset of the overlay panel in relation to the trigger's top start corner.
|
|
962
|
-
* This must be adjusted to align the selected option text over the trigger text when
|
|
963
|
-
* the panel opens. Will change based on LTR or RTL text direction. Note that the offset
|
|
964
|
-
* can't be calculated until the panel has been attached, because we need to know the
|
|
965
|
-
* content width in order to constrain the panel within the viewport.
|
|
966
|
-
*/
|
|
967
|
-
setOverlayPosition() {
|
|
968
|
-
this.resetOverlay();
|
|
969
|
-
const overlayRect = this.getOverlayRect();
|
|
970
|
-
// Window width without scrollbar
|
|
971
|
-
const windowWidth = this.scrollStrategy._overlayRef?.hostElement.clientWidth;
|
|
972
|
-
const isRtl = this.isRtl();
|
|
973
|
-
const paddingWidth = SELECT_PANEL_PADDING_X * 2;
|
|
974
|
-
let offsetX = SELECT_PANEL_PADDING_X;
|
|
975
|
-
let overlayMaxWidth;
|
|
976
|
-
// Invert the offsetX in LTR.
|
|
977
|
-
if (!isRtl) {
|
|
978
|
-
offsetX *= -1;
|
|
979
|
-
}
|
|
980
|
-
// Determine if select overflows on either side.
|
|
981
|
-
const leftOverflow = 0 - (overlayRect.left + offsetX - (isRtl ? paddingWidth : 0));
|
|
982
|
-
const rightOverflow = overlayRect.right + offsetX - windowWidth + (isRtl ? 0 : paddingWidth);
|
|
983
|
-
// If the element overflows on either side, reduce the offset to allow it to fit.
|
|
984
|
-
if (leftOverflow > 0 || rightOverflow > 0) {
|
|
985
|
-
[offsetX, overlayMaxWidth] = this.calculateOverlayXPosition(overlayRect, windowWidth, offsetX);
|
|
986
|
-
this.overlayDir.overlayRef.overlayElement.style.maxWidth = `${overlayMaxWidth}px`;
|
|
987
|
-
// reset the minWidth property
|
|
988
|
-
this.overlayDir.overlayRef.overlayElement.style.minWidth = '';
|
|
989
|
-
}
|
|
990
|
-
// Set the offset directly in order to avoid having to go through change detection and
|
|
991
|
-
// potentially triggering "changed after it was checked" errors. Round the value to avoid
|
|
992
|
-
// blurry content in some browsers.
|
|
993
|
-
this.overlayDir.offsetX = Math.round(offsetX);
|
|
994
|
-
this.overlayDir.overlayRef.updatePosition();
|
|
995
|
-
}
|
|
996
|
-
calculateOverlayXPosition(overlayRect, windowWidth, basicOffsetX) {
|
|
997
|
-
let offsetX = basicOffsetX;
|
|
998
|
-
const leftIndent = this.triggerRect.left;
|
|
999
|
-
const rightIndent = windowWidth - this.triggerRect.right;
|
|
1000
|
-
// Setting direction of dropdown expansion
|
|
1001
|
-
const isRightDirection = leftIndent <= rightIndent;
|
|
1002
|
-
let maxDropdownWidth;
|
|
1003
|
-
let overlayMaxWidth;
|
|
1004
|
-
const triggerWidth = this.triggerRect.width + SELECT_PANEL_INDENT_PADDING_X;
|
|
1005
|
-
if (isRightDirection) {
|
|
1006
|
-
maxDropdownWidth = rightIndent + triggerWidth - SELECT_PANEL_VIEWPORT_PADDING;
|
|
1007
|
-
overlayMaxWidth = overlayRect.width < maxDropdownWidth ? overlayRect.width : maxDropdownWidth;
|
|
1008
|
-
}
|
|
1009
|
-
else {
|
|
1010
|
-
let leftOffset;
|
|
1011
|
-
maxDropdownWidth = leftIndent + triggerWidth - SELECT_PANEL_VIEWPORT_PADDING;
|
|
1012
|
-
if (overlayRect.width < maxDropdownWidth) {
|
|
1013
|
-
overlayMaxWidth = overlayRect.width;
|
|
1014
|
-
leftOffset = this.triggerRect.right - overlayMaxWidth;
|
|
1015
|
-
}
|
|
1016
|
-
else {
|
|
1017
|
-
overlayMaxWidth = maxDropdownWidth;
|
|
1018
|
-
leftOffset = this.triggerRect.right - (overlayMaxWidth - SELECT_PANEL_INDENT_PADDING_X);
|
|
1019
|
-
}
|
|
1020
|
-
offsetX -= this.triggerRect.left - leftOffset;
|
|
1021
|
-
}
|
|
1022
|
-
return [offsetX, overlayMaxWidth];
|
|
1023
|
-
}
|
|
1024
|
-
resetOverlay() {
|
|
1025
|
-
this.overlayDir.overlayRef.hostElement.classList.add(this.overlayPanelClass);
|
|
1026
|
-
this.overlayDir.offsetX = 0;
|
|
1027
|
-
this.overlayDir.overlayRef.overlayElement.style.maxWidth = 'unset';
|
|
1028
|
-
this.overlayDir.overlayRef.updatePosition();
|
|
1029
|
-
}
|
|
1030
|
-
getOverlayRect() {
|
|
1031
|
-
return this.overlayDir.overlayRef.overlayElement.getBoundingClientRect();
|
|
1032
|
-
}
|
|
1033
957
|
/** Gets how wide the overlay panel should be. */
|
|
1034
958
|
getOverlayWidth(origin) {
|
|
1035
959
|
if (this.panelWidth === 'auto') {
|