arengibook 2.4.645 → 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 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39346,28 +39346,17 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39346
39346
|
style: styleLabel
|
|
39347
39347
|
}, option[optionLabel]));
|
|
39348
39348
|
};
|
|
39349
|
-
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39353
|
-
|
|
39354
|
-
|
|
39355
|
-
|
|
39356
|
-
|
|
39357
|
-
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
});
|
|
39361
|
-
// 2. Si non trouvé, cherche dans loadedOptions (fallback)
|
|
39362
|
-
if (!selectedOption && loadedOptions.length > 0) {
|
|
39363
|
-
selectedOption = loadedOptions.find(function (opt) {
|
|
39364
|
-
return opt[optionValue] === option;
|
|
39365
|
-
});
|
|
39366
|
-
}
|
|
39367
|
-
return selectedOption;
|
|
39368
|
-
}).filter(Boolean); // Filtre les valeurs "undefined" si une option n'est pas trouvée
|
|
39369
|
-
}, [selectedOptions, objValue, loadedOptions, optionValue]);
|
|
39370
|
-
});
|
|
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
|
+
};
|
|
39371
39360
|
var selectedItemTemplate = function selectedItemTemplate(option) {
|
|
39372
39361
|
var _selectedOption, _selectedOption2, _selectedOption3, _selectedOption4;
|
|
39373
39362
|
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
@@ -39384,17 +39373,18 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39384
39373
|
console.log(loadedOptions);
|
|
39385
39374
|
console.log(option);
|
|
39386
39375
|
|
|
39387
|
-
//
|
|
39376
|
+
// Aplatir loadedOptions
|
|
39377
|
+
var flattenedLoadedOptions = _flattenOptions(loadedOptions);
|
|
39378
|
+
|
|
39379
|
+
// Chercher l'option dans objValue d'abord, puis dans flattenedLoadedOptions
|
|
39388
39380
|
var selectedOption = objValue.find(function (opt) {
|
|
39389
39381
|
return opt[optionValue] === option;
|
|
39390
39382
|
});
|
|
39391
|
-
|
|
39392
|
-
|
|
39393
|
-
selectedOption = loadedOptions.find(function (opt) {
|
|
39383
|
+
if (!selectedOption) {
|
|
39384
|
+
selectedOption = flattenedLoadedOptions.find(function (opt) {
|
|
39394
39385
|
return opt[optionValue] === option;
|
|
39395
39386
|
});
|
|
39396
39387
|
}
|
|
39397
|
-
console.log(selectedOption);
|
|
39398
39388
|
if (!selectedOption) return null;
|
|
39399
39389
|
var handleRemove = function handleRemove(e) {
|
|
39400
39390
|
e.stopPropagation();
|