arengibook 2.4.563 → 2.4.565
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 +79 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35801,6 +35801,8 @@ var PopupPresets = {
|
|
|
35801
35801
|
var Dropdown = function Dropdown(_ref) {
|
|
35802
35802
|
var _ref$options = _ref.options,
|
|
35803
35803
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
35804
|
+
_ref$isGroupedOption = _ref.isGroupedOption,
|
|
35805
|
+
isGroupedOption = _ref$isGroupedOption === void 0 ? false : _ref$isGroupedOption,
|
|
35804
35806
|
value = _ref.value,
|
|
35805
35807
|
_ref$placeholder = _ref.placeholder,
|
|
35806
35808
|
placeholder = _ref$placeholder === void 0 ? 'Sélectionnez une option' : _ref$placeholder,
|
|
@@ -35819,7 +35821,10 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35819
35821
|
_ref$valueStyle = _ref.valueStyle,
|
|
35820
35822
|
valueStyle = _ref$valueStyle === void 0 ? {} : _ref$valueStyle,
|
|
35821
35823
|
_ref$optionStyle = _ref.optionStyle,
|
|
35822
|
-
optionStyle = _ref$optionStyle === void 0 ? {} : _ref$optionStyle
|
|
35824
|
+
optionStyle = _ref$optionStyle === void 0 ? {} : _ref$optionStyle,
|
|
35825
|
+
name = _ref.name,
|
|
35826
|
+
_ref$showClear = _ref.showClear,
|
|
35827
|
+
showClear = _ref$showClear === void 0 ? false : _ref$showClear;
|
|
35823
35828
|
var _useState = useState(value !== null && value !== void 0 ? value : null),
|
|
35824
35829
|
_useState2 = _slicedToArray$8(_useState, 2),
|
|
35825
35830
|
optionSelected = _useState2[0],
|
|
@@ -35860,11 +35865,72 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35860
35865
|
}, valueStyle)
|
|
35861
35866
|
}, (option === null || option === void 0 ? void 0 : option.label) || placeholder);
|
|
35862
35867
|
};
|
|
35868
|
+
var formatGroupedOptions = function formatGroupedOptions(options) {
|
|
35869
|
+
return Object.entries(options).map(function (_ref2) {
|
|
35870
|
+
var _ref3 = _slicedToArray$8(_ref2, 2),
|
|
35871
|
+
groupLabel = _ref3[0],
|
|
35872
|
+
groupItems = _ref3[1];
|
|
35873
|
+
return {
|
|
35874
|
+
label: groupLabel,
|
|
35875
|
+
items: Object.entries(groupItems).map(function (_ref4) {
|
|
35876
|
+
var _ref5 = _slicedToArray$8(_ref4, 2),
|
|
35877
|
+
label = _ref5[0],
|
|
35878
|
+
value = _ref5[1];
|
|
35879
|
+
return {
|
|
35880
|
+
label: label,
|
|
35881
|
+
value: value
|
|
35882
|
+
};
|
|
35883
|
+
})
|
|
35884
|
+
};
|
|
35885
|
+
});
|
|
35886
|
+
};
|
|
35887
|
+
var finalOptions = isGroupedOption ? formatGroupedOptions(options) : options;
|
|
35888
|
+
var groupedItemTemplateConfig = {
|
|
35889
|
+
showIcon: true,
|
|
35890
|
+
iconKey: 'icon',
|
|
35891
|
+
showImage: true,
|
|
35892
|
+
imageKey: 'image',
|
|
35893
|
+
imageStyle: {
|
|
35894
|
+
width: '18px',
|
|
35895
|
+
marginRight: '0.5rem'
|
|
35896
|
+
}
|
|
35897
|
+
};
|
|
35898
|
+
var groupedItemTemplate = function groupedItemTemplate(option) {
|
|
35899
|
+
var _ref6 = groupedItemTemplateConfig !== null && groupedItemTemplateConfig !== void 0 ? groupedItemTemplateConfig : {},
|
|
35900
|
+
showImage = _ref6.showImage,
|
|
35901
|
+
imageKey = _ref6.imageKey,
|
|
35902
|
+
imageStyle = _ref6.imageStyle,
|
|
35903
|
+
showIcon = _ref6.showIcon,
|
|
35904
|
+
iconKey = _ref6.iconKey;
|
|
35905
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
35906
|
+
className: "flex align-items-center"
|
|
35907
|
+
}, showImage && option[imageKey] && /*#__PURE__*/React__default.createElement("img", {
|
|
35908
|
+
alt: option.label,
|
|
35909
|
+
src: option[imageKey],
|
|
35910
|
+
style: imageStyle || {
|
|
35911
|
+
width: '18px',
|
|
35912
|
+
marginRight: '0.5rem'
|
|
35913
|
+
},
|
|
35914
|
+
className: "mr-2"
|
|
35915
|
+
}), showIcon && option[iconKey] && /*#__PURE__*/React__default.createElement("i", {
|
|
35916
|
+
className: "mr-2 ".concat(option[iconKey])
|
|
35917
|
+
}), /*#__PURE__*/React__default.createElement("div", null, option.label));
|
|
35918
|
+
};
|
|
35919
|
+
|
|
35920
|
+
// const groupedItemTemplate = (option) => {
|
|
35921
|
+
// return (
|
|
35922
|
+
// <div className="flex align-items-center">
|
|
35923
|
+
// <img alt={option.label} src="https://primefaces.org/cdn/primereact/images/flag/flag_placeholder.png" className={`mr-2 flag flag-${option.code.toLowerCase()}`} style={{ width: '18px' }} />
|
|
35924
|
+
// <div>{option.label}</div>
|
|
35925
|
+
// </div>
|
|
35926
|
+
// );
|
|
35927
|
+
// };
|
|
35928
|
+
|
|
35863
35929
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
35864
35930
|
className: "flex flex-col gap-1"
|
|
35865
|
-
}, /*#__PURE__*/React__default.createElement(Dropdown$1, {
|
|
35931
|
+
}, /*#__PURE__*/React__default.createElement(Dropdown$1, _extends$A({
|
|
35866
35932
|
value: optionSelected,
|
|
35867
|
-
options:
|
|
35933
|
+
options: finalOptions,
|
|
35868
35934
|
onChange: function onChange(e) {
|
|
35869
35935
|
return setOptionSelected(e.value);
|
|
35870
35936
|
},
|
|
@@ -35876,7 +35942,16 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35876
35942
|
style: style,
|
|
35877
35943
|
itemTemplate: optionTemplate,
|
|
35878
35944
|
valueTemplate: valueTemplate,
|
|
35879
|
-
onHide: resetDropdownFilter
|
|
35945
|
+
onHide: resetDropdownFilter,
|
|
35946
|
+
showClear: showClear
|
|
35947
|
+
}, isGroupedOption && {
|
|
35948
|
+
optionGroupLabel: 'label',
|
|
35949
|
+
optionGroupChildren: 'items',
|
|
35950
|
+
optionGroupTemplate: groupedItemTemplate
|
|
35951
|
+
})), name && /*#__PURE__*/React__default.createElement("input", {
|
|
35952
|
+
type: "hidden",
|
|
35953
|
+
name: name,
|
|
35954
|
+
value: optionSelected !== null && optionSelected !== void 0 ? optionSelected : ''
|
|
35880
35955
|
}), invalid && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("small", {
|
|
35881
35956
|
style: {
|
|
35882
35957
|
color: 'red',
|