@visns-studio/visns-components 5.0.21 → 5.0.22

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/package.json CHANGED
@@ -77,7 +77,7 @@
77
77
  "react-dom": "^17.0.0 || ^18.0.0"
78
78
  },
79
79
  "name": "@visns-studio/visns-components",
80
- "version": "5.0.21",
80
+ "version": "5.0.22",
81
81
  "description": "Various packages to assist in the development of our Custom Applications.",
82
82
  "main": "src/index.js",
83
83
  "files": [
@@ -31,15 +31,18 @@ import { toast } from 'react-toastify';
31
31
  import {
32
32
  Alarm,
33
33
  ArrowCounterClockwise,
34
+ ArrowCycle,
34
35
  Backspace,
35
36
  Check,
36
37
  CircleCheck,
37
38
  CircleX,
38
39
  Clock,
39
40
  CloudDownload,
41
+ CloudUpload,
40
42
  Copy,
41
43
  Edit,
42
44
  Envelope,
45
+ File,
43
46
  Folder,
44
47
  Image,
45
48
  Inbox,
@@ -82,25 +85,32 @@ const loadData = async (
82
85
 
83
86
  if (filterValue) {
84
87
  filterValue.forEach((fv) => {
85
- const identifier = fv.key ? fv.key : fv.name;
88
+ const identifier = fv.whereHas?.column || fv.key || fv.name;
86
89
  const existingIndex = params.where.findIndex(
87
90
  (w) => w.id === identifier
88
91
  );
89
92
 
90
- if (fv.value !== null && fv.value !== '') {
93
+ if (
94
+ fv.value !== undefined &&
95
+ fv.value !== null &&
96
+ fv.value !== ''
97
+ ) {
98
+ const tempParamsObject = {
99
+ id: identifier,
100
+ value: fv.value,
101
+ operator: fv.operator,
102
+ ...(fv.whereHas?.relation && {
103
+ whereHas: fv.whereHas.relation,
104
+ }),
105
+ };
106
+
91
107
  if (existingIndex !== -1) {
92
- params.where[existingIndex].value = fv.value;
108
+ params.where[existingIndex] = tempParamsObject;
93
109
  } else {
94
- params.where.push({
95
- id: identifier,
96
- value: fv.value,
97
- operator: fv.operator,
98
- });
99
- }
100
- } else {
101
- if (existingIndex !== -1) {
102
- params.where.splice(existingIndex, 1);
110
+ params.where.push(tempParamsObject);
103
111
  }
112
+ } else if (existingIndex !== -1) {
113
+ params.where.splice(existingIndex, 1);
104
114
  }
105
115
  });
106
116
  }
@@ -376,6 +386,11 @@ const DataGrid = forwardRef(
376
386
  const handleSettingClick = (s, d) => {
377
387
  switch (s.id) {
378
388
  case 'activate':
389
+ case 'arrowCycle':
390
+ case 'cloudUpload':
391
+ case 'envelope':
392
+ case 'file':
393
+ case 'image':
379
394
  CustomFetch(s.url, 'POST', { id: d[s.key] }, (result) => {
380
395
  toast.success(result.message);
381
396
  });
@@ -500,11 +515,6 @@ const DataGrid = forwardRef(
500
515
  ],
501
516
  });
502
517
  break;
503
- case 'envelope':
504
- CustomFetch(s.url, 'POST', { id: d[s.key] }, (result) => {
505
- toast.success(result.message);
506
- });
507
- break;
508
518
  case 'gallery':
509
519
  // Function to access nested property using a series of keys
510
520
  const getNestedValue = (data, keys) =>
@@ -1100,6 +1110,10 @@ const DataGrid = forwardRef(
1100
1110
  return getIconComponent(CircleCheck);
1101
1111
  case 'archive':
1102
1112
  return getIconComponent(ShippingBoxV1);
1113
+ case 'arrowCycle':
1114
+ return getIconComponent(ArrowCycle);
1115
+ case 'cloudUpload':
1116
+ return getIconComponent(CloudUpload);
1103
1117
  case 'oauth2':
1104
1118
  return getIconComponent(LockOn);
1105
1119
  case 'clone':
@@ -1114,8 +1128,12 @@ const DataGrid = forwardRef(
1114
1128
  return getIconComponent(Envelope);
1115
1129
  case 'family':
1116
1130
  return getIconComponent(Network);
1131
+ case 'file':
1132
+ return getIconComponent(File);
1117
1133
  case 'gallery':
1118
1134
  return getIconComponent(Image);
1135
+ case 'image':
1136
+ return getIconComponent(Image);
1119
1137
  case 'link':
1120
1138
  return getIconComponent(LinkOut);
1121
1139
  case 'primary':
@@ -2487,6 +2505,7 @@ const DataGrid = forwardRef(
2487
2505
  operator: column.filter.operator,
2488
2506
  type: column.filter.type,
2489
2507
  value: filterValue,
2508
+ whereHas: column.filter.whereHas || {},
2490
2509
  reset: column.filter.reset
2491
2510
  ? column.filter.reset
2492
2511
  : [],