arengibook 2.4.642 → 2.4.644
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 +38 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useContext, useEffect, useState, useRef, forwardRef, Fragment } from 'react';
|
|
2
|
+
import React__default, { useContext, useEffect, useState, useRef, forwardRef, Fragment, useMemo } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
|
|
5
5
|
function _arrayWithHoles$e(r) {
|
|
@@ -39346,19 +39346,54 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39346
39346
|
style: styleLabel
|
|
39347
39347
|
}, option[optionLabel]));
|
|
39348
39348
|
};
|
|
39349
|
+
var selectedOptionsObjects = useMemo(function () {
|
|
39350
|
+
return selectedOptions.map(function (option) {
|
|
39351
|
+
var selectedOption = objValue.find(function (opt) {
|
|
39352
|
+
return opt[optionValue] === option;
|
|
39353
|
+
});
|
|
39354
|
+
if (!selectedOption && loadedOptions.length > 0) {
|
|
39355
|
+
selectedOption = loadedOptions.find(function (opt) {
|
|
39356
|
+
return opt[optionValue] === option;
|
|
39357
|
+
});
|
|
39358
|
+
}
|
|
39359
|
+
return selectedOption;
|
|
39360
|
+
}).filter(Boolean);
|
|
39361
|
+
}, [selectedOptions, objValue, loadedOptions, optionValue]);
|
|
39349
39362
|
var selectedItemTemplate = function selectedItemTemplate(option) {
|
|
39350
|
-
|
|
39363
|
+
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
39364
|
+
var selectedOption = selectedOptionsObjects.find(function (opt) {
|
|
39351
39365
|
return opt[optionValue] === option;
|
|
39352
39366
|
});
|
|
39367
|
+
if (!selectedOption) return null;
|
|
39353
39368
|
console.log("ecoute de selectedOption");
|
|
39369
|
+
console.log(selectedOptionsObjects.find(function (opt) {
|
|
39370
|
+
return opt[optionValue] === option;
|
|
39371
|
+
}));
|
|
39354
39372
|
console.log(loadedOptions.find(function (opt) {
|
|
39355
39373
|
return opt[optionValue] === option;
|
|
39356
39374
|
}));
|
|
39375
|
+
console.log(loadedOptions.find(function (opt) {
|
|
39376
|
+
return Number(opt[optionValue]) === Number(option);
|
|
39377
|
+
}));
|
|
39357
39378
|
console.log(selectedOption);
|
|
39358
39379
|
console.log(objValue);
|
|
39359
39380
|
console.log(selectedOptions);
|
|
39360
39381
|
console.log(loadedOptions);
|
|
39361
|
-
|
|
39382
|
+
console.log(option);
|
|
39383
|
+
|
|
39384
|
+
// if (!selectedOption) return null;
|
|
39385
|
+
//
|
|
39386
|
+
// const handleRemove = (e) => {
|
|
39387
|
+
// e.stopPropagation();
|
|
39388
|
+
// const newSelectedOptions = selectedOptions.filter(opt => opt !== option);
|
|
39389
|
+
// setSelectedOptions(newSelectedOptions);
|
|
39390
|
+
// if (onChange) onChange(newSelectedOptions);
|
|
39391
|
+
// };
|
|
39392
|
+
|
|
39393
|
+
// 1. Cherche d'abord dans objValue (pour l'affichage immédiat)
|
|
39394
|
+
|
|
39395
|
+
// 2. Si non trouvé, cherche dans loadedOptions (pour les cas où objValue est obsolète)
|
|
39396
|
+
|
|
39362
39397
|
var handleRemove = function handleRemove(e) {
|
|
39363
39398
|
e.stopPropagation();
|
|
39364
39399
|
var newSelectedOptions = selectedOptions.filter(function (opt) {
|