@alphakits/ui 2.0.7 → 2.0.8
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/dist/badge/component.d.ts +1 -1
- package/dist/badge/component.js +19 -19
- package/dist/badge/component.js.map +1 -1
- package/dist/badge/index.module.css +1 -1
- package/dist/badge/index.module.css.js +46 -32
- package/dist/badge/index.module.css.js.map +1 -1
- package/dist/cell/base/component.d.ts +6 -0
- package/dist/cell/base/component.js +69 -37
- package/dist/cell/base/component.js.map +1 -1
- package/dist/cell/base/index.module.css +1 -1
- package/dist/cell/base/index.module.css.js +12 -8
- package/dist/cell/base/index.module.css.js.map +1 -1
- package/dist/cell/pure/component.d.ts +2 -0
- package/dist/cell/pure/component.js +16 -14
- package/dist/cell/pure/component.js.map +1 -1
- package/dist/cell/pure/index.module.css +1 -1
- package/dist/cell/pure/index.module.css.js +16 -14
- package/dist/cell/pure/index.module.css.js.map +1 -1
- package/dist/filter-tag/component.d.ts +12 -0
- package/dist/filter-tag/component.js +38 -0
- package/dist/filter-tag/component.js.map +1 -0
- package/dist/filter-tag/index.d.ts +1 -0
- package/dist/filter-tag/index.js +5 -0
- package/dist/filter-tag/index.js.map +1 -0
- package/dist/filter-tag/index.module.css +1 -0
- package/dist/filter-tag/index.module.css.js +29 -0
- package/dist/filter-tag/index.module.css.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +268 -266
- package/dist/index.js.map +1 -1
- package/dist/table/columns.js +2 -4
- package/dist/table/columns.js.map +1 -1
- package/dist/table/components/cell/component.d.ts +1 -0
- package/dist/table/components/cell/component.js +42 -35
- package/dist/table/components/cell/component.js.map +1 -1
- package/dist/table/components/cell/index.module.css +1 -1
- package/dist/table/components/cell/index.module.css.js +12 -8
- package/dist/table/components/cell/index.module.css.js.map +1 -1
- package/dist/table/components/cells/index.module.css +1 -1
- package/dist/table/components/table-header/index.module.css +1 -1
- package/dist/table/index.module.css.js +9 -6
- package/dist/table/index.module.css.js.map +1 -1
- package/dist/table/table.d.ts +2 -1
- package/dist/table/table.js +107 -101
- package/dist/table/table.js.map +1 -1
- package/dist/table/utils/prepare-rows.d.ts +2 -1
- package/dist/table/utils/prepare-rows.js +60 -27
- package/dist/table/utils/prepare-rows.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,73 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import S from "@alphakits/icons/dist/PhotoM";
|
|
3
3
|
import { Image as f } from "../../image/component.js";
|
|
4
|
-
import { TableCell as
|
|
5
|
-
function
|
|
6
|
-
return
|
|
4
|
+
import { TableCell as A } from "../components/cell/component.js";
|
|
5
|
+
function p(t, i, s) {
|
|
6
|
+
return t ? typeof t == "string" ? i[t] : typeof t == "function" ? t({ row: i, refetch: s }) : null : null;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function z(t, i, s) {
|
|
9
|
+
return t ? typeof t == "string" ? i[t] : typeof t == "function" ? t({ row: i, refetch: s }) : null : null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
function R({
|
|
12
|
+
columns: t,
|
|
13
|
+
view: i = "default",
|
|
14
|
+
data: s,
|
|
15
|
+
refetch: u
|
|
16
|
+
}) {
|
|
17
|
+
const m = i === "compact";
|
|
18
|
+
return s.map((o) => ({
|
|
19
|
+
row: o,
|
|
20
|
+
cells: t.map((n) => {
|
|
21
|
+
var g, c, d, x, b, y, C, v, w;
|
|
22
|
+
const e = z(((g = n.row) == null ? void 0 : g.title) || n.accessor, o, u);
|
|
23
|
+
let l;
|
|
24
|
+
if ((c = n.row) != null && c.image) {
|
|
25
|
+
const a = p((d = n.row) == null ? void 0 : d.image, o, u);
|
|
26
|
+
l = a ? /* @__PURE__ */ r(
|
|
27
|
+
f,
|
|
28
|
+
{
|
|
29
|
+
bgColor: "secondary",
|
|
30
|
+
src: a,
|
|
31
|
+
text: e == null ? void 0 : e.toString(),
|
|
32
|
+
view: "ellipse",
|
|
33
|
+
size: m ? "xs" : "m"
|
|
34
|
+
}
|
|
35
|
+
) : /* @__PURE__ */ r(
|
|
36
|
+
f,
|
|
37
|
+
{
|
|
38
|
+
bgColor: "secondary",
|
|
39
|
+
icon: /* @__PURE__ */ r(S, {}),
|
|
40
|
+
text: e == null ? void 0 : e.toString(),
|
|
41
|
+
view: "ellipse",
|
|
42
|
+
size: m ? "xs" : "m"
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
} else if ((x = n.row) != null && x.icon) {
|
|
46
|
+
const a = p((b = n.row) == null ? void 0 : b.icon, o, u);
|
|
47
|
+
l = /* @__PURE__ */ r(
|
|
48
|
+
f,
|
|
49
|
+
{
|
|
50
|
+
icon: a || /* @__PURE__ */ r(S, {}),
|
|
51
|
+
text: e == null ? void 0 : e.toString(),
|
|
52
|
+
view: "ellipse",
|
|
53
|
+
size: m ? "xs" : "m"
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
} else (y = n.row) != null && y.customAddon && (l = p((C = n.row) == null ? void 0 : C.customAddon, o, u));
|
|
57
|
+
return /* @__PURE__ */ r(
|
|
58
|
+
A,
|
|
27
59
|
{
|
|
28
60
|
title: e,
|
|
29
|
-
align:
|
|
30
|
-
|
|
31
|
-
|
|
61
|
+
align: n.align,
|
|
62
|
+
compact: m,
|
|
63
|
+
subtitle: m ? void 0 : ((v = n.row) == null ? void 0 : v.subtitle) && z((w = n.row) == null ? void 0 : w.subtitle, o, u),
|
|
64
|
+
addon: l
|
|
32
65
|
}
|
|
33
66
|
);
|
|
34
67
|
})
|
|
35
68
|
}));
|
|
36
69
|
}
|
|
37
70
|
export {
|
|
38
|
-
|
|
71
|
+
R as prepareRows
|
|
39
72
|
};
|
|
40
73
|
//# sourceMappingURL=prepare-rows.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-rows.js","sources":["../../../src/table/utils/prepare-rows.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport React, { ReactNode } from 'react';\nimport PhotoM from '@alphakits/icons/dist/PhotoM';\n\nimport { Image } from '../../image';\nimport { TableCell } from '../components/cell';\nimport { TableProps } from '../table';\n\ntype Props<T extends object> = {\n columns: TableProps<T>['columns'];\n data: T[];\n refetch: () => void;\n};\n\nfunction getCellNode<T extends object>(row: unknown, record: T, refetch: () => void) {\n if (!row) return null;\n\n if (typeof row === 'string') return record[row as keyof T];\n\n if (typeof row === 'function') return row({ row: record, refetch });\n\n return null;\n}\n\nfunction getCellValue<T extends object>(\n row: unknown,\n record: T,\n refetch: () => void,\n): string | ReactNode {\n if (!row) return null;\n\n if (typeof row === 'string') return record[row as keyof T];\n\n if (typeof row === 'function') return row({ row: record, refetch });\n\n return null;\n}\n\nexport function prepareRows<T extends object>({
|
|
1
|
+
{"version":3,"file":"prepare-rows.js","sources":["../../../src/table/utils/prepare-rows.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport React, { ReactNode } from 'react';\nimport PhotoM from '@alphakits/icons/dist/PhotoM';\n\nimport { Image } from '../../image';\nimport { TableCell } from '../components/cell';\nimport { TableProps } from '../table';\n\ntype Props<T extends object> = {\n columns: TableProps<T>['columns'];\n view: TableProps<T>['view'];\n data: T[];\n refetch: () => void;\n};\n\nfunction getCellNode<T extends object>(row: unknown, record: T, refetch: () => void) {\n if (!row) return null;\n\n if (typeof row === 'string') return record[row as keyof T];\n\n if (typeof row === 'function') return row({ row: record, refetch });\n\n return null;\n}\n\nfunction getCellValue<T extends object>(\n row: unknown,\n record: T,\n refetch: () => void,\n): string | ReactNode {\n if (!row) return null;\n\n if (typeof row === 'string') return record[row as keyof T];\n\n if (typeof row === 'function') return row({ row: record, refetch });\n\n return null;\n}\n\nexport function prepareRows<T extends object>({\n columns,\n view = 'default',\n data,\n refetch,\n}: Props<T>) {\n const isCompact = view === 'compact';\n const rows = data.map((row) => ({\n row,\n cells: columns.map((col) => {\n const title = getCellValue(col.row?.title || col.accessor, row, refetch);\n\n let addon;\n\n if (col.row?.image) {\n const imageSrc = getCellNode(col.row?.image, row, refetch);\n\n addon = imageSrc ? (\n <Image\n bgColor=\"secondary\"\n src={ imageSrc }\n text={ title?.toString() }\n view=\"ellipse\"\n size={ isCompact ? 'xs' : 'm' }\n />\n ) : (\n <Image\n bgColor=\"secondary\"\n icon={ <PhotoM /> }\n text={ title?.toString() }\n view=\"ellipse\"\n size={ isCompact ? 'xs' : 'm' }\n />\n );\n } else if (col.row?.icon) {\n const iconNode = getCellNode(col.row?.icon, row, refetch);\n\n addon = (\n <Image\n icon={ iconNode || <PhotoM /> }\n text={ title?.toString() }\n view=\"ellipse\"\n size={ isCompact ? 'xs' : 'm' }\n />\n );\n } else if (col.row?.customAddon) {\n addon = getCellNode(col.row?.customAddon, row, refetch);\n }\n\n return (\n <TableCell\n title={ title }\n align={ col.align }\n compact={ isCompact }\n subtitle={\n isCompact\n ? undefined\n : (col.row?.subtitle && getCellValue(col.row?.subtitle, row, refetch))\n }\n addon={ addon }\n />\n );\n }),\n }));\n\n return rows;\n}\n"],"names":["getCellNode","row","record","refetch","getCellValue","prepareRows","columns","view","data","isCompact","col","title","_a","addon","_b","imageSrc","_c","jsx","Image","PhotoM","_d","iconNode","_e","_f","_g","TableCell","_h","_i"],"mappings":";;;;AAeA,SAASA,EAA8BC,GAAcC,GAAWC,GAAqB;AACjF,SAAKF,IAED,OAAOA,KAAQ,WAAiBC,EAAOD,CAAc,IAErD,OAAOA,KAAQ,aAAmBA,EAAI,EAAE,KAAKC,GAAQ,SAAAC,GAAS,IAE3D,OANU;AAOrB;AAEA,SAASC,EACLH,GACAC,GAC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