arengibook 3.0.6-main → 3.0.7-main
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 +1157 -253
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41019,7 +41019,7 @@ var css_248z$4 = "@charset \"UTF-8\";\n@keyframes fadeIn {\n from {\n opacit
|
|
|
41019
41019
|
styleInject(css_248z$4);
|
|
41020
41020
|
|
|
41021
41021
|
var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
41022
|
-
var
|
|
41022
|
+
var _window$Translator, _window$Translator2;
|
|
41023
41023
|
var _ref$value = _ref.value,
|
|
41024
41024
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
41025
41025
|
options = _ref.options,
|
|
@@ -41037,7 +41037,12 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41037
41037
|
_ref$valueStyle = _ref.valueStyle,
|
|
41038
41038
|
valueStyle = _ref$valueStyle === void 0 ? {} : _ref$valueStyle,
|
|
41039
41039
|
_ref$optionStyle = _ref.optionStyle,
|
|
41040
|
-
optionStyle = _ref$optionStyle === void 0 ? {
|
|
41040
|
+
optionStyle = _ref$optionStyle === void 0 ? {
|
|
41041
|
+
maxWidth: '250px',
|
|
41042
|
+
overflow: 'hidden',
|
|
41043
|
+
textOverflow: 'ellipsis',
|
|
41044
|
+
whiteSpace: 'nowrap'
|
|
41045
|
+
} : _ref$optionStyle,
|
|
41041
41046
|
_ref$filter = _ref.filter,
|
|
41042
41047
|
filter = _ref$filter === void 0 ? false : _ref$filter,
|
|
41043
41048
|
_ref$invalid = _ref.invalid,
|
|
@@ -41051,22 +41056,77 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41051
41056
|
labelStyle: null,
|
|
41052
41057
|
generalIcon: null
|
|
41053
41058
|
} : _ref$selectMetaConfig,
|
|
41059
|
+
_ref$selectConfig = _ref.selectConfig,
|
|
41060
|
+
selectConfig = _ref$selectConfig === void 0 ? {
|
|
41061
|
+
labelStyle: null,
|
|
41062
|
+
generalIcon: null
|
|
41063
|
+
} : _ref$selectConfig,
|
|
41054
41064
|
_ref$objValue = _ref.objValue,
|
|
41055
41065
|
objValue = _ref$objValue === void 0 ? null : _ref$objValue,
|
|
41056
41066
|
_ref$useCheckbox = _ref.useCheckbox,
|
|
41057
41067
|
useCheckbox = _ref$useCheckbox === void 0 ? false : _ref$useCheckbox,
|
|
41058
41068
|
_ref$showSelectAll = _ref.showSelectAll,
|
|
41059
|
-
showSelectAll = _ref$showSelectAll === void 0 ? true : _ref$showSelectAll
|
|
41069
|
+
showSelectAll = _ref$showSelectAll === void 0 ? true : _ref$showSelectAll;
|
|
41070
|
+
_ref.selectAll;
|
|
41071
|
+
var onSelectAll = _ref.onSelectAll,
|
|
41060
41072
|
_ref$ongletID = _ref.ongletID,
|
|
41061
41073
|
ongletID = _ref$ongletID === void 0 ? null : _ref$ongletID,
|
|
41062
41074
|
_ref$classInput = _ref.classInput,
|
|
41063
41075
|
classInput = _ref$classInput === void 0 ? null : _ref$classInput,
|
|
41064
|
-
_ref$
|
|
41065
|
-
|
|
41076
|
+
_ref$displayCounter = _ref.displayCounter,
|
|
41077
|
+
displayCounter = _ref$displayCounter === void 0 ? false : _ref$displayCounter,
|
|
41078
|
+
maxVisibleCounter = _ref.maxVisibleCounter,
|
|
41066
41079
|
badgeSize = _ref.badgeSize,
|
|
41067
41080
|
virtualScroll = _ref.virtualScroll,
|
|
41068
41081
|
_ref$required = _ref.required,
|
|
41069
|
-
required = _ref$required === void 0 ? false : _ref$required
|
|
41082
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
|
41083
|
+
maxSelectedLabels = _ref.maxSelectedLabels,
|
|
41084
|
+
hasInfoLine = _ref.hasInfoLine,
|
|
41085
|
+
_ref$displayBadge = _ref.displayBadge,
|
|
41086
|
+
displayBadge = _ref$displayBadge === void 0 ? false : _ref$displayBadge,
|
|
41087
|
+
_ref$withColor = _ref.withColor,
|
|
41088
|
+
withColor = _ref$withColor === void 0 ? false : _ref$withColor,
|
|
41089
|
+
_ref$withIcon = _ref.withIcon,
|
|
41090
|
+
withIcon = _ref$withIcon === void 0 ? true : _ref$withIcon,
|
|
41091
|
+
_ref$isSelectMeta = _ref.isSelectMeta,
|
|
41092
|
+
isSelectMeta = _ref$isSelectMeta === void 0 ? false : _ref$isSelectMeta,
|
|
41093
|
+
_ref$enableItemToolti = _ref.enableItemTooltip,
|
|
41094
|
+
enableItemTooltip = _ref$enableItemToolti === void 0 ? false : _ref$enableItemToolti,
|
|
41095
|
+
_ref$enableItemLink = _ref.enableItemLink,
|
|
41096
|
+
enableItemLink = _ref$enableItemLink === void 0 ? false : _ref$enableItemLink,
|
|
41097
|
+
_ref$enableSecondaryL = _ref.enableSecondaryLabel,
|
|
41098
|
+
enableSecondaryLabel = _ref$enableSecondaryL === void 0 ? false : _ref$enableSecondaryL,
|
|
41099
|
+
_ref$secondaryLabelKe = _ref.secondaryLabelKey,
|
|
41100
|
+
secondaryLabelKey = _ref$secondaryLabelKe === void 0 ? 'profession' : _ref$secondaryLabelKe,
|
|
41101
|
+
_ref$subItem = _ref.subItem,
|
|
41102
|
+
subItem = _ref$subItem === void 0 ? false : _ref$subItem,
|
|
41103
|
+
truncateAt = _ref.truncateAt,
|
|
41104
|
+
_ref$itemsCheckedToTh = _ref.itemsCheckedToTheTop,
|
|
41105
|
+
itemsCheckedToTheTop = _ref$itemsCheckedToTh === void 0 ? false : _ref$itemsCheckedToTh,
|
|
41106
|
+
_ref$enableSorting = _ref.enableSorting,
|
|
41107
|
+
enableSorting = _ref$enableSorting === void 0 ? false : _ref$enableSorting,
|
|
41108
|
+
_ref$openOnHover = _ref.openOnHover,
|
|
41109
|
+
openOnHover = _ref$openOnHover === void 0 ? false : _ref$openOnHover,
|
|
41110
|
+
readOnly = _ref.readOnly,
|
|
41111
|
+
status = _ref.status,
|
|
41112
|
+
maxSelected = _ref.maxSelected,
|
|
41113
|
+
onClearAll = _ref.onClearAll,
|
|
41114
|
+
onApply = _ref.onApply,
|
|
41115
|
+
valueToapply = _ref.valueToapply,
|
|
41116
|
+
_ref$closeIcon = _ref.closeIcon,
|
|
41117
|
+
closeIcon = _ref$closeIcon === void 0 ? null : _ref$closeIcon,
|
|
41118
|
+
onHide = _ref.onHide;
|
|
41119
|
+
_ref.withSearch;
|
|
41120
|
+
_ref.renderValue;
|
|
41121
|
+
_ref.onModeChange;
|
|
41122
|
+
var _ref$isGroupedOption = _ref.isGroupedOption,
|
|
41123
|
+
isGroupedOption = _ref$isGroupedOption === void 0 ? false : _ref$isGroupedOption,
|
|
41124
|
+
optionGroupChildren = _ref.optionGroupChildren,
|
|
41125
|
+
optionGroupLabel = _ref.optionGroupLabel,
|
|
41126
|
+
_ref$enableGroupSelec = _ref.enableGroupSelect,
|
|
41127
|
+
enableGroupSelect = _ref$enableGroupSelec === void 0 ? false : _ref$enableGroupSelec;
|
|
41128
|
+
_ref.groupedItemTemplateConfig;
|
|
41129
|
+
_ref.maxVisibleChips;
|
|
41070
41130
|
var _useState = useState(null),
|
|
41071
41131
|
_useState2 = _slicedToArray$d(_useState, 2),
|
|
41072
41132
|
selectedOptions = _useState2[0],
|
|
@@ -41075,24 +41135,56 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41075
41135
|
_useState4 = _slicedToArray$d(_useState3, 2),
|
|
41076
41136
|
loadedOptions = _useState4[0],
|
|
41077
41137
|
setLoadedOptions = _useState4[1];
|
|
41138
|
+
var loadedOptionsRef = useRef([]);
|
|
41078
41139
|
var multiSelectRef = useRef(null);
|
|
41140
|
+
var containerRef = useRef(null);
|
|
41079
41141
|
var _useState5 = useState(false),
|
|
41080
41142
|
_useState6 = _slicedToArray$d(_useState5, 2),
|
|
41081
41143
|
loading = _useState6[0],
|
|
41082
41144
|
setLoading = _useState6[1];
|
|
41145
|
+
var isLoadingRef = useRef(false);
|
|
41083
41146
|
var loadLazyTimeout = useRef();
|
|
41084
41147
|
var currentPageRef = useRef(1);
|
|
41085
|
-
var
|
|
41086
|
-
var
|
|
41087
|
-
var
|
|
41088
|
-
|
|
41089
|
-
|
|
41090
|
-
|
|
41091
|
-
var
|
|
41148
|
+
var searchTermRef = useRef('');
|
|
41149
|
+
var searchTimeout = useRef(null);
|
|
41150
|
+
var updateLoadedOptions = function updateLoadedOptions(opts) {
|
|
41151
|
+
loadedOptionsRef.current = opts;
|
|
41152
|
+
setLoadedOptions(opts);
|
|
41153
|
+
};
|
|
41154
|
+
var _useState7 = useState(0),
|
|
41155
|
+
_useState8 = _slicedToArray$d(_useState7, 2),
|
|
41156
|
+
tooltipKey = _useState8[0],
|
|
41157
|
+
setTooltipKey = _useState8[1];
|
|
41158
|
+
var _useState9 = useState(null),
|
|
41092
41159
|
_useState0 = _slicedToArray$d(_useState9, 2),
|
|
41093
|
-
|
|
41094
|
-
|
|
41160
|
+
sortOrder = _useState0[0],
|
|
41161
|
+
setSortOrder = _useState0[1];
|
|
41162
|
+
var _useState1 = useState([]),
|
|
41163
|
+
_useState10 = _slicedToArray$d(_useState1, 2),
|
|
41164
|
+
collapsedGroups = _useState10[0],
|
|
41165
|
+
setCollapsedGroups = _useState10[1];
|
|
41166
|
+
var _useState11 = useState(value !== null && value !== void 0 ? value : []),
|
|
41167
|
+
_useState12 = _slicedToArray$d(_useState11, 2);
|
|
41168
|
+
_useState12[0];
|
|
41169
|
+
_useState12[1];
|
|
41170
|
+
var _useState13 = useState(null),
|
|
41171
|
+
_useState14 = _slicedToArray$d(_useState13, 2),
|
|
41172
|
+
displayValue = _useState14[0],
|
|
41173
|
+
setDisplayValue = _useState14[1];
|
|
41174
|
+
var isOptionsArray = Array.isArray(options) && !optionsUrl;
|
|
41175
|
+
var hasMoreRef = useRef(true);
|
|
41176
|
+
var effectiveReadOnly = Boolean(readOnly);
|
|
41177
|
+
var applyEnabled = typeof onApply === 'function';
|
|
41178
|
+
var _useState15 = useState(false),
|
|
41179
|
+
_useState16 = _slicedToArray$d(_useState15, 2),
|
|
41180
|
+
showRequiredError = _useState16[0],
|
|
41181
|
+
setShowRequiredError = _useState16[1];
|
|
41095
41182
|
var hasSelection = Array.isArray(selectedOptions) && selectedOptions.length > 0;
|
|
41183
|
+
var isError = Boolean(invalid || status === 'error' || showRequiredError);
|
|
41184
|
+
var isInvalidEffective = Boolean(isError && !hasSelection);
|
|
41185
|
+
|
|
41186
|
+
// ─── Async loading ────────────────────────────────────────────────────────
|
|
41187
|
+
|
|
41096
41188
|
var fetchOptionsFromUrl = /*#__PURE__*/function () {
|
|
41097
41189
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
41098
41190
|
var search,
|
|
@@ -41106,6 +41198,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41106
41198
|
responseJSON,
|
|
41107
41199
|
dataAjax,
|
|
41108
41200
|
mappedOptions,
|
|
41201
|
+
hasMore,
|
|
41109
41202
|
_args = arguments,
|
|
41110
41203
|
_t;
|
|
41111
41204
|
return _regenerator().w(function (_context) {
|
|
@@ -41114,7 +41207,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41114
41207
|
search = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
|
|
41115
41208
|
_ref3 = _args.length > 2 ? _args[2] : undefined, _ref3$page = _ref3.page, page = _ref3$page === void 0 ? 1 : _ref3$page;
|
|
41116
41209
|
_context.p = 1;
|
|
41117
|
-
length = 25;
|
|
41210
|
+
length = 25;
|
|
41118
41211
|
start = (page - 1) * length;
|
|
41119
41212
|
queryParams = new URLSearchParams();
|
|
41120
41213
|
if (search) queryParams.append('search[value]', search);
|
|
@@ -41125,36 +41218,46 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41125
41218
|
case 2:
|
|
41126
41219
|
response = _context.v;
|
|
41127
41220
|
if (response.ok) {
|
|
41221
|
+
_context.n = 4;
|
|
41222
|
+
break;
|
|
41223
|
+
}
|
|
41224
|
+
if (!(response.status === 404)) {
|
|
41128
41225
|
_context.n = 3;
|
|
41129
41226
|
break;
|
|
41130
41227
|
}
|
|
41131
|
-
|
|
41228
|
+
hasMoreRef.current = false;
|
|
41229
|
+
return _context.a(2, {
|
|
41230
|
+
options: [],
|
|
41231
|
+
hasMore: false
|
|
41232
|
+
});
|
|
41132
41233
|
case 3:
|
|
41133
|
-
|
|
41134
|
-
return response.json();
|
|
41234
|
+
throw new Error("Erreur HTTP: ".concat(response.status));
|
|
41135
41235
|
case 4:
|
|
41236
|
+
_context.n = 5;
|
|
41237
|
+
return response.json();
|
|
41238
|
+
case 5:
|
|
41136
41239
|
responseJSON = _context.v;
|
|
41137
|
-
dataAjax = responseJSON.data
|
|
41138
|
-
return true;
|
|
41139
|
-
});
|
|
41240
|
+
dataAjax = responseJSON.data || [];
|
|
41140
41241
|
mappedOptions = dataAjax.map(function (opt) {
|
|
41141
|
-
if (
|
|
41142
|
-
opt.color =
|
|
41242
|
+
if (opt.hasOwnProperty('color') && opt.color !== null && opt.color.length > 0) {
|
|
41243
|
+
opt.color = opt.color.toLowerCase();
|
|
41244
|
+
} else {
|
|
41245
|
+
delete opt.color;
|
|
41143
41246
|
}
|
|
41144
|
-
opt.
|
|
41145
|
-
opt.label = opt.nom;
|
|
41247
|
+
opt.label = opt.nom !== undefined && opt.nom !== null ? opt.nom : opt.label;
|
|
41146
41248
|
opt.value = opt.id;
|
|
41147
41249
|
return opt;
|
|
41148
41250
|
});
|
|
41251
|
+
hasMore = start + dataAjax.length < responseJSON.recordsTotal;
|
|
41149
41252
|
return _context.a(2, {
|
|
41150
41253
|
options: mappedOptions,
|
|
41151
|
-
hasMore:
|
|
41254
|
+
hasMore: hasMore,
|
|
41152
41255
|
additional: {
|
|
41153
41256
|
page: page + 1
|
|
41154
41257
|
}
|
|
41155
41258
|
});
|
|
41156
|
-
case
|
|
41157
|
-
_context.p =
|
|
41259
|
+
case 6:
|
|
41260
|
+
_context.p = 6;
|
|
41158
41261
|
_t = _context.v;
|
|
41159
41262
|
console.error("Erreur lors de la récupération des options :", _t);
|
|
41160
41263
|
return _context.a(2, {
|
|
@@ -41162,7 +41265,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41162
41265
|
hasMore: false
|
|
41163
41266
|
});
|
|
41164
41267
|
}
|
|
41165
|
-
}, _callee, null, [[1,
|
|
41268
|
+
}, _callee, null, [[1, 6]]);
|
|
41166
41269
|
}));
|
|
41167
41270
|
return function fetchOptionsFromUrl() {
|
|
41168
41271
|
return _ref2.apply(this, arguments);
|
|
@@ -41172,15 +41275,11 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41172
41275
|
return _objectSpread2(_objectSpread2({}, opt), {}, _defineProperty$g({}, optionValue, typeof opt[optionValue] === 'string' ? parseInt(opt[optionValue], 10) : opt[optionValue]));
|
|
41173
41276
|
}) : [];
|
|
41174
41277
|
var numValue = function numValue() {
|
|
41175
|
-
if (value && Array.isArray(value) && value.length)
|
|
41176
|
-
|
|
41177
|
-
|
|
41178
|
-
|
|
41179
|
-
|
|
41180
|
-
});
|
|
41181
|
-
} else {
|
|
41182
|
-
return [];
|
|
41183
|
-
}
|
|
41278
|
+
if (value && Array.isArray(value) && value.length) return value;
|
|
41279
|
+
if (objValue && Array.isArray(objValue) && objValue.length) return objValue.map(function (opt) {
|
|
41280
|
+
return parseInt(opt.value);
|
|
41281
|
+
});
|
|
41282
|
+
return [];
|
|
41184
41283
|
};
|
|
41185
41284
|
useEffect(function () {
|
|
41186
41285
|
if (hasSelection) setShowRequiredError(false);
|
|
@@ -41190,10 +41289,12 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41190
41289
|
setSelectedOptions(numObjValue && Array.isArray(numObjValue) && numObjValue.length ? numObjValue.map(function (opt) {
|
|
41191
41290
|
return opt[optionValue];
|
|
41192
41291
|
}) : (_numValue = numValue()) !== null && _numValue !== void 0 ? _numValue : []);
|
|
41292
|
+
currentPageRef.current = 1;
|
|
41293
|
+
hasMoreRef.current = true;
|
|
41193
41294
|
var loadInitialOptions = /*#__PURE__*/function () {
|
|
41194
41295
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
41195
|
-
var _result;
|
|
41196
|
-
var result,
|
|
41296
|
+
var _result, _result2;
|
|
41297
|
+
var result, initialOpts, existingValues, missingSelected;
|
|
41197
41298
|
return _regenerator().w(function (_context2) {
|
|
41198
41299
|
while (1) switch (_context2.n) {
|
|
41199
41300
|
case 0:
|
|
@@ -41227,17 +41328,20 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41227
41328
|
options: []
|
|
41228
41329
|
};
|
|
41229
41330
|
case 5:
|
|
41230
|
-
|
|
41231
|
-
|
|
41232
|
-
|
|
41233
|
-
|
|
41331
|
+
hasMoreRef.current = ((_result = result) === null || _result === void 0 ? void 0 : _result.hasMore) !== false;
|
|
41332
|
+
initialOpts = _flattenOptions(((_result2 = result) === null || _result2 === void 0 ? void 0 : _result2.options) || []);
|
|
41333
|
+
if (Array.isArray(numObjValue) && numObjValue.length > 0) {
|
|
41334
|
+
existingValues = new Set(initialOpts.map(function (o) {
|
|
41335
|
+
return String(o[optionValue]);
|
|
41336
|
+
}));
|
|
41337
|
+
missingSelected = numObjValue.filter(function (o) {
|
|
41338
|
+
return !existingValues.has(String(o[optionValue]));
|
|
41234
41339
|
});
|
|
41235
|
-
|
|
41236
|
-
|
|
41237
|
-
|
|
41238
|
-
});
|
|
41239
|
-
}
|
|
41340
|
+
updateLoadedOptions([].concat(_toConsumableArray$a(initialOpts), _toConsumableArray$a(missingSelected)));
|
|
41341
|
+
} else {
|
|
41342
|
+
updateLoadedOptions(initialOpts);
|
|
41240
41343
|
}
|
|
41344
|
+
// ─────────────────────────────────────────────────────────────────
|
|
41241
41345
|
case 6:
|
|
41242
41346
|
return _context2.a(2);
|
|
41243
41347
|
}
|
|
@@ -41252,157 +41356,71 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41252
41356
|
useEffect(function () {
|
|
41253
41357
|
var observer = new MutationObserver(function () {
|
|
41254
41358
|
var panel = document.querySelector('.p-multiselect-panel.p-component');
|
|
41255
|
-
if (panel)
|
|
41256
|
-
panel.style.zIndex = '10000';
|
|
41257
|
-
}
|
|
41359
|
+
if (panel) panel.style.zIndex = '10000';
|
|
41258
41360
|
});
|
|
41259
41361
|
observer.observe(document.body, {
|
|
41260
41362
|
childList: true,
|
|
41261
41363
|
subtree: true
|
|
41262
41364
|
});
|
|
41263
41365
|
return function () {
|
|
41264
|
-
observer.disconnect();
|
|
41366
|
+
return observer.disconnect();
|
|
41265
41367
|
};
|
|
41266
41368
|
}, []);
|
|
41267
|
-
|
|
41268
|
-
|
|
41269
|
-
|
|
41270
|
-
|
|
41271
|
-
|
|
41272
|
-
|
|
41273
|
-
|
|
41274
|
-
|
|
41275
|
-
var luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
41276
|
-
return luminance > 0.18 ? '#000000' : '#FFFFFF';
|
|
41277
|
-
};
|
|
41278
|
-
var isInvalidEffective = invalid || showRequiredError && !hasSelection;
|
|
41279
|
-
var style = {
|
|
41280
|
-
border: isInvalidEffective ? '1px solid red' : '1px solid #ccc',
|
|
41281
|
-
width: '100%'
|
|
41282
|
-
};
|
|
41283
|
-
var optionTemplate = function optionTemplate(option) {
|
|
41284
|
-
if (!option) return null;
|
|
41285
|
-
var _ref5 = selectMetaConfig || {};
|
|
41286
|
-
_ref5.labelStyle;
|
|
41287
|
-
var generalIcon = _ref5.generalIcon;
|
|
41288
|
-
var styleLabel = {
|
|
41289
|
-
marginLeft: '10px'
|
|
41290
|
-
};
|
|
41291
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
41292
|
-
onClick: function onClick() {
|
|
41293
|
-
clickedFromList.current = true;
|
|
41294
|
-
},
|
|
41295
|
-
style: _objectSpread2({
|
|
41296
|
-
fontFamily: 'Arial',
|
|
41297
|
-
fontSize: '14px',
|
|
41298
|
-
display: 'flex',
|
|
41299
|
-
alignItems: 'center'
|
|
41300
|
-
}, optionStyle)
|
|
41301
|
-
}, !useCheckbox && /*#__PURE__*/React__default.createElement("style", null, "\n .p-multiselect-items .p-multiselect-item .p-checkbox {\n display: none !important;\n }\n .p-multiselect-items .p-multiselect-item {\n padding-left: 1rem !important;\n align-items: center;\n }\n "), !filter && !showSelectAll && /*#__PURE__*/React__default.createElement("style", null, "\n .p-multiselect-header {\n display: none !important;\n }\n "), generalIcon && /*#__PURE__*/React__default.createElement("i", {
|
|
41302
|
-
style: {
|
|
41303
|
-
color: option === null || option === void 0 ? void 0 : option.color,
|
|
41304
|
-
marginRight: '8px'
|
|
41305
|
-
},
|
|
41306
|
-
className: generalIcon
|
|
41307
|
-
}), /*#__PURE__*/React__default.createElement("span", {
|
|
41308
|
-
style: styleLabel
|
|
41309
|
-
}, option[optionLabel]));
|
|
41310
|
-
};
|
|
41311
|
-
var _flattenOptions = function flattenOptions(options) {
|
|
41312
|
-
if (!Array.isArray(options)) return [];
|
|
41313
|
-
return options.reduce(function (acc, item) {
|
|
41314
|
-
if (Array.isArray(item)) {
|
|
41315
|
-
acc.push.apply(acc, _toConsumableArray$a(_flattenOptions(item))); // récursion
|
|
41316
|
-
} else {
|
|
41317
|
-
acc.push(item);
|
|
41318
|
-
}
|
|
41319
|
-
return acc;
|
|
41320
|
-
}, []);
|
|
41321
|
-
};
|
|
41322
|
-
var getKey = function getKey(v) {
|
|
41323
|
-
return v && _typeof$g(v) === 'object' ? v[optionValue] : v;
|
|
41324
|
-
};
|
|
41325
|
-
var selectedItemTemplate = function selectedItemTemplate(paramValue, index) {
|
|
41326
|
-
var _selectedOption$color, _selectedOption$color2;
|
|
41327
|
-
var key = String(getKey(paramValue)); // normalise pour éviter 1 vs "1"
|
|
41328
|
-
|
|
41329
|
-
var selectedOption = _flattenOptions(loadedOptions).find(function (opt) {
|
|
41330
|
-
return String(opt[optionValue]) === key;
|
|
41331
|
-
});
|
|
41332
|
-
if (!selectedOption) return null;
|
|
41333
|
-
var objMatch = Array.isArray(objValue) ? objValue.find(function (o) {
|
|
41334
|
-
return String(o[optionValue]) === key;
|
|
41335
|
-
}) : null;
|
|
41336
|
-
if (objMatch) {
|
|
41337
|
-
var _objMatch$color;
|
|
41338
|
-
selectedOption = _objectSpread2(_objectSpread2({}, selectedOption), {}, {
|
|
41339
|
-
color: (_objMatch$color = objMatch.color) !== null && _objMatch$color !== void 0 ? _objMatch$color : selectedOption.color
|
|
41340
|
-
// A ajouter d'autres props visuelles si besoin:
|
|
41341
|
-
// exempl: backgroundColor: objMatch.backgroundColor ?? selectedOption.backgroundColor,
|
|
41342
|
-
});
|
|
41369
|
+
useEffect(function () {
|
|
41370
|
+
if (!displayBadge || !withColor) return;
|
|
41371
|
+
var styleId = 'multiselect-async-chip-colors';
|
|
41372
|
+
var styleEl = document.getElementById(styleId);
|
|
41373
|
+
if (!styleEl) {
|
|
41374
|
+
styleEl = document.createElement('style');
|
|
41375
|
+
styleEl.id = styleId;
|
|
41376
|
+
document.head.appendChild(styleEl);
|
|
41343
41377
|
}
|
|
41344
|
-
var
|
|
41345
|
-
|
|
41346
|
-
var
|
|
41347
|
-
return
|
|
41348
|
-
});
|
|
41349
|
-
setSelectedOptions(newSelected);
|
|
41350
|
-
if (onChange) onChange(newSelected);
|
|
41351
|
-
};
|
|
41352
|
-
return /*#__PURE__*/React__default.createElement("span", {
|
|
41353
|
-
onClick: handleRemove,
|
|
41354
|
-
style: _objectSpread2({
|
|
41355
|
-
backgroundColor: (_selectedOption$color = selectedOption.color) !== null && _selectedOption$color !== void 0 ? _selectedOption$color : '#f8e6ec',
|
|
41356
|
-
color: inverseColor((_selectedOption$color2 = selectedOption.color) !== null && _selectedOption$color2 !== void 0 ? _selectedOption$color2 : '#f8e6ec'),
|
|
41357
|
-
padding: '6px 12px',
|
|
41358
|
-
fontSize: '14px',
|
|
41359
|
-
borderRadius: '8px',
|
|
41360
|
-
boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.15)',
|
|
41361
|
-
display: 'inline-block',
|
|
41362
|
-
marginBottom: '5px',
|
|
41363
|
-
fontFamily: 'Arial',
|
|
41364
|
-
cursor: 'pointer',
|
|
41365
|
-
marginRight: '15px'
|
|
41366
|
-
}, valueStyle)
|
|
41367
|
-
}, selectedOption[optionLabel], /*#__PURE__*/React__default.createElement("span", {
|
|
41368
|
-
style: {
|
|
41369
|
-
marginLeft: '5px'
|
|
41370
|
-
}
|
|
41371
|
-
}, "\xD7"));
|
|
41372
|
-
};
|
|
41373
|
-
var getSelectedOptionsTooltipText = function getSelectedOptionsTooltipText() {
|
|
41374
|
-
if (!selectedOptions || selectedOptions.length === 0) return "Aucune option sélectionnée";
|
|
41375
|
-
return selectedOptions.map(function (opt) {
|
|
41376
|
-
var key = String(_typeof$g(opt) === 'object' ? opt[optionValue] : opt);
|
|
41377
|
-
var selectedOption = _flattenOptions(loadedOptions).find(function (o) {
|
|
41378
|
-
return String(o[optionValue]) === key;
|
|
41378
|
+
var flat = _flattenOptions(loadedOptions);
|
|
41379
|
+
var cssRules = (selectedOptions || []).map(function (optValue) {
|
|
41380
|
+
var opt = flat.find(function (o) {
|
|
41381
|
+
return o[optionValue] === optValue;
|
|
41379
41382
|
});
|
|
41380
|
-
|
|
41383
|
+
if (!(opt !== null && opt !== void 0 && opt.color)) return '';
|
|
41384
|
+
var textColor = inverseColor(opt.color);
|
|
41385
|
+
return "\n .p-multiselect-token[data-value=\"".concat(optValue, "\"] {\n background-color: ").concat(opt.color, " !important;\n color: ").concat(textColor, " !important;\n }\n .p-multiselect-token[data-value=\"").concat(optValue, "\"] .p-multiselect-token-icon {\n color: ").concat(textColor, " !important;\n }");
|
|
41381
41386
|
}).join('\n');
|
|
41382
|
-
|
|
41383
|
-
|
|
41384
|
-
|
|
41387
|
+
styleEl.textContent = cssRules;
|
|
41388
|
+
return function () {
|
|
41389
|
+
var _styleEl;
|
|
41390
|
+
(_styleEl = styleEl) === null || _styleEl === void 0 || _styleEl.remove();
|
|
41391
|
+
};
|
|
41392
|
+
}, [selectedOptions, loadedOptions, displayBadge, withColor]);
|
|
41393
|
+
useEffect(function () {
|
|
41394
|
+
if (enableItemTooltip) setTooltipKey(function (k) {
|
|
41395
|
+
return k + 1;
|
|
41396
|
+
});
|
|
41397
|
+
}, [loadedOptions, enableItemTooltip]);
|
|
41385
41398
|
var onLazyLoad = function onLazyLoad(event) {
|
|
41386
41399
|
if (isOptionsArray) return;
|
|
41387
41400
|
setLoading(true);
|
|
41388
|
-
if (
|
|
41389
|
-
|
|
41401
|
+
if (event.last < loadedOptionsRef.current.length - 1 || !hasMoreRef.current) {
|
|
41402
|
+
setTimeout(function () {
|
|
41403
|
+
return setLoading(false);
|
|
41404
|
+
}, 0);
|
|
41405
|
+
return;
|
|
41390
41406
|
}
|
|
41407
|
+
if (isLoadingRef.current) return;
|
|
41408
|
+
isLoadingRef.current = true;
|
|
41409
|
+
if (loadLazyTimeout.current) clearTimeout(loadLazyTimeout.current);
|
|
41391
41410
|
loadLazyTimeout.current = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
41392
|
-
var _result3;
|
|
41393
|
-
var
|
|
41411
|
+
var _result3, _result4;
|
|
41412
|
+
var nextPage, result, newOptions;
|
|
41394
41413
|
return _regenerator().w(function (_context3) {
|
|
41395
41414
|
while (1) switch (_context3.n) {
|
|
41396
41415
|
case 0:
|
|
41397
|
-
|
|
41398
|
-
_items = _toConsumableArray$a(loadedOptions);
|
|
41416
|
+
nextPage = currentPageRef.current + 1;
|
|
41399
41417
|
if (!(typeof options === 'function')) {
|
|
41400
41418
|
_context3.n = 2;
|
|
41401
41419
|
break;
|
|
41402
41420
|
}
|
|
41403
41421
|
_context3.n = 1;
|
|
41404
|
-
return options(
|
|
41405
|
-
page:
|
|
41422
|
+
return options(searchTermRef.current, [], {
|
|
41423
|
+
page: nextPage
|
|
41406
41424
|
});
|
|
41407
41425
|
case 1:
|
|
41408
41426
|
result = _context3.v;
|
|
@@ -41414,8 +41432,8 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41414
41432
|
break;
|
|
41415
41433
|
}
|
|
41416
41434
|
_context3.n = 3;
|
|
41417
|
-
return fetchOptionsFromUrl(
|
|
41418
|
-
page:
|
|
41435
|
+
return fetchOptionsFromUrl(searchTermRef.current, [], {
|
|
41436
|
+
page: nextPage
|
|
41419
41437
|
});
|
|
41420
41438
|
case 3:
|
|
41421
41439
|
result = _context3.v;
|
|
@@ -41423,95 +41441,831 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41423
41441
|
break;
|
|
41424
41442
|
case 4:
|
|
41425
41443
|
result = {
|
|
41426
|
-
options: []
|
|
41444
|
+
options: [],
|
|
41445
|
+
hasMore: false
|
|
41427
41446
|
};
|
|
41428
41447
|
case 5:
|
|
41429
41448
|
newOptions = ((_result3 = result) === null || _result3 === void 0 ? void 0 : _result3.options) || [];
|
|
41430
|
-
|
|
41431
|
-
|
|
41432
|
-
|
|
41433
|
-
}
|
|
41449
|
+
if (!(newOptions.length === 0)) {
|
|
41450
|
+
_context3.n = 6;
|
|
41451
|
+
break;
|
|
41434
41452
|
}
|
|
41435
|
-
|
|
41436
|
-
|
|
41453
|
+
hasMoreRef.current = false;
|
|
41454
|
+
isLoadingRef.current = false;
|
|
41437
41455
|
setLoading(false);
|
|
41438
|
-
|
|
41439
|
-
// Redimensionnement du conteneur
|
|
41440
|
-
virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
|
|
41441
|
-
if (virtualscroll) {
|
|
41442
|
-
virtualscroll.style.height = "auto";
|
|
41443
|
-
}
|
|
41456
|
+
return _context3.a(2);
|
|
41444
41457
|
case 6:
|
|
41458
|
+
updateLoadedOptions([].concat(_toConsumableArray$a(loadedOptionsRef.current), _toConsumableArray$a(newOptions)));
|
|
41459
|
+
hasMoreRef.current = ((_result4 = result) === null || _result4 === void 0 ? void 0 : _result4.hasMore) !== false;
|
|
41460
|
+
currentPageRef.current = nextPage;
|
|
41461
|
+
isLoadingRef.current = false;
|
|
41462
|
+
setLoading(false);
|
|
41463
|
+
case 7:
|
|
41445
41464
|
return _context3.a(2);
|
|
41446
41465
|
}
|
|
41447
41466
|
}, _callee3);
|
|
41448
41467
|
})), 500);
|
|
41449
41468
|
};
|
|
41450
|
-
|
|
41451
|
-
|
|
41452
|
-
|
|
41453
|
-
|
|
41454
|
-
|
|
41455
|
-
|
|
41456
|
-
|
|
41457
|
-
|
|
41458
|
-
|
|
41459
|
-
|
|
41460
|
-
|
|
41461
|
-
|
|
41462
|
-
|
|
41463
|
-
|
|
41464
|
-
|
|
41465
|
-
|
|
41466
|
-
|
|
41467
|
-
|
|
41468
|
-
|
|
41469
|
-
|
|
41470
|
-
|
|
41469
|
+
|
|
41470
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────
|
|
41471
|
+
|
|
41472
|
+
var _flattenOptions = function flattenOptions(opts) {
|
|
41473
|
+
if (!Array.isArray(opts)) return [];
|
|
41474
|
+
return opts.reduce(function (acc, item) {
|
|
41475
|
+
if (Array.isArray(item)) acc.push.apply(acc, _toConsumableArray$a(_flattenOptions(item)));else acc.push(item);
|
|
41476
|
+
return acc;
|
|
41477
|
+
}, []);
|
|
41478
|
+
};
|
|
41479
|
+
var getKey = function getKey(v) {
|
|
41480
|
+
return v && _typeof$g(v) === 'object' ? v[optionValue] : v;
|
|
41481
|
+
};
|
|
41482
|
+
var inverseColor = function inverseColor(hexColor) {
|
|
41483
|
+
if (!hexColor || !hexColor.startsWith('#')) return '#000000';
|
|
41484
|
+
var hex = hexColor;
|
|
41485
|
+
if (hex.length === 4) {
|
|
41486
|
+
hex = '#' + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
|
|
41487
|
+
}
|
|
41488
|
+
var r = parseInt(hex.substr(1, 2), 16);
|
|
41489
|
+
var g = parseInt(hex.substr(3, 2), 16);
|
|
41490
|
+
var b = parseInt(hex.substr(5, 2), 16);
|
|
41491
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) return '#000000';
|
|
41492
|
+
var luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
41493
|
+
return luminance > 0.18 ? '#000000' : '#FFFFFF';
|
|
41494
|
+
};
|
|
41495
|
+
var safeEmitOnChange = function safeEmitOnChange(ids) {
|
|
41496
|
+
if (typeof onChange === 'function') {
|
|
41497
|
+
onChange(ids);
|
|
41498
|
+
return;
|
|
41471
41499
|
}
|
|
41500
|
+
if (typeof onChange === 'string' && typeof window[onChange] === 'function') window[onChange](ids);
|
|
41472
41501
|
};
|
|
41473
|
-
|
|
41474
|
-
|
|
41475
|
-
|
|
41502
|
+
|
|
41503
|
+
// ─── Options computed ─────────────────────────────────────────────────────
|
|
41504
|
+
|
|
41505
|
+
var flatOptions = useMemo(function () {
|
|
41506
|
+
return _flattenOptions(loadedOptions);
|
|
41507
|
+
}, [loadedOptions]);
|
|
41508
|
+
var smartSort = function smartSort(opts, order) {
|
|
41509
|
+
if (!order) return opts;
|
|
41510
|
+
return _toConsumableArray$a(opts).sort(function (a, b) {
|
|
41511
|
+
var _a$optionLabel, _b$optionLabel;
|
|
41512
|
+
var aRaw = String((_a$optionLabel = a === null || a === void 0 ? void 0 : a[optionLabel]) !== null && _a$optionLabel !== void 0 ? _a$optionLabel : '').trim();
|
|
41513
|
+
var bRaw = String((_b$optionLabel = b === null || b === void 0 ? void 0 : b[optionLabel]) !== null && _b$optionLabel !== void 0 ? _b$optionLabel : '').trim();
|
|
41514
|
+
var aNum = parseFloat(aRaw.replace(',', '.'));
|
|
41515
|
+
var bNum = parseFloat(bRaw.replace(',', '.'));
|
|
41516
|
+
var aIsNum = !isNaN(aNum) && /^[0-9]/.test(aRaw);
|
|
41517
|
+
var bIsNum = !isNaN(bNum) && /^[0-9]/.test(bRaw);
|
|
41518
|
+
if (aIsNum && bIsNum) return order === 'asc' ? aNum - bNum : bNum - aNum;
|
|
41519
|
+
return order === 'asc' ? aRaw.localeCompare(bRaw, 'fr', {
|
|
41520
|
+
sensitivity: 'base'
|
|
41521
|
+
}) : bRaw.localeCompare(aRaw, 'fr', {
|
|
41522
|
+
sensitivity: 'base'
|
|
41523
|
+
});
|
|
41524
|
+
});
|
|
41525
|
+
};
|
|
41526
|
+
var reorderedOptions = useMemo(function () {
|
|
41527
|
+
if (!itemsCheckedToTheTop || !Array.isArray(selectedOptions) || selectedOptions.length === 0) return flatOptions;
|
|
41528
|
+
var selectedSet = new Set(selectedOptions);
|
|
41529
|
+
return [].concat(_toConsumableArray$a(flatOptions.filter(function (o) {
|
|
41530
|
+
return selectedSet.has(o === null || o === void 0 ? void 0 : o[optionValue]);
|
|
41531
|
+
})), _toConsumableArray$a(flatOptions.filter(function (o) {
|
|
41532
|
+
return !selectedSet.has(o === null || o === void 0 ? void 0 : o[optionValue]);
|
|
41533
|
+
})));
|
|
41534
|
+
}, [itemsCheckedToTheTop, selectedOptions, flatOptions, optionValue]);
|
|
41535
|
+
var computedOptions = useMemo(function () {
|
|
41536
|
+
var base = itemsCheckedToTheTop ? reorderedOptions : flatOptions;
|
|
41537
|
+
return enableSorting ? smartSort(base, sortOrder) : base;
|
|
41538
|
+
}, [enableSorting, sortOrder, flatOptions, reorderedOptions, itemsCheckedToTheTop]);
|
|
41539
|
+
var toggleSortOrder = function toggleSortOrder() {
|
|
41540
|
+
setSortOrder(function (prev) {
|
|
41541
|
+
return prev === 'asc' ? 'desc' : 'asc';
|
|
41542
|
+
});
|
|
41543
|
+
requestAnimationFrame(function () {
|
|
41544
|
+
var _multiSelectRef$curre;
|
|
41545
|
+
return (_multiSelectRef$curre = multiSelectRef.current) === null || _multiSelectRef$curre === void 0 ? void 0 : _multiSelectRef$curre.show();
|
|
41546
|
+
});
|
|
41547
|
+
};
|
|
41548
|
+
var toggleGroupCollapse = function toggleGroupCollapse(groupLabel) {
|
|
41549
|
+
setCollapsedGroups(function (prev) {
|
|
41550
|
+
return prev.includes(groupLabel) ? prev.filter(function (l) {
|
|
41551
|
+
return l !== groupLabel;
|
|
41552
|
+
}) : [].concat(_toConsumableArray$a(prev), [groupLabel]);
|
|
41553
|
+
});
|
|
41554
|
+
};
|
|
41555
|
+
|
|
41556
|
+
// ─── Handlers ─────────────────────────────────────────────────────────────
|
|
41557
|
+
|
|
41558
|
+
var handleChange = function handleChange(e) {
|
|
41559
|
+
if (disabled || effectiveReadOnly) return;
|
|
41560
|
+
var ids = Array.isArray(e.value) ? e.value : [e.value];
|
|
41561
|
+
if (typeof maxSelected === 'number' && maxSelected >= 0 && ids.length > maxSelected) return;
|
|
41562
|
+
setSelectedOptions(ids);
|
|
41563
|
+
setDisplayValue(null);
|
|
41564
|
+
safeEmitOnChange(ids);
|
|
41565
|
+
};
|
|
41566
|
+
var handleClearAll = function handleClearAll() {
|
|
41567
|
+
if (disabled || effectiveReadOnly) return;
|
|
41568
|
+
setSelectedOptions([]);
|
|
41569
|
+
safeEmitOnChange([]);
|
|
41570
|
+
if (typeof onClearAll === 'function') onClearAll();
|
|
41571
|
+
};
|
|
41572
|
+
var handleApply = function handleApply() {
|
|
41573
|
+
setDisplayValue(valueToapply ? valueToapply : selectedOptions);
|
|
41574
|
+
if (typeof onApply === 'function') onApply(displayValue);
|
|
41575
|
+
};
|
|
41576
|
+
var handleSelectAllCustom = function handleSelectAllCustom(ids) {
|
|
41577
|
+
setSelectedOptions(ids);
|
|
41578
|
+
safeEmitOnChange(ids);
|
|
41579
|
+
if (typeof onSelectAll === 'function') onSelectAll(ids);
|
|
41580
|
+
};
|
|
41581
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
41582
|
+
var _multiSelectRef$curre2;
|
|
41583
|
+
if (!openOnHover || disabled || effectiveReadOnly) return;
|
|
41584
|
+
(_multiSelectRef$curre2 = multiSelectRef.current) === null || _multiSelectRef$curre2 === void 0 || _multiSelectRef$curre2.show();
|
|
41585
|
+
};
|
|
41586
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
41587
|
+
var _multiSelectRef$curre3;
|
|
41588
|
+
if (!openOnHover) return;
|
|
41589
|
+
(_multiSelectRef$curre3 = multiSelectRef.current) === null || _multiSelectRef$curre3 === void 0 || _multiSelectRef$curre3.hide();
|
|
41590
|
+
};
|
|
41591
|
+
var handleFilter = function handleFilter(e) {
|
|
41592
|
+
var _e$filter;
|
|
41593
|
+
if (isOptionsArray) return;
|
|
41594
|
+
var search = (_e$filter = e.filter) !== null && _e$filter !== void 0 ? _e$filter : '';
|
|
41595
|
+
searchTermRef.current = search;
|
|
41596
|
+
if (searchTimeout.current) clearTimeout(searchTimeout.current);
|
|
41597
|
+
searchTimeout.current = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
41598
|
+
var _result5, _result6;
|
|
41599
|
+
var result, searchOpts, existingValues, missingSelected;
|
|
41600
|
+
return _regenerator().w(function (_context4) {
|
|
41601
|
+
while (1) switch (_context4.n) {
|
|
41602
|
+
case 0:
|
|
41603
|
+
currentPageRef.current = 1;
|
|
41604
|
+
hasMoreRef.current = true;
|
|
41605
|
+
isLoadingRef.current = false;
|
|
41606
|
+
setLoading(true);
|
|
41607
|
+
if (!(typeof options === 'function')) {
|
|
41608
|
+
_context4.n = 2;
|
|
41609
|
+
break;
|
|
41610
|
+
}
|
|
41611
|
+
_context4.n = 1;
|
|
41612
|
+
return options(search, [], {
|
|
41613
|
+
page: 1
|
|
41614
|
+
});
|
|
41615
|
+
case 1:
|
|
41616
|
+
result = _context4.v;
|
|
41617
|
+
_context4.n = 5;
|
|
41618
|
+
break;
|
|
41619
|
+
case 2:
|
|
41620
|
+
if (!optionsUrl) {
|
|
41621
|
+
_context4.n = 4;
|
|
41622
|
+
break;
|
|
41623
|
+
}
|
|
41624
|
+
_context4.n = 3;
|
|
41625
|
+
return fetchOptionsFromUrl(search, [], {
|
|
41626
|
+
page: 1
|
|
41627
|
+
});
|
|
41628
|
+
case 3:
|
|
41629
|
+
result = _context4.v;
|
|
41630
|
+
_context4.n = 5;
|
|
41631
|
+
break;
|
|
41632
|
+
case 4:
|
|
41633
|
+
result = {
|
|
41634
|
+
options: [],
|
|
41635
|
+
hasMore: false
|
|
41636
|
+
};
|
|
41637
|
+
case 5:
|
|
41638
|
+
hasMoreRef.current = ((_result5 = result) === null || _result5 === void 0 ? void 0 : _result5.hasMore) !== false;
|
|
41639
|
+
|
|
41640
|
+
// ─── On réinjecte les sélectionnés absents des résultats de recherche ──
|
|
41641
|
+
searchOpts = _flattenOptions(((_result6 = result) === null || _result6 === void 0 ? void 0 : _result6.options) || []);
|
|
41642
|
+
if (Array.isArray(numObjValue) && numObjValue.length > 0) {
|
|
41643
|
+
existingValues = new Set(searchOpts.map(function (o) {
|
|
41644
|
+
return String(o[optionValue]);
|
|
41645
|
+
}));
|
|
41646
|
+
missingSelected = numObjValue.filter(function (o) {
|
|
41647
|
+
return !existingValues.has(String(o[optionValue]));
|
|
41648
|
+
});
|
|
41649
|
+
updateLoadedOptions([].concat(_toConsumableArray$a(searchOpts), _toConsumableArray$a(missingSelected)));
|
|
41650
|
+
} else {
|
|
41651
|
+
updateLoadedOptions(searchOpts);
|
|
41652
|
+
}
|
|
41653
|
+
// ────────────────────────────────────────────────────────────────────────
|
|
41654
|
+
|
|
41655
|
+
setLoading(false);
|
|
41656
|
+
case 6:
|
|
41657
|
+
return _context4.a(2);
|
|
41658
|
+
}
|
|
41659
|
+
}, _callee4);
|
|
41660
|
+
})), 300);
|
|
41661
|
+
};
|
|
41662
|
+
|
|
41663
|
+
// ─── Templates ────────────────────────────────────────────────────────────
|
|
41664
|
+
|
|
41665
|
+
var optionTemplate = function optionTemplate(option) {
|
|
41666
|
+
if (!option) return null;
|
|
41667
|
+
var tooltipProps = enableItemTooltip ? {
|
|
41668
|
+
className: 'multiselect-tooltip-item',
|
|
41669
|
+
'data-pr-tooltip': option.tooltip || option.description,
|
|
41670
|
+
'data-pr-position': 'right'
|
|
41671
|
+
} : {
|
|
41672
|
+
className: 'multiselect-tooltip-item'
|
|
41673
|
+
};
|
|
41674
|
+
var secondaryLabel = enableSecondaryLabel ? option === null || option === void 0 ? void 0 : option[secondaryLabelKey] : null;
|
|
41675
|
+
var isLink = enableItemLink && option.link;
|
|
41676
|
+
var handleLinkClick = function handleLinkClick(e) {
|
|
41677
|
+
if (isLink) {
|
|
41678
|
+
e.preventDefault();
|
|
41679
|
+
e.stopPropagation();
|
|
41680
|
+
window.open(option.link, '_blank', 'noopener,noreferrer');
|
|
41681
|
+
}
|
|
41682
|
+
};
|
|
41683
|
+
var secondaryLabelNode = secondaryLabel && /*#__PURE__*/React__default.createElement("div", {
|
|
41684
|
+
className: "secondary-link-zone",
|
|
41685
|
+
onClick: isLink ? handleLinkClick : undefined,
|
|
41686
|
+
onMouseDown: isLink ? function (e) {
|
|
41687
|
+
return e.stopPropagation();
|
|
41688
|
+
} : undefined,
|
|
41689
|
+
style: {
|
|
41690
|
+
cursor: isLink ? 'pointer' : 'default',
|
|
41691
|
+
marginTop: '2px',
|
|
41692
|
+
width: 'fit-content'
|
|
41693
|
+
}
|
|
41694
|
+
}, /*#__PURE__*/React__default.createElement("small", {
|
|
41695
|
+
style: {
|
|
41696
|
+
opacity: 0.75,
|
|
41697
|
+
fontSize: '12px',
|
|
41698
|
+
textDecoration: isLink ? 'underline' : 'none',
|
|
41699
|
+
color: isLink ? '#3b82f6' : 'inherit',
|
|
41700
|
+
transition: 'opacity 0.2s, color 0.2s'
|
|
41701
|
+
},
|
|
41702
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
41703
|
+
if (isLink) {
|
|
41704
|
+
e.target.style.opacity = '1';
|
|
41705
|
+
e.target.style.color = '#2563eb';
|
|
41706
|
+
}
|
|
41707
|
+
},
|
|
41708
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
41709
|
+
if (isLink) {
|
|
41710
|
+
e.target.style.opacity = '0.75';
|
|
41711
|
+
e.target.style.color = '#3b82f6';
|
|
41712
|
+
}
|
|
41713
|
+
}
|
|
41714
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
41715
|
+
style: subItem ? {} : {
|
|
41716
|
+
marginLeft: '10px'
|
|
41717
|
+
}
|
|
41718
|
+
}, secondaryLabel)));
|
|
41719
|
+
if (isSelectMeta) {
|
|
41720
|
+
var _ref7 = selectMetaConfig || {},
|
|
41721
|
+
labelStyle = _ref7.labelStyle,
|
|
41722
|
+
generalIcon = _ref7.generalIcon;
|
|
41723
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
41724
|
+
style: _objectSpread2({
|
|
41725
|
+
fontFamily: 'Arial',
|
|
41726
|
+
fontSize: '14px',
|
|
41727
|
+
display: 'flex',
|
|
41728
|
+
alignItems: 'center'
|
|
41729
|
+
}, optionStyle)
|
|
41730
|
+
}, generalIcon && /*#__PURE__*/React__default.createElement("i", {
|
|
41731
|
+
style: {
|
|
41732
|
+
color: option === null || option === void 0 ? void 0 : option.color,
|
|
41733
|
+
marginRight: '8px'
|
|
41734
|
+
},
|
|
41735
|
+
className: generalIcon
|
|
41736
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
41737
|
+
style: _objectSpread2(_objectSpread2({
|
|
41738
|
+
marginLeft: '10px'
|
|
41739
|
+
}, labelStyle), {}, {
|
|
41740
|
+
flex: 1
|
|
41741
|
+
})
|
|
41742
|
+
}, /*#__PURE__*/React__default.createElement("div", tooltipProps, option[optionLabel]), option[optionLabel], secondaryLabelNode));
|
|
41743
|
+
}
|
|
41744
|
+
if (withColor || withIcon) {
|
|
41745
|
+
var _ref8 = selectConfig || {},
|
|
41746
|
+
_labelStyle = _ref8.labelStyle,
|
|
41747
|
+
_generalIcon = _ref8.generalIcon;
|
|
41748
|
+
return /*#__PURE__*/React__default.createElement("div", _extends$J({}, tooltipProps, {
|
|
41749
|
+
style: _objectSpread2({
|
|
41750
|
+
fontSize: '14px',
|
|
41751
|
+
display: 'flex',
|
|
41752
|
+
alignItems: 'center',
|
|
41753
|
+
gap: '8px'
|
|
41754
|
+
}, optionStyle)
|
|
41755
|
+
}), withIcon && _generalIcon && /*#__PURE__*/React__default.createElement("i", {
|
|
41756
|
+
style: {
|
|
41757
|
+
color: option === null || option === void 0 ? void 0 : option.color
|
|
41758
|
+
},
|
|
41759
|
+
className: _generalIcon
|
|
41760
|
+
}), withColor && (option === null || option === void 0 ? void 0 : option.color) && /*#__PURE__*/React__default.createElement("span", {
|
|
41761
|
+
className: "ms-color-badge".concat((selectedOptions || []).includes(option[optionValue]) ? ' is-selected' : ''),
|
|
41762
|
+
style: {
|
|
41763
|
+
'--badge-color': option.color,
|
|
41764
|
+
color: inverseColor(option.color)
|
|
41765
|
+
}
|
|
41766
|
+
}, option[optionLabel]), (!withColor || !(option !== null && option !== void 0 && option.color)) && /*#__PURE__*/React__default.createElement("span", {
|
|
41767
|
+
style: _objectSpread2(_objectSpread2({}, _labelStyle), subItem ? {
|
|
41768
|
+
flex: 1
|
|
41769
|
+
} : {})
|
|
41770
|
+
}, option[optionLabel]), secondaryLabelNode);
|
|
41771
|
+
}
|
|
41772
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
41773
|
+
style: _objectSpread2({
|
|
41774
|
+
fontFamily: 'Arial',
|
|
41775
|
+
fontSize: '14px',
|
|
41776
|
+
display: 'flex',
|
|
41777
|
+
flexDirection: 'column'
|
|
41778
|
+
}, optionStyle)
|
|
41779
|
+
}, /*#__PURE__*/React__default.createElement("div", tooltipProps, option[optionLabel]), secondaryLabelNode);
|
|
41780
|
+
};
|
|
41781
|
+
var selectedItemTemplate = function selectedItemTemplate(paramValue) {
|
|
41782
|
+
if (paramValue == null) return null;
|
|
41783
|
+
if (truncateAt) {
|
|
41784
|
+
var index = (selectedOptions || []).indexOf(paramValue);
|
|
41785
|
+
if (index === -1) return null;
|
|
41786
|
+
if (index < truncateAt) {
|
|
41787
|
+
var opt = flatOptions.find(function (o) {
|
|
41788
|
+
return o[optionValue] === paramValue;
|
|
41789
|
+
}) || flatOptions.find(function (o) {
|
|
41790
|
+
return o.value === paramValue;
|
|
41791
|
+
}) || numObjValue.find(function (o) {
|
|
41792
|
+
return o[optionValue] === paramValue;
|
|
41793
|
+
});
|
|
41794
|
+
if (!opt) return null;
|
|
41795
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
41796
|
+
style: _objectSpread2({
|
|
41797
|
+
marginRight: '6px'
|
|
41798
|
+
}, valueStyle)
|
|
41799
|
+
}, opt[optionLabel]);
|
|
41800
|
+
}
|
|
41801
|
+
if (index === truncateAt) return /*#__PURE__*/React__default.createElement("span", {
|
|
41802
|
+
style: {
|
|
41803
|
+
opacity: 0.7,
|
|
41804
|
+
marginRight: '6px'
|
|
41805
|
+
}
|
|
41806
|
+
}, "\u2026");
|
|
41807
|
+
return null;
|
|
41808
|
+
}
|
|
41809
|
+
if (isSelectMeta) {
|
|
41810
|
+
var _selectedOption2;
|
|
41811
|
+
var _key = String(getKey(paramValue));
|
|
41812
|
+
var _selectedOption = flatOptions.find(function (o) {
|
|
41813
|
+
return String(o[optionValue]) === _key;
|
|
41814
|
+
}) || numObjValue.find(function (o) {
|
|
41815
|
+
return String(o[optionValue]) === _key;
|
|
41816
|
+
});
|
|
41817
|
+
// ─────────────────────────────────────────────────────────────────
|
|
41818
|
+
if (!_selectedOption) return null;
|
|
41819
|
+
var _objMatch = Array.isArray(objValue) ? objValue.find(function (o) {
|
|
41820
|
+
return String(o[optionValue]) === _key;
|
|
41821
|
+
}) : null;
|
|
41822
|
+
if (_objMatch) _selectedOption = _objectSpread2(_objectSpread2({}, _selectedOption), {}, {
|
|
41823
|
+
color: _objMatch.color !== undefined ? _objMatch.color : _selectedOption.color
|
|
41824
|
+
});
|
|
41825
|
+
var _handleRemove = function _handleRemove(e) {
|
|
41826
|
+
e.stopPropagation();
|
|
41827
|
+
if (disabled || effectiveReadOnly) return;
|
|
41828
|
+
var newSelected = (selectedOptions || []).filter(function (o) {
|
|
41829
|
+
return String(getKey(o)) !== _key;
|
|
41830
|
+
});
|
|
41831
|
+
setSelectedOptions(newSelected);
|
|
41832
|
+
safeEmitOnChange(newSelected);
|
|
41833
|
+
};
|
|
41834
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
41835
|
+
onClick: effectiveReadOnly ? undefined : _handleRemove,
|
|
41836
|
+
style: _objectSpread2(_objectSpread2({}, (_selectedOption2 = _selectedOption) !== null && _selectedOption2 !== void 0 && _selectedOption2.color ? {
|
|
41837
|
+
backgroundColor: _selectedOption.color,
|
|
41838
|
+
color: inverseColor(_selectedOption.color)
|
|
41839
|
+
} : {}), {}, {
|
|
41840
|
+
padding: '6px 12px',
|
|
41841
|
+
fontSize: '14px',
|
|
41842
|
+
borderRadius: '8px',
|
|
41843
|
+
boxShadow: '2px 2px 4px rgba(0,0,0,0.15)',
|
|
41844
|
+
display: 'inline-block',
|
|
41845
|
+
marginBottom: '5px',
|
|
41846
|
+
fontFamily: 'Arial',
|
|
41847
|
+
cursor: effectiveReadOnly ? 'default' : 'pointer',
|
|
41848
|
+
marginRight: '15px'
|
|
41849
|
+
}, valueStyle)
|
|
41850
|
+
}, _selectedOption[optionLabel], !effectiveReadOnly && /*#__PURE__*/React__default.createElement("span", {
|
|
41851
|
+
style: {
|
|
41852
|
+
marginLeft: '5px'
|
|
41853
|
+
}
|
|
41854
|
+
}, "\xD7"));
|
|
41855
|
+
}
|
|
41856
|
+
var key = String(getKey(paramValue));
|
|
41857
|
+
var selectedOption = flatOptions.find(function (o) {
|
|
41858
|
+
return String(o[optionValue]) === key;
|
|
41859
|
+
}) || numObjValue.find(function (o) {
|
|
41860
|
+
return String(o[optionValue]) === key;
|
|
41861
|
+
});
|
|
41862
|
+
if (!selectedOption) return null;
|
|
41863
|
+
var objMatch = Array.isArray(objValue) ? objValue.find(function (o) {
|
|
41864
|
+
return String(o[optionValue]) === key;
|
|
41865
|
+
}) : null;
|
|
41866
|
+
if (objMatch) selectedOption = _objectSpread2(_objectSpread2({}, selectedOption), {}, {
|
|
41867
|
+
color: objMatch.color !== undefined ? objMatch.color : selectedOption.color
|
|
41868
|
+
});
|
|
41869
|
+
var isLast = (selectedOptions || [])[(selectedOptions || []).length - 1] === paramValue;
|
|
41870
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
41871
|
+
style: _objectSpread2({
|
|
41872
|
+
marginRight: '4px'
|
|
41873
|
+
}, valueStyle)
|
|
41874
|
+
}, selectedOption[optionLabel], !isLast && /*#__PURE__*/React__default.createElement("span", {
|
|
41875
|
+
style: {
|
|
41876
|
+
opacity: 0.8
|
|
41877
|
+
}
|
|
41878
|
+
}, ", "));
|
|
41879
|
+
};
|
|
41880
|
+
var getSelectedOptionsTooltipText = function getSelectedOptionsTooltipText() {
|
|
41881
|
+
if (!selectedOptions || selectedOptions.length === 0) return "Aucune option sélectionnée";
|
|
41882
|
+
return selectedOptions.map(function (opt) {
|
|
41883
|
+
var key = String(_typeof$g(opt) === 'object' ? opt[optionValue] : opt);
|
|
41884
|
+
var found = flatOptions.find(function (o) {
|
|
41885
|
+
return String(o[optionValue]) === key;
|
|
41886
|
+
}) || numObjValue.find(function (o) {
|
|
41887
|
+
return String(o[optionValue]) === key;
|
|
41888
|
+
});
|
|
41889
|
+
return found ? found[optionLabel] : key;
|
|
41890
|
+
}).join('\n');
|
|
41891
|
+
};
|
|
41892
|
+
var selectedOptionsCount = selectedOptions ? selectedOptions.length : 0;
|
|
41893
|
+
var totalItemCount = computedOptions.length;
|
|
41894
|
+
var customPanelHeader = function customPanelHeader(opts) {
|
|
41895
|
+
var checkboxElement = opts.checkboxElement,
|
|
41896
|
+
filterElement = opts.filterElement;
|
|
41897
|
+
var hasSearchRow = filter || enableSorting;
|
|
41898
|
+
var hasSelectAllRow = showSelectAll;
|
|
41899
|
+
if (!hasSearchRow && !hasSelectAllRow) return null;
|
|
41900
|
+
var allSelected = totalItemCount > 0 && selectedOptionsCount >= totalItemCount;
|
|
41901
|
+
var partialSelected = selectedOptionsCount > 0 && !allSelected;
|
|
41902
|
+
var checkboxClass = "ms-group-checkbox".concat(allSelected ? ' checked' : partialSelected ? ' partial' : '');
|
|
41903
|
+
var handleSelectAllLabel = function handleSelectAllLabel() {
|
|
41904
|
+
if (disabled || effectiveReadOnly) return;
|
|
41905
|
+
if (selectedOptionsCount > 0) {
|
|
41906
|
+
handleSelectAllCustom([]);
|
|
41907
|
+
} else {
|
|
41908
|
+
handleSelectAllCustom(computedOptions.map(function (o) {
|
|
41909
|
+
return o[optionValue];
|
|
41910
|
+
}));
|
|
41911
|
+
}
|
|
41912
|
+
};
|
|
41913
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
41914
|
+
className: "ms-panel-header"
|
|
41915
|
+
}, hasSearchRow && /*#__PURE__*/React__default.createElement("div", {
|
|
41916
|
+
className: "ms-search-row"
|
|
41917
|
+
}, filter && filterElement, enableSorting && /*#__PURE__*/React__default.createElement("button", {
|
|
41918
|
+
type: "button",
|
|
41919
|
+
className: "ms-sort-btn",
|
|
41920
|
+
onClick: function onClick(e) {
|
|
41921
|
+
e.stopPropagation();
|
|
41922
|
+
toggleSortOrder();
|
|
41923
|
+
}
|
|
41924
|
+
}, /*#__PURE__*/React__default.createElement("i", {
|
|
41925
|
+
className: "pi pi-sort-alt"
|
|
41926
|
+
}))), hasSelectAllRow && /*#__PURE__*/React__default.createElement("div", {
|
|
41927
|
+
className: "ms-selectall-row"
|
|
41928
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
41929
|
+
style: {
|
|
41930
|
+
position: 'relative',
|
|
41931
|
+
width: '24px',
|
|
41932
|
+
height: '24px',
|
|
41933
|
+
flexShrink: 0,
|
|
41934
|
+
marginRight: '0.5rem'
|
|
41935
|
+
}
|
|
41936
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
41937
|
+
className: checkboxClass,
|
|
41938
|
+
style: {
|
|
41939
|
+
margin: 0,
|
|
41940
|
+
pointerEvents: 'none'
|
|
41941
|
+
}
|
|
41942
|
+
}, allSelected && /*#__PURE__*/React__default.createElement("i", {
|
|
41943
|
+
className: "pi pi-check",
|
|
41944
|
+
style: {
|
|
41945
|
+
fontSize: '10px'
|
|
41946
|
+
}
|
|
41947
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
41948
|
+
style: {
|
|
41949
|
+
position: 'absolute',
|
|
41950
|
+
inset: 0,
|
|
41951
|
+
opacity: 0,
|
|
41952
|
+
cursor: 'pointer'
|
|
41953
|
+
}
|
|
41954
|
+
}, checkboxElement)), /*#__PURE__*/React__default.createElement("span", {
|
|
41955
|
+
className: "ms-selectall-label",
|
|
41956
|
+
style: {
|
|
41957
|
+
cursor: 'pointer'
|
|
41958
|
+
},
|
|
41959
|
+
onClick: handleSelectAllLabel
|
|
41960
|
+
}, selectedOptionsCount > 0 ? 'Désélectionner tout' : 'Sélectionner tout'), /*#__PURE__*/React__default.createElement("span", {
|
|
41961
|
+
className: "ms-counter"
|
|
41962
|
+
}, selectedOptionsCount, " sur ", totalItemCount)));
|
|
41963
|
+
};
|
|
41964
|
+
var customPanelFooter = function customPanelFooter() {
|
|
41965
|
+
if (applyEnabled) {
|
|
41966
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
41967
|
+
className: "ms-panel-footer"
|
|
41968
|
+
}, /*#__PURE__*/React__default.createElement("button", {
|
|
41969
|
+
type: "button",
|
|
41970
|
+
className: "ms-cancel-btn",
|
|
41971
|
+
onClick: function onClick() {
|
|
41972
|
+
var _multiSelectRef$curre4;
|
|
41973
|
+
return (_multiSelectRef$curre4 = multiSelectRef.current) === null || _multiSelectRef$curre4 === void 0 ? void 0 : _multiSelectRef$curre4.hide();
|
|
41974
|
+
}
|
|
41975
|
+
}, "Annuler"), /*#__PURE__*/React__default.createElement("button", {
|
|
41976
|
+
type: "button",
|
|
41977
|
+
className: "ms-apply-btn",
|
|
41978
|
+
onClick: function onClick() {
|
|
41979
|
+
var _multiSelectRef$curre5;
|
|
41980
|
+
handleApply();
|
|
41981
|
+
(_multiSelectRef$curre5 = multiSelectRef.current) === null || _multiSelectRef$curre5 === void 0 || _multiSelectRef$curre5.hide();
|
|
41982
|
+
}
|
|
41983
|
+
}, "Appliquer"));
|
|
41984
|
+
}
|
|
41985
|
+
if (hasInfoLine) {
|
|
41986
|
+
var length = selectedOptions ? selectedOptions.length : 0;
|
|
41987
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
41988
|
+
className: "py-2 px-3"
|
|
41989
|
+
}, /*#__PURE__*/React__default.createElement("b", null, length), " option", length > 1 ? 's' : '', " s\xE9lectionn\xE9e", length > 1 ? 's' : '', ".");
|
|
41990
|
+
}
|
|
41991
|
+
return null;
|
|
41992
|
+
};
|
|
41993
|
+
|
|
41994
|
+
// ─── Grouped items template ───────────────────────────────────────────────
|
|
41995
|
+
|
|
41996
|
+
var getGroupValues = function getGroupValues(group) {
|
|
41997
|
+
if (!group || !Array.isArray(group.items)) return [];
|
|
41998
|
+
return group.items.map(function (item) {
|
|
41999
|
+
return item[optionValue];
|
|
42000
|
+
});
|
|
42001
|
+
};
|
|
42002
|
+
var isGroupFullySelected = function isGroupFullySelected(group) {
|
|
42003
|
+
var groupValues = getGroupValues(group);
|
|
42004
|
+
return groupValues.length > 0 && groupValues.every(function (v) {
|
|
42005
|
+
return (selectedOptions || []).includes(v);
|
|
42006
|
+
});
|
|
42007
|
+
};
|
|
42008
|
+
var handleGroupToggle = function handleGroupToggle(group) {
|
|
42009
|
+
if (!enableGroupSelect || disabled || effectiveReadOnly) return;
|
|
42010
|
+
var labelKey = optionGroupLabel || 'label';
|
|
42011
|
+
var originalGroup = loadedOptions.find(function (g) {
|
|
42012
|
+
return g[labelKey] === group[labelKey];
|
|
42013
|
+
}) || group;
|
|
42014
|
+
var groupValues = getGroupValues(originalGroup);
|
|
42015
|
+
if (!groupValues.length) return;
|
|
42016
|
+
var allSelected = isGroupFullySelected(originalGroup);
|
|
42017
|
+
var nextValues = allSelected ? (selectedOptions || []).filter(function (v) {
|
|
42018
|
+
return !groupValues.includes(v);
|
|
42019
|
+
}) : Array.from(new Set([].concat(_toConsumableArray$a(selectedOptions || []), _toConsumableArray$a(groupValues))));
|
|
42020
|
+
setSelectedOptions(nextValues);
|
|
42021
|
+
safeEmitOnChange(nextValues);
|
|
42022
|
+
};
|
|
42023
|
+
var groupedItemTemplate = function groupedItemTemplate(option) {
|
|
42024
|
+
var labelKey = optionGroupLabel || 'label';
|
|
42025
|
+
var groupLabel = option[labelKey];
|
|
42026
|
+
var originalGroup = loadedOptions.find(function (g) {
|
|
42027
|
+
return g[labelKey] === groupLabel;
|
|
42028
|
+
});
|
|
42029
|
+
var groupValues = getGroupValues(originalGroup || option);
|
|
42030
|
+
var totalItems = groupValues.length;
|
|
42031
|
+
var selectedCount = groupValues.filter(function (v) {
|
|
42032
|
+
return (selectedOptions || []).includes(v);
|
|
42033
|
+
}).length;
|
|
42034
|
+
var fullySelected = totalItems > 0 && selectedCount === totalItems;
|
|
42035
|
+
var partiallySelected = selectedCount > 0 && !fullySelected;
|
|
42036
|
+
var isCollapsed = collapsedGroups.includes(groupLabel);
|
|
42037
|
+
var checkboxClass = "ms-group-checkbox".concat(fullySelected ? ' checked' : '').concat(partiallySelected ? ' partial' : '');
|
|
42038
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
42039
|
+
className: "ms-group-header",
|
|
42040
|
+
style: {
|
|
42041
|
+
cursor: enableGroupSelect ? 'pointer' : 'default'
|
|
42042
|
+
},
|
|
42043
|
+
onClick: function onClick() {
|
|
42044
|
+
if (enableGroupSelect) handleGroupToggle(option);
|
|
42045
|
+
}
|
|
42046
|
+
}, useCheckbox && /*#__PURE__*/React__default.createElement("div", {
|
|
42047
|
+
className: checkboxClass
|
|
42048
|
+
}, fullySelected && /*#__PURE__*/React__default.createElement("i", {
|
|
42049
|
+
className: "pi pi-check",
|
|
42050
|
+
style: {
|
|
42051
|
+
fontSize: '10px'
|
|
42052
|
+
}
|
|
42053
|
+
})), /*#__PURE__*/React__default.createElement("span", {
|
|
42054
|
+
className: "ms-group-label"
|
|
42055
|
+
}, groupLabel, " : ", selectedCount, "/", totalItems), enableGroupSelect && /*#__PURE__*/React__default.createElement("button", {
|
|
42056
|
+
type: "button",
|
|
42057
|
+
className: "ms-group-collapse-btn",
|
|
42058
|
+
onClick: function onClick(e) {
|
|
42059
|
+
e.stopPropagation();
|
|
42060
|
+
toggleGroupCollapse(groupLabel);
|
|
42061
|
+
}
|
|
42062
|
+
}, isCollapsed ? '+' : '−'));
|
|
42063
|
+
};
|
|
42064
|
+
|
|
42065
|
+
// ─── Misc ─────────────────────────────────────────────────────────────────
|
|
42066
|
+
|
|
42067
|
+
var BADGE_SIZES = {
|
|
42068
|
+
small: {
|
|
42069
|
+
fontSize: '10px',
|
|
42070
|
+
size: '18px'
|
|
42071
|
+
},
|
|
42072
|
+
medium: {
|
|
42073
|
+
fontSize: '12px',
|
|
42074
|
+
size: '22px'
|
|
42075
|
+
},
|
|
42076
|
+
large: {
|
|
42077
|
+
fontSize: '14px',
|
|
42078
|
+
size: '26px'
|
|
42079
|
+
},
|
|
42080
|
+
xlarge: {
|
|
42081
|
+
fontSize: '16px',
|
|
42082
|
+
size: '32px'
|
|
42083
|
+
},
|
|
42084
|
+
xxlarge: {
|
|
42085
|
+
fontSize: '18px',
|
|
42086
|
+
size: '38px'
|
|
42087
|
+
}
|
|
42088
|
+
};
|
|
42089
|
+
var badgeStyle = BADGE_SIZES[badgeSize] || BADGE_SIZES.medium;
|
|
42090
|
+
var style = {
|
|
42091
|
+
border: isInvalidEffective ? '1px solid red' : '1px solid #ccc',
|
|
42092
|
+
width: '100%'
|
|
42093
|
+
};
|
|
42094
|
+
var effectiveShowClear = Boolean(showClear || typeof onClearAll === 'function');
|
|
42095
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
42096
|
+
onMouseEnter: handleMouseEnter,
|
|
42097
|
+
onMouseLeave: handleMouseLeave,
|
|
42098
|
+
style: {
|
|
42099
|
+
width: '100%'
|
|
42100
|
+
}
|
|
42101
|
+
}, enableItemTooltip && /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
42102
|
+
key: tooltipKey,
|
|
42103
|
+
target: ".multiselect-tooltip-item",
|
|
42104
|
+
appendTo: document.body,
|
|
42105
|
+
position: "top",
|
|
42106
|
+
style: {
|
|
42107
|
+
zIndex: '9999999'
|
|
42108
|
+
}
|
|
42109
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
42110
|
+
style: {
|
|
42111
|
+
width: '100%'
|
|
42112
|
+
}
|
|
42113
|
+
}, displayCounter && /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
42114
|
+
target: ".custom-target-icon"
|
|
42115
|
+
}), /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
42116
|
+
target: ".ms-counter-label",
|
|
42117
|
+
appendTo: document.body,
|
|
42118
|
+
position: "top",
|
|
42119
|
+
showDelay: 0,
|
|
42120
|
+
style: {
|
|
42121
|
+
zIndex: 9999999
|
|
42122
|
+
}
|
|
42123
|
+
}), /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
42124
|
+
target: ".p-multiselect-token",
|
|
42125
|
+
appendTo: document.body,
|
|
42126
|
+
position: "top",
|
|
42127
|
+
showDelay: 200,
|
|
41476
42128
|
style: {
|
|
41477
|
-
|
|
42129
|
+
zIndex: 9999999
|
|
41478
42130
|
}
|
|
41479
|
-
}, displayNbOption && /*#__PURE__*/React__default.createElement(Tooltip$1, {
|
|
41480
|
-
target: ".custom-target-icon"
|
|
41481
42131
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
41482
|
-
|
|
41483
|
-
"data-pr-tooltip": getSelectedOptionsTooltipText(),
|
|
42132
|
+
"data-pr-tooltip": enableItemTooltip ? getSelectedOptionsTooltipText() : null,
|
|
41484
42133
|
"data-pr-position": "right",
|
|
41485
42134
|
"data-pr-at": "right+5 top",
|
|
41486
42135
|
"data-pr-my": "left center-2",
|
|
42136
|
+
ref: containerRef,
|
|
41487
42137
|
className: "multiselect-container custom-target-icon",
|
|
41488
42138
|
style: {
|
|
41489
42139
|
width: '100%',
|
|
41490
42140
|
position: 'relative',
|
|
41491
42141
|
top: '0px',
|
|
41492
42142
|
right: '0px'
|
|
41493
|
-
},
|
|
41494
|
-
onMouseEnter: function onMouseEnter() {
|
|
41495
|
-
return setHovered(true);
|
|
41496
|
-
},
|
|
41497
|
-
onMouseLeave: function onMouseLeave() {
|
|
41498
|
-
return setHovered(false);
|
|
41499
42143
|
}
|
|
41500
42144
|
}, /*#__PURE__*/React__default.createElement(MultiSelect$1, _extends$J({
|
|
41501
|
-
|
|
41502
|
-
|
|
41503
|
-
|
|
41504
|
-
|
|
41505
|
-
|
|
41506
|
-
|
|
42145
|
+
ref: multiSelectRef,
|
|
42146
|
+
panelClassName: !useCheckbox ? 'ms-no-checkbox' : ''
|
|
42147
|
+
}, displayBadge && selectedOptionsCount <= maxSelectedLabels ? {
|
|
42148
|
+
display: 'chip',
|
|
42149
|
+
pt: {
|
|
42150
|
+
token: function token(_ref9) {
|
|
42151
|
+
var context = _ref9.context;
|
|
42152
|
+
var valStr = String(context.value);
|
|
42153
|
+
var opt = flatOptions.find(function (o) {
|
|
42154
|
+
return String(o[optionValue]) === valStr;
|
|
42155
|
+
}) || numObjValue.find(function (o) {
|
|
42156
|
+
return String(o[optionValue]) === valStr;
|
|
42157
|
+
});
|
|
42158
|
+
return {
|
|
42159
|
+
style: displayBadge && opt !== null && opt !== void 0 && opt.color ? {
|
|
42160
|
+
'--badge-color': opt.color,
|
|
42161
|
+
backgroundColor: opt.color,
|
|
42162
|
+
color: inverseColor(opt.color)
|
|
42163
|
+
} : {},
|
|
42164
|
+
'data-pr-tooltip': (opt === null || opt === void 0 ? void 0 : opt[optionLabel]) || context.value,
|
|
42165
|
+
'data-pr-position': 'top'
|
|
42166
|
+
};
|
|
42167
|
+
},
|
|
42168
|
+
removeTokenIcon: function removeTokenIcon(_ref0) {
|
|
42169
|
+
var context = _ref0.context;
|
|
42170
|
+
return {
|
|
42171
|
+
style: function () {
|
|
42172
|
+
var valStr = String(context.value);
|
|
42173
|
+
var opt = flatOptions.find(function (o) {
|
|
42174
|
+
return String(o[optionValue]) === valStr;
|
|
42175
|
+
}) || numObjValue.find(function (o) {
|
|
42176
|
+
return String(o[optionValue]) === valStr;
|
|
42177
|
+
});
|
|
42178
|
+
return displayBadge && withColor && opt !== null && opt !== void 0 && opt.color ? {
|
|
42179
|
+
color: inverseColor(opt.color)
|
|
42180
|
+
} : {};
|
|
42181
|
+
}()
|
|
42182
|
+
};
|
|
42183
|
+
}
|
|
42184
|
+
}
|
|
42185
|
+
} : _objectSpread2({}, displayBadge && {
|
|
42186
|
+
display: 'chip',
|
|
42187
|
+
selectedItemsLabel: /*#__PURE__*/React__default.createElement("span", {
|
|
42188
|
+
className: "ms-counter-badge"
|
|
42189
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
42190
|
+
className: "ms-counter-dots"
|
|
42191
|
+
}, (selectedOptions || []).map(function (val) {
|
|
42192
|
+
var opt = flatOptions.find(function (o) {
|
|
42193
|
+
return o[optionValue] === val;
|
|
42194
|
+
});
|
|
42195
|
+
return /*#__PURE__*/React__default.createElement("span", {
|
|
42196
|
+
key: val,
|
|
42197
|
+
className: "ms-counter-dot",
|
|
42198
|
+
style: {
|
|
42199
|
+
backgroundColor: (opt === null || opt === void 0 ? void 0 : opt.color) || undefined
|
|
42200
|
+
}
|
|
42201
|
+
});
|
|
42202
|
+
})), /*#__PURE__*/React__default.createElement("span", {
|
|
42203
|
+
className: "ms-counter-label",
|
|
42204
|
+
"data-pr-tooltip": (selectedOptions || []).map(function (val) {
|
|
42205
|
+
var valStr = String(val);
|
|
42206
|
+
var opt = flatOptions.find(function (o) {
|
|
42207
|
+
return String(o[optionValue]) === valStr;
|
|
42208
|
+
}) || numObjValue.find(function (o) {
|
|
42209
|
+
return String(o[optionValue]) === valStr;
|
|
42210
|
+
});
|
|
42211
|
+
return (opt === null || opt === void 0 ? void 0 : opt[optionLabel]) || val;
|
|
42212
|
+
}).join('\n'),
|
|
42213
|
+
"data-pr-position": "top"
|
|
42214
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
42215
|
+
className: "ms-counter-end"
|
|
42216
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
42217
|
+
className: "ms-counter-count"
|
|
42218
|
+
}, selectedOptionsCount), /*#__PURE__*/React__default.createElement("i", {
|
|
42219
|
+
className: "pi pi-times ms-counter-clear-icon",
|
|
42220
|
+
onClick: function onClick(e) {
|
|
42221
|
+
e.stopPropagation();
|
|
42222
|
+
setSelectedOptions([]);
|
|
42223
|
+
if (onChange) onChange([]);
|
|
42224
|
+
}
|
|
42225
|
+
}))))
|
|
42226
|
+
}), !displayBadge && {
|
|
42227
|
+
selectedItemsLabel: '{0} éléments sélectionnés'
|
|
42228
|
+
}, {
|
|
42229
|
+
onShow: function onShow() {
|
|
42230
|
+
if (enableItemTooltip) setTooltipKey(function (k) {
|
|
42231
|
+
return k + 1;
|
|
42232
|
+
});
|
|
42233
|
+
},
|
|
42234
|
+
onHide: onHide,
|
|
42235
|
+
onMouseDown: function onMouseDown() {
|
|
42236
|
+
if (enableItemTooltip) setTooltipKey(function (k) {
|
|
42237
|
+
return k + 1;
|
|
42238
|
+
});
|
|
42239
|
+
},
|
|
42240
|
+
options: computedOptions,
|
|
42241
|
+
value: displayValue ? displayValue : selectedOptions,
|
|
41507
42242
|
placeholder: placeholder,
|
|
42243
|
+
disabled: disabled || readOnly,
|
|
42244
|
+
filter: filter || !isOptionsArray && !!optionsUrl,
|
|
42245
|
+
onFilter: !isOptionsArray ? handleFilter : undefined,
|
|
41508
42246
|
optionLabel: optionLabel,
|
|
41509
42247
|
optionValue: optionValue,
|
|
41510
|
-
|
|
41511
|
-
|
|
42248
|
+
style: style,
|
|
42249
|
+
loading: false,
|
|
42250
|
+
maxSelectedLabels: maxSelectedLabels,
|
|
42251
|
+
emptyMessage: loading ? 'Chargement…' : 'Aucune option disponible',
|
|
42252
|
+
onChange: handleChange,
|
|
41512
42253
|
itemTemplate: optionTemplate,
|
|
41513
|
-
selectedItemTemplate: selectedItemTemplate,
|
|
41514
|
-
|
|
42254
|
+
selectedItemTemplate: displayBadge ? undefined : selectedItemTemplate,
|
|
42255
|
+
showClear: effectiveShowClear,
|
|
42256
|
+
closeIcon: closeIcon,
|
|
42257
|
+
showSelectAll: showSelectAll,
|
|
42258
|
+
panelStyle: {
|
|
42259
|
+
width: containerRef.current ? containerRef.current.offsetWidth + 'px' : undefined
|
|
42260
|
+
},
|
|
42261
|
+
panelHeaderTemplate: customPanelHeader,
|
|
42262
|
+
panelFooterTemplate: customPanelFooter
|
|
42263
|
+
}, isGroupedOption && {
|
|
42264
|
+
optionGroupChildren: optionGroupChildren,
|
|
42265
|
+
optionGroupLabel: optionGroupLabel,
|
|
42266
|
+
optionValue: optionValue
|
|
42267
|
+
}, {
|
|
42268
|
+
optionGroupTemplate: isGroupedOption ? groupedItemTemplate : null
|
|
41515
42269
|
}, virtualScroll && {
|
|
41516
42270
|
virtualScrollerOptions: {
|
|
41517
42271
|
lazy: true,
|
|
@@ -41521,7 +42275,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41521
42275
|
loading: loading,
|
|
41522
42276
|
delay: 25
|
|
41523
42277
|
}
|
|
41524
|
-
})),
|
|
42278
|
+
})), displayCounter && selectedOptionsCount > (maxVisibleCounter !== null && maxVisibleCounter !== void 0 ? maxVisibleCounter : 1) && /*#__PURE__*/React__default.createElement(Badge, {
|
|
41525
42279
|
value: selectedOptionsCount,
|
|
41526
42280
|
className: "custom-badge",
|
|
41527
42281
|
style: {
|
|
@@ -41537,10 +42291,21 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41537
42291
|
textAlign: "center",
|
|
41538
42292
|
padding: 0
|
|
41539
42293
|
}
|
|
41540
|
-
}),
|
|
42294
|
+
})), typeof onClearAll === 'function' && selectedOptionsCount > 0 && !disabled && !effectiveReadOnly && /*#__PURE__*/React__default.createElement("div", {
|
|
42295
|
+
style: {
|
|
42296
|
+
marginTop: '6px'
|
|
42297
|
+
}
|
|
42298
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
42299
|
+
label: "Tout effacer",
|
|
42300
|
+
size: "small",
|
|
42301
|
+
onClick: handleClearAll
|
|
42302
|
+
})), name && /*#__PURE__*/React__default.createElement("div", {
|
|
42303
|
+
style: {
|
|
42304
|
+
width: '0px'
|
|
42305
|
+
}
|
|
42306
|
+
}, (Array.isArray(selectedOptions) ? selectedOptions : []).filter(function (opt) {
|
|
41541
42307
|
return opt && (_typeof$g(opt) === 'object' || typeof opt === 'number' || typeof opt === 'string');
|
|
41542
42308
|
}).map(function (opt, index) {
|
|
41543
|
-
// normalisation
|
|
41544
42309
|
var id = _typeof$g(opt) === 'object' && opt !== null ? opt[optionValue] : opt;
|
|
41545
42310
|
var nameAttr = _typeof$g(opt) === 'object' && opt !== null ? opt[optionLabel] || opt.nom || '' : '';
|
|
41546
42311
|
return /*#__PURE__*/React__default.createElement("input", {
|
|
@@ -41571,15 +42336,12 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
|
|
|
41571
42336
|
display: 'block',
|
|
41572
42337
|
pointerEvents: 'none'
|
|
41573
42338
|
}
|
|
41574
|
-
})), isInvalidEffective && /*#__PURE__*/React__default.createElement("div", {
|
|
41575
|
-
style: {
|
|
41576
|
-
width: '100%'
|
|
41577
|
-
}
|
|
41578
|
-
}, /*#__PURE__*/React__default.createElement("small", {
|
|
42339
|
+
})), isInvalidEffective && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("small", {
|
|
41579
42340
|
style: {
|
|
41580
42341
|
color: 'red',
|
|
41581
42342
|
fontStyle: 'italic',
|
|
41582
|
-
display: 'block'
|
|
42343
|
+
display: 'block',
|
|
42344
|
+
width: '156px'
|
|
41583
42345
|
}
|
|
41584
42346
|
}, errorMessage || (showRequiredError ? ((_window$Translator = window.Translator) === null || _window$Translator === void 0 ? void 0 : _window$Translator.trans('error.required')) || 'Veuillez renseigner ce champ' : ((_window$Translator2 = window.Translator) === null || _window$Translator2 === void 0 ? void 0 : _window$Translator2.trans('error.invalid_selection')) || 'Sélection invalide')))));
|
|
41585
42347
|
};
|
|
@@ -43383,7 +44145,6 @@ var MultiSelectPresets = {
|
|
|
43383
44145
|
}
|
|
43384
44146
|
};
|
|
43385
44147
|
|
|
43386
|
-
// Options synchrones (tableau)
|
|
43387
44148
|
var syncOptions = [{
|
|
43388
44149
|
label: 'Option 1',
|
|
43389
44150
|
value: '1',
|
|
@@ -43405,8 +44166,6 @@ var syncOptions = [{
|
|
|
43405
44166
|
value: '5',
|
|
43406
44167
|
color: '#ec4899'
|
|
43407
44168
|
}];
|
|
43408
|
-
|
|
43409
|
-
// Fonction pour simuler des options asynchrones
|
|
43410
44169
|
var asyncOptions = /*#__PURE__*/function () {
|
|
43411
44170
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(search, _, _ref) {
|
|
43412
44171
|
var page, mockOptions, startIndex, paginatedOptions;
|
|
@@ -43454,7 +44213,7 @@ var asyncOptions = /*#__PURE__*/function () {
|
|
|
43454
44213
|
label: 'Option 10',
|
|
43455
44214
|
value: '10',
|
|
43456
44215
|
color: '#8b5cf6'
|
|
43457
|
-
}];
|
|
44216
|
+
}];
|
|
43458
44217
|
startIndex = (page - 1) * 5;
|
|
43459
44218
|
paginatedOptions = mockOptions.slice(startIndex, startIndex + 5);
|
|
43460
44219
|
return _context.a(2, {
|
|
@@ -43470,7 +44229,6 @@ var asyncOptions = /*#__PURE__*/function () {
|
|
|
43470
44229
|
};
|
|
43471
44230
|
}();
|
|
43472
44231
|
var MultiSelectMetaAsyncPresets = {
|
|
43473
|
-
// Configuration pour les options synchrones
|
|
43474
44232
|
SyncOptions: {
|
|
43475
44233
|
value: ['2', '9'],
|
|
43476
44234
|
options: syncOptions,
|
|
@@ -43492,9 +44250,8 @@ var MultiSelectMetaAsyncPresets = {
|
|
|
43492
44250
|
useCheckbox: false,
|
|
43493
44251
|
showSelectAll: false
|
|
43494
44252
|
},
|
|
43495
|
-
// Configuration pour les options asynchrones
|
|
43496
44253
|
AsyncOptions: {
|
|
43497
|
-
value: ['1', '
|
|
44254
|
+
value: ['1', '9'],
|
|
43498
44255
|
options: asyncOptions,
|
|
43499
44256
|
placeholder: 'Sélectionnez une ou plusieurs options',
|
|
43500
44257
|
optionLabel: 'label',
|
|
@@ -43513,6 +44270,153 @@ var MultiSelectMetaAsyncPresets = {
|
|
|
43513
44270
|
showClear: false,
|
|
43514
44271
|
useCheckbox: false,
|
|
43515
44272
|
showSelectAll: false
|
|
44273
|
+
},
|
|
44274
|
+
Base: {
|
|
44275
|
+
value: [],
|
|
44276
|
+
placeholder: 'Sélection multiple',
|
|
44277
|
+
options: syncOptions,
|
|
44278
|
+
filter: true,
|
|
44279
|
+
showSelectAll: true,
|
|
44280
|
+
useCheckbox: true,
|
|
44281
|
+
displayBadge: true,
|
|
44282
|
+
withColor: true,
|
|
44283
|
+
maxSelectedLabels: 4,
|
|
44284
|
+
selectMetaConfig: {
|
|
44285
|
+
labelStyle: {
|
|
44286
|
+
fontWeight: '400'
|
|
44287
|
+
},
|
|
44288
|
+
generalIcon: 'pi pi-tag'
|
|
44289
|
+
}
|
|
44290
|
+
},
|
|
44291
|
+
Badge: {
|
|
44292
|
+
displayBadge: true,
|
|
44293
|
+
maxSelectedLabels: 3,
|
|
44294
|
+
options: syncOptions,
|
|
44295
|
+
placeholder: 'Sélectionnez des options'
|
|
44296
|
+
},
|
|
44297
|
+
DefaultValue: {
|
|
44298
|
+
value: ['1', '3'],
|
|
44299
|
+
placeholder: 'Valeurs par défaut',
|
|
44300
|
+
options: syncOptions,
|
|
44301
|
+
filter: true,
|
|
44302
|
+
showSelectAll: true,
|
|
44303
|
+
useCheckbox: true
|
|
44304
|
+
},
|
|
44305
|
+
Placeholder: {
|
|
44306
|
+
placeholder: 'Veuillez sélectionner vos options',
|
|
44307
|
+
options: syncOptions,
|
|
44308
|
+
displayCounter: true
|
|
44309
|
+
},
|
|
44310
|
+
UnselectSelectAll: {
|
|
44311
|
+
showSelectAll: true,
|
|
44312
|
+
placeholder: 'Tout sélectionner',
|
|
44313
|
+
options: syncOptions,
|
|
44314
|
+
useCheckbox: true
|
|
44315
|
+
},
|
|
44316
|
+
Disabled: {
|
|
44317
|
+
disabled: true,
|
|
44318
|
+
value: [],
|
|
44319
|
+
placeholder: 'Désactivé',
|
|
44320
|
+
options: syncOptions
|
|
44321
|
+
},
|
|
44322
|
+
DeleteDeleteAll: {
|
|
44323
|
+
value: ['2', '4'],
|
|
44324
|
+
placeholder: 'Tout effacer',
|
|
44325
|
+
options: syncOptions,
|
|
44326
|
+
showClear: true
|
|
44327
|
+
},
|
|
44328
|
+
EmptyOptions: {
|
|
44329
|
+
placeholder: ' ',
|
|
44330
|
+
options: function () {
|
|
44331
|
+
var _options = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
44332
|
+
return _regenerator().w(function (_context2) {
|
|
44333
|
+
while (1) switch (_context2.n) {
|
|
44334
|
+
case 0:
|
|
44335
|
+
return _context2.a(2, {
|
|
44336
|
+
options: [],
|
|
44337
|
+
hasMore: false
|
|
44338
|
+
});
|
|
44339
|
+
}
|
|
44340
|
+
}, _callee2);
|
|
44341
|
+
}));
|
|
44342
|
+
function options() {
|
|
44343
|
+
return _options.apply(this, arguments);
|
|
44344
|
+
}
|
|
44345
|
+
return options;
|
|
44346
|
+
}()
|
|
44347
|
+
},
|
|
44348
|
+
Search: {
|
|
44349
|
+
options: syncOptions,
|
|
44350
|
+
filter: true
|
|
44351
|
+
},
|
|
44352
|
+
Required: {
|
|
44353
|
+
value: [],
|
|
44354
|
+
placeholder: 'Sélection obligatoire',
|
|
44355
|
+
options: syncOptions,
|
|
44356
|
+
invalid: true,
|
|
44357
|
+
errorMessage: 'Au moins une option doit être sélectionnée'
|
|
44358
|
+
},
|
|
44359
|
+
Checkbox: {
|
|
44360
|
+
options: syncOptions,
|
|
44361
|
+
useCheckbox: true
|
|
44362
|
+
},
|
|
44363
|
+
XItemsSelected: {
|
|
44364
|
+
maxSelectedLabels: 3,
|
|
44365
|
+
options: syncOptions,
|
|
44366
|
+
hasInfoLine: true
|
|
44367
|
+
},
|
|
44368
|
+
Counter: {
|
|
44369
|
+
placeholder: 'Options avec counter',
|
|
44370
|
+
options: syncOptions,
|
|
44371
|
+
displayCounter: true,
|
|
44372
|
+
maxVisibleCounter: 1
|
|
44373
|
+
},
|
|
44374
|
+
SearchAjaxLoading: {
|
|
44375
|
+
placeholder: 'Rechercher (Ajax)…',
|
|
44376
|
+
filter: true,
|
|
44377
|
+
showClear: true,
|
|
44378
|
+
virtualScroll: false,
|
|
44379
|
+
options: function () {
|
|
44380
|
+
var _options2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
44381
|
+
var _ref3,
|
|
44382
|
+
_ref3$page,
|
|
44383
|
+
page,
|
|
44384
|
+
_args3 = arguments;
|
|
44385
|
+
return _regenerator().w(function (_context3) {
|
|
44386
|
+
while (1) switch (_context3.n) {
|
|
44387
|
+
case 0:
|
|
44388
|
+
_ref3 = _args3.length > 2 ? _args3[2] : undefined, _ref3$page = _ref3.page, page = _ref3$page === void 0 ? 1 : _ref3$page;
|
|
44389
|
+
return _context3.a(2, new Promise(function (resolve) {
|
|
44390
|
+
setTimeout(function () {
|
|
44391
|
+
var PAGE_SIZE = 10;
|
|
44392
|
+
var allOptions = Array.from({
|
|
44393
|
+
length: 50
|
|
44394
|
+
}).map(function (_, i) {
|
|
44395
|
+
return {
|
|
44396
|
+
label: "Option Ajax ".concat(i + 1),
|
|
44397
|
+
value: i + 1
|
|
44398
|
+
};
|
|
44399
|
+
});
|
|
44400
|
+
var start = (page - 1) * PAGE_SIZE;
|
|
44401
|
+
var end = start + PAGE_SIZE;
|
|
44402
|
+
var pageOptions = allOptions.slice(start, end);
|
|
44403
|
+
resolve({
|
|
44404
|
+
options: pageOptions,
|
|
44405
|
+
hasMore: end < allOptions.length,
|
|
44406
|
+
additional: {
|
|
44407
|
+
page: page + 1
|
|
44408
|
+
}
|
|
44409
|
+
});
|
|
44410
|
+
}, 1200);
|
|
44411
|
+
}));
|
|
44412
|
+
}
|
|
44413
|
+
}, _callee3);
|
|
44414
|
+
}));
|
|
44415
|
+
function options() {
|
|
44416
|
+
return _options2.apply(this, arguments);
|
|
44417
|
+
}
|
|
44418
|
+
return options;
|
|
44419
|
+
}()
|
|
43516
44420
|
}
|
|
43517
44421
|
};
|
|
43518
44422
|
|