triafly-ui-kit 1.0.86 → 1.0.88

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,7 +1,7 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
- import y from "react";
2
+ import f from "react";
3
3
  import m from "../../../../_virtual/index.js";
4
- const g = y.memo(
4
+ const $ = f.memo(
5
5
  ({
6
6
  record: _,
7
7
  columns: r,
@@ -9,7 +9,8 @@ const g = y.memo(
9
9
  rowClassName: a,
10
10
  stickyLeft: b,
11
11
  bordered: i,
12
- id: o
12
+ id: o,
13
+ index: y
13
14
  }) => {
14
15
  const p = o || (typeof e == "function" ? e(_) : String(_[e]));
15
16
  return /* @__PURE__ */ d(
@@ -25,7 +26,12 @@ const g = y.memo(
25
26
  "table-component__wrapper__table__tbody__td--sticky-left": b && n === 0
26
27
  }),
27
28
  align: t.align,
28
- children: t.render ? t.render(_[t.dataIndex], _, `${t.key}-${n}`) : String(_[t.dataIndex] ?? "")
29
+ children: t.render ? t.render(
30
+ _[t.dataIndex],
31
+ _,
32
+ y,
33
+ `${t.key}-${n}`
34
+ ) : String(_[t.dataIndex] ?? "")
29
35
  },
30
36
  `${t.key}-${n}`
31
37
  ))
@@ -35,5 +41,5 @@ const g = y.memo(
35
41
  }
36
42
  );
37
43
  export {
38
- g as MemoizedRow
44
+ $ as MemoizedRow
39
45
  };
@@ -35,11 +35,11 @@ const T = {
35
35
  }, J) => {
36
36
  const x = W.useRef(null), [I, O] = D(i || []), [r, P] = D(
37
37
  q || null
38
- ), p = Y(() => k ? i : I, [i, I, k]), B = b((e, a) => {
38
+ ), p = Y(() => k ? i : I, [i, I, k]), B = b((e, n) => {
39
39
  O((o) => [...o].sort((d, C) => {
40
- const n = d[e], s = C[e];
41
- return typeof n == "string" && typeof s == "string" ? a === "asc" ? n.localeCompare(s) : s.localeCompare(n) : typeof n == "number" && typeof s == "number" ? a === "asc" ? n - s : s - n : n instanceof Date && s instanceof Date ? a === "asc" ? n.getTime() - s.getTime() : s.getTime() - n.getTime() : 0;
42
- })), P({ key: e, order: a });
40
+ const s = d[e], a = C[e];
41
+ return typeof s == "string" && typeof a == "string" ? n === "asc" ? s.localeCompare(a) : a.localeCompare(s) : typeof s == "number" && typeof a == "number" ? n === "asc" ? s - a : a - s : s instanceof Date && a instanceof Date ? n === "asc" ? s.getTime() - a.getTime() : a.getTime() - s.getTime() : 0;
42
+ })), P({ key: e, order: n });
43
43
  }, []), _ = b(
44
44
  (e) => typeof c == "function" ? c(e) : String(e[c]),
45
45
  [c]
@@ -53,16 +53,16 @@ const T = {
53
53
  return Z(() => {
54
54
  const e = x.current;
55
55
  if (!e) return;
56
- const a = (o) => {
56
+ const n = (o) => {
57
57
  const h = o.target, d = h.closest("tr");
58
58
  if (!d || h.closest("[data-no-bubble]")) return;
59
- const n = d.dataset.id;
60
- if (!(!n || !f)) {
61
- const s = i == null ? void 0 : i.find((V) => _(V) === n);
62
- s && f(s);
59
+ const s = d.dataset.id;
60
+ if (!(!s || !f)) {
61
+ const a = i == null ? void 0 : i.find((V) => _(V) === s);
62
+ a && f(a);
63
63
  }
64
64
  };
65
- return e.addEventListener("click", a), () => e.removeEventListener("click", a);
65
+ return e.addEventListener("click", n), () => e.removeEventListener("click", n);
66
66
  }, [i, f, _]), /* @__PURE__ */ t("div", { className: l("table-component", $), children: /* @__PURE__ */ t(
67
67
  "div",
68
68
  {
@@ -102,14 +102,14 @@ const T = {
102
102
  E
103
103
  ),
104
104
  onClick: F,
105
- children: y.map((e, a) => /* @__PURE__ */ t(
105
+ children: y.map((e, n) => /* @__PURE__ */ t(
106
106
  "th",
107
107
  {
108
108
  className: l(
109
109
  "table-component__wrapper__table__thead__th",
110
110
  {
111
111
  bordered: m,
112
- stickyLeft: g && a === 0
112
+ stickyLeft: g && n === 0
113
113
  },
114
114
  L
115
115
  ),
@@ -133,7 +133,7 @@ const T = {
133
133
  }
134
134
  )
135
135
  },
136
- `${e.key}-${a}`
136
+ `${e.key}-${n}`
137
137
  ))
138
138
  }
139
139
  )
@@ -145,7 +145,7 @@ const T = {
145
145
  ref: x,
146
146
  className: l("table-component__wrapper__table__tbody", M),
147
147
  children: [
148
- p == null ? void 0 : p.map((e) => /* @__PURE__ */ t(
148
+ p == null ? void 0 : p.map((e, n) => /* @__PURE__ */ t(
149
149
  S,
150
150
  {
151
151
  record: e,
@@ -153,7 +153,8 @@ const T = {
153
153
  rowKey: c,
154
154
  rowClassName: U,
155
155
  stickyLeft: g,
156
- bordered: m
156
+ bordered: m,
157
+ index: n
157
158
  },
158
159
  _(e)
159
160
  )),
package/dist/main.d.ts CHANGED
@@ -128,7 +128,7 @@ export declare type Column<T extends object = Record<string, unknown>> = {
128
128
  dataIndex?: keyof T | string;
129
129
  key: string;
130
130
  align?: "left" | "center" | "right";
131
- render?: (_: unknown, record: T, index: string) => default_2.ReactNode;
131
+ render?: (_: unknown, record: T, index: number, colIndex: string) => default_2.ReactNode;
132
132
  width?: number;
133
133
  className?: string;
134
134
  sorted?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triafly-ui-kit",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "description": "UI Kit from Triafly",
5
5
  "main": "./dist/main.js",
6
6
  "module": "./dist/main.js",