arame-data-grid-pro 0.0.0-stage → 1.0.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 +21 -0
- package/README.md +522 -2
- package/dist/advanced-filter-table/advanced-filter-data-table.element.d.ts +79 -0
- package/dist/advanced-filter-table/expression-engine.d.ts +26 -0
- package/dist/advanced-filter-table/index.cjs +180 -0
- package/dist/advanced-filter-table/index.cjs.map +1 -0
- package/dist/advanced-filter-table/index.d.ts +3 -0
- package/dist/advanced-filter-table/index.js +834 -0
- package/dist/advanced-filter-table/index.js.map +1 -0
- package/dist/advanced-filter-table/types.d.ts +111 -0
- package/dist/base-table-controller-BXMQn5v2.cjs +12 -0
- package/dist/base-table-controller-BXMQn5v2.cjs.map +1 -0
- package/dist/base-table-controller-DWbA88mL.js +286 -0
- package/dist/base-table-controller-DWbA88mL.js.map +1 -0
- package/dist/calculated-table/calculated-data-table.element.d.ts +68 -0
- package/dist/calculated-table/calculation-engine.d.ts +24 -0
- package/dist/calculated-table/index.cjs +376 -0
- package/dist/calculated-table/index.cjs.map +1 -0
- package/dist/calculated-table/index.d.ts +3 -0
- package/dist/calculated-table/index.js +811 -0
- package/dist/calculated-table/index.js.map +1 -0
- package/dist/calculated-table/types.d.ts +83 -0
- package/dist/column-visibility-table/column-visibility-table.element.d.ts +53 -0
- package/dist/column-visibility-table/index.cjs +2 -0
- package/dist/column-visibility-table/index.cjs.map +1 -0
- package/dist/column-visibility-table/index.d.ts +3 -0
- package/dist/column-visibility-table/index.js +263 -0
- package/dist/column-visibility-table/index.js.map +1 -0
- package/dist/column-visibility-table/types.d.ts +47 -0
- package/dist/common/accessibility-helpers.d.ts +18 -0
- package/dist/common/base-table-controller.d.ts +40 -0
- package/dist/common/base-table-types.d.ts +73 -0
- package/dist/common/configurable-table-types.d.ts +28 -0
- package/dist/common/index.cjs +4 -0
- package/dist/common/index.cjs.map +1 -0
- package/dist/common/index.d.ts +7 -0
- package/dist/common/index.js +206 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/selection-manager.d.ts +51 -0
- package/dist/common/table-localization.d.ts +31 -0
- package/dist/common/table-state-manager.d.ts +56 -0
- package/dist/common/universal-exporter.d.ts +33 -0
- package/dist/constants.d.ts +11 -0
- package/dist/context-menu-table/context-menu-data-table.element.d.ts +46 -0
- package/dist/context-menu-table/index.cjs +2 -0
- package/dist/context-menu-table/index.cjs.map +1 -0
- package/dist/context-menu-table/index.d.ts +3 -0
- package/dist/context-menu-table/index.js +303 -0
- package/dist/context-menu-table/index.js.map +1 -0
- package/dist/context-menu-table/types.d.ts +83 -0
- package/dist/core/csv-exporter.d.ts +2 -0
- package/dist/core/data-engine.d.ts +9 -0
- package/dist/core/virtualizer.d.ts +7 -0
- package/dist/editable-table/editable-data-table.element.d.ts +39 -0
- package/dist/editable-table/index.cjs +2 -0
- package/dist/editable-table/index.cjs.map +1 -0
- package/dist/editable-table/index.d.ts +3 -0
- package/dist/editable-table/index.js +309 -0
- package/dist/editable-table/index.js.map +1 -0
- package/dist/editable-table/types.d.ts +107 -0
- package/dist/expandable-table/expandable-data-table.element.d.ts +45 -0
- package/dist/expandable-table/index.cjs +2 -0
- package/dist/expandable-table/index.cjs.map +1 -0
- package/dist/expandable-table/index.d.ts +3 -0
- package/dist/expandable-table/index.js +253 -0
- package/dist/expandable-table/index.js.map +1 -0
- package/dist/expandable-table/types.d.ts +76 -0
- package/dist/filterable-table/filter-engine.d.ts +4 -0
- package/dist/filterable-table/filterable-data-table.element.d.ts +45 -0
- package/dist/filterable-table/index.cjs +2 -0
- package/dist/filterable-table/index.cjs.map +1 -0
- package/dist/filterable-table/index.d.ts +4 -0
- package/dist/filterable-table/index.js +378 -0
- package/dist/filterable-table/index.js.map +1 -0
- package/dist/filterable-table/types.d.ts +86 -0
- package/dist/grouped-table/group-engine.d.ts +13 -0
- package/dist/grouped-table/grouped-data-table.element.d.ts +37 -0
- package/dist/grouped-table/index.cjs +2 -0
- package/dist/grouped-table/index.cjs.map +1 -0
- package/dist/grouped-table/index.d.ts +4 -0
- package/dist/grouped-table/index.js +330 -0
- package/dist/grouped-table/index.js.map +1 -0
- package/dist/grouped-table/types.d.ts +75 -0
- package/dist/header-filter-table/filter-engine.d.ts +13 -0
- package/dist/header-filter-table/header-filter-data-table.element.d.ts +70 -0
- package/dist/header-filter-table/index.cjs +483 -0
- package/dist/header-filter-table/index.cjs.map +1 -0
- package/dist/header-filter-table/index.d.ts +3 -0
- package/dist/header-filter-table/index.js +1004 -0
- package/dist/header-filter-table/index.js.map +1 -0
- package/dist/header-filter-table/types.d.ts +75 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1035 -0
- package/dist/index.js.map +1 -0
- package/dist/infinite-table/index.cjs +354 -0
- package/dist/infinite-table/index.cjs.map +1 -0
- package/dist/infinite-table/index.d.ts +3 -0
- package/dist/infinite-table/index.js +749 -0
- package/dist/infinite-table/index.js.map +1 -0
- package/dist/infinite-table/infinite-data-table.element.d.ts +70 -0
- package/dist/infinite-table/types.d.ts +77 -0
- package/dist/infinite-table/virtual-scroller.d.ts +8 -0
- package/dist/sticky-table/index.cjs +2 -0
- package/dist/sticky-table/index.cjs.map +1 -0
- package/dist/sticky-table/index.d.ts +3 -0
- package/dist/sticky-table/index.js +242 -0
- package/dist/sticky-table/index.js.map +1 -0
- package/dist/sticky-table/sticky-data-table.element.d.ts +45 -0
- package/dist/sticky-table/types.d.ts +53 -0
- package/dist/styles.css +1 -0
- package/dist/tree-table/index.cjs +443 -0
- package/dist/tree-table/index.cjs.map +1 -0
- package/dist/tree-table/index.d.ts +3 -0
- package/dist/tree-table/index.js +1003 -0
- package/dist/tree-table/index.js.map +1 -0
- package/dist/tree-table/tree-data-table.element.d.ts +69 -0
- package/dist/tree-table/tree-engine.d.ts +21 -0
- package/dist/tree-table/types.d.ts +101 -0
- package/dist/types.d.ts +199 -0
- package/dist/ui/dom-utils.d.ts +2 -0
- package/dist/ui/pro-data-grid.element.d.ts +90 -0
- package/package.json +96 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Arame Global (arameglobal)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,523 @@
|
|
|
1
|
-
#
|
|
1
|
+
# arame-data-grid-pro
|
|
2
|
+
|
|
3
|
+
A fast, lightweight, and customizable data table library for the modern web.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Introduction
|
|
8
|
+
|
|
9
|
+
**`arame-data-grid-pro`** is an enterprise-ready, high-performance data grid component designed for web applications that require fast, flexible, and interactive tabular data presentation. Built on native W3C **Web Components (Custom Elements v1)** with TypeScript, it runs anywhere without framework lock-in—whether in plain vanilla HTML, Next.js, React, Vue, Svelte, or Angular.
|
|
10
|
+
|
|
11
|
+
### Application Overview
|
|
12
|
+
The component solves the common challenge of rendering, filtering, sorting, and editing complex datasets without pulling in massive UI libraries or external dependencies. It ships with 15 specialized table variations covering diverse real-world use cases:
|
|
13
|
+
- **Enterprise Operations & Dashboards**: Instant global searching, multi-column sorting with priority badges, and windowed pagination (`«`, `»`, `…`).
|
|
14
|
+
- **Data Editing & Calculations**: In-place double-click editing with instant recalculation of dependent formula columns (such as payroll, bonuses, and tax deductions).
|
|
15
|
+
- **Advanced Navigation & Structure**: Master-detail row expansion, hierarchical parent-child tree navigation, and frozen sticky columns with automatic scroll elevation drop-shadows.
|
|
16
|
+
- **Enterprise Security & Reliability**: Comprehensive mitigations for CSV Formula Injection (CWE-1236) across all export utilities, Prototype Pollution protection (CWE-1321) across all nested dotted property resolvers, and normalized directional null/undefined sorting.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## What is this library for?
|
|
21
|
+
|
|
22
|
+
When building web applications, you often need to show lists of items—such as users, orders, products, or financial records.
|
|
23
|
+
|
|
24
|
+
`arame-data-grid-pro` gives you ready-to-use tables with built-in:
|
|
25
|
+
- **Interactive Column Resizing**: Draggable header border handles with double-click auto-fit to longest cell content.
|
|
26
|
+
- **Pinned Footer Aggregations**: Live summary row (`SUM`, `AVG`, `MIN`, `MAX`, `COUNT`) pinned at the bottom of the table.
|
|
27
|
+
- **State Persistence**: Automatic sync of user customizations (column widths, ordering, visibility, sorts, and search) to `localStorage`.
|
|
28
|
+
- **Clipboard TSV Copy (Excel / Google Sheets)**: Copy selected rows to system clipboard (<kbd>Ctrl</kbd>+<kbd>C</kbd> or action bar) for instant pasting directly into spreadsheets without downloading files.
|
|
29
|
+
- **Right-Column Actions Pinning**: Freeze the Actions column (`stickyActions`) on the right edge with drop-shadow scroll indicators.
|
|
30
|
+
- **Bulk Batch Edit**: Modal dialog to batch-update values across multiple selected records in a single action.
|
|
31
|
+
- **Search**: Quickly find rows by typing in a search box.
|
|
32
|
+
- **Sorting**: Multi-column sorting with priority badges (`▲ (1)`, `▼ (2)`).
|
|
33
|
+
- **Pagination**: Break large lists into numbered pages with «, », and ellipsis windowing.
|
|
34
|
+
- **Selection & Batch Actions**: Single/multi-row checkbox selection with `grid.getSelectedRows()`, batch deletion, and CSV export.
|
|
35
|
+
- **Inline Editing**: Double-click cells to edit numbers or text on the fly with instant recalculation.
|
|
36
|
+
- **Row & Column Reordering**: Drag and drop rows or columns with your mouse or accessible keyboard arrows.
|
|
37
|
+
- **Sticky Columns**: Solid opaque pinning with automatic horizontal scroll drop-shadows.
|
|
38
|
+
- **Security Protections**: Built-in CSV formula injection protection (CWE-1236) and prototype pollution prevention.
|
|
39
|
+
- **15 Specialized Table Variations**: Pre-built tables for sticky columns, expandable details, tree hierarchies, live payroll calculations, and more.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Key Terms Explained Simply
|
|
44
|
+
|
|
45
|
+
If you are new to web development, here are plain explanations of terms you will see in this guide:
|
|
46
|
+
|
|
47
|
+
- **Web Component / Custom Element**: A special, reusable HTML tag defined in JavaScript (like `<pro-data-grid>`). Once registered, the browser treats it just like a native `<button>` or `<table>`.
|
|
48
|
+
- **Client-Side Data**: All data is already loaded in your user's browser memory (good for hundreds or a few thousand rows). The browser handles searching, sorting, and page splitting instantly.
|
|
49
|
+
- **Server-Side Data**: The data lives on a remote computer or database (good for millions of rows). The table asks your server for only 10 or 25 rows at a time when the user types in the search box or changes pages.
|
|
50
|
+
- **Debounce (`searchDebounceMs`)**: When someone types quickly, "debounce" waits a short moment (e.g., 300 milliseconds) before running the search, so it doesn't fire requests on every single keystroke.
|
|
51
|
+
- **AbortSignal**: A browser helper that cancels older search requests if the user types a new letter before the previous search finishes.
|
|
52
|
+
- **Events**: Signals the table sends out when something happens (e.g., when a user clicks a row, saves an edit, or deletes an item).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Prerequisites & Environment Requirements
|
|
57
|
+
|
|
58
|
+
Before using or integrating `arame-data-grid-pro`, ensure your development and runtime environments meet the following criteria:
|
|
59
|
+
|
|
60
|
+
### 1. Browser Support (Client Runtime)
|
|
61
|
+
Because the library is built on standard native W3C Web Components (Custom Elements v1 & Shadow DOM / Light DOM), it runs on all evergreen desktop and mobile browsers without polyfills:
|
|
62
|
+
- **Google Chrome**: Version 75+ (or any Chromium-based browser like Microsoft Edge, Brave, Opera)
|
|
63
|
+
- **Mozilla Firefox**: Version 63+
|
|
64
|
+
- **Apple Safari**: Version 12.1+ (macOS & iOS)
|
|
65
|
+
- **Android WebView & Chrome**: Android 7.0+
|
|
66
|
+
|
|
67
|
+
> **Zero External UI Dependencies**: No external CSS libraries (Bootstrap, Tailwind, Material) or runtime frameworks (React, Vue, Angular) are required.
|
|
68
|
+
|
|
69
|
+
### 2. Development Environment (Build & Package Manager)
|
|
70
|
+
If you are compiling, testing, or contributing to the library source:
|
|
71
|
+
- **Node.js**: `v18.0.0` or higher (recommended: Node LTS v20+)
|
|
72
|
+
- **Package Manager**: Any standard package manager:
|
|
73
|
+
- `npm` (v9+)
|
|
74
|
+
- `pnpm` (v8+)
|
|
75
|
+
- `yarn` (v1.22+ or Berry)
|
|
76
|
+
- **TypeScript**: `v5.0+` (if integrating in a TypeScript project for full type safety with `ColumnDef<T>` and `GridOptions<T>`)
|
|
77
|
+
|
|
78
|
+
### 3. Local Offline / Zero-CORS Mode
|
|
79
|
+
- **Zero Build / Standalone Mode**: No build tools, bundlers, or local HTTP servers are needed to test the demos. You can open any demo in `examples/vanilla/*.html` directly via the `file:///` protocol in your browser.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 5-Minute Quick Start
|
|
84
|
+
|
|
85
|
+
Here is a complete, working HTML example. You can copy and save this file as `table.html` and open it directly in any browser:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<!DOCTYPE html>
|
|
89
|
+
<html lang="en">
|
|
90
|
+
<head>
|
|
91
|
+
<meta charset="UTF-8" />
|
|
92
|
+
<title>Quick Start Data Grid</title>
|
|
93
|
+
<!-- Load the stylesheet -->
|
|
94
|
+
<link rel="stylesheet" href="./dist/styles.css" />
|
|
95
|
+
</head>
|
|
96
|
+
<body style="font-family: sans-serif; padding: 2rem;">
|
|
97
|
+
|
|
98
|
+
<h1>Employee Directory</h1>
|
|
99
|
+
|
|
100
|
+
<!-- 1. Place the custom tag on the page -->
|
|
101
|
+
<pro-data-grid id="myGrid"></pro-data-grid>
|
|
102
|
+
|
|
103
|
+
<!-- 2. Set up columns and rows using JavaScript -->
|
|
104
|
+
<script type="module">
|
|
105
|
+
import './dist/index.js';
|
|
106
|
+
|
|
107
|
+
const grid = document.getElementById('myGrid');
|
|
108
|
+
|
|
109
|
+
// Define the columns you want to display
|
|
110
|
+
grid.columns = [
|
|
111
|
+
{ id: 'id', header: 'ID', field: 'id', width: '80px' },
|
|
112
|
+
{ id: 'name', header: 'Full Name', field: 'name', sortable: true },
|
|
113
|
+
{ id: 'role', header: 'Department Role', field: 'role', sortable: true },
|
|
114
|
+
{
|
|
115
|
+
id: 'salary',
|
|
116
|
+
header: 'Annual Salary',
|
|
117
|
+
field: 'salary',
|
|
118
|
+
sortable: true,
|
|
119
|
+
formatter: (val) => `$${Number(val).toLocaleString()}`
|
|
120
|
+
}
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
// Supply your row data
|
|
124
|
+
grid.rows = [
|
|
125
|
+
{ id: '1', name: 'Alice Walker', role: 'Engineering Lead', salary: 145000 },
|
|
126
|
+
{ id: '2', name: 'Brian Miller', role: 'Product Manager', salary: 130000 },
|
|
127
|
+
{ id: '3', name: 'Clara Patel', role: 'UI/UX Designer', salary: 115000 },
|
|
128
|
+
{ id: '4', name: 'David Kim', role: 'Backend Developer', salary: 122000 }
|
|
129
|
+
];
|
|
130
|
+
</script>
|
|
131
|
+
</body>
|
|
132
|
+
</html>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Installation
|
|
138
|
+
|
|
139
|
+
### Option 1: Install using a package manager
|
|
140
|
+
|
|
141
|
+
If you are using Node.js, Next.js, or Vite, install the library locally:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Using npm
|
|
145
|
+
npm install arame-data-grid-pro
|
|
146
|
+
|
|
147
|
+
# Using pnpm
|
|
148
|
+
pnpm add arame-data-grid-pro
|
|
149
|
+
|
|
150
|
+
# Using yarn
|
|
151
|
+
yarn add arame-data-grid-pro
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Option 2: Use directly in standard HTML (Zero Build Step)
|
|
155
|
+
|
|
156
|
+
You do not need a bundler or compiler. You can open any of the standalone HTML demos in `examples/vanilla/` directly by double-clicking them in your file explorer.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Step-by-Step Guide
|
|
161
|
+
|
|
162
|
+
### Step 1: Defining Columns
|
|
163
|
+
|
|
164
|
+
Columns tell the table which data fields to display, how headers should look, and which features are enabled.
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
grid.columns = [
|
|
168
|
+
{
|
|
169
|
+
id: 'name', // Unique identifier for this column
|
|
170
|
+
header: 'User Name', // Title shown at the top of the column
|
|
171
|
+
field: 'name', // Key name in your row data objects
|
|
172
|
+
sortable: true, // Let users click the header to sort A-Z / Z-A
|
|
173
|
+
editable: true, // Let users double-click to edit cell text
|
|
174
|
+
width: '200px' // Optional column width
|
|
175
|
+
}
|
|
176
|
+
];
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Step 2: Providing Row Data
|
|
180
|
+
|
|
181
|
+
Row data is a simple JavaScript array of objects. Each object should have a unique `id` property:
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
grid.rows = [
|
|
185
|
+
{ id: '101', name: 'Sarah Connor', status: 'Active' },
|
|
186
|
+
{ id: '102', name: 'John Connor', status: 'Pending' }
|
|
187
|
+
];
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Step 3: Configuring Table Options
|
|
191
|
+
|
|
192
|
+
Customize how your table behaves using the `.options` object:
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
grid.options = {
|
|
196
|
+
pagination: true, // Show page numbers and next/previous buttons
|
|
197
|
+
pageSize: 10, // Number of rows to show per page
|
|
198
|
+
searchable: true, // Show the global search text box
|
|
199
|
+
editable: true, // Enable in-place cell editing
|
|
200
|
+
deletable: true, // Show a delete button on each row
|
|
201
|
+
confirmDelete: true, // Ask for confirmation before deleting a row
|
|
202
|
+
rowReordering: true, // Allow dragging rows up and down
|
|
203
|
+
columnReordering: true // Allow dragging column headers left and right
|
|
204
|
+
};
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Loading Data: Client-Side vs. Server-Side
|
|
210
|
+
|
|
211
|
+
### 1. In-Memory Client-Side Data (Default)
|
|
212
|
+
Assign your full dataset to `grid.rows`. Searching, sorting, and pagination happen immediately in the browser without any network requests.
|
|
213
|
+
|
|
214
|
+
### 2. Remote Server-Side Data Loading
|
|
215
|
+
When working with thousands or millions of records in a remote database, enable `serverSide: true` and provide a `serverDataLoader` function. The table calls this function whenever the user changes pages, types in the search box, or sorts a column.
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
grid.options = {
|
|
219
|
+
serverSide: true,
|
|
220
|
+
searchDebounceMs: 300, // Wait 300ms after typing before requesting data
|
|
221
|
+
keepPreviousDataWhileLoading: true, // Keep existing rows visible while fetching new ones
|
|
222
|
+
|
|
223
|
+
serverDataLoader: async (params) => {
|
|
224
|
+
// params contains: pageIndex, pageSize, globalSearch, sortCriteria, and signal
|
|
225
|
+
|
|
226
|
+
// 1. Send query parameters to your backend API
|
|
227
|
+
const url = `/api/employees?page=${params.pageIndex}&limit=${params.pageSize}&search=${encodeURIComponent(params.globalSearch)}`;
|
|
228
|
+
|
|
229
|
+
// 2. Pass params.signal so slow or outdated searches get cancelled automatically
|
|
230
|
+
const response = await fetch(url, { signal: params.signal });
|
|
231
|
+
const data = await response.json();
|
|
232
|
+
|
|
233
|
+
// 3. Return the rows for this page and the total count of matching records
|
|
234
|
+
return {
|
|
235
|
+
rows: data.items, // Array of rows for current page
|
|
236
|
+
totalRows: data.total // Total number of rows in the whole database
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Listening to Events
|
|
245
|
+
|
|
246
|
+
The table emits standard browser `CustomEvent` events when users interact with it. You can listen to them using standard `.addEventListener()`:
|
|
247
|
+
|
|
248
|
+
```javascript
|
|
249
|
+
// 1. When a user selects or unselects rows with checkboxes
|
|
250
|
+
grid.addEventListener('pdg:select', (event) => {
|
|
251
|
+
const { selectedIds, selectedRows } = event.detail;
|
|
252
|
+
console.log('Selected row IDs:', selectedIds);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// 2. When a user edits a cell and presses Enter or clicks away
|
|
256
|
+
grid.addEventListener('pdg:edit-save', (event) => {
|
|
257
|
+
const { rowId, columnId, newValue, oldValue } = event.detail;
|
|
258
|
+
console.log(`Saved row ${rowId}: changed ${columnId} to "${newValue}"`);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// 3. When a user clicks the delete button for a row
|
|
262
|
+
grid.addEventListener('pdg:delete', (event) => {
|
|
263
|
+
const { rowId, row } = event.detail;
|
|
264
|
+
console.log('User deleted row:', rowId);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// 4. When a user changes the sort column or direction
|
|
268
|
+
grid.addEventListener('pdg:sort', (event) => {
|
|
269
|
+
console.log('Current sort criteria:', event.detail.criteria);
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Working with Selected Items & Batch Actions
|
|
276
|
+
|
|
277
|
+
When row selection is enabled (`selectable: true`), you can react to selection changes, retrieve full row objects, and run bulk actions:
|
|
278
|
+
|
|
279
|
+
```javascript
|
|
280
|
+
// 1. Listen for selection changes in real-time
|
|
281
|
+
grid.addEventListener('pdg:select', (event) => {
|
|
282
|
+
const selectedIds = event.detail.selectedIds; // e.g. ['1', '3']
|
|
283
|
+
console.log(`${selectedIds.length} rows selected:`, selectedIds);
|
|
284
|
+
|
|
285
|
+
// Toggle batch action button state
|
|
286
|
+
const btnBatch = document.getElementById('btnBatchAction');
|
|
287
|
+
if (btnBatch) btnBatch.disabled = selectedIds.length === 0;
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// 2. Retrieve the complete row data records for selected items
|
|
291
|
+
const selectedRows = grid.getSelectedRows();
|
|
292
|
+
console.log('Selected row records:', selectedRows);
|
|
293
|
+
|
|
294
|
+
// 3. Programmatic selection controls & batch deletion
|
|
295
|
+
grid.selectAll(); // Selects all currently filtered rows
|
|
296
|
+
grid.deleteSelectedRows(); // Removes selected rows and updates UI
|
|
297
|
+
grid.clearSelection(); // Deselects all rows
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Using with Next.js App Router (React)
|
|
303
|
+
|
|
304
|
+
Because Web Components use browser APIs (`customElements` and `window`), you should use them inside client components in Next.js:
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
// app/dashboard/page.tsx
|
|
308
|
+
'use client';
|
|
309
|
+
|
|
310
|
+
import { useEffect, useRef } from 'react';
|
|
311
|
+
// Imports and registers the custom element in the browser
|
|
312
|
+
import 'arame-data-grid-pro';
|
|
313
|
+
import 'arame-data-grid-pro/styles.css';
|
|
314
|
+
|
|
315
|
+
export default function EmployeePage() {
|
|
316
|
+
const gridRef = useRef<any>(null);
|
|
317
|
+
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
if (gridRef.current) {
|
|
320
|
+
gridRef.current.columns = [
|
|
321
|
+
{ id: 'id', header: 'ID', field: 'id' },
|
|
322
|
+
{ id: 'name', header: 'Name', field: 'name', sortable: true },
|
|
323
|
+
{ id: 'department', header: 'Department', field: 'dept' }
|
|
324
|
+
];
|
|
325
|
+
|
|
326
|
+
gridRef.current.rows = [
|
|
327
|
+
{ id: '1', name: 'Jordan Hayes', dept: 'Operations' },
|
|
328
|
+
{ id: '2', name: 'Taylor Reed', dept: 'Marketing' }
|
|
329
|
+
];
|
|
330
|
+
}
|
|
331
|
+
}, []);
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<div style={{ padding: '2rem' }}>
|
|
335
|
+
<h2>Employee List</h2>
|
|
336
|
+
<pro-data-grid ref={gridRef}></pro-data-grid>
|
|
337
|
+
</div>
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Complete API Reference
|
|
345
|
+
|
|
346
|
+
### Column Definition Properties (`ColumnDef<T>`)
|
|
347
|
+
|
|
348
|
+
Each column passed into `grid.columns = [...]` supports the following properties:
|
|
349
|
+
|
|
350
|
+
| Property | Type | Description |
|
|
351
|
+
| :--- | :--- | :--- |
|
|
352
|
+
| `id` | `string` | **Required.** Unique key identifier for the column. |
|
|
353
|
+
| `header` | `string` | Display label rendered inside the column header cell. |
|
|
354
|
+
| `field` | `keyof T \| string` | Data path on the row object (supports nested dotted keys, e.g., `'address.city'`). |
|
|
355
|
+
| `width` | `string` | Optional CSS column width (e.g., `'120px'`, `'25%'`). |
|
|
356
|
+
| `sortable` | `boolean` | Allows users to click the column header to sort ascending or descending. |
|
|
357
|
+
| `editable` | `boolean` | Allows in-place cell editing on double-click or <kbd>Enter</kbd>. |
|
|
358
|
+
| `visible` | `boolean` | Determines if the column is displayed (`false` hides the column). |
|
|
359
|
+
| `calculate` | `(row: T) => any` | Reactive formula function recalculated when dependent editable fields change. |
|
|
360
|
+
| `formatter` | `(value: any, row: T) => string` | Formats the raw value for display without altering underlying data. |
|
|
361
|
+
| `renderer` | `(value: any, row: T, idx: number) => HTMLElement \| string` | Custom DOM node renderer for custom badges, status pills, or progress meters. |
|
|
362
|
+
| `comparator` | `(a: any, b: any, rowA: T, rowB: T) => number` | Custom sort comparator function. |
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### Grid Options Properties (`GridOptions<T>`)
|
|
367
|
+
|
|
368
|
+
Configured via `grid.options = { ... }`:
|
|
369
|
+
|
|
370
|
+
| Option | Type | Default | Description |
|
|
371
|
+
| :--- | :--- | :--- | :--- |
|
|
372
|
+
| `pagination` | `boolean` | `true` | Enables pagination controls and page information footer. |
|
|
373
|
+
| `pageSize` | `number` | `10` | Number of rows displayed per page. |
|
|
374
|
+
| `searchable` | `boolean` | `true` | Enables the global search filter input. |
|
|
375
|
+
| `searchDebounceMs` | `number` | `300` | Typing delay before triggering filter/search queries. |
|
|
376
|
+
| `sorting` | `boolean` | `true` | Enables header click sorting. |
|
|
377
|
+
| `multiSort` | `boolean` | `false` | Enables multi-column sorting with priority badges (`▲ (1)`, `▼ (2)`). |
|
|
378
|
+
| `selectable` | `boolean` | `false` | Shows row checkboxes for selection. |
|
|
379
|
+
| `multiSelect` | `boolean` | `true` | Allows selecting multiple rows (set to `false` for radio-style single selection). |
|
|
380
|
+
| `editable` | `boolean` | `false` | Enables double-click in-place editing across editable columns. |
|
|
381
|
+
| `deletable` | `boolean` | `false` | Displays a delete row action button (`✕`). |
|
|
382
|
+
| `confirmDelete` | `boolean` | `true` | Shows confirmation prompt before removing rows. |
|
|
383
|
+
| `stickyFirstColumn` | `boolean` | `false` | Pins first column to `left: 0` with scroll elevation drop-shadows. |
|
|
384
|
+
| `stickyActions` | `boolean` | `false` | Pins Actions column to `right: 0` with scroll elevation drop-shadows. |
|
|
385
|
+
| `rowReordering` | `boolean` | `false` | Enables drag-and-drop row reordering with accessible keyboard controls. |
|
|
386
|
+
| `columnReordering` | `boolean` | `false` | Enables drag-and-drop column header reordering. |
|
|
387
|
+
| `expandable` | `boolean` | `false` | Enables master-detail row expansion toggles. |
|
|
388
|
+
| `rowDetailRenderer` | `(row: T) => HTMLElement \| string` | `undefined` | Custom renderer for expanded row content. |
|
|
389
|
+
| `density` | `'compact' \| 'comfortable' \| 'spacious'` | `'comfortable'` | Sets cell padding and row height. |
|
|
390
|
+
| `serverSide` | `boolean` | `false` | Enables remote data fetching with query params. |
|
|
391
|
+
| `serverDataLoader` | `(params: ServerQueryParams) => Promise<...>` | `undefined` | Async data loading hook for remote servers. |
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
### Public Grid Methods
|
|
396
|
+
|
|
397
|
+
| Method | Parameters | Return | Description |
|
|
398
|
+
| :--- | :--- | :--- | :--- |
|
|
399
|
+
| `grid.getSelectedRows()` | None | `T[]` | Returns array of full row data objects for all selected rows. |
|
|
400
|
+
| `grid.selectAll()` | None | `void` | Selects all currently matching rows across pages. |
|
|
401
|
+
| `grid.clearSelection()` | None | `void` | Deselects all rows and resets selection state. |
|
|
402
|
+
| `grid.deleteSelectedRows()` | None | `number` | Deletes all selected rows and returns the count of deleted items. |
|
|
403
|
+
| `grid.getSelectedRowsTSV()` | None | `string` | Returns tab-separated values (TSV) formatted string of selected rows for Excel. |
|
|
404
|
+
| `grid.copySelectionToClipboard()` | None | `Promise<boolean>` | Copies selected rows directly into system clipboard in TSV format. |
|
|
405
|
+
| `grid.batchUpdateSelected(updates)` | `updates: Partial<T>` | `number` | Applies updates across all selected rows and triggers re-render. |
|
|
406
|
+
| `grid.exportToCSV(filename?)` | `filename?: string` | `void` | Downloads current records as an injection-safe CSV file. |
|
|
407
|
+
| `grid.clearAllFilters()` | None | `void` | Resets all active column filters and search input. |
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
### Standard Grid Events (`pdg:*`)
|
|
412
|
+
|
|
413
|
+
Listen using standard `grid.addEventListener(eventName, handler)`:
|
|
414
|
+
|
|
415
|
+
| Event Name | Detail Payload | Description |
|
|
416
|
+
| :--- | :--- | :--- |
|
|
417
|
+
| `pdg:select` | `{ selectedIds: (string \| number)[] }` | Fired when rows are selected or deselected. |
|
|
418
|
+
| `pdg:sort` | `{ criteria: SortCriterion[] }` | Fired when column sorting changes. |
|
|
419
|
+
| `pdg:page` | `{ pageIndex: number, pageSize: number }` | Fired on page navigation or page size change. |
|
|
420
|
+
| `pdg:edit-save` | `{ rowId, columnId, oldValue, newValue }` | Fired when a cell edit is committed. |
|
|
421
|
+
| `pdg:delete` | `{ rowId, row }` | Fired when a row is removed. |
|
|
422
|
+
| `pdg:row-expand` | `{ rowId, expanded, row }` | Fired when a row is expanded or collapsed. |
|
|
423
|
+
| `pdg:row-reorder` | `{ fromIndex, toIndex, row }` | Fired when a row is moved to a new index. |
|
|
424
|
+
| `pdg:column-reorder` | `{ fromIndex, toIndex, column }` | Fired when a column is rearranged. |
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## Security & Reliability Standards
|
|
429
|
+
|
|
430
|
+
`arame-data-grid-pro` is engineered to comply with enterprise web application security benchmarks:
|
|
431
|
+
|
|
432
|
+
### 1. CSV Formula Injection Defense (CWE-1236)
|
|
433
|
+
Spreadsheet applications (Excel, Google Sheets, Calc) automatically evaluate cells starting with execution operators (`=`, `+`, `-`, `@`, tab `\t`, carriage return `\r`) as formulas. In `exportToCSV()`, `universal-exporter`, and `exportTreeToCsv()`, values beginning with formula operators are safely escaped with a leading single quote (`'`) inside RFC-4180-compliant quotation marks:
|
|
434
|
+
```typescript
|
|
435
|
+
if (/^[=+\-@\t\r]/.test(str)) {
|
|
436
|
+
str = `'${str}`;
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### 2. Prototype Pollution Prevention (CWE-1321)
|
|
441
|
+
All deep-property resolution functions (`resolveValue`) traversing dotted field paths (e.g., `'profile.address.city'`) explicitly block toxic traversal properties:
|
|
442
|
+
- `__proto__`
|
|
443
|
+
- `constructor`
|
|
444
|
+
- `prototype`
|
|
445
|
+
|
|
446
|
+
Attempts to traverse or access object prototypes return `undefined` immediately, shielding client applications from remote state tampering.
|
|
447
|
+
|
|
448
|
+
### 3. Null & Undefined Directional Sort Predictability
|
|
449
|
+
Sort algorithms across all modules guarantee that empty, null, or undefined data consistently position at the end of sorted datasets for both ascending (`asc`) and descending (`desc`) sort requests without inverting or polluting record displays.
|
|
450
|
+
|
|
451
|
+
### 4. Zero-CORS, Zero-Bundler Architecture
|
|
452
|
+
All demos and components run natively across both `http://` / `https://` servers and local `file:///` protocols without triggering Cross-Origin Resource Sharing (CORS) exceptions.
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## Exploring the Table Demos & Gallery
|
|
457
|
+
|
|
458
|
+
This repository includes 15 interactive demos you can inspect, test, and adapt for your own apps. All demos are 100% self-contained with inline scripts and styles, meaning you can open them directly with `file:///` by double-clicking them in your file manager—no local HTTP server or build step required.
|
|
459
|
+
|
|
460
|
+
### How to use the Demo Gallery:
|
|
461
|
+
Open [`examples/vanilla/index.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/index.html) in your browser. It provides a visual hub showcasing every table variation with descriptions and direct links.
|
|
462
|
+
|
|
463
|
+
### How to use the Configurable Table Demo:
|
|
464
|
+
Open [`examples/vanilla/configurable-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/configurable-table-demo.html). It includes an interactive settings sidebar where you can toggle search, pagination, row selection, row & column drag and drop, density, and borders in real time to see how the table responds.
|
|
465
|
+
|
|
466
|
+
### Pre-Built Table Demos:
|
|
467
|
+
1. **Core Data Grid** ([`core-grid-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/core-grid-demo.html)): The standard grid with search, sort, pagination, and multi-row selection.
|
|
468
|
+
2. **Sticky Column Table** ([`sticky-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/sticky-table-demo.html)): Keeps key columns pinned on the left or right while you scroll horizontally.
|
|
469
|
+
3. **Expandable Row Table** ([`expandable-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/expandable-table-demo.html)): Click any row to expand and view nested details or sub-records.
|
|
470
|
+
4. **Column Visibility Table** ([`column-visibility-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/column-visibility-demo.html)): Includes a dropdown menu to show or hide specific columns.
|
|
471
|
+
5. **Filtering Table** ([`filterable-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/filterable-table-demo.html)): Filter rows using column criteria like "starts with", "greater than", or "equals".
|
|
472
|
+
6. **Editable Table** ([`editable-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/editable-table-demo.html)): Direct double-click in-place editing with built-in validation messages.
|
|
473
|
+
7. **Row-Grouped Table** ([`grouped-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/grouped-table-demo.html)): Groups records together under collapsible category headers.
|
|
474
|
+
8. **Context Menu Table** ([`context-menu-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/context-menu-table-demo.html)): Right-click rows to display a contextual action menu (edit, duplicate, delete).
|
|
475
|
+
9. **Infinite Scrolling Table** ([`infinite-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/infinite-table-demo.html)): Automatically loads more rows as you scroll down instead of using page buttons.
|
|
476
|
+
10. **Calculated Payroll Table** ([`calculated-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/calculated-table-demo.html)): Professional payroll table that recalculates total compensation instantly when salary or bonus inputs change.
|
|
477
|
+
11. **Header Filter Table** ([`header-filter-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/header-filter-table-demo.html)): Filter inputs embedded directly in each column header.
|
|
478
|
+
12. **Tree Data Table** ([`tree-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/tree-table-demo.html)): Displays hierarchical folder structures and parent-child records.
|
|
479
|
+
13. **Advanced Filter Table** ([`advanced-filter-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/advanced-filter-table-demo.html)): Visual filter builder supporting complex `AND`/`OR` logic rules.
|
|
480
|
+
14. **Configurable Playground** ([`configurable-table-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/configurable-table-demo.html)): Interactive controls to customize options dynamically.
|
|
481
|
+
15. **Server-Side Data Grid** ([`server-demo.html`](file:///c:/Users/1836/Music/hari-md/lib/examples/vanilla/server-demo.html)): Live server simulation with debounced search and cancelable requests.
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## Simple Troubleshooting
|
|
486
|
+
|
|
487
|
+
### 1. "Access to script at 'file:///...' has been blocked by CORS policy"
|
|
488
|
+
- **Why this happens**: Some web browsers block JavaScript `import` statements when opening files locally using `file:///`.
|
|
489
|
+
- **How to fix it**: All vanilla HTML demo files in `examples/vanilla/*.html` have their code self-contained inside inline `<script>` tags so they work immediately when double-clicked. If you are writing your own files with `import`, run a simple local web server like `npx serve` or `python -m http.server`.
|
|
490
|
+
|
|
491
|
+
### 2. "window is not defined" or "customElements is not defined" in Next.js
|
|
492
|
+
- **Why this happens**: Next.js tries to render components on your server (Node.js) where there is no browser `window` or `document`.
|
|
493
|
+
- **How to fix it**: Add `'use client';` at the top of your component file, and set up your columns and rows inside a `useEffect()` hook.
|
|
494
|
+
|
|
495
|
+
### 3. The table looks unstyled or lacks colors
|
|
496
|
+
- **Why this happens**: The CSS stylesheet was not loaded.
|
|
497
|
+
- **How to fix it**: Make sure to import or link `arame-data-grid-pro/styles.css` (or `<link rel="stylesheet" href="./dist/styles.css" />`).
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Development & Test Commands
|
|
502
|
+
|
|
503
|
+
To build or test the library locally:
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
# Build the library and compile type declarations
|
|
507
|
+
npm run build
|
|
508
|
+
|
|
509
|
+
# Run unit tests
|
|
510
|
+
npm test
|
|
511
|
+
|
|
512
|
+
# Check for TypeScript errors
|
|
513
|
+
npm run typecheck
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## License
|
|
519
|
+
|
|
520
|
+
Copyright (c) 2026 Arame Global.
|
|
521
|
+
|
|
522
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
2
523
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AdvancedFilterColumn, AdvancedFilterTableOptions, FilterExpressionGroup, FilterRule, SavedFilterPreset } from './types.js';
|
|
2
|
+
import { SortRule } from '../common/base-table-types.js';
|
|
3
|
+
export declare class AdvancedFilterDataTableElement<T = any> extends HTMLElement {
|
|
4
|
+
private _columns;
|
|
5
|
+
private _allRows;
|
|
6
|
+
private _presets;
|
|
7
|
+
private _activePresetId;
|
|
8
|
+
private _activeExpression;
|
|
9
|
+
private _options;
|
|
10
|
+
private _currentPage;
|
|
11
|
+
private _pageSize;
|
|
12
|
+
private _searchTerm;
|
|
13
|
+
private _sortRule;
|
|
14
|
+
private _totalRows;
|
|
15
|
+
private _isLoading;
|
|
16
|
+
private _isBuilderOpen;
|
|
17
|
+
private _requestId;
|
|
18
|
+
private _abortController;
|
|
19
|
+
private _searchDebounceTimer;
|
|
20
|
+
private _container;
|
|
21
|
+
private _toolbar;
|
|
22
|
+
private _quickBar;
|
|
23
|
+
private _chipsBar;
|
|
24
|
+
private _builderDrawer;
|
|
25
|
+
private _viewport;
|
|
26
|
+
private _table;
|
|
27
|
+
private _thead;
|
|
28
|
+
private _tbody;
|
|
29
|
+
private _searchInput;
|
|
30
|
+
private _metaBadge;
|
|
31
|
+
private _presetSelect;
|
|
32
|
+
private _toggleBuilderBtn;
|
|
33
|
+
private _paginationBar;
|
|
34
|
+
private _loadingOverlay;
|
|
35
|
+
static get observedAttributes(): string[];
|
|
36
|
+
constructor();
|
|
37
|
+
connectedCallback(): void;
|
|
38
|
+
disconnectedCallback(): void;
|
|
39
|
+
attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
|
|
40
|
+
get columns(): AdvancedFilterColumn<T>[];
|
|
41
|
+
set columns(cols: AdvancedFilterColumn<T>[]);
|
|
42
|
+
get data(): T[];
|
|
43
|
+
set data(rows: T[]);
|
|
44
|
+
get options(): AdvancedFilterTableOptions<T>;
|
|
45
|
+
set options(opts: Partial<AdvancedFilterTableOptions<T>>);
|
|
46
|
+
get expression(): FilterExpressionGroup;
|
|
47
|
+
set expression(exp: FilterExpressionGroup);
|
|
48
|
+
addRule(rule: FilterRule): void;
|
|
49
|
+
removeRule(ruleId: string): void;
|
|
50
|
+
clearAllFilters(): void;
|
|
51
|
+
setLogic(logic: 'AND' | 'OR'): void;
|
|
52
|
+
private onExpressionChanged;
|
|
53
|
+
applyPreset(presetId: string): void;
|
|
54
|
+
saveCurrentAsPreset(name: string): SavedFilterPreset;
|
|
55
|
+
deletePreset(presetId: string): void;
|
|
56
|
+
private persistPresets;
|
|
57
|
+
private loadPersistedPresets;
|
|
58
|
+
setSearchTerm(term: string): void;
|
|
59
|
+
setSortRule(sort: SortRule<T> | null): void;
|
|
60
|
+
setPage(page: number): void;
|
|
61
|
+
setPageSize(size: number): void;
|
|
62
|
+
private fetchServerData;
|
|
63
|
+
private setLoading;
|
|
64
|
+
private renderDomStructure;
|
|
65
|
+
private setupEventListeners;
|
|
66
|
+
private renderPresetsSelect;
|
|
67
|
+
private renderQuickFilters;
|
|
68
|
+
private renderActiveChips;
|
|
69
|
+
private renderBuilderDrawer;
|
|
70
|
+
private getOperatorsForColumn;
|
|
71
|
+
private renderRuleValueControl;
|
|
72
|
+
private renderHeader;
|
|
73
|
+
private getDisplayRows;
|
|
74
|
+
private refresh;
|
|
75
|
+
private renderBodyRows;
|
|
76
|
+
private renderPaginationBar;
|
|
77
|
+
private updateMetaInfo;
|
|
78
|
+
private getInlineStyles;
|
|
79
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FilterExpressionGroup, FilterRule, RelativeDatePreset, CustomFilterOperator, AdvancedFilterColumn } from './types.js';
|
|
2
|
+
export declare function isRuleGroup(item: FilterRule | FilterExpressionGroup): item is FilterExpressionGroup;
|
|
3
|
+
/**
|
|
4
|
+
* Evaluates relative date range presets safely
|
|
5
|
+
*/
|
|
6
|
+
export declare function evaluateRelativeDate(preset: RelativeDatePreset, targetDate: Date): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Evaluates a single rule without eval or Function.
|
|
9
|
+
*/
|
|
10
|
+
export declare function evaluateRule<T = any>(row: T, rule: FilterRule, customOperators?: CustomFilterOperator<T>[]): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Evaluates an entire expression tree (AND / OR groupings) on a single row.
|
|
13
|
+
*/
|
|
14
|
+
export declare function evaluateExpressionGroup<T = any>(row: T, group: FilterExpressionGroup, customOperators?: CustomFilterOperator<T>[]): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Flattens all active rules in an expression tree to extract UI chips.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractActiveRules(group: FilterExpressionGroup): FilterRule[];
|
|
19
|
+
/**
|
|
20
|
+
* Safely serializes expression to a URL-compatible or server query string format
|
|
21
|
+
*/
|
|
22
|
+
export declare function serializeExpression(group: FilterExpressionGroup): string;
|
|
23
|
+
/**
|
|
24
|
+
* Creates human-friendly chip label for a rule
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatRuleChipLabel(rule: FilterRule, columns: AdvancedFilterColumn[]): string;
|