arengibook 2.4.644 → 2.4.645
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 +35 -33
- 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
|
|
2
|
+
import React__default, { useContext, useEffect, useState, useRef, forwardRef, Fragment } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
|
|
5
5
|
function _arrayWithHoles$e(r) {
|
|
@@ -39346,54 +39346,56 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39346
39346
|
style: styleLabel
|
|
39347
39347
|
}, option[optionLabel]));
|
|
39348
39348
|
};
|
|
39349
|
-
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39353
|
-
|
|
39354
|
-
|
|
39355
|
-
|
|
39349
|
+
useEffect(function () {
|
|
39350
|
+
loadedOptions.find(function (opt) {
|
|
39351
|
+
return opt[optionValue] === option;
|
|
39352
|
+
});
|
|
39353
|
+
|
|
39354
|
+
// À l'extérieur de selectedItemTemplate (dans le corps du composant)
|
|
39355
|
+
useMemo(function () {
|
|
39356
|
+
return selectedOptions.map(function (option) {
|
|
39357
|
+
// 1. Cherche d'abord dans objValue (pour l'affichage immédiat)
|
|
39358
|
+
var selectedOption = objValue.find(function (opt) {
|
|
39356
39359
|
return opt[optionValue] === option;
|
|
39357
39360
|
});
|
|
39358
|
-
|
|
39359
|
-
|
|
39360
|
-
|
|
39361
|
-
|
|
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
|
+
});
|
|
39362
39371
|
var selectedItemTemplate = function selectedItemTemplate(option) {
|
|
39372
|
+
var _selectedOption, _selectedOption2, _selectedOption3, _selectedOption4;
|
|
39363
39373
|
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
39364
|
-
|
|
39365
|
-
return opt[optionValue] === option;
|
|
39366
|
-
});
|
|
39367
|
-
if (!selectedOption) return null;
|
|
39374
|
+
|
|
39368
39375
|
console.log("ecoute de selectedOption");
|
|
39369
|
-
console.log(selectedOptionsObjects.find(function (opt) {
|
|
39370
|
-
return opt[optionValue] === option;
|
|
39371
|
-
}));
|
|
39372
39376
|
console.log(loadedOptions.find(function (opt) {
|
|
39373
39377
|
return opt[optionValue] === option;
|
|
39374
39378
|
}));
|
|
39375
39379
|
console.log(loadedOptions.find(function (opt) {
|
|
39376
39380
|
return Number(opt[optionValue]) === Number(option);
|
|
39377
39381
|
}));
|
|
39378
|
-
console.log(selectedOption);
|
|
39379
39382
|
console.log(objValue);
|
|
39380
39383
|
console.log(selectedOptions);
|
|
39381
39384
|
console.log(loadedOptions);
|
|
39382
39385
|
console.log(option);
|
|
39383
39386
|
|
|
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
39387
|
// 1. Cherche d'abord dans objValue (pour l'affichage immédiat)
|
|
39394
|
-
|
|
39388
|
+
var selectedOption = objValue.find(function (opt) {
|
|
39389
|
+
return opt[optionValue] === option;
|
|
39390
|
+
});
|
|
39395
39391
|
// 2. Si non trouvé, cherche dans loadedOptions (pour les cas où objValue est obsolète)
|
|
39396
|
-
|
|
39392
|
+
if (!selectedOption && loadedOptions.length > 0) {
|
|
39393
|
+
selectedOption = loadedOptions.find(function (opt) {
|
|
39394
|
+
return opt[optionValue] === option;
|
|
39395
|
+
});
|
|
39396
|
+
}
|
|
39397
|
+
console.log(selectedOption);
|
|
39398
|
+
if (!selectedOption) return null;
|
|
39397
39399
|
var handleRemove = function handleRemove(e) {
|
|
39398
39400
|
e.stopPropagation();
|
|
39399
39401
|
var newSelectedOptions = selectedOptions.filter(function (opt) {
|
|
@@ -39405,8 +39407,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39405
39407
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
39406
39408
|
onClick: handleRemove,
|
|
39407
39409
|
style: _objectSpread2({
|
|
39408
|
-
backgroundColor: selectedOption !== null &&
|
|
39409
|
-
color: selectedOption !== null &&
|
|
39410
|
+
backgroundColor: (_selectedOption = selectedOption) !== null && _selectedOption !== void 0 && _selectedOption.color ? (_selectedOption2 = selectedOption) === null || _selectedOption2 === void 0 ? void 0 : _selectedOption2.color : '#f8e6ec',
|
|
39411
|
+
color: (_selectedOption3 = selectedOption) !== null && _selectedOption3 !== void 0 && _selectedOption3.color ? inverseColor((_selectedOption4 = selectedOption) === null || _selectedOption4 === void 0 ? void 0 : _selectedOption4.color) : '#333',
|
|
39410
39412
|
padding: '6px 12px',
|
|
39411
39413
|
fontSize: '14px',
|
|
39412
39414
|
borderRadius: '8px',
|