@fixefy/fixefy-ui-components 0.2.12 → 0.2.14

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.
@@ -183,8 +183,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
183
183
  ]);
184
184
  (0, _react.useEffect)(()=>{
185
185
  if (data && !isLastPage && prevPage < page) {
186
- //raaya todo: this is too messy clean it
187
- const newOptions = method_name == 'workspace' ? data.workspace[search_path === null || search_path === void 0 ? void 0 : search_path.split('.')[1]] : data[method_name];
186
+ 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
187
  if (newOptions == null || newOptions.length < pageSize) {
189
188
  setIsLastPage(true);
190
189
  }
@@ -249,7 +248,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
249
248
  }
250
249
  };
251
250
  const handleOptionClick = (option)=>{
252
- let clicked = getClicked(option);
251
+ let clicked = getOption(option);
253
252
  switch(multiple){
254
253
  case true:
255
254
  if (displayed.map((item)=>{
@@ -289,7 +288,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
289
288
  removeOneFromStoredDisplayed(item);
290
289
  };
291
290
  const isChecked = (option)=>{
292
- const clicked = getClicked(option);
291
+ const clicked = getOption(option);
293
292
  if (typeof displayed === 'string') {
294
293
  return false;
295
294
  } else {
@@ -353,13 +352,13 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
353
352
  setPage((prevPage)=>prevPage + 1);
354
353
  setPrevPage((prevPage)=>prevPage + 1);
355
354
  };
356
- const getClicked = (option)=>{
355
+ const getOption = (option)=>{
357
356
  if (option != '') {
358
- let clicked = (0, _helpers.getJPart)(option, search_path, 0) || option.title;
359
- if (clicked !== null && typeof clicked === 'object') {
360
- clicked = clicked[0];
357
+ let curOption = (0, _helpers.getJPart)(option, search_path, 0) || option.title;
358
+ if (curOption !== null && (0, _helpers.isArrayValid)(curOption)) {
359
+ curOption = curOption[0];
361
360
  }
362
- return clicked;
361
+ return curOption;
363
362
  }
364
363
  return null;
365
364
  };
@@ -385,7 +384,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
385
384
  break;
386
385
  case false:
387
386
  default:
388
- if (displayed[search_path] === getClicked(option)) {
387
+ if (displayed[search_path] === getOption(option)) {
389
388
  rv = /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
390
389
  onClick: ()=>{
391
390
  deleteOneItem(option);
@@ -399,7 +398,7 @@ const FxAsyncDropdown = /*#__PURE__*/ _react.default.forwardRef((props)=>{
399
398
  };
400
399
  const getSingleValueByModalType = (option, modal)=>{
401
400
  let rv = null;
402
- const clicked = getClicked(option);
401
+ const clicked = getOption(option);
403
402
  switch(modal_type){
404
403
  case 'chip':
405
404
  rv = modal === 'displayed' ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_FxChip.FxChip, {
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { EntityStatusType, ChargeStateType, InvoiceStateType, RecoStateType } from '@fixefy/fixefy-ui-utils';
3
3
  export interface ChipPropsType {
4
+ type?: 'status' | 'priority' | 'score';
4
5
  status?: EntityStatusType | ChargeStateType | InvoiceStateType | RecoStateType;
5
6
  label: string | number;
6
7
  variant?: 'outlined' | 'filled';
7
- type?: 'status' | 'priority' | 'score';
8
8
  scoreValue?: number;
9
9
  minimized?: boolean;
10
10
  [x: string]: any;
package/package.json CHANGED
@@ -70,5 +70,5 @@
70
70
  "require": "./dist/index.js"
71
71
  }
72
72
  },
73
- "version": "0.2.12"
73
+ "version": "0.2.14"
74
74
  }