@fixefy/fixefy-ui-components 0.3.2 → 0.3.4
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.
|
@@ -20,6 +20,7 @@ export type AsyncDropdownPropsType = {
|
|
|
20
20
|
onAdd?: (value: any) => void;
|
|
21
21
|
onRemoveOne?: (value: any) => void;
|
|
22
22
|
onRemoveAll?: () => void;
|
|
23
|
+
onUnselectAll?: () => void;
|
|
23
24
|
type?: 'checkbox' | 'text';
|
|
24
25
|
renderOptions?: (option: Option, index: number) => void;
|
|
25
26
|
[x: string]: any;
|
|
@@ -120,7 +120,7 @@ const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBox,
|
|
|
120
120
|
fontSize: "small"
|
|
121
121
|
});
|
|
122
122
|
const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
123
|
-
const { onAdd, onRemoveOne, onRemoveAll, fetcher, disabled, type = 'text', variables, search_path, modal_type, multiple, name, query, isInitialOpen, placeholder, title_path, rootStylesOverride, logo_placeholder, logo_folder_name, options_path, _id } = props;
|
|
123
|
+
const { onAdd, onRemoveOne, onRemoveAll, onUnselectAll, fetcher, disabled, type = 'text', variables, search_path, modal_type, multiple, name, query, isInitialOpen, placeholder, title_path, rootStylesOverride, logo_placeholder, logo_folder_name, options_path, _id } = props;
|
|
124
124
|
let { defaultValue } = props;
|
|
125
125
|
const ref = (0, _react.useRef)(null);
|
|
126
126
|
const theme = (0, _material.useTheme)();
|
|
@@ -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
|
}
|
|
@@ -333,10 +335,12 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
333
335
|
return opts;
|
|
334
336
|
});
|
|
335
337
|
};
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
const unSelectAll = ()=>{
|
|
339
|
+
if (onUnselectAll) {
|
|
340
|
+
onUnselectAll();
|
|
341
|
+
setDisplayed([]);
|
|
342
|
+
sessionStorage.removeItem(`dropdown-${query}-${name}-${_id}`);
|
|
343
|
+
}
|
|
340
344
|
};
|
|
341
345
|
const displayListOptions = ()=>{
|
|
342
346
|
switch(type){
|
|
@@ -347,7 +351,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
347
351
|
multiple && /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
|
|
348
352
|
onClick: ()=>{
|
|
349
353
|
if (displayed.length === options.length) {
|
|
350
|
-
|
|
354
|
+
unSelectAll();
|
|
351
355
|
} else {
|
|
352
356
|
selectAll();
|
|
353
357
|
}
|
package/package.json
CHANGED