arengibook 2.4.646 → 2.4.647
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/dist/index.js +17 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39346,6 +39346,17 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39346
39346
|
style: styleLabel
|
|
39347
39347
|
}, option[optionLabel]));
|
|
39348
39348
|
};
|
|
39349
|
+
var _flattenOptions = function flattenOptions(options) {
|
|
39350
|
+
return options.reduce(function (acc, option) {
|
|
39351
|
+
if (Array.isArray(option)) {
|
|
39352
|
+
// Si c'est un sous-tableau, on l'aplatit récursivement
|
|
39353
|
+
return [].concat(_toConsumableArray$7(acc), _toConsumableArray$7(_flattenOptions(option)));
|
|
39354
|
+
} else {
|
|
39355
|
+
// Sinon, on ajoute simplement l'objet
|
|
39356
|
+
return [].concat(_toConsumableArray$7(acc), [option]);
|
|
39357
|
+
}
|
|
39358
|
+
}, []);
|
|
39359
|
+
};
|
|
39349
39360
|
var selectedItemTemplate = function selectedItemTemplate(option) {
|
|
39350
39361
|
var _selectedOption, _selectedOption2, _selectedOption3, _selectedOption4;
|
|
39351
39362
|
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
@@ -39362,17 +39373,18 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39362
39373
|
console.log(loadedOptions);
|
|
39363
39374
|
console.log(option);
|
|
39364
39375
|
|
|
39365
|
-
//
|
|
39376
|
+
// Aplatir loadedOptions
|
|
39377
|
+
var flattenedLoadedOptions = _flattenOptions(loadedOptions);
|
|
39378
|
+
|
|
39379
|
+
// Chercher l'option dans objValue d'abord, puis dans flattenedLoadedOptions
|
|
39366
39380
|
var selectedOption = objValue.find(function (opt) {
|
|
39367
39381
|
return opt[optionValue] === option;
|
|
39368
39382
|
});
|
|
39369
|
-
|
|
39370
|
-
|
|
39371
|
-
selectedOption = loadedOptions.find(function (opt) {
|
|
39383
|
+
if (!selectedOption) {
|
|
39384
|
+
selectedOption = flattenedLoadedOptions.find(function (opt) {
|
|
39372
39385
|
return opt[optionValue] === option;
|
|
39373
39386
|
});
|
|
39374
39387
|
}
|
|
39375
|
-
console.log(selectedOption);
|
|
39376
39388
|
if (!selectedOption) return null;
|
|
39377
39389
|
var handleRemove = function handleRemove(e) {
|
|
39378
39390
|
e.stopPropagation();
|