@visns-studio/visns-components 4.6.7 → 4.6.9

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';
@@ -51,6 +51,7 @@ function useConfig(setting, tabs, filters, setRowsSelected, tableSetting) {
51
51
  if (activeTabConfig) {
52
52
  setConfig((currentConfig) => ({
53
53
  ...currentConfig,
54
+ id: activeTabConfig.id,
54
55
  ajaxSetting: activeTabConfig.ajaxSetting,
55
56
  form: activeTabConfig.form,
56
57
  columns: activeTabConfig.columns,
@@ -209,24 +210,63 @@ function GenericIndex({ layout = 'full', setting, userProfile }) {
209
210
  }
210
211
  }, [rowsSelected, setting?.functions?.checkboxUpdate]);
211
212
 
212
- const renderTable = useCallback(
213
- () =>
214
- config.ajaxSetting &&
215
- config.form &&
216
- config.columns &&
217
- config.settings ? (
218
- <Table
219
- {...config}
220
- ref={gridRef}
221
- gridHeight={windowHeight * 0.65}
222
- setConfig={setConfig}
223
- setTotal={setTotal}
224
- style={userProfile?.settings?.style || {}}
225
- userProfile={userProfile}
226
- />
227
- ) : null,
228
- [config, windowHeight, userProfile, setConfig, setTotal]
229
- );
213
+ const renderTable = useCallback(() => {
214
+ const isConfigValid = (config) => {
215
+ return (
216
+ config.ajaxSetting &&
217
+ config.form &&
218
+ config.columns &&
219
+ config.settings
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();
266
+ }
267
+
268
+ return null;
269
+ }, [config, subnav, windowHeight, userProfile, setConfig, setTotal]);
230
270
 
231
271
  const renderContentBasedOnType = useCallback(() => {
232
272
  switch (config.type) {
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.7",
62
+ "version": "4.6.9",
62
63
  "description": "Various packages to assist in the development of our Custom Applications.",
63
64
  "main": "index.js",
64
65
  "scripts": {