@visns-studio/visns-components 1.0.16 → 1.0.17

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.
@@ -349,15 +349,37 @@ const DataGrid = (props) => {
349
349
  }, []);
350
350
 
351
351
  useEffect(() => {
352
+ let relationName;
353
+
352
354
  const renderColumn = (column) => {
353
355
  switch (column.type) {
354
- case "number":
356
+ case "created_by":
357
+ relationName = column.id.reduce(
358
+ (acc, id) => acc + `${id}.`,
359
+ ""
360
+ );
361
+ relationName += column.nameFrom;
362
+
355
363
  return {
356
- name: column.id,
364
+ name: relationName,
357
365
  header: column.label,
358
366
  defaultFlex: 1,
359
367
  link: column.link ? column.link : {},
360
- type: "number",
368
+ render: ({ data }) => {
369
+ let value = column.id.reduce((acc, id) => {
370
+ if (acc === "") {
371
+ return data[id];
372
+ } else {
373
+ return acc[id];
374
+ }
375
+ }, "");
376
+
377
+ if (value && value.created_by) {
378
+ value = moment(value.created_by).format('DD-MM-YYYY');
379
+ }
380
+
381
+ return <span>{value}</span>;
382
+ },
361
383
  };
362
384
  case "currency":
363
385
  return {
@@ -430,6 +452,14 @@ const DataGrid = (props) => {
430
452
  }
431
453
  },
432
454
  };
455
+ case "number":
456
+ return {
457
+ name: column.id,
458
+ header: column.label,
459
+ defaultFlex: 1,
460
+ link: column.link ? column.link : {},
461
+ type: "number",
462
+ };
433
463
  case "option":
434
464
  return {
435
465
  name: column.id,
@@ -444,7 +474,7 @@ const DataGrid = (props) => {
444
474
  },
445
475
  };
446
476
  case "relation":
447
- let relationName = column.id.reduce(
477
+ relationName = column.id.reduce(
448
478
  (acc, id) => acc + `${id}.`,
449
479
  ""
450
480
  );
@@ -129,18 +129,6 @@ function Field(props) {
129
129
  break;
130
130
  }
131
131
 
132
- // if (settings.hasOwnProperty('hide')) {
133
- // if (settings.hide === true) {
134
- // setFormItemStyle({
135
- // display: 'none',
136
- // });
137
- // } else {
138
- // setFormItemStyle({
139
- // display: 'block',
140
- // });
141
- // }
142
- // }
143
-
144
132
  if (settings.size === "full") {
145
133
  setFormItemClass("formItem fwItem");
146
134
  }
package/package.json CHANGED
@@ -32,7 +32,7 @@
32
32
  "react-dom": ">=18.2.0"
33
33
  },
34
34
  "name": "@visns-studio/visns-components",
35
- "version": "1.0.16",
35
+ "version": "1.0.17",
36
36
  "description": "Various packages to assist in the development of our Custom Applications.",
37
37
  "main": "index.js",
38
38
  "devDependencies": {},