igniteui-cli 15.3.0 → 15.4.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/lib/PromptSession.d.ts +1 -1
- package/lib/PromptSession.js +2 -3
- package/lib/commands/new.js +49 -1
- package/lib/commands/types.d.ts +4 -0
- package/lib/templates/IgniteUIForWebComponentsTemplate.js +3 -2
- package/package.json +7 -7
- package/templates/blazor/igb/index.js +1 -1
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/grid-migration.md +322 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/sizing.md +11 -9
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/structure.md +2 -1
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/types.md +2 -2
- package/templates/blazor/igb/projects/empty/index.d.ts +24 -0
- package/templates/blazor/igb/projects/empty/index.js +67 -0
- package/templates/blazor/index.js +1 -1
- package/templates/react/igr-ts/grid/basic/files/src/app/__path__/__filePrefix__.tsx +49 -40
- package/templates/react/igr-ts/grid/basic/files/src/app/__path__/style.module.css +17 -7
- package/templates/react/igr-ts/grid/basic/index.js +31 -0
- package/templates/react/igr-ts/hierarchical-grid/basic/files/src/app/__path__/__filePrefix__.test.tsx +13 -0
- package/templates/react/igr-ts/hierarchical-grid/basic/files/src/app/__path__/__filePrefix__.tsx +43 -0
- package/templates/react/igr-ts/hierarchical-grid/basic/files/src/app/__path__/style.module.css +27 -0
- package/templates/react/igr-ts/hierarchical-grid/basic/index.d.ts +1 -0
- package/templates/react/igr-ts/hierarchical-grid/basic/index.js +50 -0
- package/templates/react/igr-ts/hierarchical-grid/index.d.ts +1 -0
- package/templates/react/igr-ts/hierarchical-grid/index.js +12 -0
- package/templates/react/igr-ts/pivot-grid/basic/files/src/app/__path__/__filePrefix__.test.tsx +13 -0
- package/templates/react/igr-ts/pivot-grid/basic/files/src/app/__path__/__filePrefix__.tsx +54 -0
- package/templates/react/igr-ts/pivot-grid/basic/files/src/app/__path__/style.module.css +27 -0
- package/templates/react/igr-ts/pivot-grid/basic/index.d.ts +1 -0
- package/templates/react/igr-ts/pivot-grid/basic/index.js +50 -0
- package/templates/react/igr-ts/pivot-grid/index.d.ts +1 -0
- package/templates/react/igr-ts/pivot-grid/index.js +12 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/grid-lite-to-igr-grid-migration/SKILL.md +274 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/SKILL.md +1 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +9 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/reference/gotchas.md +6 -2
- package/templates/react/igr-ts/projects/side-nav/files/src/app/app.tsx +5 -3
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/app.tsx +5 -3
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.tsx +4 -3
- package/templates/react/igr-ts/projects/side-nav-mini-auth/files/src/app/app.tsx +4 -3
- package/templates/react/igr-ts/tree-grid/basic/files/src/app/__path__/__filePrefix__.test.tsx +13 -0
- package/templates/react/igr-ts/tree-grid/basic/files/src/app/__path__/__filePrefix__.tsx +30 -0
- package/templates/react/igr-ts/tree-grid/basic/files/src/app/__path__/style.module.css +27 -0
- package/templates/react/igr-ts/tree-grid/basic/index.d.ts +1 -0
- package/templates/react/igr-ts/tree-grid/basic/index.js +50 -0
- package/templates/react/igr-ts/tree-grid/index.d.ts +1 -0
- package/templates/react/igr-ts/tree-grid/index.js +12 -0
- package/templates/webcomponents/igc-ts/grid/default/files/src/app/__path__/__filePrefix__.ts +65 -52
- package/templates/webcomponents/igc-ts/grid/default/index.js +31 -0
- package/templates/webcomponents/igc-ts/hierarchical-grid/basic/files/src/app/__path__/__filePrefix__.test.ts +9 -0
- package/templates/webcomponents/igc-ts/hierarchical-grid/basic/files/src/app/__path__/__filePrefix__.ts +100 -0
- package/templates/webcomponents/igc-ts/hierarchical-grid/basic/index.d.ts +1 -0
- package/templates/webcomponents/igc-ts/hierarchical-grid/basic/index.js +48 -0
- package/templates/webcomponents/igc-ts/hierarchical-grid/index.d.ts +1 -0
- package/templates/webcomponents/igc-ts/hierarchical-grid/index.js +12 -0
- package/templates/webcomponents/igc-ts/pivot-grid/basic/files/src/app/__path__/__filePrefix__.test.ts +9 -0
- package/templates/webcomponents/igc-ts/pivot-grid/basic/files/src/app/__path__/__filePrefix__.ts +113 -0
- package/templates/webcomponents/igc-ts/pivot-grid/basic/index.d.ts +1 -0
- package/templates/webcomponents/igc-ts/pivot-grid/basic/index.js +48 -0
- package/templates/webcomponents/igc-ts/pivot-grid/index.d.ts +1 -0
- package/templates/webcomponents/igc-ts/pivot-grid/index.js +12 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/index.html +1 -0
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/index.html +1 -0
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +15 -1
- package/templates/webcomponents/igc-ts/projects/ai-config/files/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +446 -0
- package/templates/webcomponents/igc-ts/projects/side-nav/files/src/app/app.ts +10 -3
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/index.html +1 -0
- package/templates/webcomponents/igc-ts/projects/side-nav-auth/files/src/app/app.ts +9 -3
- package/templates/webcomponents/igc-ts/projects/side-nav-mini/files/src/app/app.ts +10 -3
- package/templates/webcomponents/igc-ts/projects/side-nav-mini-auth/files/src/app/app.ts +10 -3
- package/templates/webcomponents/igc-ts/tree-grid/basic/files/src/app/__path__/__filePrefix__.test.ts +9 -0
- package/templates/webcomponents/igc-ts/tree-grid/basic/files/src/app/__path__/__filePrefix__.ts +87 -0
- package/templates/webcomponents/igc-ts/tree-grid/basic/index.d.ts +1 -0
- package/templates/webcomponents/igc-ts/tree-grid/basic/index.js +48 -0
- package/templates/webcomponents/igc-ts/tree-grid/index.d.ts +1 -0
- package/templates/webcomponents/igc-ts/tree-grid/index.js +12 -0
- package/templates/react/igr-ts/grid/basic/files/src/app/__path__/data.tsx +0 -46
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: igniteui-wc-migrate-grid-lite-to-premium
|
|
3
|
+
description: Step-by-step migration guide from igniteui-grid-lite (IgcGridLite) to the premium igniteui-webcomponents-grids (IgcGridComponent), covering every import, class name, HTML tag, property, event, template, sorting, filtering, and theming API change.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Migrate from Grid Lite to Premium Data Grid (Web Components)
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
This skill automates the migration from **Grid Lite** (`igniteui-grid-lite`, MIT licensed, `<igc-grid-lite>`) to the **Premium Data Grid** (`igniteui-webcomponents-grids`, commercially licensed, `<igc-grid>`). Use it when a project outgrows Grid Lite's read-only capabilities and needs enterprise features such as editing, selection, paging, grouping, summaries, Excel export, or state persistence.
|
|
12
|
+
|
|
13
|
+
## MANDATORY AGENT PROTOCOL
|
|
14
|
+
|
|
15
|
+
> **DO NOT write any code from memory.** Grid APIs change between versions.
|
|
16
|
+
|
|
17
|
+
Before producing migration code:
|
|
18
|
+
|
|
19
|
+
1. **Identify the current Grid Lite usage** - read the user's existing TypeScript and HTML files to understand their column configuration, cell templates, data binding, and any `dataPipelineConfiguration` usage.
|
|
20
|
+
2. **Use the MCP server** - call `mcp_igniteui-cli_get_api_reference` or `mcp_igniteui-cli_get_doc` (framework: `webcomponents`) to verify current API details when in doubt.
|
|
21
|
+
3. **Only then produce output** - base all code on verified references, not memory.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## When to Migrate
|
|
26
|
+
|
|
27
|
+
Migrate from Grid Lite to the Premium Grid when the user needs **any** of these features:
|
|
28
|
+
|
|
29
|
+
| Required Feature | Grid Lite | Premium Grid |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| Cell / Row / Batch editing | No | Yes |
|
|
32
|
+
| Row adding / deleting | No | Yes |
|
|
33
|
+
| Row / Cell / Column selection | No | Yes |
|
|
34
|
+
| Paging (client or remote) | No | Yes |
|
|
35
|
+
| GroupBy | No | Yes |
|
|
36
|
+
| Summaries (built-in & custom) | No | Yes |
|
|
37
|
+
| Column pinning | No | Yes |
|
|
38
|
+
| Column moving | No | Yes |
|
|
39
|
+
| Master-Detail rows | No | Yes |
|
|
40
|
+
| Export (Excel / CSV) | No | Yes |
|
|
41
|
+
| Toolbar | No | Yes |
|
|
42
|
+
| State persistence | No | Yes |
|
|
43
|
+
| Advanced filtering | No | Yes |
|
|
44
|
+
| Action strip | No | Yes |
|
|
45
|
+
| Row drag | No | Yes |
|
|
46
|
+
| Clipboard support | No | Yes |
|
|
47
|
+
| Cell merging | No | Yes |
|
|
48
|
+
|
|
49
|
+
> **IMPORTANT:** The upgrade path from Grid Lite is **always** to `IgcGridComponent` (`<igc-grid>`). Never recommend a different component type as a substitute.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Step 1 - Install / Verify the Premium Package
|
|
54
|
+
|
|
55
|
+
Grid Lite uses the separate `igniteui-grid-lite` npm package. The Premium Grid ships in `igniteui-webcomponents-grids` (or `@infragistics/igniteui-webcomponents-grids` for licensed builds).
|
|
56
|
+
|
|
57
|
+
> **AGENT INSTRUCTION:** Check `package.json` to determine which package variant is installed. If only `igniteui-grid-lite` is present, the user needs to install the premium package.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Remove Grid Lite
|
|
61
|
+
npm uninstall igniteui-grid-lite
|
|
62
|
+
|
|
63
|
+
# Open-source / trial (shows watermark)
|
|
64
|
+
npm install igniteui-webcomponents-grids
|
|
65
|
+
|
|
66
|
+
# OR licensed package (requires private registry)
|
|
67
|
+
npm install @infragistics/igniteui-webcomponents-grids
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Step 2 - Update Imports and Registration
|
|
71
|
+
|
|
72
|
+
**Before (Grid Lite):**
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
import { IgcGridLite, IgcGridLiteColumn } from 'igniteui-grid-lite';
|
|
76
|
+
import type { BaseIgcCellContext } from 'igniteui-grid-lite';
|
|
77
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**After (Premium Grid):**
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// Side-effect import - registers all premium grid custom elements; must come first
|
|
84
|
+
import 'igniteui-webcomponents-grids/grids/combined.js';
|
|
85
|
+
|
|
86
|
+
// Type imports
|
|
87
|
+
import type {
|
|
88
|
+
IgcGridComponent,
|
|
89
|
+
IgcColumnComponent,
|
|
90
|
+
IgcCellTemplateContext,
|
|
91
|
+
IgcColumnTemplateContext,
|
|
92
|
+
IgcSortingEventArgs,
|
|
93
|
+
IgcFilteringEventArgs,
|
|
94
|
+
IgcRowSelectionEventArgs,
|
|
95
|
+
IgcSortingExpression,
|
|
96
|
+
} from 'igniteui-webcomponents-grids';
|
|
97
|
+
|
|
98
|
+
// Value imports
|
|
99
|
+
import {
|
|
100
|
+
SortingDirection,
|
|
101
|
+
IgcStringFilteringOperand,
|
|
102
|
+
IgcNumberFilteringOperand,
|
|
103
|
+
IgcBooleanFilteringOperand,
|
|
104
|
+
IgcDateFilteringOperand,
|
|
105
|
+
IgcFilteringExpressionsTree,
|
|
106
|
+
FilteringLogic,
|
|
107
|
+
IgcNoopSortingStrategy,
|
|
108
|
+
IgcNoopFilteringStrategy,
|
|
109
|
+
} from 'igniteui-webcomponents-grids';
|
|
110
|
+
|
|
111
|
+
// Theme - change to the grids-specific path
|
|
112
|
+
// Available: light|dark x bootstrap|material|fluent|indigo
|
|
113
|
+
import 'igniteui-webcomponents-grids/grids/themes/light/bootstrap.css';
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Step 3 - Update HTML Tags
|
|
117
|
+
|
|
118
|
+
| Grid Lite | Premium Grid |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `<igc-grid-lite>` | `<igc-grid>` |
|
|
121
|
+
| `<igc-grid-lite-column>` | `<igc-column>` |
|
|
122
|
+
| Bare boolean attrs (`sortable`, `filterable`, `hidden`) | Quoted values (`sortable="true"`, `filterable="true"`, `hidden="true"`) |
|
|
123
|
+
| No grid-level filter toggle | `allow-filtering="true"` required on `<igc-grid>` |
|
|
124
|
+
| No height requirement | `height` attribute required for row virtualization |
|
|
125
|
+
|
|
126
|
+
**Before:**
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<igc-grid-lite id="grid" auto-generate>
|
|
130
|
+
<igc-grid-lite-column field="name" sortable filterable resizable></igc-grid-lite-column>
|
|
131
|
+
<igc-grid-lite-column field="price" data-type="number" sortable></igc-grid-lite-column>
|
|
132
|
+
</igc-grid-lite>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**After:**
|
|
136
|
+
|
|
137
|
+
```html
|
|
138
|
+
<!-- height is required for row virtualization; set it here or on a fixed-height parent -->
|
|
139
|
+
<igc-grid id="grid" auto-generate="true" allow-filtering="true" height="600px">
|
|
140
|
+
<igc-column field="name" sortable="true" filterable="true" resizable="true"></igc-column>
|
|
141
|
+
<igc-column field="price" data-type="number" sortable="true"></igc-column>
|
|
142
|
+
</igc-grid>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
> **Note:** `allow-filtering="true"` on `<igc-grid>` is required to enable filtering. Grid Lite had no grid-level filter toggle.
|
|
146
|
+
|
|
147
|
+
## Step 4 - Update TypeScript References
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
// Before
|
|
151
|
+
const grid = document.getElementById('grid') as IgcGridLite;
|
|
152
|
+
const column = document.querySelector('igc-grid-lite-column[field="name"]') as IgcGridLiteColumn;
|
|
153
|
+
|
|
154
|
+
// After
|
|
155
|
+
const grid = document.getElementById('grid') as IgcGridComponent;
|
|
156
|
+
const column = document.querySelector('igc-column[field="name"]') as IgcColumnComponent;
|
|
157
|
+
|
|
158
|
+
// grid.data = myArray - unchanged
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Step 5 - Migrate Column Properties
|
|
162
|
+
|
|
163
|
+
| Grid Lite Property | Premium Grid Property | Notes |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| `field` | `field` | Unchanged |
|
|
166
|
+
| `header` | `header` | Unchanged |
|
|
167
|
+
| `width` | `width` | Unchanged |
|
|
168
|
+
| `hidden` | `hidden` | Unchanged |
|
|
169
|
+
| `resizable` | `resizable` | Unchanged |
|
|
170
|
+
| `sortable` | `sortable` | Unchanged |
|
|
171
|
+
| `filterable` | `filterable` | Unchanged |
|
|
172
|
+
| `dataType` | `dataType` | Premium adds `dateTime`, `time`, `currency`, `percent` |
|
|
173
|
+
| `filteringCaseSensitive` | `filteringIgnoreCase` | **Logic inverted** - `true` becomes `false` |
|
|
174
|
+
| `sortingCaseSensitive` | `sortingIgnoreCase` | **Logic inverted** - `true` becomes `false` |
|
|
175
|
+
| `sortConfiguration: { comparer }` | `sortStrategy: IgcSortingStrategy` | Class-based (see below) |
|
|
176
|
+
| _(none)_ | `editable`, `pinned`, `groupable`, `hasSummary`, `disableHiding`, `disablePinning`, `selectable`, `searchable`, `formatter`, `minWidth`, `maxWidth` | Premium-only |
|
|
177
|
+
|
|
178
|
+
**Custom sort strategy migration:**
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
// Before (Grid Lite) - function comparer on column
|
|
182
|
+
column.sortConfiguration = { comparer: (a, b) => a.length - b.length };
|
|
183
|
+
|
|
184
|
+
// After (Premium Grid) - class extending DefaultSortingStrategy
|
|
185
|
+
import { DefaultSortingStrategy } from 'igniteui-webcomponents-grids';
|
|
186
|
+
|
|
187
|
+
class LengthSort extends DefaultSortingStrategy {
|
|
188
|
+
override compareValues(a: string, b: string) { return a.length - b.length; }
|
|
189
|
+
}
|
|
190
|
+
column.sortStrategy = new LengthSort();
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Step 6 - Migrate Cell and Header Templates
|
|
194
|
+
|
|
195
|
+
| Aspect | Grid Lite | Premium Grid |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| Cell template property | `column.cellTemplate` | `column.bodyTemplate` |
|
|
198
|
+
| Cell context type | `BaseIgcCellContext` | `IgcCellTemplateContext` |
|
|
199
|
+
| Cell value | `ctx.value` | `ctx.implicit` |
|
|
200
|
+
| Row data | `ctx.row` | `ctx.cell.row.data` |
|
|
201
|
+
| Header template | no params | `IgcColumnTemplateContext` param |
|
|
202
|
+
|
|
203
|
+
**Cell template migration:**
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
// Before (Grid Lite)
|
|
207
|
+
column.cellTemplate = (ctx) => html`<span class=${ctx.value}>${ctx.value}</span>`;
|
|
208
|
+
|
|
209
|
+
// After (Premium Grid)
|
|
210
|
+
column.bodyTemplate = (ctx: IgcCellTemplateContext) =>
|
|
211
|
+
html`<span class=${ctx.implicit}>${ctx.implicit}</span>`;
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Header template migration:**
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
// Before (Grid Lite) - no parameters
|
|
218
|
+
column.headerTemplate = () => html`<strong>Name</strong>`;
|
|
219
|
+
|
|
220
|
+
// After (Premium Grid) - receives IgcColumnTemplateContext
|
|
221
|
+
column.headerTemplate = (ctx: IgcColumnTemplateContext) =>
|
|
222
|
+
html`<strong>${ctx.column.header ?? ctx.column.field}</strong>`;
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Step 7 - Migrate Remote Data Operations
|
|
226
|
+
|
|
227
|
+
Grid Lite uses `dataPipelineConfiguration` (async callbacks). The Premium Grid uses **noop strategies + events**.
|
|
228
|
+
|
|
229
|
+
**Before (Grid Lite):**
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
grid.dataPipelineConfiguration = {
|
|
233
|
+
sort: async ({ grid }) => dataService.sortRemote(grid.sortingExpressions),
|
|
234
|
+
filter: async ({ grid }) => dataService.filterRemote(grid.filterExpressions),
|
|
235
|
+
};
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**After (Premium Grid):**
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
const grid = document.getElementById('grid') as IgcGridComponent;
|
|
242
|
+
|
|
243
|
+
// Disable built-in sort/filter so the grid does not process data locally
|
|
244
|
+
grid.sortStrategy = IgcNoopSortingStrategy.instance();
|
|
245
|
+
grid.filterStrategy = IgcNoopFilteringStrategy.instance();
|
|
246
|
+
|
|
247
|
+
// React to done events and reload data from the server
|
|
248
|
+
grid.addEventListener('sortingDone', async () => {
|
|
249
|
+
grid.data = await dataService.sortRemote(grid.sortingExpressions);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
grid.addEventListener('filteringDone', async () => {
|
|
253
|
+
grid.data = await dataService.filterRemote(grid.filteringExpressionsTree);
|
|
254
|
+
});
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Step 8 - Migrate Sort / Filter Events
|
|
258
|
+
|
|
259
|
+
| Grid Lite Event | Premium Grid Event | Notes |
|
|
260
|
+
|---|---|---|
|
|
261
|
+
| `sorting` | `sorting` | Same name - both cancellable (`e.detail.cancel = true`) |
|
|
262
|
+
| `sorted` | `sortingDone` | Name changed - `CustomEvent<IgcSortingExpression[]>` |
|
|
263
|
+
| `filtering` | `filtering` | Same name - both cancellable |
|
|
264
|
+
| `filtered` | `filteringDone` | Name changed - `CustomEvent<IgcFilteringExpressionsTree>` |
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
// Cancel a sort before it applies
|
|
268
|
+
grid.addEventListener('sorting', (e: CustomEvent<IgcSortingEventArgs>) => {
|
|
269
|
+
e.detail.cancel = true;
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// React after sort completes
|
|
273
|
+
grid.addEventListener('sortingDone', (e: CustomEvent<IgcSortingExpression[]>) => {
|
|
274
|
+
console.log('Sorted by', e.detail);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// Cancel a filter before it applies
|
|
278
|
+
grid.addEventListener('filtering', (e: CustomEvent<IgcFilteringEventArgs>) => {
|
|
279
|
+
e.detail.cancel = true;
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// React after filter completes
|
|
283
|
+
grid.addEventListener('filteringDone', (e: CustomEvent<IgcFilteringExpressionsTree>) => {
|
|
284
|
+
console.log('Filter tree', e.detail);
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Step 9 - Migrate Programmatic Sort / Filter API
|
|
289
|
+
|
|
290
|
+
**Grid Lite API:**
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
grid.sort({ key: 'name', direction: 'ascending' });
|
|
294
|
+
grid.filter({ key: 'age', condition: 'greaterThan', searchTerm: 21 });
|
|
295
|
+
grid.clearSort();
|
|
296
|
+
grid.clearFilter();
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Premium Grid API:**
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
import { SortingDirection, IgcNumberFilteringOperand } from 'igniteui-webcomponents-grids';
|
|
303
|
+
|
|
304
|
+
// Sorting - fieldName + SortingDirection enum (Asc = 1, Desc = 2, None = 0)
|
|
305
|
+
grid.sort([{ fieldName: 'name', dir: SortingDirection.Asc, ignoreCase: true }]);
|
|
306
|
+
grid.clearSort('name'); // clear one column
|
|
307
|
+
grid.clearSort(); // clear all
|
|
308
|
+
|
|
309
|
+
// Filtering - positional arguments with typed operand instances
|
|
310
|
+
grid.filter('age', 21, IgcNumberFilteringOperand.instance().condition('greaterThan'), true);
|
|
311
|
+
grid.clearFilter('age'); // clear one column
|
|
312
|
+
grid.clearFilter(); // clear all
|
|
313
|
+
|
|
314
|
+
// Multi-column filtering via expression tree
|
|
315
|
+
const tree = new IgcFilteringExpressionsTree(FilteringLogic.And);
|
|
316
|
+
tree.filteringOperands.push({
|
|
317
|
+
fieldName: 'age',
|
|
318
|
+
condition: IgcNumberFilteringOperand.instance().condition('greaterThan'),
|
|
319
|
+
searchVal: 21,
|
|
320
|
+
ignoreCase: true,
|
|
321
|
+
});
|
|
322
|
+
grid.filteringExpressionsTree = tree;
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
**Key expression shape changes:**
|
|
326
|
+
|
|
327
|
+
| Aspect | Grid Lite | Premium Grid |
|
|
328
|
+
|---|---|---|
|
|
329
|
+
| Sort target field | `key` | `fieldName` |
|
|
330
|
+
| Sort direction | `direction: 'ascending'` (string) | `dir: SortingDirection.Asc` (enum) |
|
|
331
|
+
| Filter target field | `key` | `fieldName` |
|
|
332
|
+
| Filter search value | `searchTerm` | `searchVal` (expression tree) |
|
|
333
|
+
| Case sensitivity (sort) | `caseSensitive: true` | `ignoreCase: false` (**inverted**) |
|
|
334
|
+
| Case sensitivity (filter) | `caseSensitive: true` | `ignoreCase: false` (**inverted**) |
|
|
335
|
+
| Filter criteria | `criteria` string | `FilteringLogic` enum on the tree |
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Adding Enterprise Features Post-Migration
|
|
340
|
+
|
|
341
|
+
Once on the Premium Grid, enable the features that motivated the migration:
|
|
342
|
+
|
|
343
|
+
### Row Editing
|
|
344
|
+
|
|
345
|
+
```html
|
|
346
|
+
<igc-grid id="grid" row-editable="true" primary-key="id" height="600px">
|
|
347
|
+
<igc-column field="name" editable="true"></igc-column>
|
|
348
|
+
<igc-column field="price" data-type="number" editable="true"></igc-column>
|
|
349
|
+
</igc-grid>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
> **Note:** `primary-key` is strongly recommended whenever editing, selection, or row-targeted APIs (`getRowByKey`, row pinning, transactions) are used. Without it the grid falls back to object identity, which breaks across virtualization and remote data.
|
|
353
|
+
|
|
354
|
+
### Row Selection
|
|
355
|
+
|
|
356
|
+
```html
|
|
357
|
+
<igc-grid id="grid" row-selection="multiple" primary-key="id" height="600px">
|
|
358
|
+
<!-- columns -->
|
|
359
|
+
</igc-grid>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
grid.addEventListener('rowSelectionChanging', (e: CustomEvent<IgcRowSelectionEventArgs>) => {
|
|
364
|
+
console.log('Selected rows:', e.detail.added);
|
|
365
|
+
});
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Paging
|
|
369
|
+
|
|
370
|
+
```html
|
|
371
|
+
<igc-grid id="grid" primary-key="id" height="600px">
|
|
372
|
+
<!-- columns -->
|
|
373
|
+
<igc-paginator per-page="15"></igc-paginator>
|
|
374
|
+
</igc-grid>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### GroupBy
|
|
378
|
+
|
|
379
|
+
```html
|
|
380
|
+
<igc-grid id="grid" primary-key="id" height="600px">
|
|
381
|
+
<igc-column field="category" groupable="true"></igc-column>
|
|
382
|
+
</igc-grid>
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
grid.groupBy([{ fieldName: 'category', dir: SortingDirection.Asc }]);
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Column Pinning
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
const column = grid.getColumnByName('name');
|
|
393
|
+
column.pin(); // pin to start (default)
|
|
394
|
+
column.unpin();
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Summaries
|
|
398
|
+
|
|
399
|
+
```html
|
|
400
|
+
<igc-column field="price" data-type="number" has-summary="true"></igc-column>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Toolbar (Column Hiding, Pinning, Export)
|
|
404
|
+
|
|
405
|
+
```html
|
|
406
|
+
<igc-grid id="grid" auto-generate="true" height="600px">
|
|
407
|
+
<igc-grid-toolbar>
|
|
408
|
+
<igc-grid-toolbar-title>My Grid</igc-grid-toolbar-title>
|
|
409
|
+
<igc-grid-toolbar-actions>
|
|
410
|
+
<igc-grid-toolbar-advanced-filtering></igc-grid-toolbar-advanced-filtering>
|
|
411
|
+
<igc-grid-toolbar-hiding></igc-grid-toolbar-hiding>
|
|
412
|
+
<igc-grid-toolbar-pinning></igc-grid-toolbar-pinning>
|
|
413
|
+
<igc-grid-toolbar-exporter></igc-grid-toolbar-exporter>
|
|
414
|
+
</igc-grid-toolbar-actions>
|
|
415
|
+
</igc-grid-toolbar>
|
|
416
|
+
<!-- columns -->
|
|
417
|
+
</igc-grid>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Advanced Filtering Dialog
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
grid.allowAdvancedFiltering = true;
|
|
424
|
+
grid.openAdvancedFilteringDialog();
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Excel-Style Filter UI
|
|
428
|
+
|
|
429
|
+
```typescript
|
|
430
|
+
grid.filterMode = 'excelStyleFilter'; // default is 'quickFilter'
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Batch Editing
|
|
434
|
+
|
|
435
|
+
```html
|
|
436
|
+
<igc-grid id="grid" batch-editing="true" row-editable="true" primary-key="id" height="600px">
|
|
437
|
+
<igc-column field="name" editable="true"></igc-column>
|
|
438
|
+
</igc-grid>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
## Related Skills
|
|
443
|
+
|
|
444
|
+
- **[`igniteui-wc-integrate-with-framework`](../igniteui-wc-integrate-with-framework/SKILL.md)** - Framework integration setup
|
|
445
|
+
- **[`igniteui-wc-customize-component-theme`](../igniteui-wc-customize-component-theme/SKILL.md)** - Theming and styling
|
|
446
|
+
- **[`igniteui-wc-choose-components`](../igniteui-wc-choose-components/SKILL.md)** - Choosing the right grid component
|
|
@@ -162,13 +162,14 @@ export default class App extends LitElement {
|
|
|
162
162
|
>
|
|
163
163
|
${visibleRoutes.map((route) => html`
|
|
164
164
|
<igc-nav-drawer-item
|
|
165
|
-
?active=${this.currentPath === route.path}
|
|
165
|
+
?active=${this.currentPath === this.toAbsPath(route.path)}
|
|
166
166
|
@click=${() => this.navigate(route.path)}
|
|
167
167
|
>
|
|
168
168
|
<igc-icon
|
|
169
169
|
slot="icon"
|
|
170
170
|
name=${route.icon || 'home'}
|
|
171
171
|
collection="material"
|
|
172
|
+
style=${this.currentPath === this.toAbsPath(route.path) ? 'color: #0075D2;' : ''}
|
|
172
173
|
></igc-icon>
|
|
173
174
|
<span slot="content">${route.name}</span>
|
|
174
175
|
</igc-nav-drawer-item>
|
|
@@ -202,13 +203,19 @@ export default class App extends LitElement {
|
|
|
202
203
|
router.setRoutes(routes);
|
|
203
204
|
}
|
|
204
205
|
|
|
206
|
+
private toAbsPath(p: string) {
|
|
207
|
+
return p.startsWith('/') ? p : '/' + p;
|
|
208
|
+
}
|
|
209
|
+
|
|
205
210
|
private toggleDrawer = () => {
|
|
206
211
|
this.drawerOpen = !this.drawerOpen;
|
|
207
212
|
};
|
|
208
213
|
|
|
209
214
|
private navigate(path: string) {
|
|
210
|
-
|
|
211
|
-
|
|
215
|
+
const targetPath = this.toAbsPath(path);
|
|
216
|
+
|
|
217
|
+
this.currentPath = targetPath;
|
|
218
|
+
Router.go(targetPath);
|
|
212
219
|
|
|
213
220
|
if (!this.mediaQuery?.matches) {
|
|
214
221
|
this.drawerOpen = false;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<link rel="icon" type="image/png" href="./src/assets/wc.png">
|
|
10
10
|
<link href="https://fonts.googleapis.com/css?family=Titillium+Web:300,400,600,700" rel="stylesheet">
|
|
11
11
|
<link rel="stylesheet" href="./node_modules/igniteui-webcomponents/themes/light/material.css">
|
|
12
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
|
|
12
13
|
<link rel="stylesheet" href="./styles.css">
|
|
13
14
|
<!-- Facebook JS SDK — required only when facebook is configured in external-auth-config.ts.
|
|
14
15
|
Remove this script if you are not using Facebook login. -->
|
|
@@ -176,7 +176,7 @@ export default class App extends LitElement {
|
|
|
176
176
|
>
|
|
177
177
|
${visibleRoutes.map((route) => html`
|
|
178
178
|
<igc-nav-drawer-item
|
|
179
|
-
?active=${this.currentPath === route.path}
|
|
179
|
+
?active=${this.currentPath === this.toAbsPath(route.path)}
|
|
180
180
|
@click=${() => this.navigate(route.path)}
|
|
181
181
|
>
|
|
182
182
|
<igc-icon
|
|
@@ -220,13 +220,19 @@ export default class App extends LitElement {
|
|
|
220
220
|
router.setRoutes(routes);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
private toAbsPath(p: string) {
|
|
224
|
+
return p.startsWith('/') ? p : '/' + p;
|
|
225
|
+
}
|
|
226
|
+
|
|
223
227
|
private toggleDrawer = () => {
|
|
224
228
|
this.drawerOpen = !this.drawerOpen;
|
|
225
229
|
};
|
|
226
230
|
|
|
227
231
|
private navigate(path: string) {
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
const targetPath = this.toAbsPath(path);
|
|
233
|
+
|
|
234
|
+
this.currentPath = targetPath;
|
|
235
|
+
Router.go(targetPath);
|
|
230
236
|
|
|
231
237
|
if (!this.mediaQuery?.matches) {
|
|
232
238
|
this.drawerOpen = false;
|
|
@@ -181,13 +181,14 @@ export default class App extends LitElement {
|
|
|
181
181
|
>
|
|
182
182
|
${visibleRoutes.map((route) => html`
|
|
183
183
|
<igc-nav-drawer-item
|
|
184
|
-
?active=${this.currentPath === route.path}
|
|
184
|
+
?active=${this.currentPath === this.toAbsPath(route.path)}
|
|
185
185
|
@click=${() => this.navigate(route.path)}
|
|
186
186
|
>
|
|
187
187
|
<igc-icon
|
|
188
188
|
slot="icon"
|
|
189
189
|
name=${route.icon || 'apps'}
|
|
190
190
|
collection="material"
|
|
191
|
+
style=${this.currentPath === this.toAbsPath(route.path) ? 'color: #0075D2;' : ''}
|
|
191
192
|
></igc-icon>
|
|
192
193
|
<span slot="content">${route.name}</span>
|
|
193
194
|
</igc-nav-drawer-item>
|
|
@@ -219,13 +220,19 @@ export default class App extends LitElement {
|
|
|
219
220
|
router.setRoutes(routes);
|
|
220
221
|
}
|
|
221
222
|
|
|
223
|
+
private toAbsPath(p: string) {
|
|
224
|
+
return p.startsWith('/') ? p : '/' + p;
|
|
225
|
+
}
|
|
226
|
+
|
|
222
227
|
private toggleDrawer = () => {
|
|
223
228
|
this.drawerOpen = !this.drawerOpen;
|
|
224
229
|
};
|
|
225
230
|
|
|
226
231
|
private navigate(path: string) {
|
|
227
|
-
|
|
228
|
-
|
|
232
|
+
const targetPath = this.toAbsPath(path);
|
|
233
|
+
|
|
234
|
+
this.currentPath = targetPath;
|
|
235
|
+
Router.go(targetPath);
|
|
229
236
|
}
|
|
230
237
|
|
|
231
238
|
private updateDrawerState = () => {
|
|
@@ -192,13 +192,14 @@ export default class App extends LitElement {
|
|
|
192
192
|
>
|
|
193
193
|
${visibleRoutes.map((route) => html`
|
|
194
194
|
<igc-nav-drawer-item
|
|
195
|
-
?active=${this.currentPath === route.path}
|
|
195
|
+
?active=${this.currentPath === this.toAbsPath(route.path)}
|
|
196
196
|
@click=${() => this.navigate(route.path)}
|
|
197
197
|
>
|
|
198
198
|
<igc-icon
|
|
199
199
|
slot="icon"
|
|
200
200
|
name=${route.icon || 'apps'}
|
|
201
201
|
collection="material"
|
|
202
|
+
style=${this.currentPath === this.toAbsPath(route.path) ? 'color: #0075D2;' : ''}
|
|
202
203
|
></igc-icon>
|
|
203
204
|
<span slot="content">${route.name}</span>
|
|
204
205
|
</igc-nav-drawer-item>
|
|
@@ -234,13 +235,19 @@ export default class App extends LitElement {
|
|
|
234
235
|
router.setRoutes(routes);
|
|
235
236
|
}
|
|
236
237
|
|
|
238
|
+
private toAbsPath(p: string) {
|
|
239
|
+
return p.startsWith('/') ? p : '/' + p;
|
|
240
|
+
}
|
|
241
|
+
|
|
237
242
|
private toggleDrawer = () => {
|
|
238
243
|
this.drawerOpen = !this.drawerOpen;
|
|
239
244
|
};
|
|
240
245
|
|
|
241
246
|
private navigate(path: string) {
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
const targetPath = this.toAbsPath(path);
|
|
248
|
+
|
|
249
|
+
this.currentPath = targetPath;
|
|
250
|
+
Router.go(targetPath);
|
|
244
251
|
}
|
|
245
252
|
|
|
246
253
|
private updateDrawerState = () => {
|
package/templates/webcomponents/igc-ts/tree-grid/basic/files/src/app/__path__/__filePrefix__.test.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import $(ClassName) from './$(path).js';
|
|
3
|
+
|
|
4
|
+
describe('IgcTreeGridComponent', () => {
|
|
5
|
+
it('<app-$(path)> is an instance of $(ClassName)', async () => {
|
|
6
|
+
const element = document.createElement('app-$(path)');
|
|
7
|
+
expect(element).to.be.instanceOf($(ClassName));
|
|
8
|
+
});
|
|
9
|
+
});
|