@fixefy/fixefy-ui-components 0.1.66 → 0.1.67
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/FxAsyncDropdown/FxAsyncDropdown.d.ts +16 -5
- package/dist/FxAsyncDropdown/FxAsyncDropdown.js +217 -197
- package/dist/FxAsyncDropdown/helpers/helpers.d.ts +0 -2
- package/dist/FxAsyncDropdown/helpers/helpers.js +1 -11
- package/dist/FxIcon/FxIcon.d.ts +10 -5
- package/dist/FxIcon/FxIcon.js +85 -45
- package/dist/FxIcon/index.d.ts +1 -1
- package/dist/FxIcon/index.js +11 -3
- package/dist/FxScore/styles/score.styles.js +1 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -0
- package/package.json +2 -2
|
@@ -14,16 +14,27 @@ export type AsyncDropdownPropsType = {
|
|
|
14
14
|
debug?: boolean;
|
|
15
15
|
initialValue?: Option | any;
|
|
16
16
|
styles?: StylesOptions;
|
|
17
|
-
|
|
17
|
+
structure: {
|
|
18
|
+
name: string;
|
|
19
|
+
extended: {
|
|
20
|
+
title: string;
|
|
21
|
+
title_path: string;
|
|
22
|
+
search_path: string;
|
|
23
|
+
variables: {
|
|
24
|
+
method_name: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
children: any;
|
|
28
|
+
};
|
|
29
|
+
fetcher: {
|
|
30
|
+
query: any;
|
|
31
|
+
queryOptions: any;
|
|
32
|
+
};
|
|
18
33
|
multiple?: boolean;
|
|
19
|
-
name: any;
|
|
20
|
-
variables: any;
|
|
21
34
|
onChange?: (value: any, name: string) => void;
|
|
22
35
|
type?: 'checkbox' | 'text';
|
|
23
36
|
renderOptions?: (option: Option, index: number) => void;
|
|
24
37
|
[x: string]: any;
|
|
25
38
|
showSelectedValue?: boolean;
|
|
26
|
-
modal_type?: string;
|
|
27
|
-
query: string;
|
|
28
39
|
};
|
|
29
40
|
export declare const FxAsyncDropdown: React.ForwardRefExoticComponent<Omit<AsyncDropdownPropsType, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -10,16 +10,14 @@ Object.defineProperty(exports, "FxAsyncDropdown", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
const _jsxruntime = require("react/jsx-runtime");
|
|
13
|
-
const
|
|
13
|
+
const _lodash = /*#__PURE__*/ _interop_require_default(require("lodash"));
|
|
14
14
|
const _iconsmaterial = require("@mui/icons-material");
|
|
15
|
-
const _material = require("@mui/material");
|
|
16
|
-
const _FxChip = require("../FxChip");
|
|
17
15
|
const _graphqltag = require("graphql-tag");
|
|
18
|
-
const _dropdownstyles = require("./styles/dropdown.styles");
|
|
19
|
-
const _helpers = require("./helpers/helpers");
|
|
20
16
|
const _client = require("@apollo/client");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
17
|
+
const _fixefyuiutils = require("@fixefy/fixefy-ui-utils");
|
|
18
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
19
|
+
const _material = require("@mui/material");
|
|
20
|
+
const _dropdownstyles = require("./styles/dropdown.styles");
|
|
23
21
|
function _define_property(obj, key, value) {
|
|
24
22
|
if (key in obj) {
|
|
25
23
|
Object.defineProperty(obj, key, {
|
|
@@ -33,6 +31,11 @@ function _define_property(obj, key, value) {
|
|
|
33
31
|
}
|
|
34
32
|
return obj;
|
|
35
33
|
}
|
|
34
|
+
function _interop_require_default(obj) {
|
|
35
|
+
return obj && obj.__esModule ? obj : {
|
|
36
|
+
default: obj
|
|
37
|
+
};
|
|
38
|
+
}
|
|
36
39
|
function _getRequireWildcardCache(nodeInterop) {
|
|
37
40
|
if (typeof WeakMap !== "function") return null;
|
|
38
41
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -147,63 +150,82 @@ const checkedIcon = /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CheckBox,
|
|
|
147
150
|
fontSize: "small"
|
|
148
151
|
});
|
|
149
152
|
const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props, parentRef)=>{
|
|
150
|
-
var _props_styles;
|
|
153
|
+
var _structure_extended, _props_styles, _props_styles1, _props_styles2;
|
|
151
154
|
const ref = (0, _react.useRef)(null);
|
|
152
155
|
const theme = (0, _material.useTheme)();
|
|
153
|
-
const [value, setValue] = (0, _react.useState)(null);
|
|
154
|
-
const [displayedValue, setDisplayedValue] = (0, _react.useState)('');
|
|
155
156
|
const [options, setOptions] = (0, _react.useState)([]);
|
|
156
|
-
|
|
157
|
-
const [reason, setReason] = (0, _react.useState)('init');
|
|
157
|
+
const [loadingData, setLoadingData] = (0, _react.useState)(false);
|
|
158
158
|
const [isLastPage, setIsLastPage] = (0, _react.useState)(false);
|
|
159
159
|
const [searchValue, setSearchValue] = (0, _react.useState)(null);
|
|
160
160
|
const [hasClearBtn, setHasClearBtn] = (0, _react.useState)(false);
|
|
161
161
|
const [page, setPage] = (0, _react.useState)(1);
|
|
162
162
|
const [prevPage, setPrevPage] = (0, _react.useState)(0);
|
|
163
|
-
const pageSize = 20;
|
|
164
|
-
const { debug, onChange, renderOptions, fetcher, disabled, type = 'text',
|
|
163
|
+
const [pageSize] = (0, _react.useState)(20);
|
|
164
|
+
const { debug, structure, onChange, onClear, renderOptions, fetcher, initialValue = {}, multiple, disabled, type = 'text', showSelectedValue } = props, rest = _object_without_properties(props, [
|
|
165
|
+
"debug",
|
|
166
|
+
"structure",
|
|
167
|
+
"onChange",
|
|
168
|
+
"onClear",
|
|
169
|
+
"renderOptions",
|
|
170
|
+
"fetcher",
|
|
171
|
+
"initialValue",
|
|
172
|
+
"multiple",
|
|
173
|
+
"disabled",
|
|
174
|
+
"type",
|
|
175
|
+
"showSelectedValue"
|
|
176
|
+
]);
|
|
177
|
+
const { name, extended, children } = structure;
|
|
178
|
+
const { search_path, variables } = extended;
|
|
165
179
|
const { method_name } = variables;
|
|
166
|
-
const
|
|
167
|
-
const getWhere = ()=>{
|
|
168
|
-
if (variables.method_name == 'workspace') {
|
|
169
|
-
return searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
170
|
-
_id: ws,
|
|
171
|
-
[search_path]: {
|
|
172
|
-
$regex: searchValue
|
|
173
|
-
}
|
|
174
|
-
}) : _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
175
|
-
_id: ws
|
|
176
|
-
});
|
|
177
|
-
} else {
|
|
178
|
-
return searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
179
|
-
[search_path]: {
|
|
180
|
-
$regex: searchValue
|
|
181
|
-
}
|
|
182
|
-
}) : _object_spread({}, fetcher.queryOptions.variables.where);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
const isLocal = fetcher.query.loc;
|
|
186
|
-
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), {
|
|
180
|
+
const [fetch, { data, loading }] = (0, _client.useLazyQuery)((0, _graphqltag.gql)(fetcher.query), _object_spread_props(_object_spread({}, fetcher.queryOptions), {
|
|
187
181
|
variables: _object_spread_props(_object_spread({}, fetcher.queryOptions.variables), {
|
|
188
|
-
where:
|
|
182
|
+
where: searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
183
|
+
[search_path]: searchValue
|
|
184
|
+
}) : _object_spread({}, fetcher.queryOptions.variables.where),
|
|
189
185
|
skip: page * pageSize - pageSize,
|
|
190
186
|
limit: pageSize
|
|
191
187
|
})
|
|
192
188
|
}));
|
|
193
|
-
|
|
189
|
+
var _structure_extended_title_path;
|
|
190
|
+
const labelOption = (_structure_extended_title_path = structure === null || structure === void 0 ? void 0 : (_structure_extended = structure.extended) === null || _structure_extended === void 0 ? void 0 : _structure_extended.title_path) !== null && _structure_extended_title_path !== void 0 ? _structure_extended_title_path : 'title';
|
|
191
|
+
const { getRootProps, getInputProps, getClearProps, getListboxProps, getOptionProps, groupedOptions, value, popupOpen, focused, setAnchorEl } = (0, _material.useAutocomplete)(_object_spread_props(_object_spread({}, rest), {
|
|
192
|
+
defaultValue: initialValue,
|
|
193
|
+
options: options,
|
|
194
|
+
disableCloseOnSelect: !!multiple,
|
|
195
|
+
multiple,
|
|
196
|
+
disabled: disabled,
|
|
197
|
+
isOptionEqualToValue: (option, value)=>{
|
|
198
|
+
return option._id === value._id;
|
|
199
|
+
},
|
|
200
|
+
getOptionLabel: (option)=>{
|
|
201
|
+
var _option_labelOption;
|
|
202
|
+
return (0, _fixefyuiutils.titleCase)((_option_labelOption = option[labelOption]) !== null && _option_labelOption !== void 0 ? _option_labelOption : option.title);
|
|
203
|
+
}
|
|
204
|
+
}));
|
|
205
|
+
const onPopupScroll = _lodash.default.debounce(()=>{
|
|
206
|
+
if (ref && ref.current) {
|
|
207
|
+
//@ts-ignore
|
|
208
|
+
const threshHold = ref.current.scrollHeight / 2;
|
|
209
|
+
//@ts-ignore
|
|
210
|
+
if (ref.current.scrollTop > threshHold && !loadingData && !isLastPage) {
|
|
211
|
+
setLoadingData(true);
|
|
212
|
+
setPage((prevPage)=>prevPage + 1);
|
|
213
|
+
setPrevPage((prevPage)=>prevPage + 1);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}, 800);
|
|
217
|
+
const createTitle = ()=>{
|
|
218
|
+
if (Array.isArray(value)) {
|
|
219
|
+
if (value && value.length) {
|
|
220
|
+
return `${(0, _fixefyuiutils.titleCase)(name)} (${value.length})`;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return (0, _fixefyuiutils.titleCase)(name);
|
|
224
|
+
};
|
|
225
|
+
const handleSearch = _lodash.default.debounce((e)=>{
|
|
194
226
|
setSearchValue(e.target.value);
|
|
195
|
-
setDisplayedValue(e.target.value);
|
|
196
|
-
setReason('searched');
|
|
197
227
|
setPage(1);
|
|
198
|
-
|
|
199
|
-
setIsLastPage(false);
|
|
200
|
-
};
|
|
201
|
-
(0, _react.useEffect)(()=>{
|
|
202
|
-
//@ts-ignore
|
|
203
|
-
onChange && value && onChange(value, name);
|
|
204
|
-
}, [
|
|
205
|
-
value
|
|
206
|
-
]);
|
|
228
|
+
}, 300);
|
|
207
229
|
const handleChildrens = (_param)=>{
|
|
208
230
|
var { structure } = _param, rest = _object_without_properties(_param, [
|
|
209
231
|
"structure"
|
|
@@ -239,100 +261,89 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props, parentRe
|
|
|
239
261
|
};
|
|
240
262
|
const handleRenderOptions = ()=>{
|
|
241
263
|
debug === true && console.log('renderOptions: ', renderOptions);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
sx: {
|
|
265
|
-
mr: 1,
|
|
266
|
-
minWidth: 24,
|
|
267
|
-
minHeight: 24,
|
|
268
|
-
p: 0,
|
|
269
|
-
['& svg']: {
|
|
270
|
-
fill: theme.palette.primary.light
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}),
|
|
274
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
275
|
-
variant: "subtitle2",
|
|
276
|
-
color: theme.palette.typography.title,
|
|
277
|
-
children: (0, _helpers.titleCase)((_option_title = option === null || option === void 0 ? void 0 : option.title) !== null && _option_title !== void 0 ? _option_title : title)
|
|
278
|
-
})
|
|
279
|
-
]
|
|
280
|
-
}, option._id);
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
case 'text':
|
|
284
|
-
{
|
|
285
|
-
return options.map((option)=>{
|
|
286
|
-
debug === true && console.log('renderOptions: ', title_path, option[title_path], options);
|
|
287
|
-
var _option_title_path;
|
|
288
|
-
const displayedVal = (_option_title_path = option[title_path]) !== null && _option_title_path !== void 0 ? _option_title_path : option.title;
|
|
289
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
|
|
290
|
-
onClick: ()=>{
|
|
291
|
-
setValue(option);
|
|
292
|
-
setDisplayedValue((0, _helpers.titleCase)(displayedVal));
|
|
293
|
-
},
|
|
294
|
-
children: modal_type === 'chip' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
|
|
295
|
-
status: option.value,
|
|
296
|
-
label: (0, _helpers.titleCase)(displayedVal),
|
|
297
|
-
variant: "outlined"
|
|
298
|
-
}) : modal_type === 'logo' ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
264
|
+
if (renderOptions) {
|
|
265
|
+
return groupedOptions.map((option, index)=>{
|
|
266
|
+
const CustomeComponent = renderOptions(option, index);
|
|
267
|
+
//@ts-ignore
|
|
268
|
+
return /*#__PURE__*/ _react.default.cloneElement(CustomeComponent, _object_spread({}, getOptionProps({
|
|
269
|
+
option,
|
|
270
|
+
index
|
|
271
|
+
})));
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
switch(type){
|
|
275
|
+
case 'checkbox':
|
|
276
|
+
{
|
|
277
|
+
return groupedOptions.map((option, index)=>{
|
|
278
|
+
const isSelected = getOptionProps({
|
|
279
|
+
option,
|
|
280
|
+
index
|
|
281
|
+
})['aria-selected'];
|
|
282
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)("li", _object_spread_props(_object_spread({}, getOptionProps({
|
|
283
|
+
option,
|
|
284
|
+
index
|
|
285
|
+
})), {
|
|
299
286
|
children: [
|
|
300
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(
|
|
301
|
-
icon:
|
|
302
|
-
|
|
303
|
-
|
|
287
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Checkbox, {
|
|
288
|
+
icon: icon,
|
|
289
|
+
checked: Boolean(isSelected),
|
|
290
|
+
checkedIcon: checkedIcon,
|
|
291
|
+
sx: {
|
|
292
|
+
mr: 1,
|
|
293
|
+
minWidth: 24,
|
|
294
|
+
minHeight: 24,
|
|
295
|
+
p: 0,
|
|
296
|
+
['& svg']: {
|
|
297
|
+
fill: theme.palette.primary.light
|
|
298
|
+
}
|
|
299
|
+
}
|
|
304
300
|
}),
|
|
305
301
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
306
|
-
sx: {
|
|
307
|
-
marginLeft: '5px'
|
|
308
|
-
},
|
|
309
302
|
variant: "subtitle2",
|
|
310
303
|
color: theme.palette.typography.title,
|
|
311
|
-
children: (0,
|
|
304
|
+
children: (0, _fixefyuiutils.titleCase)(option === null || option === void 0 ? void 0 : option.title)
|
|
312
305
|
})
|
|
313
306
|
]
|
|
314
|
-
})
|
|
315
|
-
variant: "subtitle2",
|
|
316
|
-
color: theme.palette.typography.title,
|
|
317
|
-
children: (0, _helpers.titleCase)(displayedVal)
|
|
318
|
-
})
|
|
319
|
-
}, option._id);
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
default:
|
|
323
|
-
{
|
|
324
|
-
return options.map((option)=>{
|
|
325
|
-
debug === true && console.log('renderOptions: ', title_path, option[title_path], options);
|
|
326
|
-
var _option_title_path;
|
|
327
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", {
|
|
328
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
329
|
-
variant: "subtitle2",
|
|
330
|
-
color: theme.palette.typography.title,
|
|
331
|
-
children: (0, _helpers.titleCase)((_option_title_path = option[title_path]) !== null && _option_title_path !== void 0 ? _option_title_path : option.title)
|
|
332
|
-
})
|
|
307
|
+
}));
|
|
333
308
|
});
|
|
334
|
-
}
|
|
335
|
-
|
|
309
|
+
}
|
|
310
|
+
case 'text':
|
|
311
|
+
{
|
|
312
|
+
return groupedOptions.map((option, index)=>{
|
|
313
|
+
var _structure_extended, _structure_extended1, _structure_extended2;
|
|
314
|
+
debug === true && console.log('renderOptions: ', structure === null || structure === void 0 ? void 0 : (_structure_extended = structure.extended) === null || _structure_extended === void 0 ? void 0 : _structure_extended.title_path, option[structure === null || structure === void 0 ? void 0 : (_structure_extended1 = structure.extended) === null || _structure_extended1 === void 0 ? void 0 : _structure_extended1.title_path], options);
|
|
315
|
+
var _option_structure_extended_title_path;
|
|
316
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", _object_spread_props(_object_spread({}, getOptionProps({
|
|
317
|
+
option,
|
|
318
|
+
index
|
|
319
|
+
})), {
|
|
320
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
321
|
+
variant: "subtitle2",
|
|
322
|
+
color: theme.palette.typography.title,
|
|
323
|
+
children: (0, _fixefyuiutils.titleCase)((_option_structure_extended_title_path = option[structure === null || structure === void 0 ? void 0 : (_structure_extended2 = structure.extended) === null || _structure_extended2 === void 0 ? void 0 : _structure_extended2.title_path]) !== null && _option_structure_extended_title_path !== void 0 ? _option_structure_extended_title_path : option.title)
|
|
324
|
+
})
|
|
325
|
+
}));
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
default:
|
|
329
|
+
{
|
|
330
|
+
return groupedOptions.map((option, index)=>{
|
|
331
|
+
var _structure_extended, _structure_extended1, _structure_extended2;
|
|
332
|
+
debug === true && console.log('renderOptions: ', structure === null || structure === void 0 ? void 0 : (_structure_extended = structure.extended) === null || _structure_extended === void 0 ? void 0 : _structure_extended.title_path, option[structure === null || structure === void 0 ? void 0 : (_structure_extended1 = structure.extended) === null || _structure_extended1 === void 0 ? void 0 : _structure_extended1.title_path], options);
|
|
333
|
+
var _option_structure_extended_title_path;
|
|
334
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)("li", _object_spread_props(_object_spread({}, getOptionProps({
|
|
335
|
+
option,
|
|
336
|
+
index
|
|
337
|
+
})), {
|
|
338
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
339
|
+
variant: "subtitle2",
|
|
340
|
+
color: theme.palette.typography.title,
|
|
341
|
+
children: (0, _fixefyuiutils.titleCase)((_option_structure_extended_title_path = option[structure === null || structure === void 0 ? void 0 : (_structure_extended2 = structure.extended) === null || _structure_extended2 === void 0 ? void 0 : _structure_extended2.title_path]) !== null && _option_structure_extended_title_path !== void 0 ? _option_structure_extended_title_path : option.title)
|
|
342
|
+
})
|
|
343
|
+
}));
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
336
347
|
}
|
|
337
348
|
};
|
|
338
349
|
(0, _react.useImperativeHandle)(parentRef, ()=>({
|
|
@@ -342,11 +353,32 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props, parentRe
|
|
|
342
353
|
(_getClearProps = getClearProps()) === null || _getClearProps === void 0 ? void 0 : _getClearProps.onClick(null);
|
|
343
354
|
}
|
|
344
355
|
}));
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
356
|
+
(0, _react.useEffect)(()=>{
|
|
357
|
+
if (ref && ref.current) {
|
|
358
|
+
//@ts-ignore
|
|
359
|
+
ref.current.addEventListener('scroll', ()=>onPopupScroll());
|
|
360
|
+
}
|
|
361
|
+
return ()=>{
|
|
362
|
+
if (ref && ref.current) {
|
|
363
|
+
//@ts-ignore
|
|
364
|
+
ref.current.removeEventListener('scroll', ()=>onPopupScroll());
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
}, [
|
|
368
|
+
groupedOptions
|
|
369
|
+
]);
|
|
370
|
+
(0, _react.useEffect)(()=>{
|
|
371
|
+
onChange && onChange(value, name);
|
|
372
|
+
}, [
|
|
373
|
+
value
|
|
374
|
+
]);
|
|
375
|
+
(0, _react.useEffect)(()=>{
|
|
376
|
+
if (popupOpen && !isLastPage && prevPage < page && !disabled) {
|
|
377
|
+
fetch();
|
|
378
|
+
}
|
|
379
|
+
}, [
|
|
380
|
+
popupOpen
|
|
381
|
+
]);
|
|
350
382
|
(0, _react.useEffect)(()=>{
|
|
351
383
|
if (!disabled) {
|
|
352
384
|
fetch();
|
|
@@ -354,83 +386,71 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props, parentRe
|
|
|
354
386
|
}, []);
|
|
355
387
|
(0, _react.useEffect)(()=>{
|
|
356
388
|
if (data && !isLastPage && prevPage < page) {
|
|
357
|
-
|
|
358
|
-
const newOptions = variables.method_name == 'workspace' ? data.workspace[search_path === null || search_path === void 0 ? void 0 : search_path.split('.')[1]] : data[method_name];
|
|
389
|
+
const newOptions = data[method_name];
|
|
359
390
|
if (newOptions.length === 0 || newOptions.length < pageSize) {
|
|
360
391
|
setIsLastPage(true);
|
|
361
392
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
...newOptions
|
|
368
|
-
]);
|
|
369
|
-
}
|
|
370
|
-
// setLoadingData(false)
|
|
393
|
+
setOptions([
|
|
394
|
+
...newOptions,
|
|
395
|
+
...options
|
|
396
|
+
]);
|
|
397
|
+
setLoadingData(false);
|
|
371
398
|
}
|
|
372
399
|
}, [
|
|
373
|
-
data
|
|
374
|
-
reason
|
|
400
|
+
data
|
|
375
401
|
]);
|
|
402
|
+
var _props_styles_width, _props_styles_maxWidth;
|
|
376
403
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Root, {
|
|
377
404
|
children: [
|
|
378
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.InputWrapper, {
|
|
405
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.InputWrapper, _object_spread_props(_object_spread({
|
|
406
|
+
hasValue: !!(value && Object.keys(value).length),
|
|
379
407
|
disabled: disabled,
|
|
380
408
|
sx: {
|
|
381
|
-
width:
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
409
|
+
width: (_props_styles_width = (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.width) !== null && _props_styles_width !== void 0 ? _props_styles_width : 180,
|
|
410
|
+
maxWidth: (_props_styles_maxWidth = (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.maxWidth) !== null && _props_styles_maxWidth !== void 0 ? _props_styles_maxWidth : 300
|
|
411
|
+
}
|
|
412
|
+
}, getRootProps()), {
|
|
413
|
+
ref: setAnchorEl,
|
|
414
|
+
className: focused ? 'focused' : '',
|
|
385
415
|
children: [
|
|
386
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
|
|
387
|
-
|
|
388
|
-
border: 'none',
|
|
389
|
-
outline: 'none'
|
|
390
|
-
},
|
|
391
|
-
autoFocus: true,
|
|
392
|
-
defaultValue: displayedValue !== null && displayedValue !== void 0 ? displayedValue : '',
|
|
393
|
-
placeholder: "Select an option...",
|
|
416
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)("input", _object_spread_props(_object_spread({}, getInputProps()), {
|
|
417
|
+
readOnly: true,
|
|
394
418
|
onChange: (e)=>{
|
|
419
|
+
var //@ts-ignore
|
|
420
|
+
_getInputProps;
|
|
421
|
+
(_getInputProps = getInputProps()) === null || _getInputProps === void 0 ? void 0 : _getInputProps.onChange(e);
|
|
395
422
|
handleSearch(e);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
423
|
+
},
|
|
424
|
+
placeholder: createTitle(),
|
|
425
|
+
value: showSelectedValue ? (0, _fixefyuiutils.titleCase)(value.title) : undefined
|
|
426
|
+
})),
|
|
427
|
+
loading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.Loading, {
|
|
399
428
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {})
|
|
400
|
-
})
|
|
429
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.KeyboardArrowDown, {})
|
|
401
430
|
]
|
|
402
|
-
}),
|
|
403
|
-
|
|
404
|
-
sx: _object_spread_props(_object_spread({}, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.menuSx), {
|
|
405
|
-
'&::-webkit-scrollbar': {
|
|
406
|
-
width: '16px',
|
|
407
|
-
backgroundColor: '#F5F5F5'
|
|
408
|
-
},
|
|
409
|
-
'&::-webkit-scrollbar-thumb': {
|
|
410
|
-
backgroundColor: '#F5F5F580',
|
|
411
|
-
borderRadius: '8px',
|
|
412
|
-
border: '4px solid #F5F5F5'
|
|
413
|
-
},
|
|
414
|
-
// To support Firefox
|
|
415
|
-
scrollbarWidth: 'thin',
|
|
416
|
-
scrollbarColor: '#F5F5F580 #F5F5F5',
|
|
417
|
-
maxHeight: '300px',
|
|
418
|
-
overflowY: 'auto'
|
|
419
|
-
}),
|
|
420
|
-
ref: ref,
|
|
431
|
+
})),
|
|
432
|
+
groupedOptions.length > 0 && !disabled ? /*#__PURE__*/ (0, _jsxruntime.jsxs)(_dropdownstyles.Listbox, _object_spread_props(_object_spread({}, getListboxProps()), {
|
|
421
433
|
children: [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
434
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.StyledListBox, {
|
|
435
|
+
sx: _object_spread({}, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.menuSx),
|
|
436
|
+
hasClearBtn: children === null || children === void 0 ? void 0 : children.length,
|
|
437
|
+
ref: ref,
|
|
438
|
+
children: handleRenderOptions()
|
|
439
|
+
}),
|
|
440
|
+
children && children.length ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_dropdownstyles.StyledClose, {
|
|
441
|
+
children: handleChildrens({
|
|
442
|
+
structure: children[0],
|
|
443
|
+
onClick: (e)=>{
|
|
444
|
+
var //@ts-ignore
|
|
445
|
+
_getClearProps;
|
|
446
|
+
onClear && onClear();
|
|
447
|
+
(_getClearProps = getClearProps()) === null || _getClearProps === void 0 ? void 0 : _getClearProps.onClick(e);
|
|
428
448
|
},
|
|
429
|
-
|
|
449
|
+
startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.Close, {})
|
|
430
450
|
})
|
|
431
|
-
})
|
|
451
|
+
}) : null
|
|
432
452
|
]
|
|
433
|
-
}) : null
|
|
453
|
+
})) : null
|
|
434
454
|
]
|
|
435
455
|
});
|
|
436
456
|
});
|
|
@@ -2,5 +2,3 @@ export declare const getJPart: (j: any, jsonPath: string, defaultValue?: any) =>
|
|
|
2
2
|
export declare const isArrayValid: (arr: any[], minLength?: number, maxLength?: number) => boolean;
|
|
3
3
|
export declare const isObjectValid: (obj: any, isCheckKeys?: boolean) => boolean;
|
|
4
4
|
export declare const isStringValid: (str: string, minLength?: number | null, maxLength?: number | null, isValidateType?: boolean) => boolean;
|
|
5
|
-
export declare const titleCase: (str?: string) => string;
|
|
6
|
-
export declare const toPascalCase: (string: string, title?: boolean) => string;
|
|
@@ -20,12 +20,6 @@ _export(exports, {
|
|
|
20
20
|
},
|
|
21
21
|
isStringValid: function() {
|
|
22
22
|
return isStringValid;
|
|
23
|
-
},
|
|
24
|
-
titleCase: function() {
|
|
25
|
-
return titleCase;
|
|
26
|
-
},
|
|
27
|
-
toPascalCase: function() {
|
|
28
|
-
return toPascalCase;
|
|
29
23
|
}
|
|
30
24
|
});
|
|
31
25
|
function _define_property(obj, key, value) {
|
|
@@ -102,7 +96,7 @@ const getJPart = (j, jsonPath, defaultValue)=>{
|
|
|
102
96
|
j = JSON.parse(j);
|
|
103
97
|
} else {
|
|
104
98
|
j = j.reduce((acc, cur)=>{
|
|
105
|
-
const innerJ = getJPart(cur, pathParts.slice(i).join(
|
|
99
|
+
const innerJ = getJPart(cur, pathParts.slice(i).join("."), defaultValue);
|
|
106
100
|
if (isArrayValid(innerJ)) {
|
|
107
101
|
acc.push(...innerJ);
|
|
108
102
|
} else {
|
|
@@ -155,7 +149,3 @@ const isStringValid = (str, minLength = null, maxLength = null, isValidateType =
|
|
|
155
149
|
}
|
|
156
150
|
return rv;
|
|
157
151
|
};
|
|
158
|
-
const titleCase = (str = '')=>str && toPascalCase(str.toString(), true);
|
|
159
|
-
const toPascalCase = (string, title = false)=>{
|
|
160
|
-
return string && string.replace(/(_[a-z])?(^[a-z])?(_|\s[a-z])?/g, ($1)=>$1.toUpperCase().replace('_', title ? ' ' : ''));
|
|
161
|
-
};
|
package/dist/FxIcon/FxIcon.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type IconPropsType = {
|
|
2
|
+
className?: string;
|
|
3
|
+
color?: unknown;
|
|
4
|
+
fontSize?: string | number;
|
|
5
|
+
height?: `${number}` | number;
|
|
2
6
|
icon: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
+
sx?: any;
|
|
8
|
+
root: string;
|
|
9
|
+
width?: `${number}` | number;
|
|
10
|
+
};
|
|
11
|
+
export declare const FxIcon: ({ className, color, fontSize, icon, height, sx, width }: IconPropsType) => JSX.Element;
|
package/dist/FxIcon/FxIcon.js
CHANGED
|
@@ -9,10 +9,23 @@ Object.defineProperty(exports, "FxIcon", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _jsxruntime = require("react/jsx-runtime");
|
|
12
|
-
const _react = /*#__PURE__*/
|
|
13
|
-
const
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
|
|
13
|
+
const _content = require("./content");
|
|
14
14
|
const _fixefyuiutils = require("@fixefy/fixefy-ui-utils");
|
|
15
|
-
const
|
|
15
|
+
const _iconsmaterial = /*#__PURE__*/ _interop_require_wildcard(require("@mui/icons-material"));
|
|
16
|
+
function _define_property(obj, key, value) {
|
|
17
|
+
if (key in obj) {
|
|
18
|
+
Object.defineProperty(obj, key, {
|
|
19
|
+
value: value,
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
obj[key] = value;
|
|
26
|
+
}
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
16
29
|
function _interop_require_default(obj) {
|
|
17
30
|
return obj && obj.__esModule ? obj : {
|
|
18
31
|
default: obj
|
|
@@ -59,49 +72,76 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
72
|
}
|
|
60
73
|
return newObj;
|
|
61
74
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
function _object_spread(target) {
|
|
76
|
+
for(var i = 1; i < arguments.length; i++){
|
|
77
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
78
|
+
var ownKeys = Object.keys(source);
|
|
79
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
80
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
81
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
ownKeys.forEach(function(key) {
|
|
85
|
+
_define_property(target, key, source[key]);
|
|
72
86
|
});
|
|
73
87
|
}
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
88
|
+
return target;
|
|
89
|
+
}
|
|
90
|
+
function ownKeys(object, enumerableOnly) {
|
|
91
|
+
var keys = Object.keys(object);
|
|
92
|
+
if (Object.getOwnPropertySymbols) {
|
|
93
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
94
|
+
if (enumerableOnly) {
|
|
95
|
+
symbols = symbols.filter(function(sym) {
|
|
96
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
keys.push.apply(keys, symbols);
|
|
100
|
+
}
|
|
101
|
+
return keys;
|
|
102
|
+
}
|
|
103
|
+
function _object_spread_props(target, source) {
|
|
104
|
+
source = source != null ? source : {};
|
|
105
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
106
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
107
|
+
} else {
|
|
108
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
109
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return target;
|
|
113
|
+
}
|
|
114
|
+
// importing all the local icons - in the future should be removed to CDN server
|
|
115
|
+
const iconsModule = [];
|
|
116
|
+
const FxIcon = ({ className, color, fontSize, icon, height, sx, width })=>{
|
|
86
117
|
if (!icon) throw Error('Provide a property `icon`');
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
let rv;
|
|
119
|
+
const splittedPath = icon.split('/');
|
|
120
|
+
const iconWithoutPath = (0, _fixefyuiutils.toPascalCase)(splittedPath[splittedPath.length - 1]);
|
|
121
|
+
// const name = toPascalCase(icon)
|
|
122
|
+
if (iconsModule[iconWithoutPath]) {
|
|
123
|
+
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_content.DynamicIcon, {
|
|
124
|
+
icon: iconsModule[iconWithoutPath],
|
|
125
|
+
sx: sx
|
|
126
|
+
});
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
} else if (_iconsmaterial[iconWithoutPath]) {
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
const MUIIcon = _iconsmaterial[iconWithoutPath];
|
|
131
|
+
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(MUIIcon, {
|
|
132
|
+
className: className,
|
|
133
|
+
color: color,
|
|
134
|
+
sx: _object_spread_props(_object_spread({}, sx), {
|
|
135
|
+
fontSize
|
|
136
|
+
})
|
|
137
|
+
});
|
|
138
|
+
} else {
|
|
139
|
+
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_content.LazyIcon, {
|
|
140
|
+
icon: icon,
|
|
141
|
+
sx: sx,
|
|
142
|
+
width: width,
|
|
143
|
+
height: height
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return rv;
|
|
107
147
|
};
|
package/dist/FxIcon/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FxIcon } from './FxIcon';
|
|
1
|
+
export { FxIcon, IconPropsType } from './FxIcon';
|
package/dist/FxIcon/index.js
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
FxIcon: function() {
|
|
8
13
|
return _FxIcon.FxIcon;
|
|
14
|
+
},
|
|
15
|
+
IconPropsType: function() {
|
|
16
|
+
return _FxIcon.IconPropsType;
|
|
9
17
|
}
|
|
10
18
|
});
|
|
11
19
|
const _FxIcon = require("./FxIcon");
|
|
@@ -78,8 +78,7 @@ const useStyles = (0, _styles.makeStyles)((theme)=>({
|
|
|
78
78
|
flexDirection: 'column'
|
|
79
79
|
},
|
|
80
80
|
scoreNumber: {
|
|
81
|
-
color: theme.palette.common.white
|
|
82
|
-
fontWeight: 700
|
|
81
|
+
color: theme.palette.common.white
|
|
83
82
|
},
|
|
84
83
|
scoreText: _object_spread_props(_object_spread({}, theme.typography.table), {
|
|
85
84
|
fontWeight: 400,
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { FxAsyncDropdown, Option, StylesOptions, AsyncDropdownPropsType } from '
|
|
|
4
4
|
export { FxAvatar, AvatarPropsType, BackgroundColorsType } from './FxAvatar';
|
|
5
5
|
export { FxButton, ButtonPropsType } from './FxButton';
|
|
6
6
|
export { FxChip, ChipPropsType } from './FxChip';
|
|
7
|
-
export { FxIcon } from './FxIcon';
|
|
7
|
+
export { FxIcon, IconPropsType } from './FxIcon';
|
|
8
8
|
export { FxModal, ModalPropsType } from './FxModal';
|
|
9
9
|
export { FxNotes, NoteCreateInput, NotesPropsType } from './FxNotes';
|
|
10
10
|
export { FxNumberField, NumberfieldPropsType } from './FxNumberField';
|
|
@@ -18,4 +18,4 @@ export { FxStatusBar, StatusBarPropsType, Options } from './FxStatusBar';
|
|
|
18
18
|
export { FxTag, TagPropsType } from './FxTag';
|
|
19
19
|
export { FxTextField, TextFieldPropsType } from './FxTextField';
|
|
20
20
|
export { FxTodo, TodoItemType, TodoPropsType } from './FxTodo';
|
|
21
|
-
export { Card, PageHeader, Label, BoldValue, Value, PageTitle, Link, Text, ShowMore, ShowMoreContainer, DataWrapper, Bars
|
|
21
|
+
export { Card, PageHeader, Label, BoldValue, Value, PageTitle, Link, Text, ShowMore, ShowMoreContainer, DataWrapper, Bars } from './FxStyledComponents';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"prettier": "prettier --write \"{src,tests,example/src}/**/*.{js,ts,jsx,tsx}\""
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
|
-
"node": "18
|
|
59
|
+
"node": "18"
|
|
60
60
|
},
|
|
61
61
|
"files": [
|
|
62
62
|
"dist/**/*"
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"require": "./dist/index.js"
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"version": "0.1.
|
|
73
|
+
"version": "0.1.67"
|
|
74
74
|
}
|