arengibook 2.4.695 → 2.4.697
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 +58 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40006,7 +40006,8 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
40006
40006
|
}, !useCheckbox && /*#__PURE__*/React__default.createElement("style", null, "\n .p-multiselect-items .p-multiselect-item .p-checkbox {\n display: none !important;\n }\n .p-multiselect-items .p-multiselect-item {\n padding-left: 1rem !important;\n align-items: center;\n }\n "), !filter && !showSelectAll && /*#__PURE__*/React__default.createElement("style", null, "\n .p-multiselect-header {\n display: none !important;\n }\n "), option[optionLabel]);
|
|
40007
40007
|
}
|
|
40008
40008
|
};
|
|
40009
|
-
selectedOptions ? selectedOptions.length : 0;
|
|
40009
|
+
var selectedOptionsCount = selectedOptions ? selectedOptions.length : 0;
|
|
40010
|
+
var selectedOptionsText = selectedOptionsCount > 0 ? "".concat(selectedOptionsCount, " option").concat(selectedOptionsCount > 1 ? 's' : '', " s\xE9lectionn\xE9e").concat(selectedOptionsCount > 1 ? 's' : '') : placeholder;
|
|
40010
40011
|
var inverseColor = function inverseColor(hexColor) {
|
|
40011
40012
|
var r = parseInt(hexColor.substr(1, 2), 16);
|
|
40012
40013
|
var g = parseInt(hexColor.substr(3, 2), 16);
|
|
@@ -40241,7 +40242,9 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
40241
40242
|
}, isGroupedOption && {
|
|
40242
40243
|
optionGroupLabel: 'label',
|
|
40243
40244
|
optionGroupChildren: 'items'
|
|
40244
|
-
})),
|
|
40245
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
40246
|
+
className: "p-multiselect-label"
|
|
40247
|
+
}, selectedOptionsText), displayNbOption && selectedOptions.length > 0 && /*#__PURE__*/React__default.createElement(Badge, {
|
|
40245
40248
|
value: selectedOptions.length,
|
|
40246
40249
|
className: "custom-badge",
|
|
40247
40250
|
style: {
|
|
@@ -41780,10 +41783,8 @@ var ChipsAutoComplete = function ChipsAutoComplete(_ref) {
|
|
|
41780
41783
|
_ref$minLength = _ref.minLength,
|
|
41781
41784
|
minLength = _ref$minLength === void 0 ? 1 : _ref$minLength,
|
|
41782
41785
|
_ref$delay = _ref.delay,
|
|
41783
|
-
delay = _ref$delay === void 0 ? 300 : _ref$delay
|
|
41784
|
-
|
|
41785
|
-
* Suggestions internes (storybook / async fake)
|
|
41786
|
-
*/
|
|
41786
|
+
delay = _ref$delay === void 0 ? 300 : _ref$delay,
|
|
41787
|
+
optionsUrl = _ref.optionsUrl;
|
|
41787
41788
|
var _useState = useState([]),
|
|
41788
41789
|
_useState2 = _slicedToArray$a(_useState, 2),
|
|
41789
41790
|
internalSuggestions = _useState2[0],
|
|
@@ -41797,10 +41798,6 @@ var ChipsAutoComplete = function ChipsAutoComplete(_ref) {
|
|
|
41797
41798
|
};
|
|
41798
41799
|
}, []);
|
|
41799
41800
|
var resolvedSuggestions = Array.isArray(suggestions) && suggestions.length > 0 ? suggestions : internalSuggestions;
|
|
41800
|
-
|
|
41801
|
-
/**
|
|
41802
|
-
* Value interne (TOUJOURS un tableau)
|
|
41803
|
-
*/
|
|
41804
41801
|
var _useState3 = useState([]),
|
|
41805
41802
|
_useState4 = _slicedToArray$a(_useState3, 2),
|
|
41806
41803
|
internalValue = _useState4[0],
|
|
@@ -41813,9 +41810,57 @@ var ChipsAutoComplete = function ChipsAutoComplete(_ref) {
|
|
|
41813
41810
|
onChange(e);
|
|
41814
41811
|
}
|
|
41815
41812
|
};
|
|
41813
|
+
var fetchSuggestions = /*#__PURE__*/function () {
|
|
41814
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
41815
|
+
var query, url, response, results, _t;
|
|
41816
|
+
return _regenerator().w(function (_context) {
|
|
41817
|
+
while (1) switch (_context.n) {
|
|
41818
|
+
case 0:
|
|
41819
|
+
if (optionsUrl) {
|
|
41820
|
+
_context.n = 1;
|
|
41821
|
+
break;
|
|
41822
|
+
}
|
|
41823
|
+
return _context.a(2);
|
|
41824
|
+
case 1:
|
|
41825
|
+
query = (event.query || '').toLowerCase();
|
|
41826
|
+
url = new URL(window.location.origin + optionsUrl);
|
|
41827
|
+
url.searchParams.append('query', query);
|
|
41828
|
+
_context.p = 2;
|
|
41829
|
+
_context.n = 3;
|
|
41830
|
+
return fetch(url);
|
|
41831
|
+
case 3:
|
|
41832
|
+
response = _context.v;
|
|
41833
|
+
if (response.ok) {
|
|
41834
|
+
_context.n = 4;
|
|
41835
|
+
break;
|
|
41836
|
+
}
|
|
41837
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
41838
|
+
case 4:
|
|
41839
|
+
_context.n = 5;
|
|
41840
|
+
return response.json();
|
|
41841
|
+
case 5:
|
|
41842
|
+
results = _context.v;
|
|
41843
|
+
setInternalSuggestions(results);
|
|
41844
|
+
_context.n = 7;
|
|
41845
|
+
break;
|
|
41846
|
+
case 6:
|
|
41847
|
+
_context.p = 6;
|
|
41848
|
+
_t = _context.v;
|
|
41849
|
+
console.error('Erreur lors de la récupération des suggestions :', _t);
|
|
41850
|
+
case 7:
|
|
41851
|
+
return _context.a(2);
|
|
41852
|
+
}
|
|
41853
|
+
}, _callee, null, [[2, 6]]);
|
|
41854
|
+
}));
|
|
41855
|
+
return function fetchSuggestions(_x) {
|
|
41856
|
+
return _ref2.apply(this, arguments);
|
|
41857
|
+
};
|
|
41858
|
+
}();
|
|
41816
41859
|
var handleComplete = function handleComplete(event) {
|
|
41817
|
-
if (
|
|
41818
|
-
|
|
41860
|
+
if (optionsUrl) {
|
|
41861
|
+
fetchSuggestions(event); // Utilise la fonction asynchrone si une URL est fournie
|
|
41862
|
+
} else if (typeof completeMethod === 'function') {
|
|
41863
|
+
completeMethod(event); // Sinon, utilise la méthode fournie (comme searchSync)
|
|
41819
41864
|
}
|
|
41820
41865
|
};
|
|
41821
41866
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -41914,6 +41959,7 @@ var ChipsAutoCompletePresets = {
|
|
|
41914
41959
|
Default: {
|
|
41915
41960
|
suggestions: [],
|
|
41916
41961
|
field: 'label',
|
|
41962
|
+
optionsUrl: null,
|
|
41917
41963
|
completeMethod: searchSync
|
|
41918
41964
|
},
|
|
41919
41965
|
Disabled: {
|