arengibook 2.4.652 → 2.4.655
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 +46 -102
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36198,7 +36198,10 @@ var DropdownSelectMetaAsync = function DropdownSelectMetaAsync(_ref) {
|
|
|
36198
36198
|
borderRadius: '8px',
|
|
36199
36199
|
boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.15)',
|
|
36200
36200
|
display: 'inline-block',
|
|
36201
|
-
|
|
36201
|
+
marginBottom: '5px',
|
|
36202
|
+
fontFamily: 'Arial',
|
|
36203
|
+
cursor: 'pointer',
|
|
36204
|
+
marginRight: '15px'
|
|
36202
36205
|
}, valueStyle)
|
|
36203
36206
|
}, selectedOption[optionLabel]);
|
|
36204
36207
|
};
|
|
@@ -36406,7 +36409,8 @@ var Dropdown = function Dropdown(props) {
|
|
|
36406
36409
|
}, [value]);
|
|
36407
36410
|
var style = {
|
|
36408
36411
|
border: invalid ? '1px solid red' : '1px solid #ccc',
|
|
36409
|
-
width: '100%'
|
|
36412
|
+
width: '100%',
|
|
36413
|
+
minHeight: '45px'
|
|
36410
36414
|
};
|
|
36411
36415
|
var inverseColor = function inverseColor(hexColor) {
|
|
36412
36416
|
var r = parseInt(hexColor.substr(1, 2), 16);
|
|
@@ -36483,7 +36487,10 @@ var Dropdown = function Dropdown(props) {
|
|
|
36483
36487
|
borderRadius: '8px',
|
|
36484
36488
|
boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.15)',
|
|
36485
36489
|
display: 'inline-block',
|
|
36486
|
-
|
|
36490
|
+
marginBottom: '5px',
|
|
36491
|
+
fontFamily: 'Arial',
|
|
36492
|
+
cursor: 'pointer',
|
|
36493
|
+
marginRight: '15px'
|
|
36487
36494
|
}, valueStyle)
|
|
36488
36495
|
}, option !== null && option !== void 0 && option[optionLabel] ? /*#__PURE__*/React__default.createElement("span", {
|
|
36489
36496
|
style: {
|
|
@@ -39123,6 +39130,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39123
39130
|
ongletID = _ref$ongletID === void 0 ? null : _ref$ongletID,
|
|
39124
39131
|
_ref$classInput = _ref.classInput,
|
|
39125
39132
|
classInput = _ref$classInput === void 0 ? null : _ref$classInput;
|
|
39133
|
+
_ref.displayNbOption;
|
|
39126
39134
|
var _useState = useState(null),
|
|
39127
39135
|
_useState2 = _slicedToArray$9(_useState, 2),
|
|
39128
39136
|
selectedOptions = _useState2[0],
|
|
@@ -39140,6 +39148,10 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39140
39148
|
var currentPageRef = useRef(1);
|
|
39141
39149
|
var isOptionsArray = Array.isArray(options);
|
|
39142
39150
|
var clickedFromList = useRef(false);
|
|
39151
|
+
var _useState7 = useState(false),
|
|
39152
|
+
_useState8 = _slicedToArray$9(_useState7, 2);
|
|
39153
|
+
_useState8[0];
|
|
39154
|
+
var setHovered = _useState8[1];
|
|
39143
39155
|
var fetchOptionsFromUrl = /*#__PURE__*/function () {
|
|
39144
39156
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
39145
39157
|
var search,
|
|
@@ -39181,9 +39193,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39181
39193
|
return response.json();
|
|
39182
39194
|
case 4:
|
|
39183
39195
|
responseJSON = _context.v;
|
|
39184
|
-
// Simule le filtrage et le mapping comme dans loadOptions
|
|
39185
39196
|
dataAjax = responseJSON.data.filter(function (data) {
|
|
39186
|
-
// Logique de filtrage si nécessaire (à adapter selon vos besoins)
|
|
39187
39197
|
return true;
|
|
39188
39198
|
});
|
|
39189
39199
|
mappedOptions = dataAjax.map(function (opt) {
|
|
@@ -39273,7 +39283,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39273
39283
|
options: []
|
|
39274
39284
|
};
|
|
39275
39285
|
case 5:
|
|
39276
|
-
// setLoadedOptions(result?.options || []);
|
|
39277
39286
|
setLoadedOptions(_flattenOptions(((_result = result) === null || _result === void 0 ? void 0 : _result.options) || []));
|
|
39278
39287
|
if (objValue) {
|
|
39279
39288
|
exists = (_result2 = result) === null || _result2 === void 0 || (_result2 = _result2.options) === null || _result2 === void 0 ? void 0 : _result2.some(function (opt) {
|
|
@@ -39313,14 +39322,10 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39313
39322
|
observer.disconnect();
|
|
39314
39323
|
};
|
|
39315
39324
|
}, []);
|
|
39316
|
-
|
|
39317
|
-
// Gestion du changement de sélection
|
|
39318
39325
|
var handleChange = function handleChange(e) {
|
|
39319
39326
|
setSelectedOptions(e.value);
|
|
39320
39327
|
if (onChange) onChange(e.value);
|
|
39321
39328
|
};
|
|
39322
|
-
|
|
39323
|
-
// Inversion de couleur pour le texte des badges
|
|
39324
39329
|
var inverseColor = function inverseColor(hexColor) {
|
|
39325
39330
|
var r = parseInt(hexColor.substr(1, 2), 16);
|
|
39326
39331
|
var g = parseInt(hexColor.substr(3, 2), 16);
|
|
@@ -39330,7 +39335,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39330
39335
|
};
|
|
39331
39336
|
var style = {
|
|
39332
39337
|
border: invalid ? '1px solid red' : '1px solid #ccc',
|
|
39333
|
-
width: '100%'
|
|
39338
|
+
width: '100%',
|
|
39339
|
+
minHeight: '45px'
|
|
39334
39340
|
};
|
|
39335
39341
|
var optionTemplate = function optionTemplate(option) {
|
|
39336
39342
|
if (!option) return null;
|
|
@@ -39360,45 +39366,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39360
39366
|
style: styleLabel
|
|
39361
39367
|
}, option[optionLabel]));
|
|
39362
39368
|
};
|
|
39363
|
-
|
|
39364
|
-
// const selectedItemTemplate = (option) => {
|
|
39365
|
-
//
|
|
39366
|
-
// const selectedOption = objValue.find(opt => opt[optionValue] === option);
|
|
39367
|
-
// if (!selectedOption) return null;
|
|
39368
|
-
// // const isLastItem = index === selectedOptions.length - 1;
|
|
39369
|
-
// const handleRemove = (e) => {
|
|
39370
|
-
// e.stopPropagation();
|
|
39371
|
-
// const newSelectedOptions = selectedOptions.filter(opt => opt !== option);
|
|
39372
|
-
// setSelectedOptions(newSelectedOptions);
|
|
39373
|
-
// if (onChange) onChange(newSelectedOptions);
|
|
39374
|
-
// };
|
|
39375
|
-
//
|
|
39376
|
-
// return (
|
|
39377
|
-
// <span
|
|
39378
|
-
// onClick={handleRemove}
|
|
39379
|
-
// style={{
|
|
39380
|
-
// backgroundColor: selectedOption?.color ? selectedOption?.color : '#f8e6ec',
|
|
39381
|
-
// color: selectedOption?.color ? inverseColor(selectedOption?.color) : '#333',
|
|
39382
|
-
// padding: '6px 12px',
|
|
39383
|
-
// fontSize: '14px',
|
|
39384
|
-
// borderRadius: '8px',
|
|
39385
|
-
// boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.15)',
|
|
39386
|
-
// display: 'inline-block',
|
|
39387
|
-
// marginBottom: '5px',
|
|
39388
|
-
// fontFamily: 'Arial',
|
|
39389
|
-
// cursor: 'pointer',
|
|
39390
|
-
// marginRight: '15px',
|
|
39391
|
-
// ...valueStyle,
|
|
39392
|
-
// }}
|
|
39393
|
-
// >
|
|
39394
|
-
// {selectedOption[optionLabel]}
|
|
39395
|
-
// <span style={{ marginLeft: '5px' }}>×</span>
|
|
39396
|
-
// </span>
|
|
39397
|
-
// );
|
|
39398
|
-
//
|
|
39399
|
-
//
|
|
39400
|
-
// };
|
|
39401
|
-
|
|
39402
39369
|
var _flattenOptions = function flattenOptions(options) {
|
|
39403
39370
|
if (!Array.isArray(options)) return [];
|
|
39404
39371
|
return options.reduce(function (acc, item) {
|
|
@@ -39410,8 +39377,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39410
39377
|
return acc;
|
|
39411
39378
|
}, []);
|
|
39412
39379
|
};
|
|
39413
|
-
|
|
39414
|
-
// util pour unifier la comparaison (objet => id | primitif => lui-même)
|
|
39415
39380
|
var getKey = function getKey(v) {
|
|
39416
39381
|
return v && _typeof$b(v) === 'object' ? v[optionValue] : v;
|
|
39417
39382
|
};
|
|
@@ -39530,11 +39495,18 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
39530
39495
|
}, _callee3);
|
|
39531
39496
|
})), 500);
|
|
39532
39497
|
};
|
|
39498
|
+
selectedOptions ? selectedOptions.length : 0;
|
|
39533
39499
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
39534
39500
|
ref: multiSelectRef,
|
|
39535
39501
|
className: "flex flex-col gap-1",
|
|
39536
39502
|
style: {
|
|
39537
39503
|
width: '100%'
|
|
39504
|
+
},
|
|
39505
|
+
onMouseEnter: function onMouseEnter() {
|
|
39506
|
+
return setHovered(true);
|
|
39507
|
+
},
|
|
39508
|
+
onMouseLeave: function onMouseLeave() {
|
|
39509
|
+
return setHovered(false);
|
|
39538
39510
|
}
|
|
39539
39511
|
}, /*#__PURE__*/React__default.createElement(MultiSelect$1, {
|
|
39540
39512
|
options: _flattenOptions(loadedOptions),
|
|
@@ -39636,7 +39608,9 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
39636
39608
|
generalImage: null
|
|
39637
39609
|
} : _props$groupedItemTem,
|
|
39638
39610
|
_props$isSelectMeta = props.isSelectMeta,
|
|
39639
|
-
isSelectMeta = _props$isSelectMeta === void 0 ? false : _props$isSelectMeta
|
|
39611
|
+
isSelectMeta = _props$isSelectMeta === void 0 ? false : _props$isSelectMeta,
|
|
39612
|
+
_props$ongletID = props.ongletID,
|
|
39613
|
+
ongletID = _props$ongletID === void 0 ? null : _props$ongletID;
|
|
39640
39614
|
var isAsyncOptions = typeof options === 'function';
|
|
39641
39615
|
if (isAsyncOptions) {
|
|
39642
39616
|
return /*#__PURE__*/React__default.createElement(MultiSelectMetaAsync, props);
|
|
@@ -39653,7 +39627,8 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
39653
39627
|
setHovered = _useState4[1];
|
|
39654
39628
|
var style = {
|
|
39655
39629
|
border: invalid ? '1px solid red' : '1px solid #ccc',
|
|
39656
|
-
width: '100%'
|
|
39630
|
+
width: '100%',
|
|
39631
|
+
minHeight: '45px'
|
|
39657
39632
|
};
|
|
39658
39633
|
useEffect(function () {
|
|
39659
39634
|
var observer = new MutationObserver(function () {
|
|
@@ -39883,14 +39858,22 @@ var MultiSelect = function MultiSelect(props) {
|
|
|
39883
39858
|
});
|
|
39884
39859
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
39885
39860
|
key: index
|
|
39886
|
-
}, option ? option
|
|
39887
|
-
})))), name && /*#__PURE__*/React__default.createElement("
|
|
39888
|
-
|
|
39889
|
-
|
|
39890
|
-
|
|
39891
|
-
|
|
39892
|
-
|
|
39893
|
-
|
|
39861
|
+
}, option ? option[optionLabel] : optionValue);
|
|
39862
|
+
})))), name && /*#__PURE__*/React__default.createElement("div", null, (Array.isArray(selectedOptions) ? selectedOptions : []).filter(function (opt) {
|
|
39863
|
+
return opt && (_typeof$b(opt) === 'object' || typeof opt === 'number' || typeof opt === 'string');
|
|
39864
|
+
}).map(function (opt, index) {
|
|
39865
|
+
// normalisation
|
|
39866
|
+
var id = _typeof$b(opt) === 'object' && opt !== null ? opt[optionValue] : opt;
|
|
39867
|
+
var nameAttr = _typeof$b(opt) === 'object' && opt !== null ? opt[optionLabel] || opt.nom || '' : '';
|
|
39868
|
+
return /*#__PURE__*/React__default.createElement("input", {
|
|
39869
|
+
key: index,
|
|
39870
|
+
type: "hidden",
|
|
39871
|
+
name: name,
|
|
39872
|
+
"data-id-onglet": ongletID,
|
|
39873
|
+
"data-name": nameAttr,
|
|
39874
|
+
value: id
|
|
39875
|
+
});
|
|
39876
|
+
})), invalid && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("small", {
|
|
39894
39877
|
style: {
|
|
39895
39878
|
color: 'red',
|
|
39896
39879
|
fontStyle: 'italic'
|
|
@@ -40081,46 +40064,6 @@ var MultiSelectPresets = {
|
|
|
40081
40064
|
useCheckbox: false,
|
|
40082
40065
|
showSelectAll: false
|
|
40083
40066
|
},
|
|
40084
|
-
// Configuration pour les options asynchrones
|
|
40085
|
-
// SelectMetaAsync: {
|
|
40086
|
-
// isSelectMeta: true,
|
|
40087
|
-
// value: [9, 4],
|
|
40088
|
-
// objValue: [{ label: 'Option 9', value: 9, color: "#67688C" }, { label: 'Option 4', value: 4, color: "#39C9BF" }],
|
|
40089
|
-
// options: async (search = '', _, { page }) => {
|
|
40090
|
-
// await simulateNetworkDelay();
|
|
40091
|
-
// const allOptions = createFakeOptions(0, 100);
|
|
40092
|
-
// const filtered = allOptions.filter(opt =>
|
|
40093
|
-
// opt.label.toLowerCase().includes(search.toLowerCase())
|
|
40094
|
-
// );
|
|
40095
|
-
// const pageSize = 30;
|
|
40096
|
-
// const start = (page - 1) * pageSize;
|
|
40097
|
-
// return {
|
|
40098
|
-
// options: filtered.slice(start, start + pageSize),
|
|
40099
|
-
// hasMore: start + pageSize < filtered.length,
|
|
40100
|
-
// additional: { page: page + 1 },
|
|
40101
|
-
// };
|
|
40102
|
-
// },
|
|
40103
|
-
// optionLabel: 'label',
|
|
40104
|
-
// optionValue: 'value',
|
|
40105
|
-
//
|
|
40106
|
-
// // value: [3,4],
|
|
40107
|
-
// // objValue: [{ name: 'Clementine Bauch', id: 3 }, { name: 'Patricia Lebsack', id: 4 }],
|
|
40108
|
-
// // optionsUrl: "https://jsonplaceholder.typicode.com/users",
|
|
40109
|
-
// // optionLabel: 'name',
|
|
40110
|
-
// // optionValue: 'id',
|
|
40111
|
-
//
|
|
40112
|
-
// placeholder: 'Sélectionnez une ou plusieurs options',
|
|
40113
|
-
// valueStyle: { marginRight: '15px', marginBottom: '5px' },
|
|
40114
|
-
// selectMetaConfig: {
|
|
40115
|
-
// labelStyle: { fontWeight: 'bold' },
|
|
40116
|
-
// generalIcon: 'pi pi-tag',
|
|
40117
|
-
// },
|
|
40118
|
-
// filter: false,
|
|
40119
|
-
// showClear: false,
|
|
40120
|
-
// useCheckbox: false,
|
|
40121
|
-
// showSelectAll: false,
|
|
40122
|
-
// },
|
|
40123
|
-
|
|
40124
40067
|
SelectMetaAsync: {
|
|
40125
40068
|
isSelectMeta: true,
|
|
40126
40069
|
value: [9, 4],
|
|
@@ -40200,6 +40143,7 @@ var MultiSelectPresets = {
|
|
|
40200
40143
|
},
|
|
40201
40144
|
generalIcon: 'pi pi-tag'
|
|
40202
40145
|
},
|
|
40146
|
+
displayNbOption: true,
|
|
40203
40147
|
filter: false,
|
|
40204
40148
|
showClear: false,
|
|
40205
40149
|
useCheckbox: false,
|