arengibook 2.4.632 → 2.4.634
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 +133 -109
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36820,12 +36820,12 @@ var DropdownPresets = {
|
|
|
36820
36820
|
}
|
|
36821
36821
|
};
|
|
36822
36822
|
|
|
36823
|
-
var simulateNetworkDelay = function simulateNetworkDelay() {
|
|
36823
|
+
var simulateNetworkDelay$1 = function simulateNetworkDelay() {
|
|
36824
36824
|
return new Promise(function (res) {
|
|
36825
36825
|
return setTimeout(res, 400);
|
|
36826
36826
|
});
|
|
36827
36827
|
};
|
|
36828
|
-
var createFakeOptions = function createFakeOptions(start, length) {
|
|
36828
|
+
var createFakeOptions$1 = function createFakeOptions(start, length) {
|
|
36829
36829
|
var options = [];
|
|
36830
36830
|
for (var i = start; i < start + length; i++) {
|
|
36831
36831
|
options.push({
|
|
@@ -36854,9 +36854,9 @@ var DropdownSelectMetaAsyncPresets = {
|
|
|
36854
36854
|
search = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
36855
36855
|
_ref = _args.length > 2 ? _args[2] : undefined, page = _ref.page;
|
|
36856
36856
|
_context.n = 1;
|
|
36857
|
-
return simulateNetworkDelay();
|
|
36857
|
+
return simulateNetworkDelay$1();
|
|
36858
36858
|
case 1:
|
|
36859
|
-
allOptions = createFakeOptions(0, 100);
|
|
36859
|
+
allOptions = createFakeOptions$1(0, 100);
|
|
36860
36860
|
filtered = allOptions.filter(function (opt) {
|
|
36861
36861
|
return opt.label.toLowerCase().includes(search.toLowerCase());
|
|
36862
36862
|
});
|
|
@@ -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,
|
|
@@ -39109,10 +39109,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39109
39109
|
useCheckbox = _ref$useCheckbox === void 0 ? false : _ref$useCheckbox,
|
|
39110
39110
|
_ref$showSelectAll = _ref.showSelectAll,
|
|
39111
39111
|
showSelectAll = _ref$showSelectAll === void 0 ? true : _ref$showSelectAll;
|
|
39112
|
-
|
|
39113
|
-
var _useState = useState(objValue ? _toConsumableArray$7(objValue.map(function (opt) {
|
|
39114
|
-
return opt[optionValue];
|
|
39115
|
-
})) : value !== null && value !== void 0 ? value : []),
|
|
39112
|
+
var _useState = useState(null),
|
|
39116
39113
|
_useState2 = _slicedToArray$9(_useState, 2),
|
|
39117
39114
|
selectedOptions = _useState2[0],
|
|
39118
39115
|
setSelectedOptions = _useState2[1];
|
|
@@ -39133,33 +39130,45 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39133
39130
|
var currentPageRef = useRef(1);
|
|
39134
39131
|
var isOptionsArray = Array.isArray(options);
|
|
39135
39132
|
useEffect(function () {
|
|
39136
|
-
|
|
39137
|
-
|
|
39138
|
-
}
|
|
39139
|
-
|
|
39140
|
-
|
|
39141
|
-
|
|
39142
|
-
|
|
39143
|
-
|
|
39144
|
-
|
|
39145
|
-
|
|
39146
|
-
|
|
39147
|
-
|
|
39133
|
+
setSelectedOptions(objValue ? _toConsumableArray$7(objValue.map(function (opt) {
|
|
39134
|
+
return opt[optionValue];
|
|
39135
|
+
})) : value !== null && value !== void 0 ? value : []);
|
|
39136
|
+
console.log(objValue ? _toConsumableArray$7(objValue.map(function (opt) {
|
|
39137
|
+
return opt[optionValue];
|
|
39138
|
+
})) : value !== null && value !== void 0 ? value : []);
|
|
39139
|
+
var loadInitialOptions = /*#__PURE__*/function () {
|
|
39140
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
39141
|
+
var result, _result$options, exists;
|
|
39142
|
+
return _regenerator().w(function (_context) {
|
|
39143
|
+
while (1) switch (_context.n) {
|
|
39144
|
+
case 0:
|
|
39145
|
+
_context.n = 1;
|
|
39146
|
+
return options('', [], {
|
|
39147
|
+
page: 1
|
|
39148
|
+
});
|
|
39149
|
+
case 1:
|
|
39150
|
+
result = _context.v;
|
|
39151
|
+
setLoadedOptions((result === null || result === void 0 ? void 0 : result.options) || []);
|
|
39152
|
+
if (objValue) {
|
|
39153
|
+
exists = result === null || result === void 0 || (_result$options = result.options) === null || _result$options === void 0 ? void 0 : _result$options.some(function (opt) {
|
|
39154
|
+
return opt[optionValue] === objValue[optionValue];
|
|
39148
39155
|
});
|
|
39149
|
-
|
|
39150
|
-
|
|
39151
|
-
|
|
39152
|
-
|
|
39153
|
-
|
|
39154
|
-
|
|
39155
|
-
|
|
39156
|
-
|
|
39157
|
-
|
|
39158
|
-
|
|
39159
|
-
|
|
39160
|
-
|
|
39161
|
-
|
|
39162
|
-
|
|
39156
|
+
if (!exists) {
|
|
39157
|
+
setLoadedOptions(function (prev) {
|
|
39158
|
+
return [].concat(_toConsumableArray$7(prev), [objValue]);
|
|
39159
|
+
});
|
|
39160
|
+
}
|
|
39161
|
+
}
|
|
39162
|
+
case 2:
|
|
39163
|
+
return _context.a(2);
|
|
39164
|
+
}
|
|
39165
|
+
}, _callee);
|
|
39166
|
+
}));
|
|
39167
|
+
return function loadInitialOptions() {
|
|
39168
|
+
return _ref2.apply(this, arguments);
|
|
39169
|
+
};
|
|
39170
|
+
}();
|
|
39171
|
+
loadInitialOptions();
|
|
39163
39172
|
}, [options]);
|
|
39164
39173
|
useEffect(function () {
|
|
39165
39174
|
var observer = new MutationObserver(function () {
|
|
@@ -39309,7 +39318,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39309
39318
|
style: style,
|
|
39310
39319
|
showSelectAll: showSelectAll,
|
|
39311
39320
|
disabled: disabled,
|
|
39312
|
-
filter:
|
|
39321
|
+
filter: filter,
|
|
39313
39322
|
placeholder: placeholder,
|
|
39314
39323
|
optionLabel: optionLabel,
|
|
39315
39324
|
optionValue: optionValue,
|
|
@@ -39656,6 +39665,11 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
39656
39665
|
}, errorMessage || 'Sélection invalide')));
|
|
39657
39666
|
};
|
|
39658
39667
|
|
|
39668
|
+
var simulateNetworkDelay = function simulateNetworkDelay() {
|
|
39669
|
+
return new Promise(function (res) {
|
|
39670
|
+
return setTimeout(res, 400);
|
|
39671
|
+
});
|
|
39672
|
+
};
|
|
39659
39673
|
var optionsExample = [{
|
|
39660
39674
|
label: 'New York',
|
|
39661
39675
|
value: 'NY'
|
|
@@ -39742,68 +39756,17 @@ var syncOptions$1 = [{
|
|
|
39742
39756
|
value: '5',
|
|
39743
39757
|
color: '#ec4899'
|
|
39744
39758
|
}];
|
|
39745
|
-
var
|
|
39746
|
-
var
|
|
39747
|
-
|
|
39748
|
-
|
|
39749
|
-
|
|
39750
|
-
|
|
39751
|
-
|
|
39752
|
-
|
|
39753
|
-
|
|
39754
|
-
|
|
39755
|
-
|
|
39756
|
-
}, {
|
|
39757
|
-
label: 'Option 2',
|
|
39758
|
-
value: '2',
|
|
39759
|
-
color: '#3b82f6'
|
|
39760
|
-
}, {
|
|
39761
|
-
label: 'Option 3',
|
|
39762
|
-
value: '3',
|
|
39763
|
-
color: '#10b981'
|
|
39764
|
-
}, {
|
|
39765
|
-
label: 'Option 4',
|
|
39766
|
-
value: '4',
|
|
39767
|
-
color: '#8b5cf6'
|
|
39768
|
-
}, {
|
|
39769
|
-
label: 'Option 5',
|
|
39770
|
-
value: '5',
|
|
39771
|
-
color: '#ec4899'
|
|
39772
|
-
}, {
|
|
39773
|
-
label: 'Option 6',
|
|
39774
|
-
value: '6',
|
|
39775
|
-
color: '#f59e0b'
|
|
39776
|
-
}, {
|
|
39777
|
-
label: 'Option 7',
|
|
39778
|
-
value: '7',
|
|
39779
|
-
color: '#ef4444'
|
|
39780
|
-
}, {
|
|
39781
|
-
label: 'Option 8',
|
|
39782
|
-
value: '8',
|
|
39783
|
-
color: '#10b981'
|
|
39784
|
-
}, {
|
|
39785
|
-
label: 'Option 9',
|
|
39786
|
-
value: '9',
|
|
39787
|
-
color: '#3b82f6'
|
|
39788
|
-
}, {
|
|
39789
|
-
label: 'Option 10',
|
|
39790
|
-
value: '10',
|
|
39791
|
-
color: '#8b5cf6'
|
|
39792
|
-
}]; // Simulation de pagination
|
|
39793
|
-
startIndex = (page - 1) * 5;
|
|
39794
|
-
paginatedOptions = mockOptions.slice(startIndex, startIndex + 5);
|
|
39795
|
-
return _context.a(2, {
|
|
39796
|
-
options: search ? mockOptions.filter(function (opt) {
|
|
39797
|
-
return opt.label.toLowerCase().includes(search.toLowerCase());
|
|
39798
|
-
}) : paginatedOptions
|
|
39799
|
-
});
|
|
39800
|
-
}
|
|
39801
|
-
}, _callee);
|
|
39802
|
-
}));
|
|
39803
|
-
return function asyncOptions(_x, _x2, _x3) {
|
|
39804
|
-
return _ref2.apply(this, arguments);
|
|
39805
|
-
};
|
|
39806
|
-
}();
|
|
39759
|
+
var createFakeOptions = function createFakeOptions(start, length) {
|
|
39760
|
+
var options = [];
|
|
39761
|
+
for (var i = start; i < start + length; i++) {
|
|
39762
|
+
options.push({
|
|
39763
|
+
value: i,
|
|
39764
|
+
label: "Option ".concat(i),
|
|
39765
|
+
color: 'black'
|
|
39766
|
+
});
|
|
39767
|
+
}
|
|
39768
|
+
return options;
|
|
39769
|
+
};
|
|
39807
39770
|
var MultiSelectPresets = {
|
|
39808
39771
|
Default: {
|
|
39809
39772
|
placeholder: 'Sélectionnez des options',
|
|
@@ -39861,8 +39824,8 @@ var MultiSelectPresets = {
|
|
|
39861
39824
|
isSelectMeta: true,
|
|
39862
39825
|
// value: ['1', '2'],
|
|
39863
39826
|
objValue: [{
|
|
39864
|
-
label: 'Option
|
|
39865
|
-
value: '
|
|
39827
|
+
label: 'Option 3',
|
|
39828
|
+
value: '3',
|
|
39866
39829
|
color: '#ff9900'
|
|
39867
39830
|
}],
|
|
39868
39831
|
displayNbOption: false,
|
|
@@ -39888,17 +39851,78 @@ var MultiSelectPresets = {
|
|
|
39888
39851
|
// Configuration pour les options asynchrones
|
|
39889
39852
|
SelectMetaAsync: {
|
|
39890
39853
|
isSelectMeta: true,
|
|
39891
|
-
// value: ['3', '4', '5'],
|
|
39892
39854
|
objValue: [{
|
|
39893
|
-
label: 'Option
|
|
39894
|
-
value:
|
|
39895
|
-
color:
|
|
39855
|
+
label: 'Option 9',
|
|
39856
|
+
value: 9,
|
|
39857
|
+
color: "#67688C"
|
|
39896
39858
|
}, {
|
|
39897
39859
|
label: 'Option 4',
|
|
39898
|
-
value:
|
|
39899
|
-
color:
|
|
39860
|
+
value: 4,
|
|
39861
|
+
color: "#39C9BF"
|
|
39900
39862
|
}],
|
|
39901
|
-
|
|
39863
|
+
// objValue: [
|
|
39864
|
+
// {
|
|
39865
|
+
// "id": 2299,
|
|
39866
|
+
// "nom": "Economique",
|
|
39867
|
+
// "color": "#62BAC0",
|
|
39868
|
+
// "label": "Economique",
|
|
39869
|
+
// "value": 2299
|
|
39870
|
+
// },
|
|
39871
|
+
// {
|
|
39872
|
+
// "id": 2300,
|
|
39873
|
+
// "nom": "Financière",
|
|
39874
|
+
// "color": "#40839E",
|
|
39875
|
+
// "label": "Financière",
|
|
39876
|
+
// "value": 2300
|
|
39877
|
+
// },
|
|
39878
|
+
// {
|
|
39879
|
+
// "id": 2301,
|
|
39880
|
+
// "nom": "Données bancaires",
|
|
39881
|
+
// "color": "#E5E798",
|
|
39882
|
+
// "label": "Données bancaires",
|
|
39883
|
+
// "value": 2301
|
|
39884
|
+
// }
|
|
39885
|
+
// ],
|
|
39886
|
+
// value: ['3', '4'],
|
|
39887
|
+
options: function () {
|
|
39888
|
+
var _options = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
39889
|
+
var search,
|
|
39890
|
+
_ref3,
|
|
39891
|
+
page,
|
|
39892
|
+
allOptions,
|
|
39893
|
+
filtered,
|
|
39894
|
+
pageSize,
|
|
39895
|
+
start,
|
|
39896
|
+
_args2 = arguments;
|
|
39897
|
+
return _regenerator().w(function (_context2) {
|
|
39898
|
+
while (1) switch (_context2.n) {
|
|
39899
|
+
case 0:
|
|
39900
|
+
search = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
|
|
39901
|
+
_ref3 = _args2.length > 2 ? _args2[2] : undefined, page = _ref3.page;
|
|
39902
|
+
_context2.n = 1;
|
|
39903
|
+
return simulateNetworkDelay();
|
|
39904
|
+
case 1:
|
|
39905
|
+
allOptions = createFakeOptions(0, 100);
|
|
39906
|
+
filtered = allOptions.filter(function (opt) {
|
|
39907
|
+
return opt.label.toLowerCase().includes(search.toLowerCase());
|
|
39908
|
+
});
|
|
39909
|
+
pageSize = 30;
|
|
39910
|
+
start = (page - 1) * pageSize;
|
|
39911
|
+
return _context2.a(2, {
|
|
39912
|
+
options: filtered.slice(start, start + pageSize),
|
|
39913
|
+
hasMore: start + pageSize < filtered.length,
|
|
39914
|
+
additional: {
|
|
39915
|
+
page: page + 1
|
|
39916
|
+
}
|
|
39917
|
+
});
|
|
39918
|
+
}
|
|
39919
|
+
}, _callee2);
|
|
39920
|
+
}));
|
|
39921
|
+
function options() {
|
|
39922
|
+
return _options.apply(this, arguments);
|
|
39923
|
+
}
|
|
39924
|
+
return options;
|
|
39925
|
+
}(),
|
|
39902
39926
|
placeholder: 'Sélectionnez une ou plusieurs options',
|
|
39903
39927
|
optionLabel: 'label',
|
|
39904
39928
|
optionValue: 'value',
|
|
@@ -40008,7 +40032,7 @@ var asyncOptions = /*#__PURE__*/function () {
|
|
|
40008
40032
|
var MultiSelectMetaAsyncPresets = {
|
|
40009
40033
|
// Configuration pour les options synchrones
|
|
40010
40034
|
SyncOptions: {
|
|
40011
|
-
value: ['
|
|
40035
|
+
value: ['2', '9'],
|
|
40012
40036
|
options: syncOptions,
|
|
40013
40037
|
placeholder: 'Sélectionnez une ou plusieurs options',
|
|
40014
40038
|
optionLabel: 'label',
|
|
@@ -40030,7 +40054,7 @@ var MultiSelectMetaAsyncPresets = {
|
|
|
40030
40054
|
},
|
|
40031
40055
|
// Configuration pour les options asynchrones
|
|
40032
40056
|
AsyncOptions: {
|
|
40033
|
-
value: ['1', '
|
|
40057
|
+
value: ['1', '12'],
|
|
40034
40058
|
options: asyncOptions,
|
|
40035
40059
|
placeholder: 'Sélectionnez une ou plusieurs options',
|
|
40036
40060
|
optionLabel: 'label',
|