arengibook 2.4.647 → 2.4.648
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 +62 -80
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39260,7 +39260,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39260
39260
|
options: []
|
|
39261
39261
|
};
|
|
39262
39262
|
case 5:
|
|
39263
|
-
setLoadedOptions(
|
|
39263
|
+
// setLoadedOptions(result?.options || []);
|
|
39264
|
+
setLoadedOptions(_flattenOptions(((_result = result) === null || _result === void 0 ? void 0 : _result.options) || []));
|
|
39264
39265
|
if (objValue) {
|
|
39265
39266
|
exists = (_result2 = result) === null || _result2 === void 0 || (_result2 = _result2.options) === null || _result2 === void 0 ? void 0 : _result2.some(function (opt) {
|
|
39266
39267
|
return opt[optionValue] === objValue[optionValue];
|
|
@@ -39346,50 +39347,76 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39346
39347
|
style: styleLabel
|
|
39347
39348
|
}, option[optionLabel]));
|
|
39348
39349
|
};
|
|
39350
|
+
|
|
39351
|
+
// const selectedItemTemplate = (option) => {
|
|
39352
|
+
//
|
|
39353
|
+
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
39354
|
+
// if (!selectedOption) return null;
|
|
39355
|
+
// // const isLastItem = index === selectedOptions.length - 1;
|
|
39356
|
+
// const handleRemove = (e) => {
|
|
39357
|
+
// e.stopPropagation();
|
|
39358
|
+
// const newSelectedOptions = selectedOptions.filter(opt => opt !== option);
|
|
39359
|
+
// setSelectedOptions(newSelectedOptions);
|
|
39360
|
+
// if (onChange) onChange(newSelectedOptions);
|
|
39361
|
+
// };
|
|
39362
|
+
//
|
|
39363
|
+
// return (
|
|
39364
|
+
// <span
|
|
39365
|
+
// onClick={handleRemove}
|
|
39366
|
+
// style={{
|
|
39367
|
+
// backgroundColor: selectedOption?.color ? selectedOption?.color : '#f8e6ec',
|
|
39368
|
+
// color: selectedOption?.color ? inverseColor(selectedOption?.color) : '#333',
|
|
39369
|
+
// padding: '6px 12px',
|
|
39370
|
+
// fontSize: '14px',
|
|
39371
|
+
// borderRadius: '8px',
|
|
39372
|
+
// boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.15)',
|
|
39373
|
+
// display: 'inline-block',
|
|
39374
|
+
// marginBottom: '5px',
|
|
39375
|
+
// fontFamily: 'Arial',
|
|
39376
|
+
// cursor: 'pointer',
|
|
39377
|
+
// marginRight: '15px',
|
|
39378
|
+
// ...valueStyle,
|
|
39379
|
+
// }}
|
|
39380
|
+
// >
|
|
39381
|
+
// {selectedOption[optionLabel]}
|
|
39382
|
+
// <span style={{ marginLeft: '5px' }}>×</span>
|
|
39383
|
+
// </span>
|
|
39384
|
+
// );
|
|
39385
|
+
//
|
|
39386
|
+
//
|
|
39387
|
+
// };
|
|
39388
|
+
|
|
39349
39389
|
var _flattenOptions = function flattenOptions(options) {
|
|
39350
|
-
|
|
39351
|
-
|
|
39352
|
-
|
|
39353
|
-
|
|
39390
|
+
if (!Array.isArray(options)) return [];
|
|
39391
|
+
return options.reduce(function (acc, item) {
|
|
39392
|
+
if (Array.isArray(item)) {
|
|
39393
|
+
acc.push.apply(acc, _toConsumableArray$7(_flattenOptions(item))); // récursion
|
|
39354
39394
|
} else {
|
|
39355
|
-
|
|
39356
|
-
return [].concat(_toConsumableArray$7(acc), [option]);
|
|
39395
|
+
acc.push(item);
|
|
39357
39396
|
}
|
|
39397
|
+
return acc;
|
|
39358
39398
|
}, []);
|
|
39359
39399
|
};
|
|
39360
|
-
var selectedItemTemplate = function selectedItemTemplate(
|
|
39361
|
-
|
|
39362
|
-
|
|
39363
|
-
|
|
39400
|
+
var selectedItemTemplate = function selectedItemTemplate(paramValue, index) {
|
|
39401
|
+
// const selectedOption = loadedOptions.find(opt => opt[optionValue] === paramValue);
|
|
39402
|
+
var selectedOption = loadedOptions.find(function (opt) {
|
|
39403
|
+
return opt[optionValue] === paramValue;
|
|
39404
|
+
});
|
|
39364
39405
|
console.log("ecoute de selectedOption");
|
|
39365
39406
|
console.log(loadedOptions.find(function (opt) {
|
|
39366
|
-
return opt[optionValue] ===
|
|
39367
|
-
}));
|
|
39368
|
-
console.log(loadedOptions.find(function (opt) {
|
|
39369
|
-
return Number(opt[optionValue]) === Number(option);
|
|
39407
|
+
return opt[optionValue] === paramValue;
|
|
39370
39408
|
}));
|
|
39409
|
+
console.log(selectedOption);
|
|
39371
39410
|
console.log(objValue);
|
|
39411
|
+
console.log(paramValue);
|
|
39372
39412
|
console.log(selectedOptions);
|
|
39373
39413
|
console.log(loadedOptions);
|
|
39374
|
-
console.log(option);
|
|
39375
|
-
|
|
39376
|
-
// Aplatir loadedOptions
|
|
39377
|
-
var flattenedLoadedOptions = _flattenOptions(loadedOptions);
|
|
39378
|
-
|
|
39379
|
-
// Chercher l'option dans objValue d'abord, puis dans flattenedLoadedOptions
|
|
39380
|
-
var selectedOption = objValue.find(function (opt) {
|
|
39381
|
-
return opt[optionValue] === option;
|
|
39382
|
-
});
|
|
39383
|
-
if (!selectedOption) {
|
|
39384
|
-
selectedOption = flattenedLoadedOptions.find(function (opt) {
|
|
39385
|
-
return opt[optionValue] === option;
|
|
39386
|
-
});
|
|
39387
|
-
}
|
|
39388
39414
|
if (!selectedOption) return null;
|
|
39415
|
+
// const isLastItem = index === selectedOptions.length - 1;
|
|
39389
39416
|
var handleRemove = function handleRemove(e) {
|
|
39390
39417
|
e.stopPropagation();
|
|
39391
39418
|
var newSelectedOptions = selectedOptions.filter(function (opt) {
|
|
39392
|
-
return opt !==
|
|
39419
|
+
return opt !== paramValue;
|
|
39393
39420
|
});
|
|
39394
39421
|
setSelectedOptions(newSelectedOptions);
|
|
39395
39422
|
if (onChange) onChange(newSelectedOptions);
|
|
@@ -39397,8 +39424,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39397
39424
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
39398
39425
|
onClick: handleRemove,
|
|
39399
39426
|
style: _objectSpread2({
|
|
39400
|
-
backgroundColor:
|
|
39401
|
-
color:
|
|
39427
|
+
backgroundColor: selectedOption !== null && selectedOption !== void 0 && selectedOption.color ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.color : '#f8e6ec',
|
|
39428
|
+
color: selectedOption !== null && selectedOption !== void 0 && selectedOption.color ? inverseColor(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.color) : '#333',
|
|
39402
39429
|
padding: '6px 12px',
|
|
39403
39430
|
fontSize: '14px',
|
|
39404
39431
|
borderRadius: '8px',
|
|
@@ -39416,52 +39443,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39416
39443
|
}, "\xD7"));
|
|
39417
39444
|
};
|
|
39418
39445
|
|
|
39419
|
-
// const selectedItemTemplate = (paramValue, index) => {
|
|
39420
|
-
// // const selectedOption = loadedOptions.find(opt => opt[optionValue] === paramValue);
|
|
39421
|
-
// const selectedOption = objValue.find(opt => opt[optionValue] === paramValue);
|
|
39422
|
-
//
|
|
39423
|
-
// console.log("ecoute de selectedOption")
|
|
39424
|
-
// console.log(loadedOptions.find(opt => opt[optionValue] === paramValue))
|
|
39425
|
-
// console.log(selectedOption)
|
|
39426
|
-
// console.log(objValue)
|
|
39427
|
-
// console.log(paramValue)
|
|
39428
|
-
// console.log(selectedOptions)
|
|
39429
|
-
// console.log(loadedOptions)
|
|
39430
|
-
//
|
|
39431
|
-
// if (!selectedOption) return null;
|
|
39432
|
-
// // const isLastItem = index === selectedOptions.length - 1;
|
|
39433
|
-
// const handleRemove = (e) => {
|
|
39434
|
-
// e.stopPropagation();
|
|
39435
|
-
// const newSelectedOptions = selectedOptions.filter(opt => opt !== paramValue);
|
|
39436
|
-
// setSelectedOptions(newSelectedOptions);
|
|
39437
|
-
// if (onChange) onChange(newSelectedOptions);
|
|
39438
|
-
// };
|
|
39439
|
-
//
|
|
39440
|
-
// return (
|
|
39441
|
-
// <span
|
|
39442
|
-
// onClick={handleRemove}
|
|
39443
|
-
// style={{
|
|
39444
|
-
// backgroundColor: selectedOption?.color ? selectedOption?.color : '#f8e6ec',
|
|
39445
|
-
// color: selectedOption?.color ? inverseColor(selectedOption?.color) : '#333',
|
|
39446
|
-
// padding: '6px 12px',
|
|
39447
|
-
// fontSize: '14px',
|
|
39448
|
-
// borderRadius: '8px',
|
|
39449
|
-
// boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.15)',
|
|
39450
|
-
// display: 'inline-block',
|
|
39451
|
-
// marginBottom: '5px',
|
|
39452
|
-
// fontFamily: 'Arial',
|
|
39453
|
-
// cursor: 'pointer',
|
|
39454
|
-
// marginRight: '15px',
|
|
39455
|
-
// ...valueStyle,
|
|
39456
|
-
// }}
|
|
39457
|
-
// >
|
|
39458
|
-
// {selectedOption[optionLabel]}
|
|
39459
|
-
// <span style={{ marginLeft: '5px' }}>×</span>
|
|
39460
|
-
// </span>
|
|
39461
|
-
// );
|
|
39462
|
-
//
|
|
39463
|
-
// };
|
|
39464
|
-
|
|
39465
39446
|
// Fonction de lazy loading
|
|
39466
39447
|
var onLazyLoad = function onLazyLoad(event) {
|
|
39467
39448
|
if (isOptionsArray) return;
|
|
@@ -39513,7 +39494,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39513
39494
|
_items[i] = newOptions[i - first];
|
|
39514
39495
|
}
|
|
39515
39496
|
}
|
|
39516
|
-
setLoadedOptions(_items);
|
|
39497
|
+
// setLoadedOptions(_items);
|
|
39498
|
+
setLoadedOptions(_flattenOptions(_items));
|
|
39517
39499
|
setLoading(false);
|
|
39518
39500
|
currentPageRef.current += 1;
|
|
39519
39501
|
// Redimensionnement du conteneur
|
|
@@ -39534,7 +39516,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39534
39516
|
width: '100%'
|
|
39535
39517
|
}
|
|
39536
39518
|
}, /*#__PURE__*/React__default.createElement(MultiSelect$1, {
|
|
39537
|
-
options: loadedOptions,
|
|
39519
|
+
options: _flattenOptions(loadedOptions),
|
|
39538
39520
|
onChange: handleChange,
|
|
39539
39521
|
style: style,
|
|
39540
39522
|
showSelectAll: showSelectAll,
|