impact-nova 0.1.3 → 0.1.4

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.
@@ -1,36 +1,37 @@
1
- import { jsx as i } from "react/jsx-runtime";
1
+ import { jsx as d } from "react/jsx-runtime";
2
2
  import { forwardRef as x, useRef as N, useCallback as $ } from "react";
3
3
  const K = x((y, S) => {
4
- const { splits: s, commonParams: c, data: f, node: o, api: m, column: p, context: r, value: a, colDef: u, metaData: E } = y, d = N({
4
+ const { splits: s, commonParams: c, data: f, node: r, api: m, column: p, context: o, value: a, colDef: u, metaData: E } = y, i = N({
5
5
  valueKey: null,
6
6
  field: null,
7
7
  newValue: null
8
8
  }), g = $(() => {
9
- const e = d.current, l = {
9
+ const e = i.current, l = {
10
10
  api: m,
11
11
  colDef: u,
12
12
  column: p,
13
- context: r,
13
+ context: o,
14
14
  data: f,
15
15
  field: u.field,
16
- node: o,
17
- rowIndex: o?.rowIndex ?? null,
18
- rowPinned: o?.rowPinned ?? void 0,
16
+ node: r,
17
+ rowIndex: r?.rowIndex ?? null,
18
+ rowPinned: r?.rowPinned ?? void 0,
19
19
  source: "edit",
20
20
  type: "cellValueChanged",
21
- currentCellUpdate: d.current,
21
+ currentCellUpdate: i.current,
22
22
  newValue: { [e.valueKey]: { value: e.newValue } },
23
23
  oldValue: { [e.valueKey]: { value: a?.[e.valueKey]?.value } },
24
24
  value: { [e.valueKey]: { value: e.newValue } }
25
25
  };
26
- o.setDataValue(u.field, { ...a, [e.valueKey]: { value: e.newValue } }), r?.onCellUpdate?.(l);
27
- }, [m, u, p, r, f, o, a]), h = (e) => {
26
+ r.setDataValue(u.field, { ...a, [e.valueKey]: { value: e.newValue } }), o?.onCellUpdate?.(l);
27
+ }, [m, u, p, o, f, r, a]), h = (e) => {
28
28
  if (typeof e == "string") {
29
29
  const l = m?.getGridOption("components");
30
- return r?.frameworkComponents?.[e] || l?.[e];
30
+ return o?.frameworkComponents?.[e] || l?.[e];
31
31
  }
32
32
  return e;
33
33
  }, V = (e, l) => {
34
+ if (!l) return "--";
34
35
  let n = l;
35
36
  switch (e?.decimals != null && !isNaN(Number(l)) && (n = Number(l).toFixed(e.decimals)), e.type) {
36
37
  case "currencySymbol": {
@@ -45,30 +46,30 @@ const K = x((y, S) => {
45
46
  return n;
46
47
  }
47
48
  };
48
- return /* @__PURE__ */ i(
49
+ return /* @__PURE__ */ d(
49
50
  "div",
50
51
  {
51
52
  style: { display: "grid", gridTemplateRows: `repeat(${s?.length}, 1fr)`, height: "100%", width: "100%" },
52
53
  children: s?.map((e, l) => {
53
54
  const n = e?.field?.split(".")?.pop(), t = a?.[n]?.value;
54
- d.current = {
55
+ i.current = {
55
56
  valueKey: n,
56
57
  field: e.field,
57
58
  newValue: t
58
59
  };
59
60
  const b = e?.valueFormatter ? V(e.valueFormatter, t?.toString()) : t?.toString(), v = e.editable ? c.cellEditor : c.cellRenderer ? c.cellRenderer : void 0, w = v ? h(v) : void 0;
60
- return /* @__PURE__ */ i(
61
+ return /* @__PURE__ */ d(
61
62
  "div",
62
63
  {
63
64
  className: "flex items-center max-h-full overflow-hidden",
64
- children: w ? /* @__PURE__ */ i(
65
+ children: w ? /* @__PURE__ */ d(
65
66
  w,
66
67
  {
67
- context: r,
68
+ context: o,
68
69
  data: f,
69
70
  value: t,
70
71
  onValueChange: (C) => {
71
- d.current = {
72
+ i.current = {
72
73
  valueKey: n,
73
74
  field: e.field,
74
75
  newValue: C
@@ -82,7 +83,7 @@ const K = x((y, S) => {
82
83
  suppressAutoFocus: l !== 0,
83
84
  className: l !== s.length - 1 ? "border-b border-gray-200" : ""
84
85
  }
85
- ) : /* @__PURE__ */ i(
86
+ ) : /* @__PURE__ */ d(
86
87
  "div",
87
88
  {
88
89
  className: "w-full h-full flex items-center ag-cell-inner-padding overflow-hidden text-ellipsis whitespace-nowrap",
@@ -1,19 +1,19 @@
1
- import { jsx as t } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
2
  const p = (r) => {
3
- const { valueFormatted: d, value: c, placeholder: u, disabled: l, colDef: i, className: o } = r, a = !l && i?.editable === !0, n = i?.cellDataType === "number", e = d ?? c, s = e === "" || e == null;
4
- return /* @__PURE__ */ t(
3
+ const { valueFormatted: d, value: c, placeholder: u, disabled: t, colDef: l, className: o } = r, i = !t && l?.editable === !0, a = l?.cellDataType === "number", n = d ?? c, s = !n;
4
+ return /* @__PURE__ */ e(
5
5
  "div",
6
6
  {
7
- className: `w-full h-full flex items-center ag-cell-inner-padding ${o} ${l ? "opacity-60 cursor-not-allowed" : a ? "in-ag-editable-cell-highlight" : ""}`,
8
- children: /* @__PURE__ */ t(
7
+ className: `w-full h-full flex items-center ag-cell-inner-padding ${o} ${t ? "opacity-60 cursor-not-allowed" : i ? "in-ag-editable-cell-highlight" : ""}`,
8
+ children: /* @__PURE__ */ e(
9
9
  "div",
10
10
  {
11
- className: `flex w-full items-center rounded-[8px] px-1.5 h-7 ${n ? "justify-end text-right" : ""} ${a ? "bg-white" : "bg-inherit"}`,
12
- children: /* @__PURE__ */ t(
11
+ className: `flex w-full items-center rounded-[8px] px-1.5 h-7 ${a ? "justify-end text-right" : ""} ${i ? "bg-white" : "bg-inherit"}`,
12
+ children: /* @__PURE__ */ e(
13
13
  "span",
14
14
  {
15
- className: `flex h-full w-full bg-transparent p-0 text-sm font-medium items-center truncate text-[#1f2b4d] ${s ? "text-[#dfe2e7]" : ""} ${n ? "justify-end text-right" : ""}`,
16
- children: s ? u ?? "" : e
15
+ className: `flex h-full w-full bg-transparent p-0 text-sm font-medium items-center truncate text-[#1f2b4d] ${s ? "text-[#dfe2e7]" : ""} ${a ? "justify-end text-right" : ""}`,
16
+ children: s ? u ?? "--" : n
17
17
  }
18
18
  )
19
19
  }
@@ -1,9 +1,10 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import "react";
3
3
  const y = (d) => {
4
- const { splits: t, commonParams: i, data: m, node: p, api: s, column: u, context: c, value: f, colDef: w } = d;
4
+ const { splits: t, commonParams: i, data: m, node: p, api: s, column: f, context: c, value: u, colDef: w } = d;
5
5
  if (!t || !Array.isArray(t)) return null;
6
6
  const g = (e, r) => {
7
+ if (!r) return "--";
7
8
  let n = r;
8
9
  switch (e?.decimals != null && !isNaN(Number(r)) && (n = Number(r).toFixed(e.decimals)), e.type) {
9
10
  case "currencySymbol": {
@@ -26,7 +27,7 @@ const y = (d) => {
26
27
  return r;
27
28
  };
28
29
  return /* @__PURE__ */ o("div", { style: { display: "grid", gridTemplateRows: `repeat(${t?.length}, 1fr)`, height: "100%", width: "100%" }, children: t?.map((e, r) => {
29
- const n = f?.[e?.field?.split(".")?.pop()]?.value?.toString(), l = e?.valueFormatter ? g(e.valueFormatter, n?.toString()) : n, a = i?.cellRenderer && typeof i?.cellRenderer == "string" ? h(i?.cellRenderer) : void 0;
30
+ const n = u?.[e?.field?.split(".")?.pop()]?.value?.toString(), l = e?.valueFormatter ? g(e.valueFormatter, n?.toString()) : n, a = i?.cellRenderer && typeof i?.cellRenderer == "string" ? h(i?.cellRenderer) : void 0;
30
31
  return /* @__PURE__ */ o(
31
32
  "div",
32
33
  {
@@ -37,7 +38,7 @@ const y = (d) => {
37
38
  {
38
39
  node: p,
39
40
  api: s,
40
- column: u,
41
+ column: f,
41
42
  context: c,
42
43
  data: m,
43
44
  value: n,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impact-nova",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",