@visns-studio/visns-components 1.4.2 → 1.4.3

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.
@@ -410,6 +410,28 @@ const DataGrid = ({
410
410
  };
411
411
 
412
412
  switch (column.type) {
413
+ case "address":
414
+ return {
415
+ ...commonProps,
416
+ name: `${column.type}.${column.id}`,
417
+ render: ({ data }) => {
418
+ if (data.address1) {
419
+ value += `${data.address1} `;
420
+ }
421
+
422
+ if (data.address2) {
423
+ value += `${data.address2} `;
424
+ }
425
+
426
+ if (data.suburb) {
427
+ value += `${data.suburb} `;
428
+ }
429
+
430
+ if (data.postcode) {
431
+ value += `${data.postcode} `;
432
+ }
433
+ },
434
+ };
413
435
  case "age":
414
436
  return {
415
437
  ...commonProps,
@@ -427,7 +449,14 @@ const DataGrid = ({
427
449
  date = moment(value);
428
450
 
429
451
  return (
430
- <span>{moment().diff(date, "years")}</span>
452
+ <span>
453
+ {moment().diff(
454
+ date,
455
+ column.duration
456
+ ? column.duration
457
+ : "years"
458
+ )}
459
+ </span>
431
460
  );
432
461
  } else {
433
462
  return null;
@@ -586,6 +586,28 @@ const DataGrid = forwardRef(
586
586
  };
587
587
 
588
588
  switch (column.type) {
589
+ case "address":
590
+ return {
591
+ ...commonProps,
592
+ name: `${column.type}.${column.id}`,
593
+ render: ({ data }) => {
594
+ if (data.address1) {
595
+ value += `${data.address1} `;
596
+ }
597
+
598
+ if (data.address2) {
599
+ value += `${data.address2} `;
600
+ }
601
+
602
+ if (data.suburb) {
603
+ value += `${data.suburb} `;
604
+ }
605
+
606
+ if (data.postcode) {
607
+ value += `${data.postcode} `;
608
+ }
609
+ },
610
+ };
589
611
  case "age":
590
612
  return {
591
613
  ...commonProps,
@@ -604,7 +626,12 @@ const DataGrid = forwardRef(
604
626
 
605
627
  return (
606
628
  <span>
607
- {moment().diff(date, "years")}
629
+ {moment().diff(
630
+ date,
631
+ column.duration
632
+ ? column.duration
633
+ : "years"
634
+ )}
608
635
  </span>
609
636
  );
610
637
  } else {
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "react-dom": "^17.0.1"
35
35
  },
36
36
  "name": "@visns-studio/visns-components",
37
- "version": "1.4.2",
37
+ "version": "1.4.3",
38
38
  "description": "Various packages to assist in the development of our Custom Applications.",
39
39
  "main": "index.js",
40
40
  "devDependencies": {},