@fixefy/fixefy-ui-components 0.2.12 → 0.2.13
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.
|
@@ -133,29 +133,28 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
133
133
|
const [prevPage, setPrevPage] = (0, _react.useState)(0);
|
|
134
134
|
const pageSize = 20;
|
|
135
135
|
const { method_name } = variables;
|
|
136
|
-
const { where } = fetcher.queryOptions.variables;
|
|
137
136
|
const ws = (0, _nookies.parseCookies)().ws;
|
|
138
137
|
const isLocal = fetcher.query.loc;
|
|
139
138
|
const getWhere = ()=>{
|
|
140
|
-
if (method_name == 'workspace') {
|
|
141
|
-
return searchValue ? _object_spread_props(_object_spread({}, where), {
|
|
139
|
+
if (variables.method_name == 'workspace') {
|
|
140
|
+
return searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
142
141
|
_id: ws,
|
|
143
142
|
[search_path]: {
|
|
144
143
|
$regex: searchValue
|
|
145
144
|
}
|
|
146
|
-
}) : _object_spread_props(_object_spread({}, where), {
|
|
145
|
+
}) : _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
147
146
|
_id: ws
|
|
148
147
|
});
|
|
149
148
|
} else {
|
|
150
|
-
return searchValue ? _object_spread_props(_object_spread({}, where), {
|
|
149
|
+
return searchValue ? _object_spread_props(_object_spread({}, fetcher.queryOptions.variables.where), {
|
|
151
150
|
[search_path]: {
|
|
152
151
|
$regex: searchValue
|
|
153
152
|
}
|
|
154
|
-
}) : _object_spread({}, where);
|
|
153
|
+
}) : _object_spread({}, fetcher.queryOptions.variables.where);
|
|
155
154
|
}
|
|
156
155
|
};
|
|
157
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), {
|
|
158
|
-
variables: _object_spread_props(_object_spread({},
|
|
157
|
+
variables: _object_spread_props(_object_spread({}, fetcher.queryOptions.variables), {
|
|
159
158
|
where: getWhere(),
|
|
160
159
|
skip: page * pageSize - pageSize,
|
|
161
160
|
limit: pageSize
|
|
@@ -183,8 +182,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
183
182
|
]);
|
|
184
183
|
(0, _react.useEffect)(()=>{
|
|
185
184
|
if (data && !isLastPage && prevPage < page) {
|
|
186
|
-
|
|
187
|
-
const newOptions = method_name == 'workspace' ? data.workspace[search_path === null || search_path === void 0 ? void 0 : search_path.split('.')[1]] : data[method_name];
|
|
185
|
+
const newOptions = method_name == 'workspace' ? data.workspace[search_path === null || search_path === void 0 ? void 0 : search_path.split('.')[1]] : (0, _helpers.getJPart)(data, method_name);
|
|
188
186
|
if (newOptions == null || newOptions.length < pageSize) {
|
|
189
187
|
setIsLastPage(true);
|
|
190
188
|
}
|
|
@@ -249,7 +247,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
249
247
|
}
|
|
250
248
|
};
|
|
251
249
|
const handleOptionClick = (option)=>{
|
|
252
|
-
let clicked =
|
|
250
|
+
let clicked = getOption(option);
|
|
253
251
|
switch(multiple){
|
|
254
252
|
case true:
|
|
255
253
|
if (displayed.map((item)=>{
|
|
@@ -289,7 +287,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
289
287
|
removeOneFromStoredDisplayed(item);
|
|
290
288
|
};
|
|
291
289
|
const isChecked = (option)=>{
|
|
292
|
-
const clicked =
|
|
290
|
+
const clicked = getOption(option);
|
|
293
291
|
if (typeof displayed === 'string') {
|
|
294
292
|
return false;
|
|
295
293
|
} else {
|
|
@@ -353,13 +351,13 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
353
351
|
setPage((prevPage)=>prevPage + 1);
|
|
354
352
|
setPrevPage((prevPage)=>prevPage + 1);
|
|
355
353
|
};
|
|
356
|
-
const
|
|
354
|
+
const getOption = (option)=>{
|
|
357
355
|
if (option != '') {
|
|
358
|
-
let
|
|
359
|
-
if (
|
|
360
|
-
|
|
356
|
+
let curOption = (0, _helpers.getJPart)(option, search_path, 0) || option.title;
|
|
357
|
+
if (curOption !== null && (0, _helpers.isArrayValid)(curOption)) {
|
|
358
|
+
curOption = curOption[0];
|
|
361
359
|
}
|
|
362
|
-
return
|
|
360
|
+
return curOption;
|
|
363
361
|
}
|
|
364
362
|
return null;
|
|
365
363
|
};
|
|
@@ -385,7 +383,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
385
383
|
break;
|
|
386
384
|
case false:
|
|
387
385
|
default:
|
|
388
|
-
if (displayed[search_path] ===
|
|
386
|
+
if (displayed[search_path] === getOption(option)) {
|
|
389
387
|
rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
390
388
|
onClick: ()=>{
|
|
391
389
|
deleteOneItem(option);
|
|
@@ -399,7 +397,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
|
|
|
399
397
|
};
|
|
400
398
|
const getSingleValueByModalType = (option, modal)=>{
|
|
401
399
|
let rv = null;
|
|
402
|
-
const clicked =
|
|
400
|
+
const clicked = getOption(option);
|
|
403
401
|
switch(modal_type){
|
|
404
402
|
case 'chip':
|
|
405
403
|
rv = modal === 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
|
package/dist/FxChip/FxChip.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EntityStatusType, ChargeStateType, InvoiceStateType, RecoStateType } from '@fixefy/fixefy-ui-utils';
|
|
3
|
+
type ChipType = {
|
|
4
|
+
score: string;
|
|
5
|
+
status: EntityStatusType | ChargeStateType | InvoiceStateType | RecoStateType;
|
|
6
|
+
};
|
|
3
7
|
export interface ChipPropsType {
|
|
4
8
|
status?: EntityStatusType | ChargeStateType | InvoiceStateType | RecoStateType;
|
|
5
9
|
label: string | number;
|
|
6
10
|
variant?: 'outlined' | 'filled';
|
|
7
|
-
type?:
|
|
11
|
+
type?: ChipType;
|
|
8
12
|
scoreValue?: number;
|
|
9
13
|
minimized?: boolean;
|
|
10
14
|
[x: string]: any;
|
|
@@ -12,3 +16,4 @@ export interface ChipPropsType {
|
|
|
12
16
|
onDelete?: (e: any) => void;
|
|
13
17
|
}
|
|
14
18
|
export declare const FxChip: (props: ChipPropsType) => React.JSX.Element;
|
|
19
|
+
export {};
|
package/dist/FxChip/FxChip.js
CHANGED
|
@@ -22,34 +22,24 @@ const FxChip = (props)=>{
|
|
|
22
22
|
const { status, label, type = 'status', scoreValue = 0, minimized = false, variant = 'outlined', onClick, onDelete } = props;
|
|
23
23
|
const newStatus = status ? status.split(' ').join('_') : status;
|
|
24
24
|
const value = typeof label === 'number' ? label.toFixed(2) : label;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} else {
|
|
46
|
-
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chipstyles.ScoreChipStyled, {
|
|
47
|
-
score: scoreValue,
|
|
48
|
-
scoreLabel: (0, _fixefyuiutils.getScoreColor)(scoreValue),
|
|
49
|
-
label: (0, _fixefyuiutils.titleCase)(value),
|
|
50
|
-
minimized: minimized,
|
|
51
|
-
variant: variant,
|
|
52
|
-
onClick: onClick
|
|
53
|
-
});
|
|
54
|
-
}
|
|
25
|
+
return type === 'status' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_chipstyles.StatusChipStyled, {
|
|
26
|
+
status: newStatus,
|
|
27
|
+
label: (0, _fixefyuiutils.titleCase)(value),
|
|
28
|
+
variant: variant,
|
|
29
|
+
onClick: onClick,
|
|
30
|
+
onDelete: onDelete,
|
|
31
|
+
deleteIcon: onDelete ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CloseRounded, {
|
|
32
|
+
sx: {
|
|
33
|
+
width: 11,
|
|
34
|
+
height: 11
|
|
35
|
+
}
|
|
36
|
+
}) : null
|
|
37
|
+
}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_chipstyles.ScoreChipStyled, {
|
|
38
|
+
score: scoreValue,
|
|
39
|
+
scoreLabel: (0, _fixefyuiutils.getScoreColor)(scoreValue),
|
|
40
|
+
label: (0, _fixefyuiutils.titleCase)(value),
|
|
41
|
+
minimized: minimized,
|
|
42
|
+
variant: variant,
|
|
43
|
+
onClick: onClick
|
|
44
|
+
});
|
|
55
45
|
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export declare const ScoreChipStyled: StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
|
|
2
2
|
export declare const StatusChipStyled: StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
|
|
3
|
-
export declare const PriorityChipStyled: StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps, JSXProps>;
|
|
@@ -9,9 +9,6 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
PriorityChipStyled: function() {
|
|
13
|
-
return PriorityChipStyled;
|
|
14
|
-
},
|
|
15
12
|
ScoreChipStyled: function() {
|
|
16
13
|
return ScoreChipStyled;
|
|
17
14
|
},
|
|
@@ -62,21 +59,3 @@ const StatusChipStyled = (0, _styles.styled)(_material.Chip)(({ theme, status, v
|
|
|
62
59
|
border: `1px solid ${border}`
|
|
63
60
|
};
|
|
64
61
|
});
|
|
65
|
-
const PriorityChipStyled = (0, _styles.styled)(_material.Chip)(({ theme, status })=>{
|
|
66
|
-
const backgroundColor = theme.palette.chipPriority[status].background;
|
|
67
|
-
const labelColor = theme.palette.chipPriority[status].label;
|
|
68
|
-
const border = theme.palette.chipPriority[status].border;
|
|
69
|
-
return {
|
|
70
|
-
height: 20,
|
|
71
|
-
minWidth: 80,
|
|
72
|
-
maxWidth: 120,
|
|
73
|
-
['& .MuiChip-label']: {
|
|
74
|
-
fontSize: 9,
|
|
75
|
-
fontWeight: 600,
|
|
76
|
-
lineHeight: '12px',
|
|
77
|
-
color: labelColor ? labelColor : theme.palette.statistics.label
|
|
78
|
-
},
|
|
79
|
-
backgroundColor,
|
|
80
|
-
border: `1px solid ${border}`
|
|
81
|
-
};
|
|
82
|
-
});
|
package/package.json
CHANGED