arengibook 2.4.630 → 2.4.631
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 +95 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39091,7 +39091,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39091
39091
|
_ref$valueStyle = _ref.valueStyle,
|
|
39092
39092
|
valueStyle = _ref$valueStyle === void 0 ? {} : _ref$valueStyle,
|
|
39093
39093
|
_ref$filter = _ref.filter,
|
|
39094
|
-
filter = _ref$filter === void 0 ?
|
|
39094
|
+
filter = _ref$filter === void 0 ? false : _ref$filter,
|
|
39095
39095
|
_ref$invalid = _ref.invalid,
|
|
39096
39096
|
invalid = _ref$invalid === void 0 ? false : _ref$invalid,
|
|
39097
39097
|
_ref$errorMessage = _ref.errorMessage,
|
|
@@ -39119,8 +39119,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39119
39119
|
loadedOptions = _useState4[0],
|
|
39120
39120
|
setLoadedOptions = _useState4[1];
|
|
39121
39121
|
var _useState5 = useState(''),
|
|
39122
|
-
_useState6 = _slicedToArray$9(_useState5, 2)
|
|
39123
|
-
|
|
39122
|
+
_useState6 = _slicedToArray$9(_useState5, 2);
|
|
39123
|
+
_useState6[0];
|
|
39124
39124
|
_useState6[1];
|
|
39125
39125
|
var multiSelectRef = useRef(null);
|
|
39126
39126
|
var _useState7 = useState(false),
|
|
@@ -39128,8 +39128,9 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39128
39128
|
loading = _useState8[0],
|
|
39129
39129
|
setLoading = _useState8[1];
|
|
39130
39130
|
var loadLazyTimeout = useRef();
|
|
39131
|
-
|
|
39131
|
+
useRef(1);
|
|
39132
39132
|
var isOptionsArray = Array.isArray(options);
|
|
39133
|
+
console.log(isOptionsArray);
|
|
39133
39134
|
var numObjValue = objValue.map(function (opt) {
|
|
39134
39135
|
return _objectSpread2(_objectSpread2({}, opt), {}, _defineProperty$b({}, optionValue, typeof opt[optionValue] === 'string' ? parseInt(opt[optionValue], 10) : opt[optionValue]));
|
|
39135
39136
|
});
|
|
@@ -39156,7 +39157,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39156
39157
|
} else {
|
|
39157
39158
|
var loadInitialOptions = /*#__PURE__*/function () {
|
|
39158
39159
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
39159
|
-
var result;
|
|
39160
|
+
var result, _result$options, exists;
|
|
39160
39161
|
return _regenerator().w(function (_context) {
|
|
39161
39162
|
while (1) switch (_context.n) {
|
|
39162
39163
|
case 0:
|
|
@@ -39167,6 +39168,16 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39167
39168
|
case 1:
|
|
39168
39169
|
result = _context.v;
|
|
39169
39170
|
setLoadedOptions((result === null || result === void 0 ? void 0 : result.options) || []);
|
|
39171
|
+
if (numObjValue) {
|
|
39172
|
+
exists = result === null || result === void 0 || (_result$options = result.options) === null || _result$options === void 0 ? void 0 : _result$options.some(function (opt) {
|
|
39173
|
+
return opt[optionValue] === numObjValue[optionValue];
|
|
39174
|
+
});
|
|
39175
|
+
if (!exists) {
|
|
39176
|
+
setLoadedOptions(function (prev) {
|
|
39177
|
+
return [].concat(_toConsumableArray$7(prev), [numObjValue]);
|
|
39178
|
+
});
|
|
39179
|
+
}
|
|
39180
|
+
}
|
|
39170
39181
|
case 2:
|
|
39171
39182
|
return _context.a(2);
|
|
39172
39183
|
}
|
|
@@ -39275,45 +39286,64 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39275
39286
|
};
|
|
39276
39287
|
|
|
39277
39288
|
// Fonction de lazy loading
|
|
39289
|
+
// const onLazyLoad = (event) => {
|
|
39290
|
+
// if (isOptionsArray) return;
|
|
39291
|
+
// setLoading(true);
|
|
39292
|
+
// if (loadLazyTimeout.current) {
|
|
39293
|
+
// clearTimeout(loadLazyTimeout.current);
|
|
39294
|
+
// }
|
|
39295
|
+
// loadLazyTimeout.current = setTimeout(async () => {
|
|
39296
|
+
// const { first, last } = event;
|
|
39297
|
+
// const _items = [...loadedOptions];
|
|
39298
|
+
// const result = await options(inputValue, [], { page: currentPageRef.current + 1 });
|
|
39299
|
+
// const newOptions = result?.options || [];
|
|
39300
|
+
// for (let i = first; i < last; i++) {
|
|
39301
|
+
// if (!_items[i] && newOptions[i - first]) {
|
|
39302
|
+
// _items[i] = newOptions[i - first];
|
|
39303
|
+
// }
|
|
39304
|
+
// }
|
|
39305
|
+
// setLoadedOptions(_items);
|
|
39306
|
+
// setLoading(false);
|
|
39307
|
+
// currentPageRef.current += 1;
|
|
39308
|
+
//
|
|
39309
|
+
// // redimensionnement du conteneur
|
|
39310
|
+
// let virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
|
|
39311
|
+
// if (virtualscroll) {
|
|
39312
|
+
// virtualscroll.style.height = "auto";
|
|
39313
|
+
// }
|
|
39314
|
+
// }, 500);
|
|
39315
|
+
// };
|
|
39278
39316
|
var onLazyLoad = function onLazyLoad(event) {
|
|
39279
|
-
if (isOptionsArray) return;
|
|
39280
39317
|
setLoading(true);
|
|
39281
39318
|
if (loadLazyTimeout.current) {
|
|
39282
39319
|
clearTimeout(loadLazyTimeout.current);
|
|
39283
39320
|
}
|
|
39284
|
-
loadLazyTimeout.current = setTimeout(
|
|
39285
|
-
var first
|
|
39286
|
-
|
|
39287
|
-
|
|
39288
|
-
|
|
39289
|
-
|
|
39290
|
-
|
|
39291
|
-
_context2.n = 1;
|
|
39292
|
-
return options(inputValue, [], {
|
|
39293
|
-
page: currentPageRef.current + 1
|
|
39294
|
-
});
|
|
39295
|
-
case 1:
|
|
39296
|
-
result = _context2.v;
|
|
39297
|
-
newOptions = (result === null || result === void 0 ? void 0 : result.options) || [];
|
|
39298
|
-
for (i = first; i < last; i++) {
|
|
39299
|
-
if (!_items[i] && newOptions[i - first]) {
|
|
39300
|
-
_items[i] = newOptions[i - first];
|
|
39301
|
-
}
|
|
39302
|
-
}
|
|
39303
|
-
setLoadedOptions(_items);
|
|
39304
|
-
setLoading(false);
|
|
39305
|
-
currentPageRef.current += 1;
|
|
39306
|
-
|
|
39307
|
-
// redimensionnement du conteneur
|
|
39308
|
-
virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
|
|
39309
|
-
if (virtualscroll) {
|
|
39310
|
-
virtualscroll.style.height = "auto";
|
|
39311
|
-
}
|
|
39312
|
-
case 2:
|
|
39313
|
-
return _context2.a(2);
|
|
39321
|
+
loadLazyTimeout.current = setTimeout(function () {
|
|
39322
|
+
var first = event.first,
|
|
39323
|
+
last = event.last;
|
|
39324
|
+
var _items = _toConsumableArray$7(loadedOptions);
|
|
39325
|
+
for (var i = first; i < last; i++) {
|
|
39326
|
+
if (!_items[i]) {
|
|
39327
|
+
_items[i] = _defineProperty$b(_defineProperty$b({}, optionLabel, "Option #".concat(i)), optionValue, i);
|
|
39314
39328
|
}
|
|
39315
|
-
}
|
|
39316
|
-
|
|
39329
|
+
}
|
|
39330
|
+
setLoadedOptions(_items);
|
|
39331
|
+
setLoading(false);
|
|
39332
|
+
var virtualscroll1 = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
|
|
39333
|
+
if (virtualscroll1) {
|
|
39334
|
+
virtualscroll1.style.height = "auto";
|
|
39335
|
+
}
|
|
39336
|
+
var hiddenSelectDiv = document.querySelector('.p-hidden-accessible.p-dropdown-hidden-select');
|
|
39337
|
+
if (hiddenSelectDiv) {
|
|
39338
|
+
var nextEl = hiddenSelectDiv.nextElementSibling;
|
|
39339
|
+
if (nextEl && nextEl.tagName === 'INPUT' && nextEl.value && nextEl.value.trim() !== '') {
|
|
39340
|
+
var virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
|
|
39341
|
+
if (virtualscroll) {
|
|
39342
|
+
virtualscroll.style.height = 'auto';
|
|
39343
|
+
}
|
|
39344
|
+
}
|
|
39345
|
+
}
|
|
39346
|
+
}, Math.random() * 1000 + 250);
|
|
39317
39347
|
};
|
|
39318
39348
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
39319
39349
|
ref: multiSelectRef,
|
|
@@ -39327,7 +39357,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39327
39357
|
style: style,
|
|
39328
39358
|
showSelectAll: showSelectAll,
|
|
39329
39359
|
disabled: disabled,
|
|
39330
|
-
filter:
|
|
39360
|
+
filter: filter,
|
|
39331
39361
|
placeholder: placeholder,
|
|
39332
39362
|
optionLabel: optionLabel,
|
|
39333
39363
|
optionValue: optionValue,
|
|
@@ -39347,7 +39377,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39347
39377
|
}), name && /*#__PURE__*/React__default.createElement("input", {
|
|
39348
39378
|
type: "hidden",
|
|
39349
39379
|
name: name,
|
|
39350
|
-
value:
|
|
39380
|
+
value: selectedOptions.map(function (opt) {
|
|
39351
39381
|
return opt[optionValue];
|
|
39352
39382
|
}).join(',')
|
|
39353
39383
|
}), invalid && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("small", {
|
|
@@ -39862,13 +39892,36 @@ var MultiSelectPresets = {
|
|
|
39862
39892
|
isSelectMeta: true,
|
|
39863
39893
|
objValue: [{
|
|
39864
39894
|
label: 'Option 9',
|
|
39865
|
-
value:
|
|
39895
|
+
value: 9,
|
|
39866
39896
|
color: '#ff9900'
|
|
39867
39897
|
}, {
|
|
39868
39898
|
label: 'Option 4',
|
|
39869
|
-
value:
|
|
39899
|
+
value: 4,
|
|
39870
39900
|
color: 'black'
|
|
39871
39901
|
}],
|
|
39902
|
+
// objValue: [
|
|
39903
|
+
// {
|
|
39904
|
+
// "id": 2299,
|
|
39905
|
+
// "nom": "Economique",
|
|
39906
|
+
// "color": "#62BAC0",
|
|
39907
|
+
// "label": "Economique",
|
|
39908
|
+
// "value": 2299
|
|
39909
|
+
// },
|
|
39910
|
+
// {
|
|
39911
|
+
// "id": 2300,
|
|
39912
|
+
// "nom": "Financière",
|
|
39913
|
+
// "color": "#40839E",
|
|
39914
|
+
// "label": "Financière",
|
|
39915
|
+
// "value": 2300
|
|
39916
|
+
// },
|
|
39917
|
+
// {
|
|
39918
|
+
// "id": 2301,
|
|
39919
|
+
// "nom": "Données bancaires",
|
|
39920
|
+
// "color": "#E5E798",
|
|
39921
|
+
// "label": "Données bancaires",
|
|
39922
|
+
// "value": 2301
|
|
39923
|
+
// }
|
|
39924
|
+
// ],
|
|
39872
39925
|
// value: ['3', '4'],
|
|
39873
39926
|
options: function () {
|
|
39874
39927
|
var _options = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|