@fixefy/fixefy-ui-components 0.3.30 → 0.3.31
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/FxCheckbox/FxCheckbox.d.ts +9 -0
- package/dist/FxCheckbox/FxCheckbox.js +76 -0
- package/dist/FxCheckbox/index.d.ts +1 -0
- package/dist/{src/FxIcon → FxCheckbox}/index.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
- package/dist/FxActionButton/FxActionButton.d.ts +0 -7
- package/dist/FxActionButton/FxActionButton.js +0 -82
- package/dist/FxActionButton/index.d.ts +0 -1
- package/dist/FxActionButton/index.js +0 -11
- package/dist/FxActionsTray/styles/actions_tray.styles.d.ts +0 -8
- package/dist/FxActionsTray/styles/actions_tray.styles.js +0 -159
- package/dist/FxFilterActionButton/FxFilterActionButton.d.ts +0 -7
- package/dist/FxFilterActionButton/FxFilterActionButton.js +0 -82
- package/dist/FxFilterActionButton/index.d.ts +0 -1
- package/dist/FxFilterActionButton/index.js +0 -11
- package/dist/FxFilterSortButton/FxFilterSortButton.d.ts +0 -7
- package/dist/FxFilterSortButton/FxFilterSortButton.js +0 -82
- package/dist/FxFilterSortButton/index.d.ts +0 -1
- package/dist/FxFilterSortButton/index.js +0 -11
- package/dist/FxModalWithButton/FxModalWithButton.d.ts +0 -10
- package/dist/FxModalWithButton/FxModalWithButton.js +0 -131
- package/dist/FxModalWithButton/index.d.ts +0 -1
- package/dist/FxModalWithButton/index.js +0 -11
- package/dist/FxModalWithComponent/FxModalWithComponent.d.ts +0 -11
- package/dist/FxModalWithComponent/FxModalWithComponent.js +0 -102
- package/dist/FxModalWithComponent/index.d.ts +0 -1
- package/dist/FxModalWithComponent/index.js +0 -11
- package/dist/FxModalWithMenu/FxModalWithMenu.d.ts +0 -14
- package/dist/FxModalWithMenu/FxModalWithMenu.js +0 -114
- package/dist/FxModalWithMenu/index.d.ts +0 -1
- package/dist/FxModalWithMenu/index.js +0 -11
- package/dist/FxPopper/styles/makeStyles.d.ts +0 -16
- package/dist/FxPopper/styles/makeStyles.js +0 -23
- package/dist/FxWizard/FxWizard/FxWizard.d.ts +0 -6
- package/dist/FxWizard/FxWizard/FxWizard.js +0 -42
- package/dist/FxWizard/FxWizard/index.d.ts +0 -2
- package/dist/FxWizard/FxWizard/index.js +0 -19
- package/dist/FxWizard/FxWizard/utils/envHelpers.d.ts +0 -1
- package/dist/FxWizard/FxWizard/utils/envHelpers.js +0 -35
- package/dist/FxWizard/FxWizard/utils/index.d.ts +0 -1
- package/dist/FxWizard/FxWizard/utils/index.js +0 -18
- package/dist/FxWizard/pages/wizard/[step].d.ts +0 -9
- package/dist/FxWizard/pages/wizard/[step].js +0 -112
- package/dist/FxWizard/pages/wizard/index.d.ts +0 -1
- package/dist/FxWizard/pages/wizard/index.js +0 -18
- package/dist/src/FxActionsTray/FxActionsTray.js +0 -351
- package/dist/src/FxActionsTray/index.js +0 -19
- package/dist/src/FxActionsTray/styles/actions_tray.styles.js +0 -159
- package/dist/src/FxAggregationsBar/FxAggregations.js +0 -41
- package/dist/src/FxAggregationsBar/helpers/structureReader.js +0 -78
- package/dist/src/FxAggregationsBar/index.js +0 -22
- package/dist/src/FxAggregationsBar/operations/query.js +0 -73
- package/dist/src/FxAsyncDropdown/FxAsyncDropdown.js +0 -628
- package/dist/src/FxAsyncDropdown/helpers/helpers.js +0 -161
- package/dist/src/FxAsyncDropdown/index.js +0 -25
- package/dist/src/FxAsyncDropdown/styles/dropdown.styles.js +0 -228
- package/dist/src/FxAvatar/FxAvatar.js +0 -145
- package/dist/src/FxAvatar/helpers/stringToColor.js +0 -23
- package/dist/src/FxAvatar/index.js +0 -22
- package/dist/src/FxAvatar/styles/avatar.styles.js +0 -192
- package/dist/src/FxButton/FxButton.js +0 -106
- package/dist/src/FxButton/index.js +0 -19
- package/dist/src/FxButton/styles/button.styles.js +0 -23
- package/dist/src/FxChip/FxChip.js +0 -45
- package/dist/src/FxChip/index.js +0 -19
- package/dist/src/FxChip/styles/chip.styles.js +0 -61
- package/dist/src/FxFilterSortButton/FxFilterSortButton.js +0 -82
- package/dist/src/FxFilterSortButton/index.js +0 -11
- package/dist/src/FxIcon/FxIcon.js +0 -107
- package/dist/src/FxIcon/content/dynamic_icon.js +0 -20
- package/dist/src/FxIcon/content/index.js +0 -20
- package/dist/src/FxIcon/content/lazy_icon.js +0 -137
- package/dist/src/FxModal/FxModal.js +0 -170
- package/dist/src/FxModal/index.js +0 -19
- package/dist/src/FxModal/styles/modal.style.js +0 -59
- package/dist/src/FxModalWithButton/FxModalWithButton.js +0 -94
- package/dist/src/FxModalWithButton/index.js +0 -11
- package/dist/src/FxNotes/FxNotes.js +0 -216
- package/dist/src/FxNotes/helpers/stringToColor.js +0 -26
- package/dist/src/FxNotes/index.js +0 -22
- package/dist/src/FxNotes/operations/queries.js +0 -35
- package/dist/src/FxNotes/styles/notes.styles.js +0 -168
- package/dist/src/FxNumberField/FxNumberField.js +0 -109
- package/dist/src/FxNumberField/index.js +0 -19
- package/dist/src/FxNumberField/styles/number_field.styles.js +0 -94
- package/dist/src/FxProgressCircle/FxProgressCircle.js +0 -65
- package/dist/src/FxProgressCircle/index.js +0 -19
- package/dist/src/FxProgressCircle/styles/progress_circle.styles.js +0 -106
- package/dist/src/FxProgressCounter/ProgressCounter.js +0 -168
- package/dist/src/FxProgressCounter/index.js +0 -19
- package/dist/src/FxProgressCounter/styles/progress_counter.styles.js +0 -61
- package/dist/src/FxScore/FxScore.js +0 -207
- package/dist/src/FxScore/index.js +0 -19
- package/dist/src/FxScore/styles/score.styles.js +0 -97
- package/dist/src/FxShowMore/FxShowMore.js +0 -80
- package/dist/src/FxShowMore/index.js +0 -19
- package/dist/src/FxShowMore/styles/show_more.styles.js +0 -134
- package/dist/src/FxSlider/FxSlider.js +0 -49
- package/dist/src/FxSlider/index.js +0 -19
- package/dist/src/FxStatisticsBar/FxStatisticsBar.js +0 -191
- package/dist/src/FxStatisticsBar/index.js +0 -19
- package/dist/src/FxStatisticsBar/styles/statistics.styles.js +0 -98
- package/dist/src/FxStatusBar/FxStatusBar.js +0 -143
- package/dist/src/FxStatusBar/helpers/constants.js +0 -22
- package/dist/src/FxStatusBar/index.js +0 -22
- package/dist/src/FxStatusBar/styles/statusBar.styles.js +0 -131
- package/dist/src/FxStyledComponents/index.js +0 -310
- package/dist/src/FxTag/FxTag.js +0 -41
- package/dist/src/FxTag/index.js +0 -19
- package/dist/src/FxTag/styles/tag.styles.js +0 -100
- package/dist/src/FxTextField/FxTextField.js +0 -208
- package/dist/src/FxTextField/index.js +0 -19
- package/dist/src/FxTodo/FxTodo.js +0 -95
- package/dist/src/FxTodo/index.js +0 -22
- package/dist/src/FxTodo/styles/todo.styles.js +0 -183
- package/dist/src/index.js +0 -215
|
@@ -1,628 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "FxAsyncDropdown", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return FxAsyncDropdown;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
13
|
-
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
14
|
-
const _iconsmaterial = require("@mui/icons-material");
|
|
15
|
-
const _material = require("@mui/material");
|
|
16
|
-
const _FxChip = require("../FxChip");
|
|
17
|
-
const _FxIcon = require("../FxIcon");
|
|
18
|
-
const _graphqltag = require("graphql-tag");
|
|
19
|
-
const _dropdownstyles = require("./styles/dropdown.styles");
|
|
20
|
-
const _helpers = require("./helpers/helpers");
|
|
21
|
-
const _client = require("@apollo/client");
|
|
22
|
-
const _nookies = require("nookies");
|
|
23
|
-
function _define_property(obj, key, value) {
|
|
24
|
-
if (key in obj) {
|
|
25
|
-
Object.defineProperty(obj, key, {
|
|
26
|
-
value: value,
|
|
27
|
-
enumerable: true,
|
|
28
|
-
configurable: true,
|
|
29
|
-
writable: true
|
|
30
|
-
});
|
|
31
|
-
} else {
|
|
32
|
-
obj[key] = value;
|
|
33
|
-
}
|
|
34
|
-
return obj;
|
|
35
|
-
}
|
|
36
|
-
function _getRequireWildcardCache(nodeInterop) {
|
|
37
|
-
if (typeof WeakMap !== "function") return null;
|
|
38
|
-
var cacheBabelInterop = new WeakMap();
|
|
39
|
-
var cacheNodeInterop = new WeakMap();
|
|
40
|
-
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
41
|
-
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
42
|
-
})(nodeInterop);
|
|
43
|
-
}
|
|
44
|
-
function _interop_require_wildcard(obj, nodeInterop) {
|
|
45
|
-
if (!nodeInterop && obj && obj.__esModule) {
|
|
46
|
-
return obj;
|
|
47
|
-
}
|
|
48
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
49
|
-
return {
|
|
50
|
-
default: obj
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
54
|
-
if (cache && cache.has(obj)) {
|
|
55
|
-
return cache.get(obj);
|
|
56
|
-
}
|
|
57
|
-
var newObj = {
|
|
58
|
-
__proto__: null
|
|
59
|
-
};
|
|
60
|
-
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
61
|
-
for(var key in obj){
|
|
62
|
-
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
63
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
64
|
-
if (desc && (desc.get || desc.set)) {
|
|
65
|
-
Object.defineProperty(newObj, key, desc);
|
|
66
|
-
} else {
|
|
67
|
-
newObj[key] = obj[key];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
newObj.default = obj;
|
|
72
|
-
if (cache) {
|
|
73
|
-
cache.set(obj, newObj);
|
|
74
|
-
}
|
|
75
|
-
return newObj;
|
|
76
|
-
}
|
|
77
|
-
function _object_spread(target) {
|
|
78
|
-
for(var i = 1; i < arguments.length; i++){
|
|
79
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
80
|
-
var ownKeys = Object.keys(source);
|
|
81
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
82
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
83
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
84
|
-
}));
|
|
85
|
-
}
|
|
86
|
-
ownKeys.forEach(function(key) {
|
|
87
|
-
_define_property(target, key, source[key]);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return target;
|
|
91
|
-
}
|
|
92
|
-
function ownKeys(object, enumerableOnly) {
|
|
93
|
-
var keys = Object.keys(object);
|
|
94
|
-
if (Object.getOwnPropertySymbols) {
|
|
95
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
96
|
-
if (enumerableOnly) {
|
|
97
|
-
symbols = symbols.filter(function(sym) {
|
|
98
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
keys.push.apply(keys, symbols);
|
|
102
|
-
}
|
|
103
|
-
return keys;
|
|
104
|
-
}
|
|
105
|
-
function _object_spread_props(target, source) {
|
|
106
|
-
source = source != null ? source : {};
|
|
107
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
108
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
109
|
-
} else {
|
|
110
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
111
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return target;
|
|
115
|
-
}
|
|
116
|
-
const icon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBoxOutlineBlank, {
|
|
117
|
-
fontSize: "small"
|
|
118
|
-
});
|
|
119
|
-
const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBox, {
|
|
120
|
-
fontSize: "small"
|
|
121
|
-
});
|
|
122
|
-
const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props, parentRef)=>{
|
|
123
|
-
var _props_styles;
|
|
124
|
-
const { onAdd, onRemoveOne, onRemoveAll, fetcher, disabled, type = 'text', variables, search_path, modal_type, multiple, name, query } = props;
|
|
125
|
-
const ref = (0, _react.useRef)(null);
|
|
126
|
-
const theme = (0, _material.useTheme)();
|
|
127
|
-
const [displayed, setDisplayed] = (0, _react.useState)(multiple ? [] : '');
|
|
128
|
-
const [options, setOptions] = (0, _react.useState)([]);
|
|
129
|
-
const [reason, setReason] = (0, _react.useState)('init');
|
|
130
|
-
const [isLastPage, setIsLastPage] = (0, _react.useState)(false);
|
|
131
|
-
const [searchValue, setSearchValue] = (0, _react.useState)(null);
|
|
132
|
-
const [page, setPage] = (0, _react.useState)(1);
|
|
133
|
-
const [prevPage, setPrevPage] = (0, _react.useState)(0);
|
|
134
|
-
const pageSize = 20;
|
|
135
|
-
const { method_name } = variables;
|
|
136
|
-
const ws = (0, _nookies.parseCookies)().ws;
|
|
137
|
-
const isLocal = fetcher.query.loc;
|
|
138
|
-
const getWhere = ()=>{
|
|
139
|
-
if (variables.method_name == 'workspace') {
|
|
140
|
-
return searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
141
|
-
_id: ws,
|
|
142
|
-
[search_path]: {
|
|
143
|
-
$regex: searchValue
|
|
144
|
-
}
|
|
145
|
-
}) : _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
146
|
-
_id: ws
|
|
147
|
-
});
|
|
148
|
-
} else {
|
|
149
|
-
return searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
150
|
-
[search_path]: {
|
|
151
|
-
$regex: searchValue
|
|
152
|
-
}
|
|
153
|
-
}) : _object_spread({}, fetcher.queryOptions.variables.where);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const [fetch, { data, loading }] = (0, _client.useLazyQuery)((0, _graphqltag.gql)(isLocal ? fetcher.query.loc.source.body : fetcher.query), _object_spread_props(_object_spread({}, fetcher.queryOptions), {
|
|
157
|
-
variables: _object_spread_props(_object_spread({}, fetcher.queryOptions.variables), {
|
|
158
|
-
where: getWhere(),
|
|
159
|
-
skip: page * pageSize - pageSize,
|
|
160
|
-
limit: pageSize
|
|
161
|
-
})
|
|
162
|
-
}));
|
|
163
|
-
(0, _react.useEffect)(()=>{
|
|
164
|
-
if (!disabled) {
|
|
165
|
-
fetch();
|
|
166
|
-
}
|
|
167
|
-
}, []);
|
|
168
|
-
(0, _react.useEffect)(()=>{
|
|
169
|
-
const storedData = sessionStorage.getItem(`dropdown-${query}`);
|
|
170
|
-
if (storedData) {
|
|
171
|
-
const parsedData = JSON.parse(storedData);
|
|
172
|
-
const items = parsedData[name];
|
|
173
|
-
if (items) {
|
|
174
|
-
multiple ? setDisplayed([
|
|
175
|
-
...items
|
|
176
|
-
]) : setDisplayed(items[0]);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, [
|
|
180
|
-
query,
|
|
181
|
-
name
|
|
182
|
-
]);
|
|
183
|
-
(0, _react.useEffect)(()=>{
|
|
184
|
-
if (data && !isLastPage && prevPage < page) {
|
|
185
|
-
//raaya todo: this is too messy clean it
|
|
186
|
-
const newOptions = variables.method_name == 'workspace' ? data.workspace[search_path === null || search_path === void 0 ? void 0 : search_path.split('.')[1]] : data[method_name];
|
|
187
|
-
if (newOptions == null || newOptions.length < pageSize) {
|
|
188
|
-
setIsLastPage(true);
|
|
189
|
-
}
|
|
190
|
-
if (reason === 'searched' || reason === 'init') {
|
|
191
|
-
setOptions(newOptions);
|
|
192
|
-
} else if (reason === 'loaded more') {
|
|
193
|
-
setOptions((prevOptions)=>[
|
|
194
|
-
...prevOptions,
|
|
195
|
-
...newOptions
|
|
196
|
-
]);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}, [
|
|
200
|
-
data,
|
|
201
|
-
reason
|
|
202
|
-
]);
|
|
203
|
-
const handleSearch = (e)=>{
|
|
204
|
-
setSearchValue(e.target.value);
|
|
205
|
-
setReason('searched');
|
|
206
|
-
setPage(1);
|
|
207
|
-
setPrevPage(0);
|
|
208
|
-
setIsLastPage(false);
|
|
209
|
-
};
|
|
210
|
-
const addToStoredDisplayed = (option)=>{
|
|
211
|
-
const prevStored = sessionStorage.getItem(`dropdown-${query}`);
|
|
212
|
-
let data = prevStored ? JSON.parse(prevStored) : {};
|
|
213
|
-
if (data[name]) {
|
|
214
|
-
if (multiple) {
|
|
215
|
-
data[name] = [
|
|
216
|
-
...data[name],
|
|
217
|
-
option
|
|
218
|
-
];
|
|
219
|
-
} else {
|
|
220
|
-
data[name] = [
|
|
221
|
-
option
|
|
222
|
-
];
|
|
223
|
-
}
|
|
224
|
-
} else {
|
|
225
|
-
data[name] = [
|
|
226
|
-
option
|
|
227
|
-
];
|
|
228
|
-
}
|
|
229
|
-
sessionStorage.setItem(`dropdown-${query}`, JSON.stringify(data));
|
|
230
|
-
};
|
|
231
|
-
const removeOneFromStoredDisplayed = (option)=>{
|
|
232
|
-
let storedDisplayed = sessionStorage.getItem(`dropdown-${query}`);
|
|
233
|
-
if (storedDisplayed) {
|
|
234
|
-
storedDisplayed = JSON.parse(storedDisplayed);
|
|
235
|
-
if (multiple) {
|
|
236
|
-
const newDisplayed = storedDisplayed[name].filter((opt)=>{
|
|
237
|
-
if (search_path.includes('workspace')) {
|
|
238
|
-
return opt['title'] !== option['title'];
|
|
239
|
-
} else {
|
|
240
|
-
return opt[search_path] !== option[search_path];
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
storedDisplayed[name] = newDisplayed;
|
|
244
|
-
} else {
|
|
245
|
-
delete storedDisplayed[name];
|
|
246
|
-
}
|
|
247
|
-
sessionStorage.setItem(`dropdown-${query}`, JSON.stringify(storedDisplayed));
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
const handleOptionClick = (option)=>{
|
|
251
|
-
let clicked = getClicked(option);
|
|
252
|
-
switch(multiple){
|
|
253
|
-
case true:
|
|
254
|
-
if (displayed.map((item)=>{
|
|
255
|
-
if (search_path.includes('workspace')) {
|
|
256
|
-
return item['title'];
|
|
257
|
-
} else {
|
|
258
|
-
return item[search_path];
|
|
259
|
-
}
|
|
260
|
-
}).includes(clicked)) {
|
|
261
|
-
deleteOneItem(option);
|
|
262
|
-
} else {
|
|
263
|
-
onAdd && onAdd(option);
|
|
264
|
-
setDisplayed((prev)=>[
|
|
265
|
-
...prev,
|
|
266
|
-
option
|
|
267
|
-
]);
|
|
268
|
-
addToStoredDisplayed(option);
|
|
269
|
-
}
|
|
270
|
-
break;
|
|
271
|
-
default:
|
|
272
|
-
setDisplayed(option);
|
|
273
|
-
onAdd && onAdd(option);
|
|
274
|
-
addToStoredDisplayed(option);
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
const deleteOneItem = (item)=>{
|
|
278
|
-
if (multiple) {
|
|
279
|
-
if (search_path.includes('workspace')) {
|
|
280
|
-
setDisplayed((prev)=>prev.filter((val)=>val['title'] !== item['title']));
|
|
281
|
-
} else {
|
|
282
|
-
setDisplayed((prev)=>prev.filter((val)=>val[search_path] !== item[search_path]));
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
setDisplayed('');
|
|
286
|
-
}
|
|
287
|
-
onRemoveOne && onRemoveOne(item);
|
|
288
|
-
removeOneFromStoredDisplayed(item);
|
|
289
|
-
};
|
|
290
|
-
const isChecked = (option)=>{
|
|
291
|
-
const clicked = getClicked(option);
|
|
292
|
-
if (typeof displayed === 'string') {
|
|
293
|
-
return false;
|
|
294
|
-
} else {
|
|
295
|
-
if (multiple) {
|
|
296
|
-
return displayed.map((item)=>{
|
|
297
|
-
if (search_path.includes('workspace')) {
|
|
298
|
-
return item['title'];
|
|
299
|
-
} else {
|
|
300
|
-
return item[search_path];
|
|
301
|
-
}
|
|
302
|
-
}).includes(clicked);
|
|
303
|
-
} else {
|
|
304
|
-
return displayed[search_path] === clicked;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
const handleListOptions = ()=>{
|
|
309
|
-
switch(type){
|
|
310
|
-
case 'checkbox':
|
|
311
|
-
{
|
|
312
|
-
return options.map((option)=>{
|
|
313
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", {
|
|
314
|
-
onClick: ()=>{
|
|
315
|
-
handleOptionClick(option);
|
|
316
|
-
},
|
|
317
|
-
children: [
|
|
318
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
319
|
-
icon: icon,
|
|
320
|
-
checked: isChecked(option),
|
|
321
|
-
checkedIcon: checkedIcon,
|
|
322
|
-
sx: {
|
|
323
|
-
mr: 1,
|
|
324
|
-
minWidth: 24,
|
|
325
|
-
minHeight: 24,
|
|
326
|
-
p: 0,
|
|
327
|
-
['& svg']: {
|
|
328
|
-
fill: theme.palette.primary.light
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}),
|
|
332
|
-
getValueByModalType(option, 'list')
|
|
333
|
-
]
|
|
334
|
-
}, option._id);
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
case 'text':
|
|
338
|
-
default:
|
|
339
|
-
{
|
|
340
|
-
return options.map((option)=>{
|
|
341
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
|
|
342
|
-
onClick: ()=>{
|
|
343
|
-
handleOptionClick(option);
|
|
344
|
-
},
|
|
345
|
-
children: getValueByModalType(option, 'list')
|
|
346
|
-
}, option._id);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
(0, _react.useImperativeHandle)(parentRef, ()=>({
|
|
352
|
-
clearDDL: ()=>{
|
|
353
|
-
var //@ts-ignore
|
|
354
|
-
_getClearProps;
|
|
355
|
-
(_getClearProps = getClearProps()) === null || _getClearProps === void 0 ? void 0 : _getClearProps.onClick(null);
|
|
356
|
-
}
|
|
357
|
-
}));
|
|
358
|
-
const loadMore = ()=>{
|
|
359
|
-
setPage((prevPage)=>prevPage + 1);
|
|
360
|
-
setPrevPage((prevPage)=>prevPage + 1);
|
|
361
|
-
};
|
|
362
|
-
const getClicked = (option)=>{
|
|
363
|
-
if (option != '') {
|
|
364
|
-
let clicked = (0, _helpers.getJPart)(option, search_path, 0) || option.title;
|
|
365
|
-
if (clicked !== null && typeof clicked === 'object') {
|
|
366
|
-
clicked = clicked[0];
|
|
367
|
-
}
|
|
368
|
-
return clicked;
|
|
369
|
-
}
|
|
370
|
-
return null;
|
|
371
|
-
};
|
|
372
|
-
const getCurrentValues = ()=>{
|
|
373
|
-
let rv = null;
|
|
374
|
-
switch(multiple){
|
|
375
|
-
case true:
|
|
376
|
-
rv = getMultipleDisplayedValues();
|
|
377
|
-
break;
|
|
378
|
-
case false:
|
|
379
|
-
default:
|
|
380
|
-
rv = getValueByModalType(displayed, 'displayed');
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
return rv;
|
|
384
|
-
};
|
|
385
|
-
const DeleteButton = ({ option })=>{
|
|
386
|
-
let rv = null;
|
|
387
|
-
switch(multiple){
|
|
388
|
-
case true:
|
|
389
|
-
if ((displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0) {
|
|
390
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
391
|
-
onClick: ()=>{
|
|
392
|
-
deleteOneItem(option);
|
|
393
|
-
},
|
|
394
|
-
children: "x"
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
break;
|
|
398
|
-
case false:
|
|
399
|
-
default:
|
|
400
|
-
if (displayed[search_path] === getClicked(option)) {
|
|
401
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
402
|
-
onClick: ()=>{
|
|
403
|
-
deleteOneItem(option);
|
|
404
|
-
},
|
|
405
|
-
children: "x"
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
break;
|
|
409
|
-
}
|
|
410
|
-
return rv;
|
|
411
|
-
};
|
|
412
|
-
const getValueByModalType = (option, location)=>{
|
|
413
|
-
let rv = null;
|
|
414
|
-
const clicked = getClicked(option);
|
|
415
|
-
switch(modal_type){
|
|
416
|
-
case 'chip':
|
|
417
|
-
rv = location === 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
|
|
418
|
-
status: clicked,
|
|
419
|
-
label: (0, _helpers.titleCase)(clicked),
|
|
420
|
-
variant: "outlined",
|
|
421
|
-
onDelete: ()=>{
|
|
422
|
-
deleteOneItem(option);
|
|
423
|
-
}
|
|
424
|
-
}, option._id) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
|
|
425
|
-
status: clicked,
|
|
426
|
-
label: (0, _helpers.titleCase)(clicked),
|
|
427
|
-
variant: "outlined"
|
|
428
|
-
}, option._id);
|
|
429
|
-
break;
|
|
430
|
-
case 'logo':
|
|
431
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
432
|
-
sx: {
|
|
433
|
-
display: 'flex',
|
|
434
|
-
gap: 1,
|
|
435
|
-
color: 'grey',
|
|
436
|
-
cursor: 'pointer',
|
|
437
|
-
width: '100%'
|
|
438
|
-
},
|
|
439
|
-
children: [
|
|
440
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
|
|
441
|
-
style: {
|
|
442
|
-
width: '70px'
|
|
443
|
-
},
|
|
444
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
|
|
445
|
-
icon: `companies/${option.logo}`,
|
|
446
|
-
width: 70,
|
|
447
|
-
height: 16
|
|
448
|
-
})
|
|
449
|
-
}),
|
|
450
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
451
|
-
sx: {
|
|
452
|
-
width: '170px',
|
|
453
|
-
overflow: 'hidden',
|
|
454
|
-
display: 'flex',
|
|
455
|
-
justifyContent: 'flex-start',
|
|
456
|
-
gap: 1
|
|
457
|
-
},
|
|
458
|
-
children: [
|
|
459
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
460
|
-
variant: "subtitle2",
|
|
461
|
-
color: theme.palette.typography.title,
|
|
462
|
-
children: (0, _helpers.titleCase)(clicked)
|
|
463
|
-
}),
|
|
464
|
-
location === 'displayed' && /*#__PURE__*/ (0, _jsxruntime.jsx)(DeleteButton, {
|
|
465
|
-
option: option
|
|
466
|
-
})
|
|
467
|
-
]
|
|
468
|
-
}),
|
|
469
|
-
location === 'list' && isChecked(option) && /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
|
|
470
|
-
width: 16,
|
|
471
|
-
height: 16,
|
|
472
|
-
icon: 'filters/chosen_icon.svg'
|
|
473
|
-
})
|
|
474
|
-
]
|
|
475
|
-
}, option._id);
|
|
476
|
-
break;
|
|
477
|
-
case 'text':
|
|
478
|
-
default:
|
|
479
|
-
rv = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
480
|
-
sx: {
|
|
481
|
-
display: 'flex',
|
|
482
|
-
justifyContent: 'space-between',
|
|
483
|
-
width: '100%',
|
|
484
|
-
maxWidth: '250px',
|
|
485
|
-
gap: 1,
|
|
486
|
-
color: 'grey',
|
|
487
|
-
cursor: 'pointer'
|
|
488
|
-
},
|
|
489
|
-
children: [
|
|
490
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
491
|
-
sx: {
|
|
492
|
-
width: '210px',
|
|
493
|
-
overflow: 'hidden',
|
|
494
|
-
display: 'flex',
|
|
495
|
-
justifyContent: 'flex-start',
|
|
496
|
-
gap: 1
|
|
497
|
-
},
|
|
498
|
-
children: [
|
|
499
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
500
|
-
variant: "subtitle2",
|
|
501
|
-
color: theme.palette.typography.title,
|
|
502
|
-
children: (0, _helpers.titleCase)(clicked)
|
|
503
|
-
}),
|
|
504
|
-
location === 'displayed' && /*#__PURE__*/ (0, _jsxruntime.jsx)(DeleteButton, {
|
|
505
|
-
option: option
|
|
506
|
-
})
|
|
507
|
-
]
|
|
508
|
-
}),
|
|
509
|
-
location === 'list' && isChecked(option) && /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
|
|
510
|
-
width: 16,
|
|
511
|
-
height: 16,
|
|
512
|
-
icon: 'filters/chosen_icon.svg'
|
|
513
|
-
})
|
|
514
|
-
]
|
|
515
|
-
}, option._id);
|
|
516
|
-
break;
|
|
517
|
-
}
|
|
518
|
-
return rv;
|
|
519
|
-
};
|
|
520
|
-
const getMultipleDisplayedValues = ()=>{
|
|
521
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
522
|
-
direction: 'row',
|
|
523
|
-
sx: {
|
|
524
|
-
maxWidth: 270,
|
|
525
|
-
minWidth: 270,
|
|
526
|
-
display: 'flex',
|
|
527
|
-
justifyContent: 'space-between'
|
|
528
|
-
},
|
|
529
|
-
children: [
|
|
530
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
531
|
-
direction: 'row',
|
|
532
|
-
sx: {
|
|
533
|
-
overflow: 'hidden',
|
|
534
|
-
flexWrap: 'wrap',
|
|
535
|
-
gap: 1
|
|
536
|
-
},
|
|
537
|
-
children: displayed.map((item)=>{
|
|
538
|
-
return getValueByModalType(item, 'displayed');
|
|
539
|
-
})
|
|
540
|
-
}),
|
|
541
|
-
(displayed === null || displayed === void 0 ? void 0 : displayed.length) > 0 && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
542
|
-
sx: {
|
|
543
|
-
minWidth: '20px',
|
|
544
|
-
maxWidth: '20px',
|
|
545
|
-
cursor: 'pointer'
|
|
546
|
-
},
|
|
547
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxIcon.FxIcon, {
|
|
548
|
-
onClick: ()=>{
|
|
549
|
-
setDisplayed([]);
|
|
550
|
-
onRemoveAll && onRemoveAll();
|
|
551
|
-
sessionStorage.removeItem(`dropdown-${query}`);
|
|
552
|
-
},
|
|
553
|
-
icon: `filters/remove_all_button.svg`,
|
|
554
|
-
width: 16,
|
|
555
|
-
height: 16
|
|
556
|
-
})
|
|
557
|
-
})
|
|
558
|
-
]
|
|
559
|
-
});
|
|
560
|
-
};
|
|
561
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
|
|
562
|
-
sx: {
|
|
563
|
-
background: '#FFFFFF',
|
|
564
|
-
padding: '0 16px'
|
|
565
|
-
},
|
|
566
|
-
children: [
|
|
567
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
568
|
-
children: [
|
|
569
|
-
getCurrentValues(),
|
|
570
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.InputWrapper, {
|
|
571
|
-
disabled: disabled,
|
|
572
|
-
sx: {
|
|
573
|
-
width: '100%',
|
|
574
|
-
border: 'none !important',
|
|
575
|
-
outline: 'none !important'
|
|
576
|
-
},
|
|
577
|
-
children: [
|
|
578
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
|
|
579
|
-
style: {
|
|
580
|
-
border: 'none',
|
|
581
|
-
outline: 'none'
|
|
582
|
-
},
|
|
583
|
-
autoFocus: true,
|
|
584
|
-
placeholder: "Select an option...",
|
|
585
|
-
onChange: (e)=>{
|
|
586
|
-
handleSearch(e);
|
|
587
|
-
}
|
|
588
|
-
}),
|
|
589
|
-
loading && /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.Loading, {
|
|
590
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {})
|
|
591
|
-
})
|
|
592
|
-
]
|
|
593
|
-
})
|
|
594
|
-
]
|
|
595
|
-
}),
|
|
596
|
-
options && (options === null || options === void 0 ? void 0 : options.length) > 0 && !disabled ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.StyledListBox, {
|
|
597
|
-
sx: _object_spread_props(_object_spread({}, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.menuSx), {
|
|
598
|
-
'&::-webkit-scrollbar': {
|
|
599
|
-
width: '8px',
|
|
600
|
-
backgroundColor: 'transparent'
|
|
601
|
-
},
|
|
602
|
-
'&::-webkit-scrollbar-thumb': {
|
|
603
|
-
backgroundColor: '#8B9092',
|
|
604
|
-
borderRadius: '8px'
|
|
605
|
-
},
|
|
606
|
-
// To support Firefox
|
|
607
|
-
scrollbarWidth: 'thin',
|
|
608
|
-
scrollbarColor: '#8B9092 transparent',
|
|
609
|
-
maxHeight: '300px',
|
|
610
|
-
overflowY: 'auto'
|
|
611
|
-
}),
|
|
612
|
-
ref: ref,
|
|
613
|
-
children: [
|
|
614
|
-
handleListOptions(),
|
|
615
|
-
!isLastPage && /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
|
|
616
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
617
|
-
onClick: ()=>{
|
|
618
|
-
setReason('loaded more');
|
|
619
|
-
loadMore();
|
|
620
|
-
},
|
|
621
|
-
children: "load more"
|
|
622
|
-
})
|
|
623
|
-
})
|
|
624
|
-
]
|
|
625
|
-
}) : null
|
|
626
|
-
]
|
|
627
|
-
});
|
|
628
|
-
});
|