@kodaris/krubble-components 1.0.74 → 1.0.75

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.
@@ -0,0 +1,187 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import '../button/button.js';
3
+ import '../form/select-field/select-field.js';
4
+ import '../form/select-field/select-option.js';
5
+ import { KRTableDef, KRTableColumn } from '../table/table.js';
6
+ import '../tabs/tabs.js';
7
+ import '../tabs/tab.js';
8
+ export declare class KRGrid extends LitElement {
9
+ static styles: import("lit").CSSResult[];
10
+ /**
11
+ * Internal flag to switch between scroll edge modes:
12
+ * - 'overlay': Fixed padding with overlay elements that hide content at edges (scrollbar at viewport edge)
13
+ * - 'edge': Padding scrolls with content, allowing table to reach edges when scrolling
14
+ */
15
+ private _scrollStyle;
16
+ private _refreshTimer?;
17
+ private _data;
18
+ private _dataState;
19
+ private _page;
20
+ private _pageSize;
21
+ private _totalItems;
22
+ private _totalPages;
23
+ private _searchQuery;
24
+ private _canScrollLeft;
25
+ private _canScrollRight;
26
+ private _canScrollHorizontal;
27
+ private _columnPickerOpen;
28
+ private _filterPanelOpened;
29
+ private _filterPanelTab;
30
+ private _buckets;
31
+ private _filterPanelPos;
32
+ private _sorts;
33
+ private _resizing;
34
+ private _resizeObserver;
35
+ private _searchPositionLocked;
36
+ private _columnWidthsLocked;
37
+ private _model;
38
+ def: KRTableDef;
39
+ /**
40
+ * Table layout variant.
41
+ * - 'default': Full-page table that fills parent height with centered search.
42
+ * - 'card': Embedded table that sizes itself to content, left-aligns search, and
43
+ * reserves space for pageSize rows to prevent layout shift.
44
+ */
45
+ variant: 'default' | 'card';
46
+ connectedCallback(): void;
47
+ disconnectedCallback(): void;
48
+ willUpdate(changedProperties: Map<string, unknown>): void;
49
+ updated(changedProperties: Map<string, unknown>): void;
50
+ /** Measures header cell widths and locks them to prevent column shift on subsequent data changes. */
51
+ private _lockColumnWidths;
52
+ /** Syncs light DOM content for cells with custom render functions */
53
+ private _syncSlottedContent;
54
+ refresh(): void;
55
+ goToPrevPage(): void;
56
+ goToNextPage(): void;
57
+ goToPage(page: number): void;
58
+ private _toSolrData;
59
+ private _toDbParams;
60
+ /**
61
+ * Fetches data from the API and updates the table.
62
+ * Shows a loading spinner while fetching, then displays rows on success
63
+ * or an error snackbar on failure.
64
+ * Request/response format depends on dataSource.mode (solr, opensearch, db).
65
+ */
66
+ private _fetch;
67
+ private _parseFacetResults;
68
+ /**
69
+ * Sets up auto-refresh so the table automatically fetches fresh data
70
+ * at a regular interval (useful for dashboards, monitoring views).
71
+ * Configured via def.refreshInterval in milliseconds.
72
+ */
73
+ private _initRefresh;
74
+ private _handleSearch;
75
+ private _getGridTemplateColumns;
76
+ /**
77
+ * Updates search position to be centered with equal gaps from title and tools.
78
+ * On first call: resets to flex centering, measures position, then locks with fixed margin.
79
+ * Subsequent calls are ignored unless _searchPositionLocked is reset (e.g., on resize).
80
+ */
81
+ private _updateSearchPosition;
82
+ private _toggleColumnPicker;
83
+ private _toggleColumn;
84
+ private _handleRowMouseDown;
85
+ private _handleRowClick;
86
+ private _handleClickOutside;
87
+ getDisplayedColumns(): KRTableColumn[];
88
+ /**
89
+ * Scroll event handler that updates scroll flags in real-time as user scrolls.
90
+ * Updates shadow indicators to show if more content exists left/right.
91
+ */
92
+ private _handleScroll;
93
+ /**
94
+ * Updates scroll state flags for the table content container.
95
+ * - _canScrollLeft: true if scrolled right (can scroll back left)
96
+ * - _canScrollRight: true if more content exists to the right
97
+ * - _canScrollHorizontal: true if content is wider than container
98
+ * These flags control scroll shadow indicators and CSS classes.
99
+ */
100
+ private _updateScrollFlags;
101
+ private _handleResizeStart;
102
+ private _handleResizeMove;
103
+ private _handleResizeEnd;
104
+ private _handleSortClick;
105
+ private _renderSortIndicator;
106
+ private _handleAction;
107
+ private _handleKqlChange;
108
+ private _handleFilterPanelToggle;
109
+ private _handleKqlClear;
110
+ private _handleFilterClear;
111
+ private _handleFilterTextKeydown;
112
+ private _handleOperatorChange;
113
+ private _handleFilterStringChange;
114
+ private _handleFilterNumberChange;
115
+ private _handleFilterDateChange;
116
+ private _handleFilterBooleanChange;
117
+ private _handleFilterDateStartChange;
118
+ private _handleFilterDateEndChange;
119
+ private _handleFilterNumberStartChange;
120
+ private _handleFilterNumberEndChange;
121
+ private _handleFilterListChange;
122
+ private _handleFilterApply;
123
+ private _handleFilterPanelTabChange;
124
+ private _handleBucketToggle;
125
+ private _renderCellContent;
126
+ /**
127
+ * Returns CSS classes for a header cell based on column config.
128
+ */
129
+ private _getHeaderCellClasses;
130
+ /**
131
+ * Returns CSS classes for a table cell based on column config:
132
+ * - Alignment (center, right)
133
+ * - Sticky positioning (left, right)
134
+ * - Border classes for the last left-sticky or first right-sticky column
135
+ */
136
+ private _getCellClasses;
137
+ /**
138
+ * Returns inline styles for a table cell:
139
+ * - Width (from column config or default 150px)
140
+ * - Min-width (if specified)
141
+ * - Left/right offset for sticky columns (calculated from widths of preceding sticky columns)
142
+ */
143
+ private _getCellStyle;
144
+ /**
145
+ * Renders the pagination controls:
146
+ * - Previous page arrow (disabled on first page)
147
+ * - Range text showing "1-50 of 150" format
148
+ * - Next page arrow (disabled on last page)
149
+ *
150
+ * Hidden when there's no data or all data fits on one page.
151
+ */
152
+ private _renderPagination;
153
+ /** Renders the card title block (title + description) above the toolbar in card mode. */
154
+ private _renderCardHeader;
155
+ /**
156
+ * Renders the header toolbar containing:
157
+ * - Title (left, default variant only)
158
+ * - Search bar with view selector dropdown (center, or left-aligned in card variant)
159
+ * - Tools (right): page navigation, refresh button, column visibility picker, actions dropdown
160
+ *
161
+ * Hidden when there's no title, no actions, and data fits on one page.
162
+ */
163
+ private _renderHeader;
164
+ /** Renders status message (loading, error, empty) */
165
+ private _renderStatus;
166
+ private _renderFilterPanel;
167
+ /**
168
+ * Renders filter row below column headers.
169
+ * Only displays for columns with filterable: true.
170
+ */
171
+ private _renderFilterRow;
172
+ /** Renders the scrollable data grid with column headers and rows. */
173
+ private _renderTable;
174
+ /**
175
+ * Renders a data table with:
176
+ * - Header bar with title, search input with view selector, and tools (pagination, refresh, column visibility, actions dropdown)
177
+ * - Scrollable grid with sticky header row and optional sticky left/right columns
178
+ * - Loading, error message, or empty state when no data
179
+ */
180
+ render(): TemplateResult<1>;
181
+ }
182
+ declare global {
183
+ interface HTMLElementTagNameMap {
184
+ 'kr-grid': KRGrid;
185
+ }
186
+ }
187
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/grid/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAmB,MAAM,KAAK,CAAC;AAM7E,OAAO,qBAAqB,CAAC;AAE7B,OAAO,sCAAsC,CAAC;AAC9C,OAAO,uCAAuC,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAoB,aAAa,EAA2I,MAAM,mBAAmB,CAAC;AACzN,OAAO,iBAAiB,CAAC;AACzB,OAAO,gBAAgB,CAAC;AAmBxB,qBACa,MAAO,SAAQ,UAAU;IACpC,OAAgB,MAAM,4BAi4BnB;IAEH;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAA8B;IAElD,OAAO,CAAC,aAAa,CAAC,CAAS;IAG/B,OAAO,CAAC,KAAK,CAA6B;IAG1C,OAAO,CAAC,UAAU,CAAoD;IAGtE,OAAO,CAAC,KAAK,CAAK;IAGlB,OAAO,CAAC,SAAS,CAAM;IAGvB,OAAO,CAAC,WAAW,CAAK;IAGxB,OAAO,CAAC,WAAW,CAAK;IAGxB,OAAO,CAAC,YAAY,CAAM;IAG1B,OAAO,CAAC,cAAc,CAAS;IAG/B,OAAO,CAAC,eAAe,CAAS;IAGhC,OAAO,CAAC,oBAAoB,CAAS;IAGrC,OAAO,CAAC,iBAAiB,CAAS;IAGlC,OAAO,CAAC,kBAAkB,CAAuB;IAGjD,OAAO,CAAC,eAAe,CAAiC;IAGxD,OAAO,CAAC,QAAQ,CAA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