@@ -1312,22 +1312,24 @@ Array<number | string>
1312
1312
With ` remove() ` we are able to remove Item/s from
1313
1313
1314
1314
- ### ` everywhere() `
1315
- Removes the Item/s at ` itemKey/s ` from the entire Collection and all [ Groups] ( ./group/Introduction.md ) / [ Selectors] ( ./selector/Introduction.md ) ,
1315
+ Removes Item/s at ` itemKey/s ` from the entire Collection and all [ Groups] ( ./group/Introduction.md ) / [ Selectors] ( ./selector/Introduction.md ) ,
1316
1316
i.e. from everywhere.
1317
1317
``` ts
1318
1318
MY_COLLECTION .remove (' item1' ).everywhere ();
1319
1319
```
1320
+ Synonym to [ ` removeItems() ` ] ( #removeitems ) .
1320
1321
1321
1322
- ### ` fromGroups() `
1322
- Removes the Item/s at ` itemKey/s ` only from specific [ Groups] ( ./group/Introduction.md ) .
1323
+ Removes Item/s at ` itemKey/s ` only from specific [ Groups] ( ./group/Introduction.md ) .
1323
1324
``` ts
1324
1325
MY_COLLECTION .remove (' item1' ).fromGroups ([' group1' , ' group2' ]);
1325
1326
```
1327
+ Synonym to [ ` removeFromGroups() ` ] ( #removefromgroups ) .
1326
1328
1327
1329
::: info
1328
1330
1329
1331
Note that a standalone ` remove() ` doesn't do anything,
1330
- so we have to always add ` .everywhere() ` or ` .fromGroups() ` .
1332
+ so we must always add ` .everywhere() ` or ` .fromGroups() ` .
1331
1333
1332
1334
:::
1333
1335
@@ -1358,7 +1360,7 @@ so we have to always add `.everywhere()` or `.fromGroups()`.
1358
1360
1359
1361
## ` removeFromGroups() `
1360
1362
1361
- Removes Item at ` itemKey ` from specific [ Group] ( ./group/Introduction.md ) .
1363
+ Removes Item at ` itemKey ` from specific [ Group] ( ./group/Introduction.md ) at ` groupKey ` .
1362
1364
``` ts
1363
1365
MY_COLLECTION .removeFromGroups (' item1' , ' group1' );
1364
1366
```
@@ -1372,7 +1374,8 @@ In the above example the Items at `item1` and `item2` will be removed from the G
1372
1374
1373
1375
| Prop | Type | Default | Description | Required |
1374
1376
| ----------------------| -----------------------------------------------------------------------------------| ------------| -----------------------------------------------------------------------------------------------| ----------|
1375
- | ` itemKeys ` | number \| string | Array<number \| string\> | undefined | itemKey/s that get removed | Yes |
1377
+ | ` itemKeys ` | number \| string | Array<number \| string\> | undefined | itemKey/s of Items that that get removed from Group/s | Yes |
1378
+ | ` groupKeys ` | number \| string | Array<number \| string\> | undefined | groupKey/s of Group/s from which the Item/s will be removed | Yes |
1376
1379
1377
1380
### 📄 Return
1378
1381
@@ -1381,3 +1384,110 @@ Collection
1381
1384
```
1382
1385
Returns the [ Collection] ( ./Introduction.md ) it was called on.
1383
1386
1387
+
1388
+
1389
+ <br />
1390
+
1391
+ ---
1392
+
1393
+ <br />
1394
+
1395
+
1396
+
1397
+ ## ` removeItems() `
1398
+
1399
+ Removes Item at ` itemKey ` from the entire Collection and all [ Groups] ( ./group/Introduction.md ) / [ Selectors] ( ./selector/Introduction.md )
1400
+ ``` ts
1401
+ MY_COLLECTION .removeItems (' item1' );
1402
+ ```
1403
+ It is also possible to remove multiple Items at once.
1404
+ ``` ts
1405
+ MY_COLLECTION .removeItems ([' item1' , ' item2' ]);
1406
+ ```
1407
+
1408
+ ### ⚠️ Remove includes?
1409
+
1410
+ - remove Item/s from the entire Collection
1411
+ - remove Item/s from all Groups
1412
+ - remove Item/s from all Selectors
1413
+ - remove Item value/s from Storage
1414
+
1415
+ ### 📭 Props
1416
+
1417
+ | Prop | Type | Default | Description | Required |
1418
+ | ----------------------| -----------------------------------------------------------------------------------| ------------| -----------------------------------------------------------------------------------------------| ----------|
1419
+ | ` itemKeys ` | number \| string | Array<number \| string\> | undefined | itemKey/s of Item/s that get removed | Yes |
1420
+
1421
+ ### 📄 Return
1422
+
1423
+ ``` ts
1424
+ Collection
1425
+ ```
1426
+ Returns the [ Collection] ( ./Introduction.md ) it was called on.
1427
+
1428
+
1429
+
1430
+ <br />
1431
+
1432
+ ---
1433
+
1434
+ <br />
1435
+
1436
+
1437
+
1438
+ ## ` setData() `
1439
+
1440
+ ::: warning
1441
+
1442
+ ** No public function!** (only public for testing purpose) <br />
1443
+ ` setData() ` applies newly set data (for instance from the [ ` collect() ` ] ( #collect ) method) to the Collection.
1444
+
1445
+ :::
1446
+
1447
+
1448
+
1449
+ <br />
1450
+
1451
+ ---
1452
+
1453
+ <br />
1454
+
1455
+
1456
+
1457
+ ## ` rebuildGroupsThatIncludeItemKey() `
1458
+
1459
+ ::: warning
1460
+
1461
+ This function is mainly thought for the internal use.
1462
+
1463
+ :::
1464
+
1465
+ Rebuilds all [ Groups] ( ./group/Introduction.md ) that include the provided ` itemKey ` .
1466
+ ``` ts
1467
+ MY_COLLECTION .rebuildGroupsThatIncludeItemKey (' item1' );
1468
+ ```
1469
+ Such rebuild does recompute the ` output ` of the Group.
1470
+ ``` ts
1471
+ // group value '[1, 2, 3]'
1472
+ // group output '[{id: 1, name: 'jeff'}, {id: 3, name: 'hans'}]'
1473
+
1474
+ // Item gets added to Collection -> Collection rebuilds all Groups that include the 'itemKey'
1475
+ MY_COLLECTION .collect ({id: 2 , name: ' jeff' });
1476
+ // Exectues internally: 'MY_COLLECTION.rebuildGroupsThatIncludeItemKey(2)'
1477
+
1478
+ // group output '[{id: 1, name: 'jeff'}, {id: 2, name: 'jeff'}, {id: 3, name: 'hans'}]'
1479
+ ```
1480
+
1481
+ ### 📭 Props
1482
+
1483
+ | Prop | Type | Default | Description | Required |
1484
+ | ----------------------| -----------------------------------------------------------------------------------| ------------| -----------------------------------------------------------------------------------------------| ----------|
1485
+ | ` itemKey ` | number \| string | undefined | itemKey | Yes |
1486
+ | ` config ` | RebuildGroupsThatIncludeItemKeyConfigInterface | {} | Configuration | No |
1487
+
1488
+ ### 📄 Return
1489
+
1490
+ ``` ts
1491
+ Collection
1492
+ ```
1493
+ Returns the [ Collection] ( ./Introduction.md ) it was called on.
0 commit comments