@fixefy/fixefy-ui-components 0.2.11 → 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.
@@ -182,8 +182,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
182
182
  ]);
183
183
  (0, _react.useEffect)(()=>{
184
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];
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);
187
186
  if (newOptions == null || newOptions.length < pageSize) {
188
187
  setIsLastPage(true);
189
188
  }
@@ -248,7 +247,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
248
247
  }
249
248
  };
250
249
  const handleOptionClick = (option)=>{
251
- let clicked = getClicked(option);
250
+ let clicked = getOption(option);
252
251
  switch(multiple){
253
252
  case true:
254
253
  if (displayed.map((item)=>{
@@ -288,7 +287,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
288
287
  removeOneFromStoredDisplayed(item);
289
288
  };
290
289
  const isChecked = (option)=>{
291
- const clicked = getClicked(option);
290
+ const clicked = getOption(option);
292
291
  if (typeof displayed === 'string') {
293
292
  return false;
294
293
  } else {
@@ -352,13 +351,13 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
352
351
  setPage((prevPage)=>prevPage + 1);
353
352
  setPrevPage((prevPage)=>prevPage + 1);
354
353
  };
355
- const getClicked = (option)=>{
354
+ const getOption = (option)=>{
356
355
  if (option != '') {
357
- let clicked = (0, _helpers.getJPart)(option, search_path, 0) || option.title;
358
- if (clicked !== null && typeof clicked === 'object') {
359
- clicked = clicked[0];
356
+ let curOption = (0, _helpers.getJPart)(option, search_path, 0) || option.title;
357
+ if (curOption !== null && (0, _helpers.isArrayValid)(curOption)) {
358
+ curOption = curOption[0];
360
359
  }
361
- return clicked;
360
+ return curOption;
362
361
  }
363
362
  return null;
364
363
  };
@@ -384,7 +383,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
384
383
  break;
385
384
  case false:
386
385
  default:
387
- if (displayed[search_path] === getClicked(option)) {
386
+ if (displayed[search_path] === getOption(option)) {
388
387
  rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
389
388
  onClick: ()=>{
390
389
  deleteOneItem(option);
@@ -398,7 +397,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
398
397
  };
399
398
  const getSingleValueByModalType = (option, modal)=>{
400
399
  let rv = null;
401
- const clicked = getClicked(option);
400
+ const clicked = getOption(option);
402
401
  switch(modal_type){
403
402
  case 'chip':
404
403
  rv = modal === 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
@@ -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?: 'status' | 'priority' | 'score';
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 {};
@@ -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
- if (type === 'status') {
26
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chipstyles.StatusChipStyled, {
27
- status: newStatus,
28
- label: (0, _fixefyuiutils.titleCase)(value),
29
- variant: variant,
30
- onClick: onClick,
31
- onDelete: onDelete,
32
- deleteIcon: onDelete ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_iconsmaterial.CloseRounded, {
33
- sx: {
34
- width: 11,
35
- height: 11
36
- }
37
- }) : null
38
- });
39
- } else if (type === 'priority') {
40
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_chipstyles.PriorityChipStyled, {
41
- status: newStatus,
42
- label: (0, _fixefyuiutils.titleCase)(value),
43
- variant: variant
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
@@ -70,5 +70,5 @@
70
70
  "require": "./dist/index.js"
71
71
  }
72
72
  },
73
- "version": "0.2.11"
73
+ "version": "0.2.13"
74
74
  }