arengibook 2.4.644 → 2.4.646
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 +15 -35
- 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,34 @@ 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]);
|
|
39362
39349
|
var selectedItemTemplate = function selectedItemTemplate(option) {
|
|
39350
|
+
var _selectedOption, _selectedOption2, _selectedOption3, _selectedOption4;
|
|
39363
39351
|
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
39364
|
-
|
|
39365
|
-
return opt[optionValue] === option;
|
|
39366
|
-
});
|
|
39367
|
-
if (!selectedOption) return null;
|
|
39352
|
+
|
|
39368
39353
|
console.log("ecoute de selectedOption");
|
|
39369
|
-
console.log(selectedOptionsObjects.find(function (opt) {
|
|
39370
|
-
return opt[optionValue] === option;
|
|
39371
|
-
}));
|
|
39372
39354
|
console.log(loadedOptions.find(function (opt) {
|
|
39373
39355
|
return opt[optionValue] === option;
|
|
39374
39356
|
}));
|
|
39375
39357
|
console.log(loadedOptions.find(function (opt) {
|
|
39376
39358
|
return Number(opt[optionValue]) === Number(option);
|
|
39377
39359
|
}));
|
|
39378
|
-
console.log(selectedOption);
|
|
39379
39360
|
console.log(objValue);
|
|
39380
39361
|
console.log(selectedOptions);
|
|
39381
39362
|
console.log(loadedOptions);
|
|
39382
39363
|
console.log(option);
|
|
39383
39364
|
|
|
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
39365
|
// 1. Cherche d'abord dans objValue (pour l'affichage immédiat)
|
|
39394
|
-
|
|
39366
|
+
var selectedOption = objValue.find(function (opt) {
|
|
39367
|
+
return opt[optionValue] === option;
|
|
39368
|
+
});
|
|
39395
39369
|
// 2. Si non trouvé, cherche dans loadedOptions (pour les cas où objValue est obsolète)
|
|
39396
|
-
|
|
39370
|
+
if (!selectedOption && loadedOptions.length > 0) {
|
|
39371
|
+
selectedOption = loadedOptions.find(function (opt) {
|
|
39372
|
+
return opt[optionValue] === option;
|
|
39373
|
+
});
|
|
39374
|
+
}
|
|
39375
|
+
console.log(selectedOption);
|
|
39376
|
+
if (!selectedOption) return null;
|
|
39397
39377
|
var handleRemove = function handleRemove(e) {
|
|
39398
39378
|
e.stopPropagation();
|
|
39399
39379
|
var newSelectedOptions = selectedOptions.filter(function (opt) {
|
|
@@ -39405,8 +39385,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39405
39385
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
39406
39386
|
onClick: handleRemove,
|
|
39407
39387
|
style: _objectSpread2({
|
|
39408
|
-
backgroundColor: selectedOption !== null &&
|
|
39409
|
-
color: selectedOption !== null &&
|
|
39388
|
+
backgroundColor: (_selectedOption = selectedOption) !== null && _selectedOption !== void 0 && _selectedOption.color ? (_selectedOption2 = selectedOption) === null || _selectedOption2 === void 0 ? void 0 : _selectedOption2.color : '#f8e6ec',
|
|
39389
|
+
color: (_selectedOption3 = selectedOption) !== null && _selectedOption3 !== void 0 && _selectedOption3.color ? inverseColor((_selectedOption4 = selectedOption) === null || _selectedOption4 === void 0 ? void 0 : _selectedOption4.color) : '#333',
|
|
39410
39390
|
padding: '6px 12px',
|
|
39411
39391
|
fontSize: '14px',
|
|
39412
39392
|
borderRadius: '8px',
|