@neural-ui/core 1.2.1 → 1.3.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/README.md +56 -88
- package/accordion/package.json +4 -0
- package/alert/package.json +4 -0
- package/autocomplete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/badge/package.json +4 -0
- package/block-ui/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/card/package.json +4 -0
- package/chart/package.json +4 -0
- package/checkbox/package.json +4 -0
- package/chip/package.json +4 -0
- package/code-block/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/command-palette/package.json +4 -0
- package/confirm-dialog/package.json +4 -0
- package/context-menu/package.json +4 -0
- package/dashboard-grid/package.json +4 -0
- package/date-input/package.json +4 -0
- package/divider/package.json +4 -0
- package/empty-state/package.json +4 -0
- package/fesm2022/neural-ui-core-accordion.mjs +162 -0
- package/fesm2022/neural-ui-core-accordion.mjs.map +1 -0
- package/fesm2022/neural-ui-core-alert.mjs +116 -0
- package/fesm2022/neural-ui-core-alert.mjs.map +1 -0
- package/fesm2022/neural-ui-core-autocomplete.mjs +332 -0
- package/fesm2022/neural-ui-core-autocomplete.mjs.map +1 -0
- package/fesm2022/neural-ui-core-avatar.mjs +109 -0
- package/fesm2022/neural-ui-core-avatar.mjs.map +1 -0
- package/fesm2022/neural-ui-core-badge.mjs +54 -0
- package/fesm2022/neural-ui-core-badge.mjs.map +1 -0
- package/fesm2022/neural-ui-core-block-ui.mjs +95 -0
- package/fesm2022/neural-ui-core-block-ui.mjs.map +1 -0
- package/fesm2022/neural-ui-core-breadcrumb.mjs +84 -0
- package/fesm2022/neural-ui-core-breadcrumb.mjs.map +1 -0
- package/fesm2022/neural-ui-core-button.mjs +125 -0
- package/fesm2022/neural-ui-core-button.mjs.map +1 -0
- package/fesm2022/neural-ui-core-card.mjs +69 -0
- package/fesm2022/neural-ui-core-card.mjs.map +1 -0
- package/fesm2022/neural-ui-core-chart.mjs +287 -0
- package/fesm2022/neural-ui-core-chart.mjs.map +1 -0
- package/fesm2022/neural-ui-core-checkbox.mjs +138 -0
- package/fesm2022/neural-ui-core-checkbox.mjs.map +1 -0
- package/fesm2022/neural-ui-core-chip.mjs +130 -0
- package/fesm2022/neural-ui-core-chip.mjs.map +1 -0
- package/fesm2022/neural-ui-core-code-block.mjs +250 -0
- package/fesm2022/neural-ui-core-code-block.mjs.map +1 -0
- package/fesm2022/neural-ui-core-color-picker.mjs +435 -0
- package/fesm2022/neural-ui-core-color-picker.mjs.map +1 -0
- package/fesm2022/neural-ui-core-command-palette.mjs +235 -0
- package/fesm2022/neural-ui-core-command-palette.mjs.map +1 -0
- package/fesm2022/neural-ui-core-confirm-dialog.mjs +118 -0
- package/fesm2022/neural-ui-core-confirm-dialog.mjs.map +1 -0
- package/fesm2022/neural-ui-core-context-menu.mjs +158 -0
- package/fesm2022/neural-ui-core-context-menu.mjs.map +1 -0
- package/fesm2022/neural-ui-core-dashboard-grid.mjs +144 -0
- package/fesm2022/neural-ui-core-dashboard-grid.mjs.map +1 -0
- package/fesm2022/neural-ui-core-date-input.mjs +1332 -0
- package/fesm2022/neural-ui-core-date-input.mjs.map +1 -0
- package/fesm2022/neural-ui-core-divider.mjs +54 -0
- package/fesm2022/neural-ui-core-divider.mjs.map +1 -0
- package/fesm2022/neural-ui-core-empty-state.mjs +84 -0
- package/fesm2022/neural-ui-core-empty-state.mjs.map +1 -0
- package/fesm2022/neural-ui-core-filter-bar.mjs +118 -0
- package/fesm2022/neural-ui-core-filter-bar.mjs.map +1 -0
- package/fesm2022/neural-ui-core-icon.mjs +50 -0
- package/fesm2022/neural-ui-core-icon.mjs.map +1 -0
- package/fesm2022/neural-ui-core-image-viewer.mjs +309 -0
- package/fesm2022/neural-ui-core-image-viewer.mjs.map +1 -0
- package/fesm2022/neural-ui-core-input-otp.mjs +192 -0
- package/fesm2022/neural-ui-core-input-otp.mjs.map +1 -0
- package/fesm2022/neural-ui-core-input.mjs +320 -0
- package/fesm2022/neural-ui-core-input.mjs.map +1 -0
- package/fesm2022/neural-ui-core-knob.mjs +323 -0
- package/fesm2022/neural-ui-core-knob.mjs.map +1 -0
- package/fesm2022/neural-ui-core-meter-group.mjs +122 -0
- package/fesm2022/neural-ui-core-meter-group.mjs.map +1 -0
- package/fesm2022/neural-ui-core-modal.mjs +156 -0
- package/fesm2022/neural-ui-core-modal.mjs.map +1 -0
- package/fesm2022/neural-ui-core-multiselect.mjs +748 -0
- package/fesm2022/neural-ui-core-multiselect.mjs.map +1 -0
- package/fesm2022/neural-ui-core-nav.mjs +952 -0
- package/fesm2022/neural-ui-core-nav.mjs.map +1 -0
- package/fesm2022/neural-ui-core-notification-center.mjs +264 -0
- package/fesm2022/neural-ui-core-notification-center.mjs.map +1 -0
- package/fesm2022/neural-ui-core-number-input.mjs +331 -0
- package/fesm2022/neural-ui-core-number-input.mjs.map +1 -0
- package/fesm2022/neural-ui-core-pagination.mjs +198 -0
- package/fesm2022/neural-ui-core-pagination.mjs.map +1 -0
- package/fesm2022/neural-ui-core-popover.mjs +207 -0
- package/fesm2022/neural-ui-core-popover.mjs.map +1 -0
- package/fesm2022/neural-ui-core-progress-bar.mjs +105 -0
- package/fesm2022/neural-ui-core-progress-bar.mjs.map +1 -0
- package/fesm2022/neural-ui-core-radio.mjs +171 -0
- package/fesm2022/neural-ui-core-radio.mjs.map +1 -0
- package/fesm2022/neural-ui-core-rating.mjs +151 -0
- package/fesm2022/neural-ui-core-rating.mjs.map +1 -0
- package/fesm2022/neural-ui-core-select.mjs +638 -0
- package/fesm2022/neural-ui-core-select.mjs.map +1 -0
- package/fesm2022/neural-ui-core-sidebar.mjs +214 -0
- package/fesm2022/neural-ui-core-sidebar.mjs.map +1 -0
- package/fesm2022/neural-ui-core-skeleton.mjs +40 -0
- package/fesm2022/neural-ui-core-skeleton.mjs.map +1 -0
- package/fesm2022/neural-ui-core-slider.mjs +146 -0
- package/fesm2022/neural-ui-core-slider.mjs.map +1 -0
- package/fesm2022/neural-ui-core-spinner.mjs +113 -0
- package/fesm2022/neural-ui-core-spinner.mjs.map +1 -0
- package/fesm2022/neural-ui-core-split-button.mjs +252 -0
- package/fesm2022/neural-ui-core-split-button.mjs.map +1 -0
- package/fesm2022/neural-ui-core-splitter.mjs +174 -0
- package/fesm2022/neural-ui-core-splitter.mjs.map +1 -0
- package/fesm2022/neural-ui-core-stats-card.mjs +163 -0
- package/fesm2022/neural-ui-core-stats-card.mjs.map +1 -0
- package/fesm2022/neural-ui-core-stepper.mjs +204 -0
- package/fesm2022/neural-ui-core-stepper.mjs.map +1 -0
- package/fesm2022/neural-ui-core-switch.mjs +111 -0
- package/fesm2022/neural-ui-core-switch.mjs.map +1 -0
- package/fesm2022/neural-ui-core-table.mjs +1860 -0
- package/fesm2022/neural-ui-core-table.mjs.map +1 -0
- package/fesm2022/neural-ui-core-tabs.mjs +246 -0
- package/fesm2022/neural-ui-core-tabs.mjs.map +1 -0
- package/fesm2022/neural-ui-core-textarea.mjs +188 -0
- package/fesm2022/neural-ui-core-textarea.mjs.map +1 -0
- package/fesm2022/neural-ui-core-timeline.mjs +117 -0
- package/fesm2022/neural-ui-core-timeline.mjs.map +1 -0
- package/fesm2022/neural-ui-core-toast.mjs +171 -0
- package/fesm2022/neural-ui-core-toast.mjs.map +1 -0
- package/fesm2022/neural-ui-core-toggle-button-group.mjs +162 -0
- package/fesm2022/neural-ui-core-toggle-button-group.mjs.map +1 -0
- package/fesm2022/neural-ui-core-toolbar.mjs +67 -0
- package/fesm2022/neural-ui-core-toolbar.mjs.map +1 -0
- package/fesm2022/neural-ui-core-tooltip.mjs +151 -0
- package/fesm2022/neural-ui-core-tooltip.mjs.map +1 -0
- package/fesm2022/neural-ui-core-url-state.mjs +96 -0
- package/fesm2022/neural-ui-core-url-state.mjs.map +1 -0
- package/fesm2022/neural-ui-core-virtual-list.mjs +126 -0
- package/fesm2022/neural-ui-core-virtual-list.mjs.map +1 -0
- package/fesm2022/neural-ui-core.mjs +11 -8544
- package/fesm2022/neural-ui-core.mjs.map +1 -1
- package/filter-bar/package.json +4 -0
- package/icon/package.json +4 -0
- package/image-viewer/package.json +4 -0
- package/input/package.json +4 -0
- package/input-otp/package.json +4 -0
- package/knob/package.json +4 -0
- package/meter-group/package.json +4 -0
- package/modal/package.json +4 -0
- package/multiselect/package.json +4 -0
- package/nav/package.json +4 -0
- package/notification-center/package.json +4 -0
- package/number-input/package.json +4 -0
- package/package.json +252 -5
- package/pagination/package.json +4 -0
- package/popover/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/radio/package.json +4 -0
- package/rating/package.json +4 -0
- package/select/package.json +4 -0
- package/sidebar/package.json +4 -0
- package/skeleton/package.json +4 -0
- package/slider/package.json +4 -0
- package/spinner/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stats-card/package.json +4 -0
- package/stepper/package.json +4 -0
- package/styles/_tokens.scss +202 -0
- package/styles.scss +1 -0
- package/switch/package.json +4 -0
- package/table/package.json +4 -0
- package/tabs/package.json +4 -0
- package/textarea/package.json +4 -0
- package/timeline/package.json +4 -0
- package/toast/package.json +4 -0
- package/toggle-button-group/package.json +4 -0
- package/toolbar/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/types/neural-ui-core-accordion.d.ts +55 -0
- package/types/neural-ui-core-alert.d.ts +47 -0
- package/types/neural-ui-core-autocomplete.d.ts +69 -0
- package/types/neural-ui-core-avatar.d.ts +39 -0
- package/types/neural-ui-core-badge.d.ts +36 -0
- package/types/neural-ui-core-block-ui.d.ts +46 -0
- package/types/neural-ui-core-breadcrumb.d.ts +38 -0
- package/types/neural-ui-core-button.d.ts +55 -0
- package/types/neural-ui-core-card.d.ts +37 -0
- package/types/neural-ui-core-chart.d.ts +236 -0
- package/types/neural-ui-core-checkbox.d.ts +33 -0
- package/types/neural-ui-core-chip.d.ts +53 -0
- package/types/neural-ui-core-code-block.d.ts +55 -0
- package/types/neural-ui-core-color-picker.d.ts +55 -0
- package/types/neural-ui-core-command-palette.d.ts +56 -0
- package/types/neural-ui-core-confirm-dialog.d.ts +50 -0
- package/types/neural-ui-core-context-menu.d.ts +66 -0
- package/types/neural-ui-core-dashboard-grid.d.ts +41 -0
- package/types/neural-ui-core-date-input.d.ts +178 -0
- package/types/neural-ui-core-divider.d.ts +20 -0
- package/types/neural-ui-core-empty-state.d.ts +32 -0
- package/types/neural-ui-core-filter-bar.d.ts +49 -0
- package/types/neural-ui-core-icon.d.ts +33 -0
- package/types/neural-ui-core-image-viewer.d.ts +67 -0
- package/types/neural-ui-core-input-otp.d.ts +49 -0
- package/types/neural-ui-core-input.d.ts +86 -0
- package/types/neural-ui-core-knob.d.ts +68 -0
- package/types/neural-ui-core-meter-group.d.ts +52 -0
- package/types/neural-ui-core-modal.d.ts +54 -0
- package/types/neural-ui-core-multiselect.d.ts +129 -0
- package/types/neural-ui-core-nav.d.ts +69 -0
- package/types/neural-ui-core-notification-center.d.ts +60 -0
- package/types/neural-ui-core-number-input.d.ts +63 -0
- package/types/neural-ui-core-pagination.d.ts +30 -0
- package/types/neural-ui-core-popover.d.ts +73 -0
- package/types/neural-ui-core-progress-bar.d.ts +35 -0
- package/types/neural-ui-core-radio.d.ts +51 -0
- package/types/neural-ui-core-rating.d.ts +34 -0
- package/types/neural-ui-core-select.d.ts +161 -0
- package/types/neural-ui-core-sidebar.d.ts +57 -0
- package/types/neural-ui-core-skeleton.d.ts +22 -0
- package/types/neural-ui-core-slider.d.ts +42 -0
- package/types/neural-ui-core-spinner.d.ts +38 -0
- package/types/neural-ui-core-split-button.d.ts +65 -0
- package/types/neural-ui-core-splitter.d.ts +28 -0
- package/types/neural-ui-core-stats-card.d.ts +39 -0
- package/types/neural-ui-core-stepper.d.ts +51 -0
- package/types/neural-ui-core-switch.d.ts +34 -0
- package/types/neural-ui-core-table.d.ts +282 -0
- package/types/neural-ui-core-tabs.d.ts +76 -0
- package/types/neural-ui-core-textarea.d.ts +52 -0
- package/types/neural-ui-core-timeline.d.ts +33 -0
- package/types/neural-ui-core-toast.d.ts +70 -0
- package/types/neural-ui-core-toggle-button-group.d.ts +63 -0
- package/types/neural-ui-core-toolbar.d.ts +36 -0
- package/types/neural-ui-core-tooltip.d.ts +48 -0
- package/types/neural-ui-core-url-state.d.ts +58 -0
- package/types/neural-ui-core-virtual-list.d.ts +60 -0
- package/types/neural-ui-core.d.ts +3 -2105
- package/url-state/package.json +4 -0
- package/virtual-list/package.json +4 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { afterNextRender, input, output, computed, TemplateRef, ContentChild, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/cdk/scrolling';
|
|
4
|
+
import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
|
5
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* NeuralUI VirtualList
|
|
9
|
+
*
|
|
10
|
+
* Wrapper sobre CDK VirtualScrollViewport para listas de miles de ítems.
|
|
11
|
+
* Proyecta contenido mediante `ng-template` con let-item.
|
|
12
|
+
*
|
|
13
|
+
* Uso:
|
|
14
|
+
* <neu-virtual-list [items]="bigArray" [itemSize]="40">
|
|
15
|
+
* <ng-template neuVirtualItem let-item>
|
|
16
|
+
* <div class="my-row">{{ item.name }}</div>
|
|
17
|
+
* </ng-template>
|
|
18
|
+
* </neu-virtual-list>
|
|
19
|
+
*/
|
|
20
|
+
class NeuVirtualListComponent {
|
|
21
|
+
/** Referencia al viewport CDK — para forzar remeasure tras render / CDK viewport ref — to force remeasure after render */
|
|
22
|
+
_viewport;
|
|
23
|
+
constructor() {
|
|
24
|
+
// Fuerza checkViewportSize() tras el primer paint completo (necesario en modo zoneless)
|
|
25
|
+
// Forces checkViewportSize() after the first full paint (needed in zoneless mode)
|
|
26
|
+
afterNextRender(() => this._viewport?.checkViewportSize());
|
|
27
|
+
}
|
|
28
|
+
ngAfterViewInit() {
|
|
29
|
+
// Segundo intento de medición sincrona por si afterNextRender no cubre todos los casos
|
|
30
|
+
// Second synchronous measurement pass as a fallback
|
|
31
|
+
this._viewport?.checkViewportSize();
|
|
32
|
+
}
|
|
33
|
+
/** Array de ítems / Item array */
|
|
34
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/** Altura de cada fila en px / Row height in px */
|
|
36
|
+
itemSize = input(48, ...(ngDevMode ? [{ debugName: "itemSize" }] : /* istanbul ignore next */ []));
|
|
37
|
+
/** Número de filas visibles / Visible row count (sets container height) */
|
|
38
|
+
visibleRows = input(10, ...(ngDevMode ? [{ debugName: "visibleRows" }] : /* istanbul ignore next */ []));
|
|
39
|
+
/** Texto cuando la lista está vacía / Empty state text */
|
|
40
|
+
emptyLabel = input('Sin resultados', ...(ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** Función de tracking / Tracking function */
|
|
42
|
+
trackBy = input((i) => i, ...(ngDevMode ? [{ debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
43
|
+
/** Emitido al hacer click en un ítem / Emitted on item click */
|
|
44
|
+
itemClick = output();
|
|
45
|
+
itemTemplate = null;
|
|
46
|
+
_containerHeight = computed(() => `${this.itemSize() * this.visibleRows()}px`, ...(ngDevMode ? [{ debugName: "_containerHeight" }] : /* istanbul ignore next */ []));
|
|
47
|
+
_isEmpty = computed(() => this.items().length === 0, ...(ngDevMode ? [{ debugName: "_isEmpty" }] : /* istanbul ignore next */ []));
|
|
48
|
+
_trackBy = (index, item) => this.trackBy()(index, item);
|
|
49
|
+
_itemTemplateOrDefault(fallback) {
|
|
50
|
+
return this.itemTemplate ?? fallback;
|
|
51
|
+
}
|
|
52
|
+
_itemContext(item, index) {
|
|
53
|
+
return { $implicit: item, index };
|
|
54
|
+
}
|
|
55
|
+
_defaultItemLabel(item) {
|
|
56
|
+
return String(item);
|
|
57
|
+
}
|
|
58
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: NeuVirtualListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
59
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: NeuVirtualListComponent, isStandalone: true, selector: "neu-virtual-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, itemSize: { classPropertyName: "itemSize", publicName: "itemSize", isSignal: true, isRequired: false, transformFunction: null }, visibleRows: { classPropertyName: "visibleRows", publicName: "visibleRows", isSignal: true, isRequired: false, transformFunction: null }, emptyLabel: { classPropertyName: "emptyLabel", publicName: "emptyLabel", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick" }, host: { properties: { "style.height": "_containerHeight()" }, classAttribute: "neu-virtual-list" }, queries: [{ propertyName: "itemTemplate", first: true, predicate: TemplateRef, descendants: true }], viewQueries: [{ propertyName: "_viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], ngImport: i0, template: `
|
|
60
|
+
<ng-template #defaultItem let-item>
|
|
61
|
+
<div class="neu-virtual-list__item-default" [style.height.px]="itemSize()">
|
|
62
|
+
{{ _defaultItemLabel(item) }}
|
|
63
|
+
</div>
|
|
64
|
+
</ng-template>
|
|
65
|
+
|
|
66
|
+
<cdk-virtual-scroll-viewport
|
|
67
|
+
class="neu-virtual-list__viewport"
|
|
68
|
+
[itemSize]="itemSize()"
|
|
69
|
+
[style.height]="_containerHeight()"
|
|
70
|
+
tabindex="0"
|
|
71
|
+
>
|
|
72
|
+
<ng-container *cdkVirtualFor="let item of items(); let index = index; trackBy: _trackBy">
|
|
73
|
+
<ng-container
|
|
74
|
+
[ngTemplateOutlet]="_itemTemplateOrDefault(defaultItem)"
|
|
75
|
+
[ngTemplateOutletContext]="_itemContext(item, index)"
|
|
76
|
+
/>
|
|
77
|
+
</ng-container>
|
|
78
|
+
</cdk-virtual-scroll-viewport>
|
|
79
|
+
@if (_isEmpty()) {
|
|
80
|
+
<div class="neu-virtual-list__empty" role="status">{{ emptyLabel() }}</div>
|
|
81
|
+
}
|
|
82
|
+
`, isInline: true, styles: [".neu-virtual-list{display:block;overflow:hidden}.neu-virtual-list__viewport{width:100%;overflow-y:auto}.neu-virtual-list__item-default{display:flex;align-items:center;padding:0 12px;border-bottom:1px solid var(--neu-border-color, #e5e7eb);font-size:.875rem;color:var(--neu-text-primary, #111)}.neu-virtual-list__empty{display:flex;align-items:center;justify-content:center;padding:32px;color:var(--neu-text-secondary, #6b7280);font-size:.875rem}\n"], dependencies: [{ kind: "ngmodule", type: ScrollingModule }, { kind: "directive", type: i1.CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: i1.CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: i1.CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: NeuVirtualListComponent, decorators: [{
|
|
85
|
+
type: Component,
|
|
86
|
+
args: [{ selector: 'neu-virtual-list', imports: [ScrollingModule, NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
87
|
+
class: 'neu-virtual-list',
|
|
88
|
+
'[style.height]': '_containerHeight()',
|
|
89
|
+
}, template: `
|
|
90
|
+
<ng-template #defaultItem let-item>
|
|
91
|
+
<div class="neu-virtual-list__item-default" [style.height.px]="itemSize()">
|
|
92
|
+
{{ _defaultItemLabel(item) }}
|
|
93
|
+
</div>
|
|
94
|
+
</ng-template>
|
|
95
|
+
|
|
96
|
+
<cdk-virtual-scroll-viewport
|
|
97
|
+
class="neu-virtual-list__viewport"
|
|
98
|
+
[itemSize]="itemSize()"
|
|
99
|
+
[style.height]="_containerHeight()"
|
|
100
|
+
tabindex="0"
|
|
101
|
+
>
|
|
102
|
+
<ng-container *cdkVirtualFor="let item of items(); let index = index; trackBy: _trackBy">
|
|
103
|
+
<ng-container
|
|
104
|
+
[ngTemplateOutlet]="_itemTemplateOrDefault(defaultItem)"
|
|
105
|
+
[ngTemplateOutletContext]="_itemContext(item, index)"
|
|
106
|
+
/>
|
|
107
|
+
</ng-container>
|
|
108
|
+
</cdk-virtual-scroll-viewport>
|
|
109
|
+
@if (_isEmpty()) {
|
|
110
|
+
<div class="neu-virtual-list__empty" role="status">{{ emptyLabel() }}</div>
|
|
111
|
+
}
|
|
112
|
+
`, styles: [".neu-virtual-list{display:block;overflow:hidden}.neu-virtual-list__viewport{width:100%;overflow-y:auto}.neu-virtual-list__item-default{display:flex;align-items:center;padding:0 12px;border-bottom:1px solid var(--neu-border-color, #e5e7eb);font-size:.875rem;color:var(--neu-text-primary, #111)}.neu-virtual-list__empty{display:flex;align-items:center;justify-content:center;padding:32px;color:var(--neu-text-secondary, #6b7280);font-size:.875rem}\n"] }]
|
|
113
|
+
}], ctorParameters: () => [], propDecorators: { _viewport: [{
|
|
114
|
+
type: ViewChild,
|
|
115
|
+
args: [CdkVirtualScrollViewport]
|
|
116
|
+
}], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], itemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemSize", required: false }] }], visibleRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "visibleRows", required: false }] }], emptyLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyLabel", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], itemTemplate: [{
|
|
117
|
+
type: ContentChild,
|
|
118
|
+
args: [TemplateRef]
|
|
119
|
+
}] } });
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Generated bundle index. Do not edit.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
export { NeuVirtualListComponent };
|
|
126
|
+
//# sourceMappingURL=neural-ui-core-virtual-list.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"neural-ui-core-virtual-list.mjs","sources":["../../../../projects/ui-core/virtual-list/neu-virtual-list.component.ts","../../../../projects/ui-core/virtual-list/neural-ui-core-virtual-list.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n afterNextRender,\n computed,\n input,\n output,\n} from '@angular/core';\nimport { CdkVirtualScrollViewport, ScrollingModule } from '@angular/cdk/scrolling';\nimport { NgTemplateOutlet } from '@angular/common';\n\n/**\n * NeuralUI VirtualList\n *\n * Wrapper sobre CDK VirtualScrollViewport para listas de miles de ítems.\n * Proyecta contenido mediante `ng-template` con let-item.\n *\n * Uso:\n * <neu-virtual-list [items]=\"bigArray\" [itemSize]=\"40\">\n * <ng-template neuVirtualItem let-item>\n * <div class=\"my-row\">{{ item.name }}</div>\n * </ng-template>\n * </neu-virtual-list>\n */\n@Component({\n selector: 'neu-virtual-list',\n imports: [ScrollingModule, NgTemplateOutlet],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'neu-virtual-list',\n '[style.height]': '_containerHeight()',\n },\n template: `\n <ng-template #defaultItem let-item>\n <div class=\"neu-virtual-list__item-default\" [style.height.px]=\"itemSize()\">\n {{ _defaultItemLabel(item) }}\n </div>\n </ng-template>\n\n <cdk-virtual-scroll-viewport\n class=\"neu-virtual-list__viewport\"\n [itemSize]=\"itemSize()\"\n [style.height]=\"_containerHeight()\"\n tabindex=\"0\"\n >\n <ng-container *cdkVirtualFor=\"let item of items(); let index = index; trackBy: _trackBy\">\n <ng-container\n [ngTemplateOutlet]=\"_itemTemplateOrDefault(defaultItem)\"\n [ngTemplateOutletContext]=\"_itemContext(item, index)\"\n />\n </ng-container>\n </cdk-virtual-scroll-viewport>\n @if (_isEmpty()) {\n <div class=\"neu-virtual-list__empty\" role=\"status\">{{ emptyLabel() }}</div>\n }\n `,\n styleUrl: './neu-virtual-list.component.scss',\n})\nexport class NeuVirtualListComponent<T = unknown> implements AfterViewInit {\n /** Referencia al viewport CDK — para forzar remeasure tras render / CDK viewport ref — to force remeasure after render */\n @ViewChild(CdkVirtualScrollViewport) private readonly _viewport?: CdkVirtualScrollViewport;\n\n constructor() {\n // Fuerza checkViewportSize() tras el primer paint completo (necesario en modo zoneless)\n // Forces checkViewportSize() after the first full paint (needed in zoneless mode)\n afterNextRender(() => this._viewport?.checkViewportSize());\n }\n\n ngAfterViewInit(): void {\n // Segundo intento de medición sincrona por si afterNextRender no cubre todos los casos\n // Second synchronous measurement pass as a fallback\n this._viewport?.checkViewportSize();\n }\n /** Array de ítems / Item array */\n readonly items = input<T[]>([]);\n\n /** Altura de cada fila en px / Row height in px */\n readonly itemSize = input<number>(48);\n\n /** Número de filas visibles / Visible row count (sets container height) */\n readonly visibleRows = input<number>(10);\n\n /** Texto cuando la lista está vacía / Empty state text */\n readonly emptyLabel = input<string>('Sin resultados');\n\n /** Función de tracking / Tracking function */\n readonly trackBy = input<(index: number, item: T) => unknown>((i) => i);\n\n /** Emitido al hacer click en un ítem / Emitted on item click */\n readonly itemClick = output<{ item: T; index: number }>();\n\n @ContentChild(TemplateRef) itemTemplate: TemplateRef<{ $implicit: T; index: number }> | null =\n null;\n\n readonly _containerHeight = computed(() => `${this.itemSize() * this.visibleRows()}px`);\n readonly _isEmpty = computed(() => this.items().length === 0);\n\n _trackBy = (index: number, item: T) => this.trackBy()(index, item);\n\n protected _itemTemplateOrDefault(\n fallback: TemplateRef<{ $implicit: T; index: number }>,\n ): TemplateRef<{ $implicit: T; index: number }> {\n return this.itemTemplate ?? fallback;\n }\n\n protected _itemContext(item: T, index: number): { $implicit: T; index: number } {\n return { $implicit: item, index };\n }\n\n protected _defaultItemLabel(item: T): string {\n return String(item);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;AAgBA;;;;;;;;;;;;AAYG;MAoCU,uBAAuB,CAAA;;AAEoB,IAAA,SAAS;AAE/D,IAAA,WAAA,GAAA;;;QAGE,eAAe,CAAC,MAAM,IAAI,CAAC,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC5D;IAEA,eAAe,GAAA;;;AAGb,QAAA,IAAI,CAAC,SAAS,EAAE,iBAAiB,EAAE;IACrC;;AAES,IAAA,KAAK,GAAG,KAAK,CAAM,EAAE,4EAAC;;AAGtB,IAAA,QAAQ,GAAG,KAAK,CAAS,EAAE,+EAAC;;AAG5B,IAAA,WAAW,GAAG,KAAK,CAAS,EAAE,kFAAC;;AAG/B,IAAA,UAAU,GAAG,KAAK,CAAS,gBAAgB,iFAAC;;IAG5C,OAAO,GAAG,KAAK,CAAsC,CAAC,CAAC,KAAK,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,8BAAA,EAAA,CAAA,CAAC;;IAG9D,SAAS,GAAG,MAAM,EAA8B;IAE9B,YAAY,GACrC,IAAI;AAEG,IAAA,gBAAgB,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,GA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