@visns-studio/visns-components 3.5.4 → 3.5.6

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.
@@ -578,45 +578,47 @@ const DataGrid = forwardRef(
578
578
  } else {
579
579
  const column = rowProps.columns[columnIndex];
580
580
 
581
- if (column.link && column.link.url) {
582
- const fileRelationArray = column.id.split('.');
583
- const linkUrl = column.link.url;
584
- const linkKey = rowProps.columns[columnIndex].link.key;
585
- const rowData = rowProps.data[linkKey];
586
-
587
- if (column.link.hasOwnProperty('folder')) {
588
- const linkFolder =
589
- rowProps.columns[columnIndex].link.folder;
590
-
591
- if (rowProps.data[fileRelationArray[0]]) {
592
- if (linkFolder !== '') {
593
- window.open(
594
- `${linkUrl}${rowData}/${linkFolder}`
595
- );
596
- } else {
597
- window.open(`${linkUrl}${rowData}`);
581
+ if (column.id !== '__checkbox-column') {
582
+ if (column.link && column.link.url) {
583
+ const fileRelationArray = column.id.split('.');
584
+ const linkUrl = column.link.url;
585
+ const linkKey = rowProps.columns[columnIndex].link.key;
586
+ const rowData = rowProps.data[linkKey];
587
+
588
+ if (column.link.hasOwnProperty('folder')) {
589
+ const linkFolder =
590
+ rowProps.columns[columnIndex].link.folder;
591
+
592
+ if (rowProps.data[fileRelationArray[0]]) {
593
+ if (linkFolder !== '') {
594
+ window.open(
595
+ `${linkUrl}${rowData}/${linkFolder}`
596
+ );
597
+ } else {
598
+ window.open(`${linkUrl}${rowData}`);
599
+ }
598
600
  }
601
+ } else {
602
+ navigate(`${linkUrl}${rowData}`);
599
603
  }
604
+ } else if (column.link && column.link.popup) {
605
+ const linkPopup = column.link.popup;
606
+ const linkKey = rowProps.columns[columnIndex].link.key;
607
+ const rowData = rowProps.data[linkKey];
608
+
609
+ window.open(
610
+ `${linkPopup}/${rowData}`,
611
+ '',
612
+ 'width=1440,height=1024,menubar=1,resizable=1,status=1,titlebar=1,toolbar=1'
613
+ );
600
614
  } else {
601
- navigate(`${linkUrl}${rowData}`);
602
- }
603
- } else if (column.link && column.link.popup) {
604
- const linkPopup = column.link.popup;
605
- const linkKey = rowProps.columns[columnIndex].link.key;
606
- const rowData = rowProps.data[linkKey];
607
-
608
- window.open(
609
- `${linkPopup}/${rowData}`,
610
- '',
611
- 'width=1440,height=1024,menubar=1,resizable=1,status=1,titlebar=1,toolbar=1'
612
- );
613
- } else {
614
- const updateSetting = settings.find(
615
- (setting) => setting.id === 'update'
616
- );
615
+ const updateSetting = settings.find(
616
+ (setting) => setting.id === 'update'
617
+ );
617
618
 
618
- if (updateSetting) {
619
- modalOpen('update', rowProps.data[form.primaryKey]);
619
+ if (updateSetting) {
620
+ modalOpen('update', rowProps.data[form.primaryKey]);
621
+ }
620
622
  }
621
623
  }
622
624
  }
@@ -1936,10 +1938,24 @@ const DataGrid = forwardRef(
1936
1938
  e.stopPropagation();
1937
1939
  e.preventDefault();
1938
1940
 
1939
- handleTimer(
1940
- data[form.primaryKey],
1941
- column.id
1942
- );
1941
+ // Check if every required field in column.validate exists and is truthy in data
1942
+ const isValid =
1943
+ column.validate?.every(
1944
+ (v) => data[v]
1945
+ ) ?? true;
1946
+
1947
+ if (isValid) {
1948
+ handleTimer(
1949
+ data[
1950
+ form.primaryKey
1951
+ ],
1952
+ column.id
1953
+ );
1954
+ } else {
1955
+ toast.error(
1956
+ 'Please complete the required fields before starting the timer.'
1957
+ );
1958
+ }
1943
1959
  }}
1944
1960
  >
1945
1961
  <Alarm
@@ -363,16 +363,30 @@ function GenericDetail({ extraUrlParam, setting, urlParam, userProfile }) {
363
363
  });
364
364
  }}
365
365
  >
366
- {({ getRootProps, getInputProps }) => (
366
+ {({
367
+ getRootProps,
368
+ getInputProps,
369
+ isDragActive,
370
+ }) => (
367
371
  <section className="dropzone__container">
368
372
  <div {...getRootProps()}>
369
373
  <input
370
374
  {...getInputProps()}
371
375
  />
372
376
  <p>
373
- Drag 'n' drop some files
374
- here, or click to select
375
- files
377
+ {isDragActive ? (
378
+ <p>
379
+ Drop the files
380
+ here ...
381
+ </p>
382
+ ) : (
383
+ <p>
384
+ Drag 'n' drop
385
+ some files here,
386
+ or click to
387
+ select files
388
+ </p>
389
+ )}
376
390
  </p>
377
391
  </div>
378
392
  <ul className="dropzone__files">
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  "react-dom": "^17.0.1"
51
51
  },
52
52
  "name": "@visns-studio/visns-components",
53
- "version": "3.5.4",
53
+ "version": "3.5.6",
54
54
  "description": "Various packages to assist in the development of our Custom Applications.",
55
55
  "main": "index.js",
56
56
  "scripts": {