@datavac/ui-kit 1.8.0-data-table.1 → 1.8.0-data-table.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.
- package/dist/components/DataTable/types.d.ts +5 -0
- package/dist/index.css +1 -1
- package/dist/index.js +49 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7910,7 +7910,8 @@ var Zf = {
|
|
|
7910
7910
|
overlay: "rgba(243, 243, 243, 0.7)",
|
|
7911
7911
|
neutral: "#4F5153",
|
|
7912
7912
|
border: "#E4E4E4",
|
|
7913
|
-
link: "#E30C5C"
|
|
7913
|
+
link: "#E30C5C",
|
|
7914
|
+
warning: "#FB9A40"
|
|
7914
7915
|
},
|
|
7915
7916
|
radius: {
|
|
7916
7917
|
tooltip: "4px",
|
|
@@ -7936,7 +7937,8 @@ var Zf = {
|
|
|
7936
7937
|
overlay: "rgba(28, 30, 32, 0.7)",
|
|
7937
7938
|
neutral: "#4F5153",
|
|
7938
7939
|
border: "#3A3A3A",
|
|
7939
|
-
link: "#F31667"
|
|
7940
|
+
link: "#F31667",
|
|
7941
|
+
warning: "#FBAA4D"
|
|
7940
7942
|
},
|
|
7941
7943
|
radius: {
|
|
7942
7944
|
tooltip: "4px",
|
|
@@ -8001,6 +8003,10 @@ var Zf = {
|
|
|
8001
8003
|
path: "colors.link",
|
|
8002
8004
|
cssVar: "--color-link"
|
|
8003
8005
|
},
|
|
8006
|
+
{
|
|
8007
|
+
path: "colors.warning",
|
|
8008
|
+
cssVar: "--color-warning"
|
|
8009
|
+
},
|
|
8004
8010
|
{
|
|
8005
8011
|
path: "radius.tooltip",
|
|
8006
8012
|
cssVar: "--radius-tooltip"
|
|
@@ -8967,18 +8973,27 @@ function Gm(e, t) {
|
|
|
8967
8973
|
return n;
|
|
8968
8974
|
}
|
|
8969
8975
|
function Km(e) {
|
|
8976
|
+
let t = [], n = 0;
|
|
8977
|
+
for (; n < e.length;) if (e[n].mobileHalf) {
|
|
8978
|
+
let r = [];
|
|
8979
|
+
for (; n < e.length && e[n].mobileHalf;) r.push(e[n]), n++;
|
|
8980
|
+
t.push(r);
|
|
8981
|
+
} else t.push([e[n]]), n++;
|
|
8982
|
+
return t;
|
|
8983
|
+
}
|
|
8984
|
+
function qm(e) {
|
|
8970
8985
|
return {
|
|
8971
8986
|
width: e.width == null ? void 0 : typeof e.width == "number" ? `${e.width}px` : e.width,
|
|
8972
8987
|
flex: e.flex,
|
|
8973
8988
|
minWidth: 0
|
|
8974
8989
|
};
|
|
8975
8990
|
}
|
|
8976
|
-
function
|
|
8991
|
+
function Jm(e, t, n) {
|
|
8977
8992
|
if (e.render) return e.render(t, n);
|
|
8978
8993
|
let r = t[e.key];
|
|
8979
8994
|
return r == null ? "" : typeof r == "string" ? r : JSON.stringify(r);
|
|
8980
8995
|
}
|
|
8981
|
-
function
|
|
8996
|
+
function Ym({ row: e, index: t, columns: n, isDisabled: r = !1, hasAction: i = !1, mobileActionLabel: a = "Подробнее", mobileDisabledLabel: o = "Нет сведений", tabletColumns: s = 3, desktopBreakpoint: c = "md", onClick: l }) {
|
|
8982
8997
|
let u = !!l && !r, d = u ? {
|
|
8983
8998
|
role: "button",
|
|
8984
8999
|
tabIndex: 0,
|
|
@@ -8988,33 +9003,33 @@ function Jm({ row: e, index: t, columns: n, isDisabled: r = !1, hasAction: i = !
|
|
|
8988
9003
|
onKeyDown: (e) => {
|
|
8989
9004
|
u && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), l());
|
|
8990
9005
|
}
|
|
8991
|
-
} : {}, h = K("bg-card rounded-xl transition-colors", r ? "text-fg-muted" : "text-fg", !r && u ? "cursor-pointer hover:brightness-[0.97]" : ""), g = r ? "py-[11px]" : "py-4", _ = n.filter((e) => !e.desktopOnly), v = Gm(_, s), { desktop:
|
|
9006
|
+
} : {}, h = K("bg-card rounded-xl transition-colors", r ? "text-fg-muted" : "text-fg", !r && u ? "cursor-pointer hover:brightness-[0.97]" : ""), g = r ? "py-[11px]" : "py-4", _ = n.filter((e) => !e.desktopOnly), v = Gm(_, s), y = Km(_), { desktop: b, tablet: x } = Wm[c], S = i && /* @__PURE__ */ p("div", {
|
|
8992
9007
|
className: "shrink-0 flex items-center justify-center size-5 rounded-full bg-subtle",
|
|
8993
9008
|
children: r ? /* @__PURE__ */ p(Is, {
|
|
8994
9009
|
width: 12,
|
|
8995
9010
|
height: 12,
|
|
8996
9011
|
className: "text-fg-muted"
|
|
8997
9012
|
}) : /* @__PURE__ */ p(ws, { className: "text-fg" })
|
|
8998
|
-
}),
|
|
9013
|
+
}), C = i && /* @__PURE__ */ p("span", {
|
|
8999
9014
|
className: "shrink-0 px-2 py-0.5 bg-subtle rounded-full text-xs text-neutral whitespace-nowrap",
|
|
9000
9015
|
children: r ? o : a
|
|
9001
9016
|
});
|
|
9002
9017
|
return /* @__PURE__ */ m(f, { children: [
|
|
9003
9018
|
/* @__PURE__ */ m("div", {
|
|
9004
|
-
className: K(
|
|
9019
|
+
className: K(b, "items-center px-3 gap-5", g, h),
|
|
9005
9020
|
"aria-disabled": r || void 0,
|
|
9006
9021
|
...d,
|
|
9007
9022
|
children: [n.map((n) => /* @__PURE__ */ p("div", {
|
|
9008
9023
|
className: "shrink-0 text-base overflow-hidden text-ellipsis",
|
|
9009
|
-
style:
|
|
9010
|
-
children:
|
|
9024
|
+
style: qm(n),
|
|
9025
|
+
children: Jm(n, e, t)
|
|
9011
9026
|
}, n.key)), i && /* @__PURE__ */ p("div", {
|
|
9012
9027
|
className: "ml-auto",
|
|
9013
|
-
children:
|
|
9028
|
+
children: S
|
|
9014
9029
|
})]
|
|
9015
9030
|
}),
|
|
9016
9031
|
/* @__PURE__ */ m("div", {
|
|
9017
|
-
className: K(
|
|
9032
|
+
className: K(x, "items-start gap-[10px] p-3", h),
|
|
9018
9033
|
"aria-disabled": r || void 0,
|
|
9019
9034
|
...d,
|
|
9020
9035
|
children: [/* @__PURE__ */ p("div", {
|
|
@@ -9028,35 +9043,38 @@ function Jm({ row: e, index: t, columns: n, isDisabled: r = !1, hasAction: i = !
|
|
|
9028
9043
|
children: n.label
|
|
9029
9044
|
}), /* @__PURE__ */ p("div", {
|
|
9030
9045
|
className: "text-sm",
|
|
9031
|
-
children:
|
|
9046
|
+
children: Jm(n, e, t)
|
|
9032
9047
|
})]
|
|
9033
9048
|
}, n.key))
|
|
9034
9049
|
}, r))
|
|
9035
|
-
}),
|
|
9050
|
+
}), S]
|
|
9036
9051
|
}),
|
|
9037
9052
|
/* @__PURE__ */ p("div", {
|
|
9038
9053
|
className: K("min-[480px]:hidden flex flex-col gap-[10px] px-3 py-4", h),
|
|
9039
9054
|
"aria-disabled": r || void 0,
|
|
9040
9055
|
...d,
|
|
9041
|
-
children:
|
|
9042
|
-
className: "flex
|
|
9043
|
-
children:
|
|
9044
|
-
className: "flex
|
|
9045
|
-
children: [/* @__PURE__ */
|
|
9046
|
-
className: "
|
|
9047
|
-
children:
|
|
9048
|
-
|
|
9049
|
-
|
|
9050
|
-
|
|
9051
|
-
|
|
9052
|
-
|
|
9053
|
-
|
|
9056
|
+
children: y.map((n, r) => /* @__PURE__ */ p("div", {
|
|
9057
|
+
className: "flex gap-3 w-full",
|
|
9058
|
+
children: n.map((n, i) => /* @__PURE__ */ m("div", {
|
|
9059
|
+
className: "flex-1 flex flex-col gap-1 min-w-0",
|
|
9060
|
+
children: [/* @__PURE__ */ m("div", {
|
|
9061
|
+
className: "flex items-center justify-between gap-2",
|
|
9062
|
+
children: [/* @__PURE__ */ p("span", {
|
|
9063
|
+
className: "text-xs text-fg-secondary",
|
|
9064
|
+
children: n.label
|
|
9065
|
+
}), r === 0 && i === 0 && C]
|
|
9066
|
+
}), /* @__PURE__ */ p("div", {
|
|
9067
|
+
className: "text-sm",
|
|
9068
|
+
children: Jm(n, e, t)
|
|
9069
|
+
})]
|
|
9070
|
+
}, n.key))
|
|
9071
|
+
}, n[0].key))
|
|
9054
9072
|
})
|
|
9055
9073
|
] });
|
|
9056
9074
|
}
|
|
9057
9075
|
//#endregion
|
|
9058
9076
|
//#region src/components/DataTable/DataTable.tsx
|
|
9059
|
-
var
|
|
9077
|
+
var Xm = {
|
|
9060
9078
|
md: {
|
|
9061
9079
|
show: "hidden md:flex",
|
|
9062
9080
|
hide: "md:hidden"
|
|
@@ -9066,7 +9084,7 @@ var Ym = {
|
|
|
9066
9084
|
hide: "lg:hidden"
|
|
9067
9085
|
}
|
|
9068
9086
|
};
|
|
9069
|
-
function
|
|
9087
|
+
function Zm({ columns: e, rows: t, isRowDisabled: n, onRowClick: r, getRowKey: i, sortField: a, sortDirection: o = "asc", onSortChange: s, mobileActionLabel: c = "Подробнее", mobileDisabledLabel: l = "Нет сведений", tabletColumns: u = 3, desktopBreakpoint: d = "md", className: f }) {
|
|
9070
9088
|
let h = e.filter((e) => e.sortable), g = h.length > 0 && !!s, _ = h.flatMap((e) => [{
|
|
9071
9089
|
value: `${e.key}::asc`,
|
|
9072
9090
|
label: `По ${e.label} А – Я`
|
|
@@ -9076,7 +9094,7 @@ function Xm({ columns: e, rows: t, isRowDisabled: n, onRowClick: r, getRowKey: i
|
|
|
9076
9094
|
}]), v = a && o ? `${a}::${o}` : _[0]?.value ?? "", y = (e) => {
|
|
9077
9095
|
let t = e.lastIndexOf("::");
|
|
9078
9096
|
t === -1 || !s || s(e.slice(0, t), e.slice(t + 2));
|
|
9079
|
-
}, b = !!r, { show: x, hide: S } =
|
|
9097
|
+
}, b = !!r, { show: x, hide: S } = Xm[d];
|
|
9080
9098
|
return /* @__PURE__ */ m("div", {
|
|
9081
9099
|
className: K("flex flex-col gap-3", f),
|
|
9082
9100
|
children: [
|
|
@@ -9139,7 +9157,7 @@ function Xm({ columns: e, rows: t, isRowDisabled: n, onRowClick: r, getRowKey: i
|
|
|
9139
9157
|
}),
|
|
9140
9158
|
/* @__PURE__ */ p("div", {
|
|
9141
9159
|
className: "flex flex-col gap-1",
|
|
9142
|
-
children: t.map((t, a) => /* @__PURE__ */ p(
|
|
9160
|
+
children: t.map((t, a) => /* @__PURE__ */ p(Ym, {
|
|
9143
9161
|
row: t,
|
|
9144
9162
|
index: a,
|
|
9145
9163
|
columns: e,
|
|
@@ -9156,4 +9174,4 @@ function Xm({ columns: e, rows: t, isRowDisabled: n, onRowClick: r, getRowKey: i
|
|
|
9156
9174
|
});
|
|
9157
9175
|
}
|
|
9158
9176
|
//#endregion
|
|
9159
|
-
export { Gd as Accordion, Kd as AccordionItem, Jf as AdministrationIcon, bs as ArrowDownArrowUpIcon, xs as ArrowDownToBracketIcon, Cs as ArrowIcon, Ss as ArrowUpRightFromSquareIcon, ws as ArrowsIcon, bt as Badge, Ts as BottleIcon, yt as Button, nt as Caption, Jd as Card, Es as ChevronDownIcon, xt as Chip, Ds as CircleAttentionIcon, Os as CircleMinusIcon, ks as CirclePlusIcon, As as CircleXmarkIcon, js as CopyIcon, St as Counter,
|
|
9177
|
+
export { Gd as Accordion, Kd as AccordionItem, Jf as AdministrationIcon, bs as ArrowDownArrowUpIcon, xs as ArrowDownToBracketIcon, Cs as ArrowIcon, Ss as ArrowUpRightFromSquareIcon, ws as ArrowsIcon, bt as Badge, Ts as BottleIcon, yt as Button, nt as Caption, Jd as Card, Es as ChevronDownIcon, xt as Chip, Ds as CircleAttentionIcon, Os as CircleMinusIcon, ks as CirclePlusIcon, As as CircleXmarkIcon, js as CopyIcon, St as Counter, Zm as DataTable, Ms as DnaIcon, Bu as Drawer, Yd as EmptyState, Xd as ErrorState, Ns as FileArrowDownIcon, $e as Heading, Ps as InfoCircleIcon, Ct as Input, tt as Label, Fs as MenuIcon, Is as MinusIcon, Ls as MoonStarsIcon, Rs as PlusIcon, Xs as SearchBar, ys as SearchDropdown, zs as SearchIcon, Bs as SearchListIcon, Hm as Select, _s as Skeleton, Um as SortControl, gs as Spinner, Hs as SunIcon, Vs as SunMiniIcon, Xf as Switch, Rf as Tabs, dp as TagFilter, Us as TestTubeIcon, et as Text, sp as ThemeProvider, lp as ThemeToggle, Ws as ThermometerIcon, Uc as Tooltip, Gs as VirusIcon, qs as XmarkIcon, Ks as XmarkLargeIcon, K as cn, Qf as darkTheme, Zf as defaultTheme, ep as themes, np as tokensToCssVars, cp as useTheme };
|