@visns-studio/visns-components 5.3.7 → 5.3.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.
package/package.json CHANGED
@@ -54,8 +54,8 @@
54
54
  "swapy": "^1.0.5",
55
55
  "truncate": "^3.0.0",
56
56
  "uuid": "^10.0.0",
57
- "validator": "^13.12.0",
58
- "vite": "^5.4.14",
57
+ "validator": "^13.15.0",
58
+ "vite": "^5.4.15",
59
59
  "yarn": "^1.22.22"
60
60
  },
61
61
  "devDependencies": {
@@ -78,7 +78,7 @@
78
78
  "react-dom": "^17.0.0 || ^18.0.0"
79
79
  },
80
80
  "name": "@visns-studio/visns-components",
81
- "version": "5.3.7",
81
+ "version": "5.3.9",
82
82
  "description": "Various packages to assist in the development of our Custom Applications.",
83
83
  "main": "src/index.js",
84
84
  "files": [
@@ -242,6 +242,27 @@ const DataGrid = forwardRef(
242
242
  },
243
243
  }));
244
244
 
245
+ const getRowStyle = useCallback(
246
+ (rowProps) => {
247
+ const { data } = rowProps;
248
+
249
+ if (ajaxSetting?.rowColours?.length > 0) {
250
+ const colorConfig = ajaxSetting.rowColours.find(
251
+ (config) => data[config.id] === config.value
252
+ );
253
+
254
+ if (colorConfig) {
255
+ return {
256
+ backgroundColor: colorConfig.colour,
257
+ };
258
+ }
259
+ }
260
+
261
+ return null;
262
+ },
263
+ [ajaxSetting]
264
+ );
265
+
245
266
  const handleDownload = async (d) => {
246
267
  const toastId = toast.loading('Starting download please wait...');
247
268
 
@@ -910,7 +931,22 @@ const DataGrid = forwardRef(
910
931
 
911
932
  if (form.create) {
912
933
  if (form.create.url) {
913
- navigate(form.create.url);
934
+ // Check if URL is external
935
+ if (
936
+ form.create.url.startsWith(
937
+ 'http://'
938
+ ) ||
939
+ form.create.url.startsWith(
940
+ 'https://'
941
+ )
942
+ ) {
943
+ window.open(
944
+ form.create.url,
945
+ '_blank'
946
+ );
947
+ } else {
948
+ navigate(form.create.url);
949
+ }
914
950
  } else {
915
951
  modalOpen('create', 0);
916
952
  }
@@ -2859,6 +2895,7 @@ const DataGrid = forwardRef(
2859
2895
  renderColumnContextMenu={renderColumnContextMenu}
2860
2896
  rowClassName="vs-datagrid--row"
2861
2897
  rowHeight={null}
2898
+ rowStyle={getRowStyle}
2862
2899
  selected={selected}
2863
2900
  showZebraRows={true}
2864
2901
  showActiveRowIndicator={false}