@indigina/ui-kit 1.1.580 → 1.1.581
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.
|
@@ -8184,24 +8184,11 @@ class KitScrollNavigationComponent {
|
|
|
8184
8184
|
if (!contentElement || !this.sectionContentRefs.length || this.disableScrollUpdates) {
|
|
8185
8185
|
return;
|
|
8186
8186
|
}
|
|
8187
|
-
|
|
8188
|
-
const
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
const sectionElement = ref.nativeElement;
|
|
8192
|
-
const sectionTop = sectionElement.offsetTop;
|
|
8193
|
-
const sectionHeight = sectionElement.offsetHeight;
|
|
8194
|
-
const isFullyVisibleOnScreen = sectionTop <= contentScrollTop && ((sectionTop + sectionHeight) >= contentScrollTop);
|
|
8195
|
-
if ((sectionTop + sectionHeight < (contentElement.scrollTop + contentElement.clientHeight)) || isFullyVisibleOnScreen) {
|
|
8196
|
-
scrolledSectionIndexes.add(index);
|
|
8197
|
-
}
|
|
8198
|
-
if ((contentElement.scrollTop + contentElement.clientHeight) === contentElement.scrollHeight) {
|
|
8199
|
-
scrolledSectionIndexes.add(index);
|
|
8200
|
-
}
|
|
8201
|
-
index++;
|
|
8187
|
+
const activeSectionIndex = this.getActiveSectionIndex(contentElement);
|
|
8188
|
+
const activeItem = this.collapsedListItems()[activeSectionIndex];
|
|
8189
|
+
if (activeItem) {
|
|
8190
|
+
this.collapsedList?.setSelectedItem(activeItem);
|
|
8202
8191
|
}
|
|
8203
|
-
const activeSectionIndex = Array.from(scrolledSectionIndexes)[scrolledSectionIndexes.size - 1];
|
|
8204
|
-
this.collapsedList?.setSelectedItem(this.collapsedListItems()[activeSectionIndex]);
|
|
8205
8192
|
}
|
|
8206
8193
|
scrollToSection(selectedItem) {
|
|
8207
8194
|
this.disableScrollUpdates = true;
|
|
@@ -8217,17 +8204,15 @@ class KitScrollNavigationComponent {
|
|
|
8217
8204
|
});
|
|
8218
8205
|
}
|
|
8219
8206
|
updateListItems() {
|
|
8220
|
-
const sectionsData = this.sections?.toArray()?.map(section => {
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
};
|
|
8230
|
-
}) ?? [];
|
|
8207
|
+
const sectionsData = this.sections?.toArray()?.map(section => ({
|
|
8208
|
+
text: section.title,
|
|
8209
|
+
value: section.title,
|
|
8210
|
+
state: section.buttonState,
|
|
8211
|
+
icon: section.buttonIcon,
|
|
8212
|
+
tooltipText: section.tooltipText,
|
|
8213
|
+
badgeCount: section.badgeCount,
|
|
8214
|
+
id: section.id,
|
|
8215
|
+
})) ?? [];
|
|
8231
8216
|
this.collapsedListItems.set(sectionsData);
|
|
8232
8217
|
this.collapsedList?.setSelectedItem(this.collapsedListItems()[0]);
|
|
8233
8218
|
}
|
|
@@ -8249,6 +8234,22 @@ class KitScrollNavigationComponent {
|
|
|
8249
8234
|
lastSection.style.minHeight = `${contentHeight}px`;
|
|
8250
8235
|
}
|
|
8251
8236
|
}
|
|
8237
|
+
getActiveSectionIndex(contentElement) {
|
|
8238
|
+
const sectionCount = this.sectionContentRefs.length;
|
|
8239
|
+
const isScrolledToBottom = (contentElement.scrollTop + contentElement.clientHeight) >= contentElement.scrollHeight;
|
|
8240
|
+
const activeSectionScrollOffset = 1;
|
|
8241
|
+
if (isScrolledToBottom) {
|
|
8242
|
+
return Math.max(sectionCount - 1, 0);
|
|
8243
|
+
}
|
|
8244
|
+
const scrollTop = Math.floor(contentElement.scrollTop) + activeSectionScrollOffset;
|
|
8245
|
+
let activeSectionIndex = 0;
|
|
8246
|
+
this.sectionContentRefs.toArray().forEach((ref, index) => {
|
|
8247
|
+
if (ref.nativeElement.offsetTop <= scrollTop) {
|
|
8248
|
+
activeSectionIndex = index;
|
|
8249
|
+
}
|
|
8250
|
+
});
|
|
8251
|
+
return activeSectionIndex;
|
|
8252
|
+
}
|
|
8252
8253
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: KitScrollNavigationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8253
8254
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: KitScrollNavigationComponent, isStandalone: true, selector: "kit-scroll-navigation", inputs: { isNavigationBtnDisabled: { classPropertyName: "isNavigationBtnDisabled", publicName: "isNavigationBtnDisabled", isSignal: true, isRequired: false, transformFunction: null }, dropdownDefaultText: { classPropertyName: "dropdownDefaultText", publicName: "dropdownDefaultText", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "sections", predicate: KitScrollNavigationSectionComponent }], viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, static: true }, { propertyName: "collapsedList", first: true, predicate: KitCollapsedListComponent, descendants: true }, { propertyName: "sectionContentRefs", predicate: ["sectionContent"], descendants: true }], ngImport: i0, template: "<div class=\"kit-scroll-navigation\">\n <div class=\"kit-scroll-navigation-items\">\n <kit-collapsed-list [itemList]=\"collapsedListItems()\"\n [dropdownDefaultValueText]=\"dropdownDefaultText()\"\n [gap]=\"18\"\n [itemTemplate]=\"navItem\"\n [disableActions]=\"isNavigationBtnDisabled()\"\n [dropdownAlign]=\"kitCollapsedListDropdownAlign.END\"\n (selectItem)=\"scrollToSection($event)\" />\n </div>\n\n <div #content\n class=\"kit-scroll-navigation-content\"\n (scroll)=\"onSectionScroll()\">\n @for (item of sections?.toArray(); track item) {\n <div #sectionContent\n class=\"kit-scroll-navigation-section\">\n <ng-container *ngTemplateOutlet=\"item.sectionTemplate\" />\n </div>\n }\n </div>\n</div>\n\n<ng-template #navItem let-item>\n <div kitBadge\n [kitBadgeVisible]=\"item.badgeCount\"\n [kitBadgeText]=\"item.badgeCount\"\n [kitBadgeTheme]=\"kitBadgeTheme.DANGER\">\n <kit-button kitTooltip\n kitTooltipFilter='.nav-item'\n class=\"nav-item\"\n [active]=\"currentVisibleItem?.value === item.value\"\n [type]=\"kitButtonType.GHOST\"\n [kind]=\"kitButtonKind.SMALL\"\n [icon]=\"item.icon\"\n [iconPosition]=\"kitButtonIconPosition.LEADING\"\n [state]=\"item.state ?? kitButtonState.DEFAULT\"\n [label]=\"item.text\"\n [title]=\"item.tooltipText\"\n [disabled]=\"isNavigationBtnDisabled()\"\n [kitTooltipVisible]=\"!!item.tooltipText\"\n ></kit-button>\n </div>\n</ng-template>\n", styles: [".kit-scroll-navigation{display:flex;flex-direction:column;height:100%}.kit-scroll-navigation-items{padding-bottom:27px}.kit-scroll-navigation .nav-item.active .kit-button .k-button{color:var(--ui-kit-color-white);border-color:var(--ui-kit-color-main);background:var(--ui-kit-color-main)}.kit-scroll-navigation-content{display:flex;flex-direction:column;flex:1;gap:20px;position:relative;overflow-y:auto}.kit-scroll-navigation-section{flex-shrink:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: KitButtonComponent, selector: "kit-button", inputs: ["disabled", "label", "type", "icon", "iconType", "kind", "state", "iconPosition", "buttonClass", "active"], outputs: ["clicked"] }, { kind: "component", type: KitCollapsedListComponent, selector: "kit-collapsed-list", inputs: ["itemList", "lineHeight", "dropdownDefaultValueText", "gap", "disableActions", "itemTemplate", "dropdownFooterTemplate", "dropdownItemTemplate", "dropdownNoDataTemplate", "appendTo", "alwaysShowDropdown", "dropdownAlign"], outputs: ["selectItem"] }, { kind: "directive", type: KitTooltipDirective, selector: "[kitTooltip]", inputs: ["kitTooltipPosition", "kitTooltipFilter", "kitTooltipTemplateRef", "kitTooltipVisible", "kitTooltipOffset"] }, { kind: "directive", type: KitBadgeDirective, selector: "[kitBadge]", inputs: ["kitBadgeText", "kitBadgeTheme", "kitBadgeVisible"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
8254
8255
|
}
|