arengibook 2.4.613 → 2.4.615
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 +41 -80
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36039,7 +36039,8 @@ var DropdownSelectMetaAsync = function DropdownSelectMetaAsync(_ref) {
|
|
|
36039
36039
|
};
|
|
36040
36040
|
var style = {
|
|
36041
36041
|
border: invalid ? '1px solid red' : '1px solid #ccc',
|
|
36042
|
-
width: '100%'
|
|
36042
|
+
width: '100%',
|
|
36043
|
+
minHeight: '45px'
|
|
36043
36044
|
};
|
|
36044
36045
|
useEffect(function () {
|
|
36045
36046
|
setOptionSelected(objValue ? objValue === null || objValue === void 0 ? void 0 : objValue[optionValue] : value !== null && value !== void 0 ? value : null);
|
|
@@ -36086,16 +36087,6 @@ var DropdownSelectMetaAsync = function DropdownSelectMetaAsync(_ref) {
|
|
|
36086
36087
|
setIsEditing(false);
|
|
36087
36088
|
}
|
|
36088
36089
|
};
|
|
36089
|
-
var handleClear = function handleClear() {
|
|
36090
|
-
setOptionSelected(null);
|
|
36091
|
-
setInputValue('');
|
|
36092
|
-
if (onChange) onChange(null);
|
|
36093
|
-
options('', [], {
|
|
36094
|
-
page: 1
|
|
36095
|
-
}).then(function (result) {
|
|
36096
|
-
setLoadedOptions((result === null || result === void 0 ? void 0 : result.options) || []);
|
|
36097
|
-
});
|
|
36098
|
-
};
|
|
36099
36090
|
useEffect(function () {
|
|
36100
36091
|
var _dropdownRef$current;
|
|
36101
36092
|
var clearButton = (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.querySelector('.p-dropdown-clear-icon');
|
|
@@ -36112,15 +36103,25 @@ var DropdownSelectMetaAsync = function DropdownSelectMetaAsync(_ref) {
|
|
|
36112
36103
|
setOptionSelected(e.value);
|
|
36113
36104
|
if (clickedFromList.current) {
|
|
36114
36105
|
var _selected$optionLabel;
|
|
36106
|
+
setIsEditing(false);
|
|
36115
36107
|
var selected = loadedOptions.find(function (opt) {
|
|
36116
36108
|
return opt[optionValue] === e.value;
|
|
36117
36109
|
});
|
|
36118
36110
|
setInputValue((_selected$optionLabel = selected === null || selected === void 0 ? void 0 : selected[optionLabel]) !== null && _selected$optionLabel !== void 0 ? _selected$optionLabel : '');
|
|
36119
|
-
setIsEditing(true);
|
|
36120
36111
|
}
|
|
36121
36112
|
clickedFromList.current = false;
|
|
36122
36113
|
if (onChange) onChange(e.value);
|
|
36123
36114
|
};
|
|
36115
|
+
var handleClear = function handleClear() {
|
|
36116
|
+
setOptionSelected(null);
|
|
36117
|
+
setInputValue('');
|
|
36118
|
+
if (onChange) onChange(null);
|
|
36119
|
+
options('', [], {
|
|
36120
|
+
page: 1
|
|
36121
|
+
}).then(function (result) {
|
|
36122
|
+
setLoadedOptions((result === null || result === void 0 ? void 0 : result.options) || []);
|
|
36123
|
+
});
|
|
36124
|
+
};
|
|
36124
36125
|
var handleInputChange = /*#__PURE__*/function () {
|
|
36125
36126
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
|
|
36126
36127
|
var search, result, _result$options2, _result, filteredOptions;
|
|
@@ -36181,8 +36182,8 @@ var DropdownSelectMetaAsync = function DropdownSelectMetaAsync(_ref) {
|
|
|
36181
36182
|
}, placeholder);
|
|
36182
36183
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
36183
36184
|
style: _objectSpread2({
|
|
36184
|
-
backgroundColor: selectedOption !== null && selectedOption !== void 0 && selectedOption.color ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.color : '#
|
|
36185
|
-
color: selectedOption !== null && selectedOption !== void 0 && selectedOption.color ? inverseColor(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.color) : '#
|
|
36185
|
+
backgroundColor: selectedOption !== null && selectedOption !== void 0 && selectedOption.color ? selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.color : '#FFFFFF',
|
|
36186
|
+
color: selectedOption !== null && selectedOption !== void 0 && selectedOption.color ? inverseColor(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.color) : '#FFFFFF',
|
|
36186
36187
|
padding: '6px 12px',
|
|
36187
36188
|
fontSize: '14px',
|
|
36188
36189
|
borderRadius: '8px',
|
|
@@ -36261,7 +36262,7 @@ var DropdownSelectMetaAsync = function DropdownSelectMetaAsync(_ref) {
|
|
|
36261
36262
|
options: loadedOptions,
|
|
36262
36263
|
onChange: handleChange,
|
|
36263
36264
|
filter: filter,
|
|
36264
|
-
placeholder: placeholder,
|
|
36265
|
+
placeholder: placeholder === "" || placeholder === null ? ' ' : placeholder,
|
|
36265
36266
|
optionLabel: optionLabel,
|
|
36266
36267
|
optionValue: optionValue,
|
|
36267
36268
|
showClear: true,
|
|
@@ -36311,7 +36312,7 @@ var Dropdown = function Dropdown(props) {
|
|
|
36311
36312
|
isGroupedOption = _props$isGroupedOptio === void 0 ? false : _props$isGroupedOptio,
|
|
36312
36313
|
value = props.value,
|
|
36313
36314
|
_props$placeholder = props.placeholder,
|
|
36314
|
-
placeholder = _props$placeholder === void 0 ? '
|
|
36315
|
+
placeholder = _props$placeholder === void 0 ? ' ' : _props$placeholder,
|
|
36315
36316
|
_props$disabled = props.disabled,
|
|
36316
36317
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
36317
36318
|
_props$filter = props.filter,
|
|
@@ -36713,12 +36714,12 @@ var DropdownPresets = {
|
|
|
36713
36714
|
}
|
|
36714
36715
|
},
|
|
36715
36716
|
SelectMetaSync: {
|
|
36716
|
-
placeholder: 'Sélectionnez une couleur',
|
|
36717
36717
|
options: optionsWithColors,
|
|
36718
|
-
value: '
|
|
36718
|
+
value: 'bleu',
|
|
36719
36719
|
// objValue: { label: 'Bleu', value: 'bleu', color: '#000000' },
|
|
36720
36720
|
isSelectMeta: true,
|
|
36721
|
-
|
|
36721
|
+
placeholder: "",
|
|
36722
|
+
editable: true,
|
|
36722
36723
|
selectMetaConfig: {
|
|
36723
36724
|
generalIcon: 'pi pi-circle-fill'
|
|
36724
36725
|
},
|
|
@@ -36773,6 +36774,7 @@ var DropdownPresets = {
|
|
|
36773
36774
|
}(),
|
|
36774
36775
|
value: 23,
|
|
36775
36776
|
// objValue: { label: 'Option 24', value: '24', color: '#000000' },
|
|
36777
|
+
placeholder: "",
|
|
36776
36778
|
editable: true,
|
|
36777
36779
|
filter: false,
|
|
36778
36780
|
selectMetaConfig: {
|
|
@@ -39120,8 +39122,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39120
39122
|
setLoadedOptions = _useState4[1];
|
|
39121
39123
|
var _useState5 = useState(''),
|
|
39122
39124
|
_useState6 = _slicedToArray$9(_useState5, 2),
|
|
39123
|
-
inputValue = _useState6[0]
|
|
39124
|
-
|
|
39125
|
+
inputValue = _useState6[0];
|
|
39126
|
+
_useState6[1];
|
|
39125
39127
|
var multiSelectRef = useRef(null);
|
|
39126
39128
|
var _useState7 = useState(false),
|
|
39127
39129
|
_useState8 = _slicedToArray$9(_useState7, 2),
|
|
@@ -39131,9 +39133,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39131
39133
|
var currentPageRef = useRef(1);
|
|
39132
39134
|
var isOptionsArray = Array.isArray(options);
|
|
39133
39135
|
useEffect(function () {
|
|
39134
|
-
if (objValue) {
|
|
39135
|
-
setValueToOptionMap(objValue);
|
|
39136
|
-
}
|
|
39137
39136
|
if (isOptionsArray) {
|
|
39138
39137
|
setLoadedOptions(options);
|
|
39139
39138
|
} else {
|
|
@@ -39169,49 +39168,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39169
39168
|
if (onChange) onChange(e.value);
|
|
39170
39169
|
};
|
|
39171
39170
|
|
|
39172
|
-
// Filtre des options lors de la saisie
|
|
39173
|
-
var handleInputChange = /*#__PURE__*/function () {
|
|
39174
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
|
|
39175
|
-
var search, result, _result$options, _result, filteredOptions;
|
|
39176
|
-
return _regenerator().w(function (_context2) {
|
|
39177
|
-
while (1) switch (_context2.n) {
|
|
39178
|
-
case 0:
|
|
39179
|
-
search = e.target.value;
|
|
39180
|
-
setInputValue(search);
|
|
39181
|
-
if (search) {
|
|
39182
|
-
_context2.n = 2;
|
|
39183
|
-
break;
|
|
39184
|
-
}
|
|
39185
|
-
_context2.n = 1;
|
|
39186
|
-
return options('', [], {
|
|
39187
|
-
page: 1
|
|
39188
|
-
});
|
|
39189
|
-
case 1:
|
|
39190
|
-
result = _context2.v;
|
|
39191
|
-
setLoadedOptions((result === null || result === void 0 ? void 0 : result.options) || []);
|
|
39192
|
-
_context2.n = 4;
|
|
39193
|
-
break;
|
|
39194
|
-
case 2:
|
|
39195
|
-
_context2.n = 3;
|
|
39196
|
-
return options(search, [], {
|
|
39197
|
-
page: 1
|
|
39198
|
-
});
|
|
39199
|
-
case 3:
|
|
39200
|
-
_result = _context2.v;
|
|
39201
|
-
filteredOptions = (_result === null || _result === void 0 || (_result$options = _result.options) === null || _result$options === void 0 ? void 0 : _result$options.filter(function (opt) {
|
|
39202
|
-
return opt[optionLabel].toLowerCase().includes(search.toLowerCase());
|
|
39203
|
-
})) || [];
|
|
39204
|
-
setLoadedOptions(filteredOptions);
|
|
39205
|
-
case 4:
|
|
39206
|
-
return _context2.a(2);
|
|
39207
|
-
}
|
|
39208
|
-
}, _callee2);
|
|
39209
|
-
}));
|
|
39210
|
-
return function handleInputChange(_x) {
|
|
39211
|
-
return _ref3.apply(this, arguments);
|
|
39212
|
-
};
|
|
39213
|
-
}();
|
|
39214
|
-
|
|
39215
39171
|
// Inversion de couleur pour le texte des badges
|
|
39216
39172
|
var inverseColor = function inverseColor(hexColor) {
|
|
39217
39173
|
var r = parseInt(hexColor.substr(1, 2), 16);
|
|
@@ -39226,9 +39182,9 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39226
39182
|
};
|
|
39227
39183
|
var optionTemplate = function optionTemplate(option) {
|
|
39228
39184
|
if (!option) return null;
|
|
39229
|
-
var
|
|
39230
|
-
|
|
39231
|
-
var generalIcon =
|
|
39185
|
+
var _ref3 = selectMetaConfig || {};
|
|
39186
|
+
_ref3.labelStyle;
|
|
39187
|
+
var generalIcon = _ref3.generalIcon;
|
|
39232
39188
|
var styleLabel = {
|
|
39233
39189
|
marginLeft: '10px'
|
|
39234
39190
|
};
|
|
@@ -39292,19 +39248,19 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39292
39248
|
if (loadLazyTimeout.current) {
|
|
39293
39249
|
clearTimeout(loadLazyTimeout.current);
|
|
39294
39250
|
}
|
|
39295
|
-
loadLazyTimeout.current = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
39296
|
-
var first, last, _items, result, newOptions, i;
|
|
39297
|
-
return _regenerator().w(function (
|
|
39298
|
-
while (1) switch (
|
|
39251
|
+
loadLazyTimeout.current = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
39252
|
+
var first, last, _items, result, newOptions, i, virtualscroll;
|
|
39253
|
+
return _regenerator().w(function (_context2) {
|
|
39254
|
+
while (1) switch (_context2.n) {
|
|
39299
39255
|
case 0:
|
|
39300
39256
|
first = event.first, last = event.last;
|
|
39301
39257
|
_items = _toConsumableArray$7(loadedOptions);
|
|
39302
|
-
|
|
39258
|
+
_context2.n = 1;
|
|
39303
39259
|
return options(inputValue, [], {
|
|
39304
39260
|
page: currentPageRef.current + 1
|
|
39305
39261
|
});
|
|
39306
39262
|
case 1:
|
|
39307
|
-
result =
|
|
39263
|
+
result = _context2.v;
|
|
39308
39264
|
newOptions = (result === null || result === void 0 ? void 0 : result.options) || [];
|
|
39309
39265
|
for (i = first; i < last; i++) {
|
|
39310
39266
|
if (!_items[i] && newOptions[i - first]) {
|
|
@@ -39314,10 +39270,16 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39314
39270
|
setLoadedOptions(_items);
|
|
39315
39271
|
setLoading(false);
|
|
39316
39272
|
currentPageRef.current += 1;
|
|
39273
|
+
|
|
39274
|
+
// redimensionnement du conteneur
|
|
39275
|
+
virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
|
|
39276
|
+
if (virtualscroll) {
|
|
39277
|
+
virtualscroll.style.height = "auto";
|
|
39278
|
+
}
|
|
39317
39279
|
case 2:
|
|
39318
|
-
return
|
|
39280
|
+
return _context2.a(2);
|
|
39319
39281
|
}
|
|
39320
|
-
},
|
|
39282
|
+
}, _callee2);
|
|
39321
39283
|
})), 500);
|
|
39322
39284
|
};
|
|
39323
39285
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -39333,13 +39295,12 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39333
39295
|
style: style,
|
|
39334
39296
|
showSelectAll: showSelectAll,
|
|
39335
39297
|
disabled: disabled,
|
|
39336
|
-
filter:
|
|
39298
|
+
filter: true,
|
|
39337
39299
|
placeholder: placeholder,
|
|
39338
39300
|
optionLabel: optionLabel,
|
|
39339
39301
|
optionValue: optionValue,
|
|
39340
39302
|
showClear: showClear,
|
|
39341
39303
|
value: selectedOptions,
|
|
39342
|
-
onFilterChange: handleInputChange,
|
|
39343
39304
|
itemTemplate: optionTemplate,
|
|
39344
39305
|
selectedItemTemplate: selectedItemTemplate,
|
|
39345
39306
|
className: "w-full md:w-14rem",
|