- Notifications
You must be signed in to change notification settings - Fork906
Commit4ec4b30
committed
Enforce one-dv-per-cell invariant
When the the XLDataValidation had the IXLRanges replaced withthe XLAreaList, the DataValications also stopped enforcingone-dv-per-cell invariant. There were also no failing tests forthe invariant.The switch and removal was done to fix data validation shifting,but invariant wasn't implemented in the change to keep scopereasonable.To make sure the invariant is enforced, adding an area to datavalidation is done in a single function in XLDataValidations.The collection contains all DVs in a sheet and adjusts/removesDVs that no longer have any area.The invariant has to be enforced only when area is added to DV,removal of areas can't violate invariant. Thus IXLDV.ClearRanges()and other area removals can be done directly in XLDataValidation.This is basically emergecy repair, in the long run, whole conceptualmodel of DVs + API should be replaced with something less concernedwith actual data structures and more with behavior. Addition or removalof XLDataValidations should be basically transparent to user.Example: ws.Range("A1:C3").DataValidations.List("one,two") ws.Range("A1:C3").DataValidations.Clear()And all this DV uses these areas should be hidden away. I thinkproviding API that treats XML DV element as an API object is a mistake.1 parentfb8f754 commit4ec4b30
File tree
9 files changed
+193
-101
lines changed- ClosedXML.Tests/Excel/DataValidations
- ClosedXML/Excel
- Cells
- DataValidation
- IO
- Ranges
9 files changed
+193
-101
lines changedLines changed: 7 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | 295 | | |
302 | 296 | | |
303 | 297 | | |
| |||
306 | 300 | | |
307 | 301 | | |
308 | 302 | | |
309 | | - | |
| 303 | + | |
310 | 304 | | |
311 | | - | |
| 305 | + | |
312 | 306 | | |
313 | 307 | | |
314 | 308 | | |
| |||
322 | 316 | | |
323 | 317 | | |
324 | 318 | | |
325 | | - | |
| 319 | + | |
326 | 320 | | |
327 | 321 | | |
328 | 322 | | |
| |||
343 | 337 | | |
344 | 338 | | |
345 | 339 | | |
346 | | - | |
| 340 | + | |
347 | 341 | | |
348 | 342 | | |
349 | 343 | | |
| |||
360 | 354 | | |
361 | 355 | | |
362 | 356 | | |
363 | | - | |
| 357 | + | |
364 | 358 | | |
365 | 359 | | |
366 | 360 | | |
| |||
379 | 373 | | |
380 | 374 | | |
381 | 375 | | |
382 | | - | |
| 376 | + | |
383 | 377 | | |
384 | 378 | | |
385 | 379 | | |
| |||
397 | 391 | | |
398 | 392 | | |
399 | 393 | | |
400 | | - | |
| 394 | + | |
401 | 395 | | |
402 | 396 | | |
403 | 397 | | |
| |||
Lines changed: 85 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | | - | |
4 | | - | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 10 | | |
17 | 11 | | |
18 | 12 | | |
| |||
36 | 30 | | |
37 | 31 | | |
38 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
39 | 110 | | |
40 | 111 | | |
41 | 112 | | |
| |||
137 | 208 | | |
138 | 209 | | |
139 | 210 | | |
140 | | - | |
| 211 | + | |
141 | 212 | | |
142 | 213 | | |
143 | 214 | | |
| |||
147 | 218 | | |
148 | 219 | | |
149 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
150 | 226 | | |
151 | 227 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
| 1068 | + | |
1071 | 1069 | | |
1072 | 1070 | | |
1073 | 1071 | | |
| |||
1468 | 1466 | | |
1469 | 1467 | | |
1470 | 1468 | | |
1471 | | - | |
| 1469 | + | |
1472 | 1470 | | |
1473 | 1471 | | |
1474 | 1472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 14 | + | |
24 | 15 | | |
25 | 16 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 17 | | |
33 | 18 | | |
34 | 19 | | |
| |||
41 | 26 | | |
42 | 27 | | |
43 | 28 | | |
44 | | - | |
| 29 | + | |
45 | 30 | | |
46 | 31 | | |
47 | 32 | | |
| |||
186 | 171 | | |
187 | 172 | | |
188 | 173 | | |
189 | | - | |
| 174 | + | |
| 175 | + | |
190 | 176 | | |
191 | | - | |
192 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
193 | 181 | | |
194 | | - | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
195 | 185 | | |
196 | 186 | | |
197 | 187 | | |
| |||
0 commit comments
Comments
(0)