arengibook 2.4.589 → 2.4.591
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 +353 -88
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5748,6 +5748,31 @@ function _arrayWithHoles$8(r) {
|
|
|
5748
5748
|
function _arrayWithoutHoles$6(r) {
|
|
5749
5749
|
if (Array.isArray(r)) return _arrayLikeToArray$a(r);
|
|
5750
5750
|
}
|
|
5751
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
5752
|
+
try {
|
|
5753
|
+
var i = n[a](c),
|
|
5754
|
+
u = i.value;
|
|
5755
|
+
} catch (n) {
|
|
5756
|
+
return void e(n);
|
|
5757
|
+
}
|
|
5758
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
5759
|
+
}
|
|
5760
|
+
function _asyncToGenerator(n) {
|
|
5761
|
+
return function () {
|
|
5762
|
+
var t = this,
|
|
5763
|
+
e = arguments;
|
|
5764
|
+
return new Promise(function (r, o) {
|
|
5765
|
+
var a = n.apply(t, e);
|
|
5766
|
+
function _next(n) {
|
|
5767
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
5768
|
+
}
|
|
5769
|
+
function _throw(n) {
|
|
5770
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
5771
|
+
}
|
|
5772
|
+
_next(void 0);
|
|
5773
|
+
});
|
|
5774
|
+
};
|
|
5775
|
+
}
|
|
5751
5776
|
function _defineProperty$a(e, r, t) {
|
|
5752
5777
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
5753
5778
|
value: t,
|
|
@@ -5839,6 +5864,116 @@ function _objectWithoutPropertiesLoose$2(r, e) {
|
|
|
5839
5864
|
}
|
|
5840
5865
|
return t;
|
|
5841
5866
|
}
|
|
5867
|
+
function _regenerator() {
|
|
5868
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
5869
|
+
var e,
|
|
5870
|
+
t,
|
|
5871
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
5872
|
+
n = r.iterator || "@@iterator",
|
|
5873
|
+
o = r.toStringTag || "@@toStringTag";
|
|
5874
|
+
function i(r, n, o, i) {
|
|
5875
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
5876
|
+
u = Object.create(c.prototype);
|
|
5877
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
5878
|
+
var i,
|
|
5879
|
+
c,
|
|
5880
|
+
u,
|
|
5881
|
+
f = 0,
|
|
5882
|
+
p = o || [],
|
|
5883
|
+
y = false,
|
|
5884
|
+
G = {
|
|
5885
|
+
p: 0,
|
|
5886
|
+
n: 0,
|
|
5887
|
+
v: e,
|
|
5888
|
+
a: d,
|
|
5889
|
+
f: d.bind(e, 4),
|
|
5890
|
+
d: function (t, r) {
|
|
5891
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
5892
|
+
}
|
|
5893
|
+
};
|
|
5894
|
+
function d(r, n) {
|
|
5895
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
5896
|
+
var o,
|
|
5897
|
+
i = p[t],
|
|
5898
|
+
d = G.p,
|
|
5899
|
+
l = i[2];
|
|
5900
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
5901
|
+
}
|
|
5902
|
+
if (o || r > 1) return a;
|
|
5903
|
+
throw y = true, n;
|
|
5904
|
+
}
|
|
5905
|
+
return function (o, p, l) {
|
|
5906
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
5907
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
5908
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
5909
|
+
try {
|
|
5910
|
+
if (f = 2, i) {
|
|
5911
|
+
if (c || (o = "next"), t = i[o]) {
|
|
5912
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
5913
|
+
if (!t.done) return t;
|
|
5914
|
+
u = t.value, c < 2 && (c = 0);
|
|
5915
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
5916
|
+
i = e;
|
|
5917
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
5918
|
+
} catch (t) {
|
|
5919
|
+
i = e, c = 1, u = t;
|
|
5920
|
+
} finally {
|
|
5921
|
+
f = 1;
|
|
5922
|
+
}
|
|
5923
|
+
}
|
|
5924
|
+
return {
|
|
5925
|
+
value: t,
|
|
5926
|
+
done: y
|
|
5927
|
+
};
|
|
5928
|
+
};
|
|
5929
|
+
}(r, o, i), true), u;
|
|
5930
|
+
}
|
|
5931
|
+
var a = {};
|
|
5932
|
+
function Generator() {}
|
|
5933
|
+
function GeneratorFunction() {}
|
|
5934
|
+
function GeneratorFunctionPrototype() {}
|
|
5935
|
+
t = Object.getPrototypeOf;
|
|
5936
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
5937
|
+
return this;
|
|
5938
|
+
}), t),
|
|
5939
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
5940
|
+
function f(e) {
|
|
5941
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
5942
|
+
}
|
|
5943
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
5944
|
+
return this;
|
|
5945
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
5946
|
+
return "[object Generator]";
|
|
5947
|
+
}), (_regenerator = function () {
|
|
5948
|
+
return {
|
|
5949
|
+
w: i,
|
|
5950
|
+
m: f
|
|
5951
|
+
};
|
|
5952
|
+
})();
|
|
5953
|
+
}
|
|
5954
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
5955
|
+
var i = Object.defineProperty;
|
|
5956
|
+
try {
|
|
5957
|
+
i({}, "", {});
|
|
5958
|
+
} catch (e) {
|
|
5959
|
+
i = 0;
|
|
5960
|
+
}
|
|
5961
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
5962
|
+
if (r) i ? i(e, r, {
|
|
5963
|
+
value: n,
|
|
5964
|
+
enumerable: !t,
|
|
5965
|
+
configurable: !t,
|
|
5966
|
+
writable: !t
|
|
5967
|
+
}) : e[r] = n;else {
|
|
5968
|
+
function o(r, n) {
|
|
5969
|
+
_regeneratorDefine(e, r, function (e) {
|
|
5970
|
+
return this._invoke(r, n, e);
|
|
5971
|
+
});
|
|
5972
|
+
}
|
|
5973
|
+
o("next", 0), o("throw", 1), o("return", 2);
|
|
5974
|
+
}
|
|
5975
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
5976
|
+
}
|
|
5842
5977
|
function _slicedToArray$8(r, e) {
|
|
5843
5978
|
return _arrayWithHoles$8(r) || _iterableToArrayLimit$8(r, e) || _unsupportedIterableToArray$a(r, e) || _nonIterableRest$8();
|
|
5844
5979
|
}
|
|
@@ -35813,6 +35948,8 @@ var PopupPresets = {
|
|
|
35813
35948
|
var Dropdown = function Dropdown(_ref) {
|
|
35814
35949
|
var _ref$options = _ref.options,
|
|
35815
35950
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
35951
|
+
_ref$optionLoad = _ref.optionLoad,
|
|
35952
|
+
optionLoad = _ref$optionLoad === void 0 ? null : _ref$optionLoad,
|
|
35816
35953
|
_ref$isGroupedOption = _ref.isGroupedOption,
|
|
35817
35954
|
isGroupedOption = _ref$isGroupedOption === void 0 ? false : _ref$isGroupedOption,
|
|
35818
35955
|
value = _ref.value,
|
|
@@ -35863,52 +36000,22 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35863
36000
|
_useState2 = _slicedToArray$8(_useState, 2),
|
|
35864
36001
|
optionSelected = _useState2[0],
|
|
35865
36002
|
setOptionSelected = _useState2[1];
|
|
35866
|
-
var items = useRef(
|
|
35867
|
-
length: 100000
|
|
35868
|
-
}));
|
|
36003
|
+
var items = useRef([]);
|
|
35869
36004
|
var _useState3 = useState(false),
|
|
35870
36005
|
_useState4 = _slicedToArray$8(_useState3, 2),
|
|
35871
36006
|
loading = _useState4[0],
|
|
35872
36007
|
setLoading = _useState4[1];
|
|
35873
|
-
var
|
|
36008
|
+
var loadedOptionsRef = useRef([]);
|
|
36009
|
+
var currentPageRef = useRef(1);
|
|
36010
|
+
var isLazy = typeof optionLoad === 'function';
|
|
35874
36011
|
useEffect(function () {
|
|
35875
36012
|
setOptionSelected(value !== null && value !== void 0 ? value : null);
|
|
35876
36013
|
}, [value]);
|
|
35877
36014
|
useEffect(function () {
|
|
35878
|
-
|
|
35879
|
-
|
|
35880
|
-
|
|
35881
|
-
|
|
35882
|
-
if (target.closest && target.closest('.p-dropdown-panel')) {
|
|
35883
|
-
return;
|
|
35884
|
-
}
|
|
35885
|
-
// Sinon, le zone de liste est fermée
|
|
35886
|
-
var dropdownPanels = document.querySelectorAll('.p-dropdown-panel');
|
|
35887
|
-
dropdownPanels.forEach(function (panel) {
|
|
35888
|
-
if (panel && panel.style.display !== 'none') {
|
|
35889
|
-
document.body.click(); // Déclenche un "click outside"
|
|
35890
|
-
}
|
|
35891
|
-
});
|
|
35892
|
-
};
|
|
35893
|
-
window.addEventListener('scroll', handleScroll, true);
|
|
35894
|
-
return function () {
|
|
35895
|
-
window.removeEventListener('scroll', handleScroll, true);
|
|
35896
|
-
};
|
|
35897
|
-
}, []);
|
|
35898
|
-
var resetDropdownFilter = function resetDropdownFilter() {
|
|
35899
|
-
setTimeout(function () {
|
|
35900
|
-
var dropdownPanels = document.querySelectorAll('.p-dropdown-panel');
|
|
35901
|
-
dropdownPanels.forEach(function (panel) {
|
|
35902
|
-
var input = panel.querySelector('.p-dropdown-filter');
|
|
35903
|
-
if (input) {
|
|
35904
|
-
input.value = '';
|
|
35905
|
-
input.dispatchEvent(new Event('input', {
|
|
35906
|
-
bubbles: true
|
|
35907
|
-
}));
|
|
35908
|
-
}
|
|
35909
|
-
});
|
|
35910
|
-
}, 50);
|
|
35911
|
-
};
|
|
36015
|
+
if (!isLazy) {
|
|
36016
|
+
items.current = options;
|
|
36017
|
+
}
|
|
36018
|
+
}, [options, isLazy]);
|
|
35912
36019
|
var style = {
|
|
35913
36020
|
border: invalid ? '1px solid red' : '1px solid #ccc',
|
|
35914
36021
|
width: '100%'
|
|
@@ -35918,7 +36025,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35918
36025
|
var g = parseInt(hexColor.substr(3, 2), 16);
|
|
35919
36026
|
var b = parseInt(hexColor.substr(5, 2), 16);
|
|
35920
36027
|
var luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
35921
|
-
return luminance > 0.
|
|
36028
|
+
return luminance > 0.18 ? '#000000' : '#FFFFFF';
|
|
35922
36029
|
};
|
|
35923
36030
|
var optionTemplate = function optionTemplate(option) {
|
|
35924
36031
|
if (!isSelectMeta) {
|
|
@@ -35926,7 +36033,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35926
36033
|
style: _objectSpread2({
|
|
35927
36034
|
fontSize: '14px'
|
|
35928
36035
|
}, optionStyle)
|
|
35929
|
-
}, option
|
|
36036
|
+
}, option === null || option === void 0 ? void 0 : option[optionLabel]);
|
|
35930
36037
|
} else {
|
|
35931
36038
|
var _ref2 = selectMetaConfig || {},
|
|
35932
36039
|
labelStyle = _ref2.labelStyle,
|
|
@@ -35951,7 +36058,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35951
36058
|
className: generalIcon
|
|
35952
36059
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
35953
36060
|
style: styleLabel
|
|
35954
|
-
}, option === null || option === void 0 ? void 0 : option
|
|
36061
|
+
}, option === null || option === void 0 ? void 0 : option[optionLabel])));
|
|
35955
36062
|
}
|
|
35956
36063
|
};
|
|
35957
36064
|
var valueTemplate = function valueTemplate(option) {
|
|
@@ -35960,16 +36067,16 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35960
36067
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
35961
36068
|
style: _objectSpread2({
|
|
35962
36069
|
backgroundColor: option === null || option === void 0 ? void 0 : option.color,
|
|
35963
|
-
color:
|
|
36070
|
+
color: iconColor,
|
|
35964
36071
|
padding: '0.5rem',
|
|
35965
36072
|
borderRadius: '1rem',
|
|
35966
36073
|
display: 'inline-block'
|
|
35967
36074
|
}, valueStyle)
|
|
35968
|
-
}, option !== null && option !== void 0 && option
|
|
36075
|
+
}, option !== null && option !== void 0 && option[optionLabel] ? /*#__PURE__*/React__default.createElement("span", {
|
|
35969
36076
|
style: {
|
|
35970
36077
|
color: iconColor
|
|
35971
36078
|
}
|
|
35972
|
-
}, option === null || option === void 0 ? void 0 : option
|
|
36079
|
+
}, option === null || option === void 0 ? void 0 : option[optionLabel]) : /*#__PURE__*/React__default.createElement("span", {
|
|
35973
36080
|
style: {
|
|
35974
36081
|
color: '#000000'
|
|
35975
36082
|
}
|
|
@@ -35980,28 +36087,54 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
35980
36087
|
fontFamily: 'Arial',
|
|
35981
36088
|
fontSize: '14px'
|
|
35982
36089
|
}, valueStyle)
|
|
35983
|
-
}, (option === null || option === void 0 ? void 0 : option
|
|
35984
|
-
}
|
|
35985
|
-
};
|
|
35986
|
-
var onLazyLoad = function
|
|
35987
|
-
|
|
35988
|
-
|
|
35989
|
-
|
|
35990
|
-
|
|
35991
|
-
|
|
35992
|
-
|
|
35993
|
-
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35997
|
-
|
|
35998
|
-
|
|
35999
|
-
|
|
36000
|
-
|
|
36001
|
-
|
|
36002
|
-
|
|
36003
|
-
|
|
36004
|
-
|
|
36090
|
+
}, (option === null || option === void 0 ? void 0 : option[optionLabel]) || placeholder);
|
|
36091
|
+
}
|
|
36092
|
+
};
|
|
36093
|
+
var onLazyLoad = /*#__PURE__*/function () {
|
|
36094
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
36095
|
+
var _event$filter;
|
|
36096
|
+
var search, _res$options, _res$additional$page, _res$additional, res, newOptions, _t;
|
|
36097
|
+
return _regenerator().w(function (_context) {
|
|
36098
|
+
while (1) switch (_context.n) {
|
|
36099
|
+
case 0:
|
|
36100
|
+
if (!(!isLazy || !optionLoad)) {
|
|
36101
|
+
_context.n = 1;
|
|
36102
|
+
break;
|
|
36103
|
+
}
|
|
36104
|
+
return _context.a(2);
|
|
36105
|
+
case 1:
|
|
36106
|
+
setLoading(true);
|
|
36107
|
+
search = (_event$filter = event === null || event === void 0 ? void 0 : event.filter) !== null && _event$filter !== void 0 ? _event$filter : '';
|
|
36108
|
+
_context.p = 2;
|
|
36109
|
+
_context.n = 3;
|
|
36110
|
+
return optionLoad(search, loadedOptionsRef.current, {
|
|
36111
|
+
page: currentPageRef.current
|
|
36112
|
+
});
|
|
36113
|
+
case 3:
|
|
36114
|
+
res = _context.v;
|
|
36115
|
+
newOptions = (_res$options = res === null || res === void 0 ? void 0 : res.options) !== null && _res$options !== void 0 ? _res$options : [];
|
|
36116
|
+
loadedOptionsRef.current = [].concat(_toConsumableArray$6(loadedOptionsRef.current), _toConsumableArray$6(newOptions));
|
|
36117
|
+
items.current = loadedOptionsRef.current;
|
|
36118
|
+
currentPageRef.current = (_res$additional$page = res === null || res === void 0 || (_res$additional = res.additional) === null || _res$additional === void 0 ? void 0 : _res$additional.page) !== null && _res$additional$page !== void 0 ? _res$additional$page : currentPageRef.current + 1;
|
|
36119
|
+
_context.n = 5;
|
|
36120
|
+
break;
|
|
36121
|
+
case 4:
|
|
36122
|
+
_context.p = 4;
|
|
36123
|
+
_t = _context.v;
|
|
36124
|
+
console.error('Erreur optionLoad:', _t);
|
|
36125
|
+
case 5:
|
|
36126
|
+
_context.p = 5;
|
|
36127
|
+
setLoading(false);
|
|
36128
|
+
return _context.f(5);
|
|
36129
|
+
case 6:
|
|
36130
|
+
return _context.a(2);
|
|
36131
|
+
}
|
|
36132
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
36133
|
+
}));
|
|
36134
|
+
return function onLazyLoad(_x) {
|
|
36135
|
+
return _ref3.apply(this, arguments);
|
|
36136
|
+
};
|
|
36137
|
+
}();
|
|
36005
36138
|
var handleChange = function handleChange(e) {
|
|
36006
36139
|
var newValue = e.value;
|
|
36007
36140
|
setOptionSelected(newValue);
|
|
@@ -36010,22 +36143,19 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
36010
36143
|
}
|
|
36011
36144
|
};
|
|
36012
36145
|
var groupedItemTemplate = function groupedItemTemplate(option) {
|
|
36013
|
-
var
|
|
36014
|
-
showImage =
|
|
36015
|
-
imageKey =
|
|
36016
|
-
imageStyle =
|
|
36017
|
-
showIcon =
|
|
36018
|
-
iconKey =
|
|
36019
|
-
labelStyle =
|
|
36020
|
-
generalIcon =
|
|
36021
|
-
generalImage =
|
|
36146
|
+
var _ref4 = groupedItemTemplateConfig || {},
|
|
36147
|
+
showImage = _ref4.showImage,
|
|
36148
|
+
imageKey = _ref4.imageKey,
|
|
36149
|
+
imageStyle = _ref4.imageStyle,
|
|
36150
|
+
showIcon = _ref4.showIcon,
|
|
36151
|
+
iconKey = _ref4.iconKey,
|
|
36152
|
+
labelStyle = _ref4.labelStyle,
|
|
36153
|
+
generalIcon = _ref4.generalIcon,
|
|
36154
|
+
generalImage = _ref4.generalImage;
|
|
36022
36155
|
var icon = option.value && option.value[iconKey];
|
|
36023
|
-
var styleLabel = {
|
|
36024
|
-
|
|
36025
|
-
|
|
36026
|
-
'marginLeft': '10px'
|
|
36027
|
-
};
|
|
36028
|
-
}
|
|
36156
|
+
var styleLabel = generalIcon || showImage && option[imageKey] || showIcon && icon ? {
|
|
36157
|
+
marginLeft: '10px'
|
|
36158
|
+
} : {};
|
|
36029
36159
|
if (option.group) {
|
|
36030
36160
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
36031
36161
|
className: "flex align-items-center"
|
|
@@ -36035,11 +36165,11 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
36035
36165
|
fontWeight: 'bold'
|
|
36036
36166
|
}, labelStyle)
|
|
36037
36167
|
}, generalIcon && /*#__PURE__*/React__default.createElement("i", {
|
|
36168
|
+
className: generalIcon,
|
|
36038
36169
|
style: _objectSpread2({
|
|
36039
36170
|
fontSize: '15px',
|
|
36040
36171
|
fontWeight: 'bold'
|
|
36041
|
-
}, labelStyle)
|
|
36042
|
-
className: generalIcon
|
|
36172
|
+
}, labelStyle)
|
|
36043
36173
|
}), generalImage && /*#__PURE__*/React__default.createElement("img", {
|
|
36044
36174
|
alt: "General",
|
|
36045
36175
|
src: generalImage,
|
|
@@ -36057,11 +36187,11 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
36057
36187
|
},
|
|
36058
36188
|
className: "mr-2"
|
|
36059
36189
|
}), showIcon && icon && /*#__PURE__*/React__default.createElement("i", {
|
|
36190
|
+
className: "mr-2 ".concat(icon),
|
|
36060
36191
|
style: _objectSpread2({
|
|
36061
36192
|
fontSize: '15px',
|
|
36062
36193
|
fontWeight: 'bold'
|
|
36063
|
-
}, labelStyle)
|
|
36064
|
-
className: 'mr-2 ' + icon
|
|
36194
|
+
}, labelStyle)
|
|
36065
36195
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
36066
36196
|
style: styleLabel
|
|
36067
36197
|
}, option.label)));
|
|
@@ -36071,7 +36201,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
36071
36201
|
className: "flex flex-col gap-1"
|
|
36072
36202
|
}, /*#__PURE__*/React__default.createElement(Dropdown$1, _extends$A({
|
|
36073
36203
|
value: optionSelected,
|
|
36074
|
-
options: options,
|
|
36204
|
+
options: isLazy ? items.current : options,
|
|
36075
36205
|
onChange: handleChange,
|
|
36076
36206
|
placeholder: placeholder,
|
|
36077
36207
|
disabled: disabled,
|
|
@@ -36081,13 +36211,12 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
36081
36211
|
style: style,
|
|
36082
36212
|
itemTemplate: optionTemplate,
|
|
36083
36213
|
valueTemplate: valueTemplate,
|
|
36084
|
-
onHide: resetDropdownFilter,
|
|
36085
36214
|
showClear: showClear,
|
|
36086
36215
|
optionGroupTemplate: isGroupedOption ? groupedItemTemplate : null
|
|
36087
36216
|
}, isGroupedOption && {
|
|
36088
36217
|
optionGroupLabel: 'label',
|
|
36089
36218
|
optionGroupChildren: 'items'
|
|
36090
|
-
}, isSelectMeta && {
|
|
36219
|
+
}, (isSelectMeta || isLazy) && {
|
|
36091
36220
|
virtualScrollerOptions: {
|
|
36092
36221
|
lazy: true,
|
|
36093
36222
|
onLazyLoad: onLazyLoad,
|
|
@@ -36188,6 +36317,33 @@ var optionsWithColors = [{
|
|
|
36188
36317
|
value: 'cyan',
|
|
36189
36318
|
color: '#00FFFF'
|
|
36190
36319
|
}];
|
|
36320
|
+
var createFakeOptions = function createFakeOptions(start, length) {
|
|
36321
|
+
var options = [];
|
|
36322
|
+
for (var i = start; i < length; i++) {
|
|
36323
|
+
options.push({
|
|
36324
|
+
value: i,
|
|
36325
|
+
label: "Option ".concat(i)
|
|
36326
|
+
// Ajoutez d'autres propriétés si nécessaire
|
|
36327
|
+
});
|
|
36328
|
+
}
|
|
36329
|
+
return options;
|
|
36330
|
+
};
|
|
36331
|
+
var generateOptions = function generateOptions(length) {
|
|
36332
|
+
return Array.from({
|
|
36333
|
+
length: length
|
|
36334
|
+
}, function (_, i) {
|
|
36335
|
+
return {
|
|
36336
|
+
id: i,
|
|
36337
|
+
nom: "Option ".concat(i),
|
|
36338
|
+
color: '#ccc'
|
|
36339
|
+
};
|
|
36340
|
+
});
|
|
36341
|
+
};
|
|
36342
|
+
var simulateNetworkDelay = function simulateNetworkDelay() {
|
|
36343
|
+
return new Promise(function (res) {
|
|
36344
|
+
return setTimeout(res, 400);
|
|
36345
|
+
});
|
|
36346
|
+
};
|
|
36191
36347
|
var DropdownPresets = {
|
|
36192
36348
|
Default: {
|
|
36193
36349
|
placeholder: 'Sélectionnez une option',
|
|
@@ -36217,6 +36373,115 @@ var DropdownPresets = {
|
|
|
36217
36373
|
fontFamily: 'Arial'
|
|
36218
36374
|
}
|
|
36219
36375
|
},
|
|
36376
|
+
AsyncLoad: {
|
|
36377
|
+
placeholder: 'Chargement distant simulé',
|
|
36378
|
+
options: [],
|
|
36379
|
+
optionLoad: function () {
|
|
36380
|
+
var _optionLoad = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(search, loadedOptions, _ref) {
|
|
36381
|
+
var page, length, start, data;
|
|
36382
|
+
return _regenerator().w(function (_context) {
|
|
36383
|
+
while (1) switch (_context.n) {
|
|
36384
|
+
case 0:
|
|
36385
|
+
page = _ref.page;
|
|
36386
|
+
length = 20;
|
|
36387
|
+
start = (page - 1) * length; // Simule un délai réseau
|
|
36388
|
+
_context.n = 1;
|
|
36389
|
+
return new Promise(function (res) {
|
|
36390
|
+
return setTimeout(res, 500);
|
|
36391
|
+
});
|
|
36392
|
+
case 1:
|
|
36393
|
+
data = createFakeOptions(start, length);
|
|
36394
|
+
return _context.a(2, {
|
|
36395
|
+
options: data.map(function (opt) {
|
|
36396
|
+
return _objectSpread2(_objectSpread2({}, opt), {}, {
|
|
36397
|
+
label: opt.label,
|
|
36398
|
+
value: opt.value,
|
|
36399
|
+
color: 'blue'
|
|
36400
|
+
});
|
|
36401
|
+
}),
|
|
36402
|
+
hasMore: page * length < 100,
|
|
36403
|
+
// Supposons que nous avons 100 options au total
|
|
36404
|
+
additional: {
|
|
36405
|
+
page: page + 1
|
|
36406
|
+
}
|
|
36407
|
+
});
|
|
36408
|
+
}
|
|
36409
|
+
}, _callee);
|
|
36410
|
+
}));
|
|
36411
|
+
function optionLoad(_x, _x2, _x3) {
|
|
36412
|
+
return _optionLoad.apply(this, arguments);
|
|
36413
|
+
}
|
|
36414
|
+
return optionLoad;
|
|
36415
|
+
}(),
|
|
36416
|
+
selectMetaConfig: {
|
|
36417
|
+
generalIcon: 'pi pi-circle-fill'
|
|
36418
|
+
},
|
|
36419
|
+
isSelectMeta: true,
|
|
36420
|
+
valueStyle: {
|
|
36421
|
+
fontSize: '14px',
|
|
36422
|
+
fontFamily: 'Arial'
|
|
36423
|
+
},
|
|
36424
|
+
optionStyle: {
|
|
36425
|
+
fontSize: '14px',
|
|
36426
|
+
fontFamily: 'Arial'
|
|
36427
|
+
}
|
|
36428
|
+
},
|
|
36429
|
+
AsyncSearch: {
|
|
36430
|
+
placeholder: 'Recherchez une option...',
|
|
36431
|
+
filter: true,
|
|
36432
|
+
options: [],
|
|
36433
|
+
optionLoad: function () {
|
|
36434
|
+
var _optionLoad2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(search, loadedOptions, _ref2) {
|
|
36435
|
+
var page, length, allOptions, filteredOptions, start, pageSlice;
|
|
36436
|
+
return _regenerator().w(function (_context2) {
|
|
36437
|
+
while (1) switch (_context2.n) {
|
|
36438
|
+
case 0:
|
|
36439
|
+
page = _ref2.page;
|
|
36440
|
+
length = 10;
|
|
36441
|
+
_context2.n = 1;
|
|
36442
|
+
return simulateNetworkDelay();
|
|
36443
|
+
case 1:
|
|
36444
|
+
// Générer toutes les options possibles
|
|
36445
|
+
allOptions = generateOptions(100); // Filtrer les options en fonction de la recherche
|
|
36446
|
+
filteredOptions = allOptions.filter(function (opt) {
|
|
36447
|
+
return opt.nom.toLowerCase().includes(search.toLowerCase());
|
|
36448
|
+
}); // Pagination des résultats filtrés
|
|
36449
|
+
start = (page - 1) * length;
|
|
36450
|
+
pageSlice = filteredOptions.slice(start, start + length);
|
|
36451
|
+
return _context2.a(2, {
|
|
36452
|
+
options: pageSlice.map(function (opt) {
|
|
36453
|
+
return _objectSpread2(_objectSpread2({}, opt), {}, {
|
|
36454
|
+
label: opt.nom,
|
|
36455
|
+
value: opt.id,
|
|
36456
|
+
color: 'red'
|
|
36457
|
+
});
|
|
36458
|
+
}),
|
|
36459
|
+
hasMore: start + length < filteredOptions.length,
|
|
36460
|
+
additional: {
|
|
36461
|
+
page: page + 1
|
|
36462
|
+
}
|
|
36463
|
+
});
|
|
36464
|
+
}
|
|
36465
|
+
}, _callee2);
|
|
36466
|
+
}));
|
|
36467
|
+
function optionLoad(_x4, _x5, _x6) {
|
|
36468
|
+
return _optionLoad2.apply(this, arguments);
|
|
36469
|
+
}
|
|
36470
|
+
return optionLoad;
|
|
36471
|
+
}(),
|
|
36472
|
+
isSelectMeta: true,
|
|
36473
|
+
selectMetaConfig: {
|
|
36474
|
+
generalIcon: 'pi pi-search'
|
|
36475
|
+
},
|
|
36476
|
+
valueStyle: {
|
|
36477
|
+
fontSize: '14px',
|
|
36478
|
+
fontFamily: 'Arial'
|
|
36479
|
+
},
|
|
36480
|
+
optionStyle: {
|
|
36481
|
+
fontSize: '14px',
|
|
36482
|
+
fontFamily: 'Arial'
|
|
36483
|
+
}
|
|
36484
|
+
},
|
|
36220
36485
|
Group: {
|
|
36221
36486
|
placeholder: 'Veuillez choisir une option',
|
|
36222
36487
|
options: optionsGroup,
|