igniteui-cli 15.1.0 → 15.2.1-alpha.3
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 -2
- package/lib/commands/ai-config.d.ts +3 -5
- package/lib/commands/ai-config.js +68 -23
- package/lib/commands/new.js +1 -1
- package/package.json +4 -4
- package/templates/blazor/igb/index.d.ts +1 -0
- package/templates/blazor/igb/index.js +12 -0
- package/templates/blazor/igb/projects/ai-config/files/AGENTS.md +65 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/AGENTS.md +65 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/README.md +61 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/SKILL.md +118 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/charts.md +302 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/data-display.md +350 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/feedback.md +178 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/form-controls.md +365 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout-manager.md +180 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout.md +322 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/mcp-setup.md +78 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/setup.md +214 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/SKILL.md +284 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/references/component-mapping.md +281 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/references/gotchas.md +503 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/SKILL.md +188 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/data-operations.md +264 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/editing.md +297 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/features.md +447 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/mcp-setup.md +78 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/paging-remote.md +299 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/sizing.md +284 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/state.md +160 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/structure.md +497 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/types.md +553 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/SKILL.md +259 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/references/common-patterns.md +276 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/references/mcp-setup.md +81 -0
- package/templates/blazor/igb/projects/ai-config/index.d.ts +22 -0
- package/templates/blazor/igb/projects/ai-config/index.js +62 -0
- package/templates/blazor/index.d.ts +3 -0
- package/templates/blazor/index.js +11 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Editing - Cell Editing, Row Editing & Validation
|
|
2
|
+
|
|
3
|
+
> **Part of the [`igniteui-blazor-grids`](../SKILL.md) skill hub.**
|
|
4
|
+
> For grid setup and column configuration — see [`structure.md`](./structure.md).
|
|
5
|
+
> For programmatic API access — see [`data-operations.md`](./data-operations.md).
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Choosing an Editing Mode](#choosing-an-editing-mode)
|
|
10
|
+
- [Cell Editing](#cell-editing)
|
|
11
|
+
- [Row Editing](#row-editing)
|
|
12
|
+
- [Adding & Deleting Rows Programmatically](#adding--deleting-rows-programmatically)
|
|
13
|
+
- [Validation](#validation)
|
|
14
|
+
- [Custom Editors](#custom-editors)
|
|
15
|
+
- [Key Rules](#key-rules)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
> **Pivot Grid does not support editing.** The Pivot Grid is read-only. The content below applies to IgbGrid, IgbTreeGrid, and IgbHierarchicalGrid.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Choosing an Editing Mode
|
|
24
|
+
|
|
25
|
+
| Mode | Property | Best For | Commit Behavior |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| Cell editing | `Editable="true"` on column | Quick inline edits | Commits on blur, Enter, or Tab |
|
|
28
|
+
| Row editing | `RowEditable="true"` on grid | Multi-field row changes | Shows confirm/cancel banner; commits on confirm |
|
|
29
|
+
|
|
30
|
+
> **Recommendation:** Use **row editing** for most CRUD scenarios. It gives users a clear confirm/cancel flow and prevents partial row updates.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Cell Editing
|
|
35
|
+
|
|
36
|
+
### Enable cell editing
|
|
37
|
+
|
|
38
|
+
Mark columns as editable:
|
|
39
|
+
|
|
40
|
+
```razor
|
|
41
|
+
<IgbGrid Data="@employees" PrimaryKey="Id" AutoGenerate="false">
|
|
42
|
+
<IgbColumn Field="Id" Header="ID" Editable="false" />
|
|
43
|
+
<IgbColumn Field="Name" Header="Name" Editable="true" DataType="GridColumnDataType.String" />
|
|
44
|
+
<IgbColumn Field="Salary" Header="Salary" Editable="true" DataType="GridColumnDataType.Currency" />
|
|
45
|
+
<IgbColumn Field="HireDate" Header="Hire Date" Editable="true" DataType="GridColumnDataType.Date" />
|
|
46
|
+
<IgbColumn Field="IsActive" Header="Active" Editable="true" DataType="GridColumnDataType.Boolean" />
|
|
47
|
+
</IgbGrid>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- Double-click (or press Enter on a focused cell) enters edit mode.
|
|
51
|
+
- The editor type is determined by `DataType`: text input for strings, numeric input for numbers, datepicker for dates, checkbox for booleans.
|
|
52
|
+
|
|
53
|
+
### Cell editing events
|
|
54
|
+
|
|
55
|
+
| Event | Type | Description |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `CellEditEnter` | `EventCallback<IgbGridEditEventArgs>` | Fires when a cell enters edit mode |
|
|
58
|
+
| `CellEdit` | `EventCallback<IgbGridEditEventArgs>` | Fires before a cell value is committed - set `args.Cancel = true` to reject |
|
|
59
|
+
| `CellEditDone` | `EventCallback<IgbGridEditDoneEventArgs>` | Fires after a cell value is committed |
|
|
60
|
+
| `CellEditExit` | `EventCallback<IgbGridEditEventArgs>` | Fires when a cell exits edit mode |
|
|
61
|
+
|
|
62
|
+
### Example: Validate before commit
|
|
63
|
+
|
|
64
|
+
```razor
|
|
65
|
+
<IgbGrid Data="data" PrimaryKey="Id" CellEdit="OnCellEdit">
|
|
66
|
+
<IgbColumn Field="Salary" Editable="true" DataType="GridColumnDataType.Number" />
|
|
67
|
+
</IgbGrid>
|
|
68
|
+
|
|
69
|
+
@code {
|
|
70
|
+
private void OnCellEdit(IgbGridEditEventArgs args)
|
|
71
|
+
{
|
|
72
|
+
if (args.Column.Field == "Salary")
|
|
73
|
+
{
|
|
74
|
+
var newValue = Convert.ToDecimal(args.NewValue);
|
|
75
|
+
if (newValue < 0)
|
|
76
|
+
{
|
|
77
|
+
args.Cancel = true; // reject negative salary
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Example: React to committed changes
|
|
85
|
+
|
|
86
|
+
```razor
|
|
87
|
+
<IgbGrid Data="data" PrimaryKey="Id" CellEditDone="OnCellEditDone">
|
|
88
|
+
...
|
|
89
|
+
</IgbGrid>
|
|
90
|
+
|
|
91
|
+
@code {
|
|
92
|
+
private async Task OnCellEditDone(IgbGridEditDoneEventArgs args)
|
|
93
|
+
{
|
|
94
|
+
var rowData = args.RowData;
|
|
95
|
+
var field = args.Column.Field;
|
|
96
|
+
var newValue = args.NewValue;
|
|
97
|
+
// Save to server
|
|
98
|
+
await EmployeeService.UpdateFieldAsync(rowData, field, newValue);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Row Editing
|
|
106
|
+
|
|
107
|
+
### Enable row editing
|
|
108
|
+
|
|
109
|
+
```razor
|
|
110
|
+
<IgbGrid Data="employees" PrimaryKey="Id" RowEditable="true" AutoGenerate="false">
|
|
111
|
+
<IgbColumn Field="Id" Header="ID" Editable="false" />
|
|
112
|
+
<IgbColumn Field="Name" Header="Name" Editable="true" />
|
|
113
|
+
<IgbColumn Field="Department" Header="Department" Editable="true" />
|
|
114
|
+
<IgbColumn Field="Salary" Header="Salary" Editable="true" DataType="GridColumnDataType.Currency" />
|
|
115
|
+
</IgbGrid>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- When `RowEditable="true"`, editing a cell shows a row-level overlay with **Confirm** and **Cancel** buttons.
|
|
119
|
+
- All cells in the row are editable simultaneously.
|
|
120
|
+
- Changes are committed to the data source only on **Confirm**.
|
|
121
|
+
|
|
122
|
+
### Row editing events
|
|
123
|
+
|
|
124
|
+
| Event | Type | Description |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `RowEditEnter` | `EventCallback<IgbGridEditEventArgs>` | Fires when a row enters edit mode |
|
|
127
|
+
| `RowEdit` | `EventCallback<IgbGridEditEventArgs>` | Fires before row changes are committed - set `args.Cancel = true` to reject |
|
|
128
|
+
| `RowEditDone` | `EventCallback<IgbGridEditDoneEventArgs>` | Fires after row changes are committed |
|
|
129
|
+
| `RowEditExit` | `EventCallback<IgbGridEditEventArgs>` | Fires when a row exits edit mode |
|
|
130
|
+
|
|
131
|
+
### Example: Save row on confirm
|
|
132
|
+
|
|
133
|
+
```razor
|
|
134
|
+
<IgbGrid Data="data" PrimaryKey="Id" RowEditable="true"
|
|
135
|
+
RowEditDone="OnRowEditDone">
|
|
136
|
+
...
|
|
137
|
+
</IgbGrid>
|
|
138
|
+
|
|
139
|
+
@code {
|
|
140
|
+
private async Task OnRowEditDone(IgbGridEditDoneEventArgs args)
|
|
141
|
+
{
|
|
142
|
+
var updatedRow = args.RowData;
|
|
143
|
+
await EmployeeService.UpdateAsync(updatedRow);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Row editing with Action Strip
|
|
149
|
+
|
|
150
|
+
Add inline add/edit/delete actions:
|
|
151
|
+
|
|
152
|
+
```razor
|
|
153
|
+
<IgbGrid Data="data" PrimaryKey="Id" RowEditable="true">
|
|
154
|
+
<IgbColumn Field="Name" Editable="true" />
|
|
155
|
+
<IgbColumn Field="Salary" Editable="true" DataType="GridColumnDataType.Number" />
|
|
156
|
+
<IgbActionStrip>
|
|
157
|
+
<IgbGridEditingActions AddRow="true" />
|
|
158
|
+
</IgbActionStrip>
|
|
159
|
+
</IgbGrid>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`IgbGridEditingActions` provides:
|
|
163
|
+
- **Edit** - enters row edit mode on the clicked row
|
|
164
|
+
- **Delete** - removes the row
|
|
165
|
+
- **Add Row** (when `AddRow="true"`) - adds a new empty row above or below
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Adding & Deleting Rows Programmatically
|
|
170
|
+
|
|
171
|
+
### Add a row
|
|
172
|
+
|
|
173
|
+
```razor
|
|
174
|
+
@code {
|
|
175
|
+
private async Task AddEmployee()
|
|
176
|
+
{
|
|
177
|
+
var newEmployee = new Employee
|
|
178
|
+
{
|
|
179
|
+
Id = employees.Max(e => e.Id) + 1,
|
|
180
|
+
Name = "New Employee",
|
|
181
|
+
Department = "Unassigned",
|
|
182
|
+
Salary = 0
|
|
183
|
+
};
|
|
184
|
+
await grid.AddRowAsync(newEmployee);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Delete a row
|
|
190
|
+
|
|
191
|
+
```razor
|
|
192
|
+
@code {
|
|
193
|
+
private async Task DeleteEmployee(int id)
|
|
194
|
+
{
|
|
195
|
+
await grid.DeleteRowAsync(id); // pass the primary key value
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Validation
|
|
203
|
+
|
|
204
|
+
### Built-in validation
|
|
205
|
+
|
|
206
|
+
Columns support built-in validators that run during editing:
|
|
207
|
+
|
|
208
|
+
```razor
|
|
209
|
+
<IgbColumn Field="Name" Editable="true" Required="true" />
|
|
210
|
+
<IgbColumn Field="Email" Editable="true" DataType="GridColumnDataType.String" MinLength="5" MaxLength="100" />
|
|
211
|
+
<IgbColumn Field="Age" Editable="true" DataType="GridColumnDataType.Number" Min="18" Max="120" />
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
| Validator Parameter | Type | Description |
|
|
215
|
+
|---|---|---|
|
|
216
|
+
| `Required` | `bool` | Value cannot be empty |
|
|
217
|
+
| `MinLength` | `int` | Minimum string length |
|
|
218
|
+
| `MaxLength` | `int` | Maximum string length |
|
|
219
|
+
| `Min` | `object` | Minimum numeric/date value |
|
|
220
|
+
| `Max` | `object` | Maximum numeric/date value |
|
|
221
|
+
|
|
222
|
+
### Validation display
|
|
223
|
+
|
|
224
|
+
When a validation rule is violated, the cell shows a red border and a tooltip with the error message. The row cannot be committed while validation errors exist in row editing mode.
|
|
225
|
+
|
|
226
|
+
### Custom validation
|
|
227
|
+
|
|
228
|
+
Implement custom logic in the `CellEdit` or `RowEdit` event:
|
|
229
|
+
|
|
230
|
+
```razor
|
|
231
|
+
<IgbGrid Data="data" PrimaryKey="Id" RowEditable="true"
|
|
232
|
+
RowEdit="OnRowEdit">
|
|
233
|
+
<IgbColumn Field="StartDate" Editable="true" DataType="GridColumnDataType.Date" />
|
|
234
|
+
<IgbColumn Field="EndDate" Editable="true" DataType="GridColumnDataType.Date" />
|
|
235
|
+
</IgbGrid>
|
|
236
|
+
|
|
237
|
+
@code {
|
|
238
|
+
private void OnRowEdit(IgbGridEditEventArgs args)
|
|
239
|
+
{
|
|
240
|
+
var rowData = args.NewValue as ProjectTask;
|
|
241
|
+
if (rowData != null && rowData.EndDate < rowData.StartDate)
|
|
242
|
+
{
|
|
243
|
+
args.Cancel = true;
|
|
244
|
+
// Show notification to user
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Custom Editors
|
|
253
|
+
|
|
254
|
+
Provide a fully custom edit template for a column:
|
|
255
|
+
|
|
256
|
+
```razor
|
|
257
|
+
<IgbColumn Field="Priority" Header="Priority" Editable="true">
|
|
258
|
+
<InlineEditorTemplate>
|
|
259
|
+
@{
|
|
260
|
+
var cell = (IgbCellTemplateContext)context;
|
|
261
|
+
}
|
|
262
|
+
<IgbSelect @bind-Value="cell.Cell.EditValue">
|
|
263
|
+
<IgbSelectItem Value="Low">Low</IgbSelectItem>
|
|
264
|
+
<IgbSelectItem Value="Medium">Medium</IgbSelectItem>
|
|
265
|
+
<IgbSelectItem Value="High">High</IgbSelectItem>
|
|
266
|
+
<IgbSelectItem Value="Critical">Critical</IgbSelectItem>
|
|
267
|
+
</IgbSelect>
|
|
268
|
+
</InlineEditorTemplate>
|
|
269
|
+
</IgbColumn>
|
|
270
|
+
|
|
271
|
+
<IgbColumn Field="AssignedTo" Header="Assigned To" Editable="true">
|
|
272
|
+
<InlineEditorTemplate>
|
|
273
|
+
@{
|
|
274
|
+
var cell = (IgbCellTemplateContext)context;
|
|
275
|
+
}
|
|
276
|
+
<IgbCombo TValue="Person"
|
|
277
|
+
Data="people"
|
|
278
|
+
ValueKey="Id"
|
|
279
|
+
DisplayKey="Name"
|
|
280
|
+
SingleSelect="true"
|
|
281
|
+
@bind-Value="cell.Cell.EditValue" />
|
|
282
|
+
</InlineEditorTemplate>
|
|
283
|
+
</IgbColumn>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Key Rules
|
|
289
|
+
|
|
290
|
+
1. **Set `PrimaryKey`** - editing requires a primary key to identify rows.
|
|
291
|
+
2. **`Editable` is on the column, not the grid** - mark each editable column individually.
|
|
292
|
+
3. **`RowEditable` is on the grid** - it enables the row-editing overlay with confirm/cancel.
|
|
293
|
+
4. **Use `CellEdit` / `RowEdit` to cancel edits** - set `args.Cancel = true` before commit.
|
|
294
|
+
5. **Use `CellEditDone` / `RowEditDone` to persist** - these fire after the edit is committed to the grid.
|
|
295
|
+
6. **Validation blocks commit** - in row editing, the row cannot be confirmed while validation errors exist.
|
|
296
|
+
7. **Pivot Grid is read-only** - never set `Editable` or `RowEditable` on an `IgbPivotGrid`.
|
|
297
|
+
8. **Row editing mode is recommended** - it provides the best UX with confirm/cancel and prevents partial updates.
|