@visns-studio/visns-components 5.15.27 → 5.15.29

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
@@ -13,10 +13,10 @@
13
13
  "@nivo/line": "^0.87.0",
14
14
  "@nivo/pie": "^0.87.0",
15
15
  "@react-pdf/renderer": "^4.3.1",
16
- "@tanstack/react-query": "^5.90.5",
16
+ "@tanstack/react-query": "^5.90.11",
17
17
  "@tinymce/miniature": "^6.0.0",
18
18
  "@tinymce/tinymce-react": "^6.3.0",
19
- "@uiw/react-color": "^2.9.0",
19
+ "@uiw/react-color": "^2.9.2",
20
20
  "@visns-studio/visns-datagrid-community": "1.1.0",
21
21
  "@visns-studio/visns-datagrid-enterprise": "1.1.0",
22
22
  "@vitejs/plugin-react": "^4.7.0",
@@ -24,16 +24,16 @@
24
24
  "array-move": "^4.0.0",
25
25
  "awesome-debounce-promise": "^2.1.0",
26
26
  "browser-image-compression": "^2.0.2",
27
- "dayjs": "^1.11.18",
28
- "fabric": "^6.7.1",
27
+ "dayjs": "^1.11.19",
28
+ "fabric": "^6.9.0",
29
29
  "file-saver": "^2.0.5",
30
30
  "framer-motion": "^12.23.24",
31
- "html-react-parser": "^5.2.7",
31
+ "html-react-parser": "^5.2.10",
32
32
  "html2canvas": "^1.4.1",
33
33
  "lodash": "^4.17.21",
34
34
  "lodash.debounce": "^4.0.8",
35
35
  "lucide-react": "^0.544.0",
36
- "mapbox-gl": "^3.15.0",
36
+ "mapbox-gl": "^3.16.0",
37
37
  "moment": "^2.30.1",
38
38
  "motion": "^12.23.24",
39
39
  "numeral": "^2.0.6",
@@ -43,7 +43,7 @@
43
43
  "react-big-calendar": "^1.19.4",
44
44
  "react-copy-to-clipboard": "^5.1.0",
45
45
  "react-currency-input-field": "^3.10.0",
46
- "react-datepicker": "^8.8.0",
46
+ "react-datepicker": "^8.10.0",
47
47
  "react-dropzone": "^14.3.8",
48
48
  "react-grid-gallery": "^1.0.1",
49
49
  "react-number-format": "^5.4.4",
@@ -51,9 +51,9 @@
51
51
  "react-promise-tracker": "^2.1.1",
52
52
  "react-quill": "^2.0.0",
53
53
  "react-reveal": "^1.2.2",
54
- "react-router-dom": "^6.30.1",
54
+ "react-router-dom": "^6.30.2",
55
55
  "react-select": "^5.10.2",
56
- "react-signature-pad-wrapper": "^4.2.0",
56
+ "react-signature-pad-wrapper": "^4.3.0",
57
57
  "react-slugify": "^4.0.1",
58
58
  "react-sortable-hoc": "^2.0.0",
59
59
  "react-to-print": "^3.2.0",
@@ -68,17 +68,17 @@
68
68
  "tesseract.js": "^6.0.1",
69
69
  "truncate": "^3.0.0",
70
70
  "uuid": "^11.1.0",
71
- "validator": "^13.15.15",
71
+ "validator": "^13.15.23",
72
72
  "vite": "^6.4.1",
73
73
  "xlsx": "^0.18.5",
74
74
  "yarn": "^1.22.22",
75
75
  "yet-another-react-lightbox": "^3.25.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@babel/core": "^7.28.4",
79
- "@babel/plugin-transform-runtime": "^7.28.3",
80
- "@babel/preset-env": "^7.28.3",
81
- "@babel/preset-react": "^7.27.1",
78
+ "@babel/core": "^7.28.5",
79
+ "@babel/plugin-transform-runtime": "^7.28.5",
80
+ "@babel/preset-env": "^7.28.5",
81
+ "@babel/preset-react": "^7.28.5",
82
82
  "babel-loader": "^10.0.0",
83
83
  "copy-webpack-plugin": "^13.0.1",
84
84
  "css-loader": "^7.1.2",
@@ -86,15 +86,15 @@
86
86
  "mini-css-extract-plugin": "^2.9.4",
87
87
  "react": "^18.3.1",
88
88
  "react-dom": "^18.3.1",
89
- "sass": "^1.93.2",
90
- "sass-loader": "^16.0.5"
89
+ "sass": "^1.94.2",
90
+ "sass-loader": "^16.0.6"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "react": "^17.0.0 || ^18.0.0",
94
94
  "react-dom": "^17.0.0 || ^18.0.0"
95
95
  },
96
96
  "name": "@visns-studio/visns-components",
97
- "version": "5.15.27",
97
+ "version": "5.15.29",
98
98
  "description": "Various packages to assist in the development of our Custom Applications.",
99
99
  "main": "src/index.js",
100
100
  "files": [
@@ -541,12 +541,52 @@ const DataGrid = forwardRef(
541
541
  const [gridColumns, setGridColumns] = useState([]);
542
542
  const [columnsMetadata, setColumnsMetadata] = useState({});
543
543
  const gridRef = useRef(null);
544
- const [limit, setLimit] = useState(0);
544
+
545
+ // Get default limit from userProfile preferences, tableSetting, or default to 25
546
+ const getDefaultLimit = () => {
547
+ console.log('[DataGrid] getDefaultLimit called:', {
548
+ userProfile_rows_per_page: userProfile?.rows_per_page,
549
+ userProfile_settings_rows_per_page: userProfile?.settings?.rows_per_page,
550
+ tableSetting_pageSize: tableSetting?.pageSize,
551
+ userProfile: userProfile,
552
+ });
553
+ if (userProfile?.rows_per_page) return userProfile.rows_per_page;
554
+ if (userProfile?.settings?.rows_per_page) return userProfile.settings.rows_per_page;
555
+ if (tableSetting?.pageSize) return tableSetting.pageSize;
556
+ return 25;
557
+ };
558
+
559
+ const [limit, setLimit] = useState(() => {
560
+ const initialLimit = getDefaultLimit();
561
+ console.log('[DataGrid] Initial limit set to:', initialLimit);
562
+ return initialLimit;
563
+ });
545
564
  const [search, setSearch] = useState('');
546
565
  const [selected, setSelected] = useState({});
547
566
  const [inputDebounceTimers] = useState({});
548
567
  const [localInputValues, setLocalInputValues] = useState({});
549
568
  const localInputValuesRef = useRef({}); // Add this ref to track values
569
+ const initialLimitApplied = useRef(false); // Track if we've applied user's rows_per_page preference
570
+
571
+ // Effect to update limit when userProfile becomes available (for async loaded profiles)
572
+ useEffect(() => {
573
+ console.log('[DataGrid] useEffect triggered:', {
574
+ initialLimitApplied: initialLimitApplied.current,
575
+ userProfile_rows_per_page: userProfile?.rows_per_page,
576
+ userProfile_settings_rows_per_page: userProfile?.settings?.rows_per_page,
577
+ currentLimit: limit,
578
+ });
579
+ // Only apply the user's preference once, when userProfile first becomes available
580
+ if (!initialLimitApplied.current) {
581
+ const userLimit = userProfile?.rows_per_page || userProfile?.settings?.rows_per_page;
582
+ console.log('[DataGrid] Checking userLimit:', userLimit);
583
+ if (userLimit && userLimit > 0) {
584
+ console.log('[DataGrid] Setting limit to userLimit:', userLimit);
585
+ setLimit(userLimit);
586
+ initialLimitApplied.current = true;
587
+ }
588
+ }
589
+ }, [userProfile?.rows_per_page, userProfile?.settings?.rows_per_page]);
550
590
 
551
591
  /** Auto Refresh States */
552
592
  const [autoRefreshEnabled, setAutoRefreshEnabled] = useState(false);
@@ -3340,7 +3380,18 @@ const DataGrid = forwardRef(
3340
3380
  const minHeight = getMinimumHeight();
3341
3381
  setGridStyle((prevState) => ({ ...prevState, minHeight }));
3342
3382
 
3343
- if (ajaxSetting?.take >= 35) {
3383
+ // Priority for limit:
3384
+ // 1. User's rows_per_page preference (already applied via initialLimitApplied ref)
3385
+ // 2. ajaxSetting.take if >= 35
3386
+ // 3. Calculated rows based on height (fallback)
3387
+
3388
+ // Only auto-calculate limit if user hasn't set a preference
3389
+ const userPreferredLimit = userProfile?.rows_per_page || userProfile?.settings?.rows_per_page;
3390
+
3391
+ if (userPreferredLimit && userPreferredLimit > 0) {
3392
+ // User has a preference, don't override it
3393
+ console.log('[DataGrid] Respecting user preference, not auto-calculating limit:', userPreferredLimit);
3394
+ } else if (ajaxSetting?.take >= 35) {
3344
3395
  setLimit(ajaxSetting.take);
3345
3396
  } else {
3346
3397
  const calculateRows = (height) =>
@@ -3349,7 +3400,7 @@ const DataGrid = forwardRef(
3349
3400
  const rowCount = calculateRows(minHeight);
3350
3401
  setLimit(rowCount);
3351
3402
  }
3352
- }, [dataCount, gridHeight, window.innerHeight]);
3403
+ }, [dataCount, gridHeight, window.innerHeight, userProfile?.rows_per_page, userProfile?.settings?.rows_per_page]);
3353
3404
 
3354
3405
  useEffect(() => {
3355
3406
  const debouncedHandleResize = debounce(() => {
@@ -2767,7 +2767,9 @@ function GenericDetail({
2767
2767
  ?.url &&
2768
2768
  item
2769
2769
  .href
2770
- ?.key ? (
2770
+ ?.key &&
2771
+ item.type !== 'link' &&
2772
+ item.type !== 'file' ? (
2771
2773
  <Link
2772
2774
  to={`${
2773
2775
  item
@@ -389,6 +389,19 @@ const GenericDynamic = ({
389
389
  };
390
390
 
391
391
  const handleFileDownload = async (d) => {
392
+ // If file has a direct URL (from Vapor/S3), open it directly
393
+ if (d.url || d.file_url || d.temporary_url) {
394
+ const fileUrl = d.url || d.file_url || d.temporary_url;
395
+ window.open(fileUrl, '_blank');
396
+ return;
397
+ }
398
+
399
+ // If no download endpoint configured, show error
400
+ if (!setting?.file) {
401
+ toast.error('File download not configured');
402
+ return;
403
+ }
404
+
392
405
  const toastId = toast.loading('Downloading file...');
393
406
  try {
394
407
  const res = await Download(setting.file, 'POST', {
@@ -871,14 +884,13 @@ const GenericDynamic = ({
871
884
  'label',
872
885
  'type',
873
886
  'size',
874
- 'value',
875
887
  ].every((k) =>
876
888
  value.hasOwnProperty(k)
877
889
  )
878
890
  )
879
891
  .map(
880
892
  ([key, field]) =>
881
- field.hide === 0 && (
893
+ (field.hide === undefined || field.hide === 0) && (
882
894
  <Field
883
895
  settings={field}
884
896
  key={`field-${key}-${field.id}`}
@@ -931,7 +943,7 @@ const GenericDynamic = ({
931
943
  : typeof activeForm?.map === 'function' &&
932
944
  activeForm.map(
933
945
  (field, index) =>
934
- field.hide === 0 && (
946
+ (field.hide === undefined || field.hide === 0) && (
935
947
  <Field
936
948
  settings={field}
937
949
  key={`field-array-${index}-${field.id}`}