@fixefy/fixefy-ui-components 0.3.1 → 0.3.3
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.
|
@@ -143,7 +143,8 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
143
143
|
return searchValue ? _object_spread_props(_object_spread({}, where), {
|
|
144
144
|
_id: ws,
|
|
145
145
|
[search_path]: {
|
|
146
|
-
$regex: searchValue
|
|
146
|
+
$regex: searchValue,
|
|
147
|
+
$options: 'i'
|
|
147
148
|
}
|
|
148
149
|
}) : _object_spread_props(_object_spread({}, where), {
|
|
149
150
|
_id: ws
|
|
@@ -151,7 +152,8 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
151
152
|
} else {
|
|
152
153
|
return searchValue ? _object_spread_props(_object_spread({}, where), {
|
|
153
154
|
[search_path]: {
|
|
154
|
-
$regex: searchValue
|
|
155
|
+
$regex: searchValue,
|
|
156
|
+
$options: 'i'
|
|
155
157
|
}
|
|
156
158
|
}) : _object_spread({}, where);
|
|
157
159
|
}
|
|
@@ -317,33 +319,85 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
321
|
};
|
|
322
|
+
const selectAll = ()=>{
|
|
323
|
+
setDisplayed((prev)=>{
|
|
324
|
+
const unselectedOptions = options.filter((option)=>{
|
|
325
|
+
return !prev.map((item)=>item[title_path]).includes((0, _helpers.getOption)(option, title_path));
|
|
326
|
+
});
|
|
327
|
+
const opts = [
|
|
328
|
+
...prev,
|
|
329
|
+
...unselectedOptions
|
|
330
|
+
];
|
|
331
|
+
onAdd && onAdd(opts);
|
|
332
|
+
sessionStorage.setItem(`dropdown-${query}-${name}-${_id}`, JSON.stringify({
|
|
333
|
+
[name]: opts
|
|
334
|
+
}));
|
|
335
|
+
return opts;
|
|
336
|
+
});
|
|
337
|
+
};
|
|
338
|
+
const removeAllSelected = ()=>{
|
|
339
|
+
setDisplayed([]);
|
|
340
|
+
onRemoveAll && onRemoveAll();
|
|
341
|
+
sessionStorage.removeItem(`dropdown-${query}-${name}-${_id}`);
|
|
342
|
+
};
|
|
320
343
|
const displayListOptions = ()=>{
|
|
321
344
|
switch(type){
|
|
322
345
|
case 'checkbox':
|
|
323
346
|
{
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
checked: isChecked(option),
|
|
333
|
-
checkedIcon: checkedIcon,
|
|
334
|
-
sx: {
|
|
335
|
-
mr: 1,
|
|
336
|
-
minWidth: 24,
|
|
337
|
-
minHeight: 24,
|
|
338
|
-
p: 0,
|
|
339
|
-
['& svg']: {
|
|
340
|
-
fill: theme.palette.primary.light
|
|
341
|
-
}
|
|
347
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
348
|
+
children: [
|
|
349
|
+
multiple && /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
|
|
350
|
+
onClick: ()=>{
|
|
351
|
+
if (displayed.length === options.length) {
|
|
352
|
+
removeAllSelected();
|
|
353
|
+
} else {
|
|
354
|
+
selectAll();
|
|
342
355
|
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
356
|
+
},
|
|
357
|
+
children: [
|
|
358
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
359
|
+
icon: uncheckedIcon,
|
|
360
|
+
checked: displayed.length === options.length,
|
|
361
|
+
checkedIcon: checkedIcon,
|
|
362
|
+
sx: {
|
|
363
|
+
mr: 1,
|
|
364
|
+
minWidth: 24,
|
|
365
|
+
minHeight: 24,
|
|
366
|
+
p: 0,
|
|
367
|
+
['& svg']: {
|
|
368
|
+
fill: theme.palette.primary.light
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}),
|
|
372
|
+
(0, _helpers.titleCase)('select all')
|
|
373
|
+
]
|
|
374
|
+
}),
|
|
375
|
+
options.map((option)=>{
|
|
376
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
|
|
377
|
+
onClick: ()=>{
|
|
378
|
+
handleOptionClick(option);
|
|
379
|
+
},
|
|
380
|
+
children: [
|
|
381
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
382
|
+
icon: uncheckedIcon,
|
|
383
|
+
checked: isChecked(option),
|
|
384
|
+
checkedIcon: checkedIcon,
|
|
385
|
+
sx: {
|
|
386
|
+
mr: 1,
|
|
387
|
+
minWidth: 24,
|
|
388
|
+
minHeight: 24,
|
|
389
|
+
p: 0,
|
|
390
|
+
['& svg']: {
|
|
391
|
+
fill: theme.palette.primary.light
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}),
|
|
395
|
+
getSingleOptionFromListOrDisplayed(option, 'list')
|
|
396
|
+
]
|
|
397
|
+
}, option._id);
|
|
398
|
+
}),
|
|
399
|
+
' '
|
|
400
|
+
]
|
|
347
401
|
});
|
|
348
402
|
}
|
|
349
403
|
case 'text':
|
package/package.json
CHANGED