@visns-studio/visns-components 4.6.8 → 4.6.10

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.
@@ -20,6 +20,10 @@ import NumberFilter from '@inovua/reactdatagrid-community/NumberFilter';
20
20
  import SelectFilter from '@inovua/reactdatagrid-community/SelectFilter';
21
21
  import DateFilter from '@inovua/reactdatagrid-community/DateFilter';
22
22
  import ReactDataGrid from '@inovua/reactdatagrid-community';
23
+ // import NumberFilter from '@visns-studio/visns-datagrid-enterprise/NumberFilter';
24
+ // import SelectFilter from '@visns-studio/visns-datagrid-enterprise/SelectFilter';
25
+ // import DateFilter from '@visns-studio/visns-datagrid-enterprise/DateFilter';
26
+ // import ReactDataGrid from '@visns-studio/visns-datagrid-enterprise';
23
27
  import { Gallery } from 'react-grid-gallery';
24
28
  import { confirmAlert } from 'react-confirm-alert';
25
29
  import { toast } from 'react-toastify';
@@ -1833,7 +1837,11 @@ const DataGrid = forwardRef(
1833
1837
  render: ({ data }) => {
1834
1838
  value = column.id.reduce((acc, id) => {
1835
1839
  if (acc === '') {
1836
- return data[id];
1840
+ if (data[id]) {
1841
+ return data[id];
1842
+ } else {
1843
+ return '';
1844
+ }
1837
1845
  } else {
1838
1846
  if (acc && acc[id]) {
1839
1847
  return acc[id];
@@ -1843,16 +1851,23 @@ const DataGrid = forwardRef(
1843
1851
  }
1844
1852
  }, '');
1845
1853
 
1854
+ console.info(value);
1855
+
1846
1856
  if (value) {
1847
1857
  if (Array.isArray(value)) {
1848
- value = value[0];
1858
+ if (value[0]) {
1859
+ value = value[0];
1860
+ }
1849
1861
  }
1850
1862
 
1851
1863
  if (
1852
1864
  Array.isArray(column.nameFrom)
1853
1865
  ) {
1854
1866
  value = column.nameFrom
1855
- .map((nf) => value[nf])
1867
+ .map(
1868
+ (nf) =>
1869
+ value?.[nf] ?? ''
1870
+ )
1856
1871
  .join(' ');
1857
1872
  } else {
1858
1873
  if (
@@ -1891,7 +1906,11 @@ const DataGrid = forwardRef(
1891
1906
  }
1892
1907
  }
1893
1908
 
1894
- return <span>{value}</span>;
1909
+ if (typeof value === 'string') {
1910
+ return <span>{value}</span>;
1911
+ } else {
1912
+ return null;
1913
+ }
1895
1914
  }
1896
1915
  } else {
1897
1916
  return null;
@@ -211,29 +211,58 @@ function GenericIndex({ layout = 'full', setting, userProfile }) {
211
211
  }, [rowsSelected, setting?.functions?.checkboxUpdate]);
212
212
 
213
213
  const renderTable = useCallback(() => {
214
- // Find the active subnav item with show: true
215
- const activeSubnav = subnav.find((item) => item.show === true);
216
-
217
- // Check if the config.id matches the active subnav id
218
- if (
219
- activeSubnav &&
220
- activeSubnav.id === config.id &&
221
- config.ajaxSetting &&
222
- config.form &&
223
- config.columns &&
224
- config.settings
225
- ) {
214
+ const isConfigValid = (config) => {
226
215
  return (
227
- <Table
228
- {...config}
229
- ref={gridRef}
230
- gridHeight={windowHeight * 0.65}
231
- setConfig={setConfig}
232
- setTotal={setTotal}
233
- style={userProfile?.settings?.style || {}}
234
- userProfile={userProfile}
235
- />
216
+ config.ajaxSetting &&
217
+ config.form &&
218
+ config.columns &&
219
+ config.settings
236
220
  );
221
+ };
222
+
223
+ const renderTableComponent = () => (
224
+ <Table
225
+ {...config}
226
+ ref={gridRef}
227
+ gridHeight={windowHeight * 0.65}
228
+ setConfig={setConfig}
229
+ setTotal={setTotal}
230
+ style={userProfile?.settings?.style || {}}
231
+ userProfile={userProfile}
232
+ />
233
+ );
234
+
235
+ if (subnav) {
236
+ // Find the active subnav item with show: true
237
+ const activeSubnav = subnav.find((item) => item.show === true);
238
+
239
+ // Check if the config.id matches the active subnav id
240
+ if (
241
+ activeSubnav &&
242
+ activeSubnav.id === config.id &&
243
+ isConfigValid(config)
244
+ ) {
245
+ return renderTableComponent();
246
+ }
247
+
248
+ // Check for active alternative subnav
249
+ const activeAltSubNav = subnav.find(
250
+ (item) =>
251
+ item.class === 'subactive' || item.class === 'activetab'
252
+ );
253
+
254
+ const activeTabExist =
255
+ config.ajaxSetting?.where?.some(
256
+ (w) =>
257
+ w.id === activeAltSubNav?.id &&
258
+ parseInt(w.value) === parseInt(activeAltSubNav?.value)
259
+ ) || false;
260
+
261
+ if (isConfigValid(config) && activeTabExist) {
262
+ return renderTableComponent();
263
+ }
264
+ } else if (isConfigValid(config)) {
265
+ return renderTableComponent();
237
266
  }
238
267
 
239
268
  return null;
package/package.json CHANGED
@@ -2,6 +2,7 @@
2
2
  "dependencies": {
3
3
  "@fontsource/barlow": "^5.0.13",
4
4
  "@inovua/reactdatagrid-community": "^5.10.2",
5
+ "@inovua/reactdatagrid-enterprise": "^5.10.2",
5
6
  "@nivo/bar": "^0.87.0",
6
7
  "@nivo/core": "^0.87.0",
7
8
  "@nivo/line": "^0.87.0",
@@ -11,10 +12,10 @@
11
12
  "akar-icons": "^1.9.31",
12
13
  "array-move": "^4.0.0",
13
14
  "awesome-debounce-promise": "^2.1.0",
14
- "axios": "^1.7.3",
15
+ "axios": "^1.7.4",
15
16
  "dayjs": "^1.11.12",
16
17
  "file-saver": "^2.0.5",
17
- "framer-motion": "^11.3.21",
18
+ "framer-motion": "^11.3.27",
18
19
  "html-react-parser": "^5.1.12",
19
20
  "lodash": "^4.17.21",
20
21
  "lodash.debounce": "^4.0.8",
@@ -58,7 +59,7 @@
58
59
  "react-dom": "^17.0.1"
59
60
  },
60
61
  "name": "@visns-studio/visns-components",
61
- "version": "4.6.8",
62
+ "version": "4.6.10",
62
63
  "description": "Various packages to assist in the development of our Custom Applications.",
63
64
  "main": "index.js",
64
65
  "scripts": {