@mci-ui/mci-ui 0.0.87 → 0.0.89
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/index.css +1 -1
- package/dist/shared/ui/MciModal/MciModal.js +30 -28
- package/dist/shared/ui/mciAccordion/MciAccordion.js +97 -64
- package/dist/shared/ui/mciBreadcrumb/MciBreadcrumb.js +45 -25
- package/dist/shared/ui/mciButton/MciButton.js +39 -31
- package/dist/shared/ui/mciCheck/MciCheck.js +86 -76
- package/dist/shared/ui/mciDrawer/MciDrawer.js +78 -54
- package/dist/shared/ui/mciInput/MciInput.js +39 -40
- package/dist/shared/ui/mciLoader/MciLoader.js +14 -14
- package/dist/shared/ui/mciPagination/MciPagination.js +28 -18
- package/dist/shared/ui/mciPicker/MciPicker.js +53 -53
- package/dist/shared/ui/mciSelect/MciSelect.js +42 -41
- package/dist/shared/ui/mciTable/MciTable.js +97 -90
- package/dist/shared/ui/mciTable/MciTableClamp2.js +4 -3
- package/dist/shared/ui/mciTable/MciTableColumnsPanel.js +100 -79
- package/dist/shared/ui/mciTabs/MciTabs.js +66 -55
- package/dist/shared/ui/mciToggle/MciToggle.js +51 -43
- package/dist/shared/ui/mciUpload/MciUpload.js +129 -107
- package/dist/types/shared/types/mci-table.types.d.ts +2 -0
- package/dist/types/shared/types/ui/accordion.types.d.ts +1 -0
- package/dist/types/shared/types/ui/breadcrumb.types.d.ts +1 -1
- package/dist/types/shared/types/ui/button.types.d.ts +1 -1
- package/dist/types/shared/types/ui/check.types.d.ts +1 -1
- package/dist/types/shared/types/ui/drawer.types.d.ts +2 -0
- package/dist/types/shared/types/ui/loader.types.d.ts +1 -1
- package/dist/types/shared/types/ui/pagination.types.d.ts +1 -1
- package/dist/types/shared/types/ui/toggle.types.d.ts +1 -1
- package/dist/types/shared/types/ui/upload.types.d.ts +1 -1
- package/dist/types/shared/ui/mciAccordion/MciAccordion.d.ts +5 -3
- package/dist/types/shared/ui/mciDrawer/MciDrawer.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTable.d.ts +1 -1
- package/dist/types/shared/ui/mciTable/MciTableColumnsPanel.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,65 +1,70 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { ConfoundedSquare as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { ConfoundedSquare as _, SortVertical as H, SortFromTopToBottom as J, SortFromBottomToTop as K } from "@solar-icons/react";
|
|
3
|
+
import { useState as O, useMemo as v, useEffect as Q, useCallback as U } from "react";
|
|
4
4
|
import { cn as a } from "../../lib/utils.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import z from "../mciCheck/MciCheck.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { sortRows as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
import B from "../mciSkeleton/MciSkeleton.js";
|
|
8
|
+
import X from "./MciTableClamp2.js";
|
|
9
|
+
import { sortRows as Y, normalizeColWidth as Z } from "./mci-table.utils.js";
|
|
10
|
+
const w = (o) => {
|
|
11
|
+
const b = String(o.key).toLowerCase(), d = o.title.toLowerCase();
|
|
12
|
+
return b === "action" || b === "actions" || b.includes("action") || d === "action" || d === "actions" || d.includes("action");
|
|
13
|
+
};
|
|
14
|
+
function ae({
|
|
15
|
+
columns: o,
|
|
16
|
+
data: b = [],
|
|
17
|
+
loading: d = !1,
|
|
18
|
+
skeletonRows: D = 5,
|
|
19
|
+
noDataText: P = "",
|
|
16
20
|
sort: n,
|
|
17
21
|
onSortChange: N,
|
|
18
|
-
className:
|
|
19
|
-
headerClassName:
|
|
20
|
-
bodyClassName:
|
|
21
|
-
darkMode:
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
className: F,
|
|
23
|
+
headerClassName: C,
|
|
24
|
+
bodyClassName: R,
|
|
25
|
+
darkMode: i = !1,
|
|
26
|
+
variant: j = "orange",
|
|
27
|
+
rowKey: p = "id",
|
|
28
|
+
rowSelection: l
|
|
24
29
|
}) {
|
|
25
|
-
const [
|
|
26
|
-
|
|
27
|
-
n !== void 0 &&
|
|
30
|
+
const [V, A] = O(null), h = n ?? V, x = v(() => Array.isArray(b) ? b : [], [b]), L = v(() => Y(x, h, !!n), [x, h, n]);
|
|
31
|
+
Q(() => {
|
|
32
|
+
n !== void 0 && A(null);
|
|
28
33
|
}, [n]);
|
|
29
|
-
const
|
|
30
|
-
() =>
|
|
31
|
-
[
|
|
32
|
-
),
|
|
34
|
+
const f = v(
|
|
35
|
+
() => d ? [] : n ? x : L,
|
|
36
|
+
[d, n, x, L]
|
|
37
|
+
), q = U(
|
|
33
38
|
(e) => {
|
|
34
39
|
if (!e.sortable) return;
|
|
35
|
-
let
|
|
36
|
-
|
|
40
|
+
let s = null;
|
|
41
|
+
h?.key !== e.key ? s = { key: e.key, direction: "asc" } : h.direction === "asc" && (s = { key: e.key, direction: "desc" }), n !== void 0 ? N?.(s) : A(s);
|
|
37
42
|
},
|
|
38
|
-
[
|
|
39
|
-
),
|
|
40
|
-
if (!
|
|
41
|
-
const { onChange:
|
|
43
|
+
[h, n, N]
|
|
44
|
+
), E = (e) => {
|
|
45
|
+
if (!l) return;
|
|
46
|
+
const { onChange: s, getCheckboxProps: m } = l;
|
|
42
47
|
if (e.target.checked) {
|
|
43
|
-
const
|
|
44
|
-
|
|
48
|
+
const r = f.filter((u) => !m?.(u)?.disabled).map((u) => u[p]);
|
|
49
|
+
s(r);
|
|
45
50
|
} else
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
if (!
|
|
49
|
-
const { selectedRowKeys:
|
|
50
|
-
y(
|
|
51
|
-
},
|
|
52
|
-
if (!
|
|
53
|
-
const e =
|
|
51
|
+
s([]);
|
|
52
|
+
}, G = (e, s) => {
|
|
53
|
+
if (!l) return;
|
|
54
|
+
const { selectedRowKeys: m, onChange: y } = l, g = e[p], r = s ? [...m, g] : m.filter((u) => u !== g);
|
|
55
|
+
y(r);
|
|
56
|
+
}, I = v(() => {
|
|
57
|
+
if (!l || f.length === 0) return !1;
|
|
58
|
+
const e = f.filter((s) => !l.getCheckboxProps?.(s)?.disabled);
|
|
54
59
|
return e.length === 0 ? !1 : e.every(
|
|
55
|
-
(
|
|
60
|
+
(s) => l.selectedRowKeys.includes(s[p])
|
|
56
61
|
);
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
59
|
-
return e.sortable ? !
|
|
62
|
+
}, [l, f, p]), W = (e) => {
|
|
63
|
+
const s = a(i ? "text-neutral-100" : "text-slate-base", "shrink-0");
|
|
64
|
+
return e.sortable ? !h || h.key !== e.key ? /* @__PURE__ */ t(H, { weight: "Linear", size: 20, className: s }) : h.direction === "asc" ? /* @__PURE__ */ t(J, { weight: "Linear", size: 20, className: s }) : /* @__PURE__ */ t(K, { weight: "Linear", size: 20, className: s }) : null;
|
|
60
65
|
}, T = () => /* @__PURE__ */ c("colgroup", { children: [
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
l && /* @__PURE__ */ t("col", { style: { width: 48 } }),
|
|
67
|
+
o.map((e) => /* @__PURE__ */ t("col", { style: { width: Z(e.width) ?? (w(e) ? "1%" : "auto") } }, e.key))
|
|
63
68
|
] });
|
|
64
69
|
return /* @__PURE__ */ t(
|
|
65
70
|
"div",
|
|
@@ -68,10 +73,10 @@ function re({
|
|
|
68
73
|
"w-full overflow-x-auto pb-0.5",
|
|
69
74
|
"[&::-webkit-scrollbar]:h-1",
|
|
70
75
|
"[&::-webkit-scrollbar-track]:bg-transparent",
|
|
71
|
-
|
|
76
|
+
i ? "[&::-webkit-scrollbar-thumb]:bg-neutral-200" : "[&::-webkit-scrollbar-thumb]:bg-slate-200",
|
|
72
77
|
"[&::-webkit-scrollbar-thumb]:rounded-full",
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
i ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300",
|
|
79
|
+
F
|
|
75
80
|
),
|
|
76
81
|
children: /* @__PURE__ */ c("div", { className: "inline-block min-w-full align-middle", children: [
|
|
77
82
|
/* @__PURE__ */ t(
|
|
@@ -79,33 +84,34 @@ function re({
|
|
|
79
84
|
{
|
|
80
85
|
className: a(
|
|
81
86
|
"overflow-hidden rounded-xl border",
|
|
82
|
-
|
|
87
|
+
i ? "border-neutral-200 bg-neutral-300" : "border-slate-200 bg-slate-100"
|
|
83
88
|
),
|
|
84
89
|
children: /* @__PURE__ */ c("table", { className: "w-full table-fixed", children: [
|
|
85
90
|
T(),
|
|
86
91
|
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ c("tr", { children: [
|
|
87
|
-
|
|
92
|
+
l && /* @__PURE__ */ t("th", { className: a("w-12 px-4 py-3", C), children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ t(
|
|
88
93
|
z,
|
|
89
94
|
{
|
|
90
|
-
checked:
|
|
91
|
-
onChange:
|
|
92
|
-
variant:
|
|
93
|
-
darkMode:
|
|
94
|
-
disabled:
|
|
95
|
+
checked: I,
|
|
96
|
+
onChange: E,
|
|
97
|
+
variant: j,
|
|
98
|
+
darkMode: i,
|
|
99
|
+
disabled: d || f.length === 0
|
|
95
100
|
}
|
|
96
101
|
) }) }),
|
|
97
|
-
|
|
102
|
+
o.map((e) => /* @__PURE__ */ t(
|
|
98
103
|
"th",
|
|
99
104
|
{
|
|
100
|
-
onClick: () =>
|
|
105
|
+
onClick: () => q(e),
|
|
101
106
|
className: a(
|
|
102
107
|
"px-4 py-3 text-left text-sm font-medium transition-colors",
|
|
103
|
-
|
|
108
|
+
i ? "text-neutral-50" : "text-slate-700",
|
|
104
109
|
"whitespace-nowrap overflow-hidden text-ellipsis",
|
|
110
|
+
w(e) && "w-px",
|
|
105
111
|
e.align === "center" && "text-center",
|
|
106
112
|
e.align === "right" && "text-right",
|
|
107
|
-
e.sortable && (
|
|
108
|
-
|
|
113
|
+
e.sortable && (i ? "cursor-pointer hover:bg-neutral-200" : "cursor-pointer hover:bg-slate-200"),
|
|
114
|
+
C
|
|
109
115
|
),
|
|
110
116
|
children: /* @__PURE__ */ c(
|
|
111
117
|
"div",
|
|
@@ -113,7 +119,7 @@ function re({
|
|
|
113
119
|
className: a("flex items-center gap-2 min-w-0", e.align === "right" && "justify-end"),
|
|
114
120
|
children: [
|
|
115
121
|
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", title: e.title, children: e.title }),
|
|
116
|
-
|
|
122
|
+
W(e)
|
|
117
123
|
]
|
|
118
124
|
}
|
|
119
125
|
)
|
|
@@ -129,56 +135,57 @@ function re({
|
|
|
129
135
|
{
|
|
130
136
|
className: a(
|
|
131
137
|
"overflow-hidden rounded-xl border border-t-0",
|
|
132
|
-
|
|
138
|
+
i ? "border-neutral-200 bg-transparent" : "border-slate-200 bg-white"
|
|
133
139
|
),
|
|
134
140
|
children: /* @__PURE__ */ c("table", { className: "w-full table-fixed", children: [
|
|
135
141
|
T(),
|
|
136
|
-
/* @__PURE__ */ t("tbody", { className: a("divide-y",
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
] },
|
|
142
|
+
/* @__PURE__ */ t("tbody", { className: a("divide-y", i ? "divide-neutral-200" : "divide-slate-200"), children: d ? Array.from({ length: D }).map((e, s) => /* @__PURE__ */ c("tr", { children: [
|
|
143
|
+
l && /* @__PURE__ */ t("td", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ t(B, { height: 20, width: 20, variant: "rounded" }) }),
|
|
144
|
+
o.map((m) => /* @__PURE__ */ t("td", { className: "px-4 py-3", children: /* @__PURE__ */ t(B, { height: 30, variant: "rounded" }) }, m.key))
|
|
145
|
+
] }, s)) : f.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", { colSpan: o.length + (l ? 1 : 0), className: "py-20", children: /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center", children: [
|
|
140
146
|
/* @__PURE__ */ t("div", { className: "relative mb-4", children: /* @__PURE__ */ t(
|
|
141
|
-
|
|
147
|
+
_,
|
|
142
148
|
{
|
|
143
149
|
weight: "Bold",
|
|
144
150
|
size: 64,
|
|
145
|
-
className: a("animate-float",
|
|
151
|
+
className: a("animate-float", i ? "text-neutral-100" : "text-slate-400")
|
|
146
152
|
}
|
|
147
153
|
) }),
|
|
148
|
-
/* @__PURE__ */ t("p", { className: a("text-sm font-medium",
|
|
149
|
-
] }) }) }) :
|
|
150
|
-
const
|
|
151
|
-
return /* @__PURE__ */ c("tr", { className: a("group transition-colors",
|
|
152
|
-
|
|
154
|
+
/* @__PURE__ */ t("p", { className: a("text-sm font-medium", i ? "text-neutral-100" : "text-slate-400"), children: P })
|
|
155
|
+
] }) }) }) : f.map((e, s) => {
|
|
156
|
+
const m = e[p], y = l?.selectedRowKeys.includes(m), g = l?.getCheckboxProps?.(e)?.disabled;
|
|
157
|
+
return /* @__PURE__ */ c("tr", { className: a("group transition-colors", i ? "hover:bg-neutral-100/35" : "hover:bg-slate-50"), children: [
|
|
158
|
+
l && /* @__PURE__ */ t("td", { className: a("w-12 px-4 py-3 align-top", R), children: /* @__PURE__ */ t("div", { className: "flex items-center justify-center pt-1", children: /* @__PURE__ */ t(
|
|
153
159
|
z,
|
|
154
160
|
{
|
|
155
161
|
checked: y,
|
|
156
|
-
disabled:
|
|
157
|
-
variant:
|
|
158
|
-
darkMode:
|
|
159
|
-
onChange: (
|
|
162
|
+
disabled: g,
|
|
163
|
+
variant: j,
|
|
164
|
+
darkMode: i,
|
|
165
|
+
onChange: (r) => G(e, r.target.checked)
|
|
160
166
|
}
|
|
161
167
|
) }) }),
|
|
162
|
-
|
|
163
|
-
const
|
|
168
|
+
o.map((r) => {
|
|
169
|
+
const u = e[r.key], k = r.render ? r.render(u, e) : String(u ?? "-");
|
|
164
170
|
return /* @__PURE__ */ t(
|
|
165
171
|
"td",
|
|
166
172
|
{
|
|
167
173
|
className: a(
|
|
168
|
-
"align-top px-4 py-3 text-sm font-normal",
|
|
169
|
-
|
|
174
|
+
"align-top px-4 py-3 text-sm font-normal overflow-visible",
|
|
175
|
+
i ? "text-neutral-50" : "text-black",
|
|
170
176
|
"min-w-0 whitespace-normal",
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
w(r) && "w-px whitespace-nowrap",
|
|
178
|
+
r.align === "center" && "text-center",
|
|
179
|
+
r.align === "right" && "text-right",
|
|
180
|
+
R,
|
|
181
|
+
r.className
|
|
175
182
|
),
|
|
176
|
-
children: /* @__PURE__ */ t(
|
|
183
|
+
children: /* @__PURE__ */ t(X, { title: typeof k == "string" ? k : void 0, children: k })
|
|
177
184
|
},
|
|
178
|
-
|
|
185
|
+
r.key
|
|
179
186
|
);
|
|
180
187
|
})
|
|
181
|
-
] },
|
|
188
|
+
] }, s);
|
|
182
189
|
}) })
|
|
183
190
|
] })
|
|
184
191
|
}
|
|
@@ -188,5 +195,5 @@ function re({
|
|
|
188
195
|
);
|
|
189
196
|
}
|
|
190
197
|
export {
|
|
191
|
-
|
|
198
|
+
ae as default
|
|
192
199
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
function
|
|
3
|
-
|
|
2
|
+
function o({ children: t, title: i }) {
|
|
3
|
+
const a = typeof t == "string" ? t : void 0;
|
|
4
|
+
return typeof t != "string" && typeof t != "number" ? /* @__PURE__ */ e("div", { className: "-m-1 inline-flex w-fit max-w-full items-start overflow-visible p-1 align-top", children: t }) : /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("div", { className: "clamp-2 break-words", title: i ?? a, children: t }) });
|
|
4
5
|
}
|
|
5
6
|
export {
|
|
6
|
-
|
|
7
|
+
o as default
|
|
7
8
|
};
|
|
@@ -1,122 +1,142 @@
|
|
|
1
|
-
import { jsxs as g, jsx as
|
|
2
|
-
import { useRef as K, useEffect as
|
|
3
|
-
import { TransferVertical as
|
|
4
|
-
import { useClickOutside as
|
|
1
|
+
import { jsxs as g, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as K, useEffect as q, useMemo as Y, useState as p, useCallback as h } from "react";
|
|
3
|
+
import { TransferVertical as J } from "@solar-icons/react";
|
|
4
|
+
import { useClickOutside as U, cn as l } from "../../lib/utils.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import V from "../mciCheck/MciCheck.js";
|
|
7
|
+
const W = {
|
|
8
8
|
ru: {
|
|
9
9
|
title: "Настройки",
|
|
10
10
|
close: "Закрыть",
|
|
11
11
|
activeColumns: "Активные колонки",
|
|
12
|
-
minColumns: (
|
|
12
|
+
minColumns: (u) => `Минимум ${u} колонок`,
|
|
13
13
|
drag: "Перетащить"
|
|
14
14
|
},
|
|
15
15
|
uz: {
|
|
16
16
|
title: "Sozlamalar",
|
|
17
17
|
close: "Yopish",
|
|
18
18
|
activeColumns: "Aktiv ustunlar",
|
|
19
|
-
minColumns: (
|
|
19
|
+
minColumns: (u) => `Kamida ${u} ta ustun`,
|
|
20
20
|
drag: "Sudrash"
|
|
21
21
|
}
|
|
22
|
+
}, X = {
|
|
23
|
+
blue: {
|
|
24
|
+
dropIndicator: "bg-blue-300",
|
|
25
|
+
darkDropIndicator: "bg-blue-500",
|
|
26
|
+
close: "hover:bg-blue-50 hover:text-blue-600 focus-visible:ring-2 focus-visible:ring-[rgba(21,93,252,0.25)]",
|
|
27
|
+
darkClose: "hover:bg-blue-500/20 hover:text-blue-400 focus-visible:ring-2 focus-visible:ring-[rgba(21,93,252,0.25)]"
|
|
28
|
+
},
|
|
29
|
+
yellow: {
|
|
30
|
+
dropIndicator: "bg-yellow-400",
|
|
31
|
+
darkDropIndicator: "bg-yellow-500",
|
|
32
|
+
close: "hover:bg-yellow-50 hover:text-yellow-600 focus-visible:ring-2 focus-visible:ring-yellow-200",
|
|
33
|
+
darkClose: "hover:bg-yellow-500/20 hover:text-yellow-300 focus-visible:ring-2 focus-visible:ring-yellow-300/40"
|
|
34
|
+
},
|
|
35
|
+
orange: {
|
|
36
|
+
dropIndicator: "bg-orange-400",
|
|
37
|
+
darkDropIndicator: "bg-orange-600",
|
|
38
|
+
close: "hover:bg-orange-50 hover:text-orange-600 focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]",
|
|
39
|
+
darkClose: "hover:bg-orange-600/20 hover:text-orange-400 focus-visible:ring-2 focus-visible:ring-[rgba(227,98,12,0.25)]"
|
|
40
|
+
}
|
|
22
41
|
};
|
|
23
|
-
function
|
|
24
|
-
open:
|
|
25
|
-
onClose:
|
|
42
|
+
function ae({
|
|
43
|
+
open: u,
|
|
44
|
+
onClose: N,
|
|
26
45
|
columns: i,
|
|
27
|
-
hidden:
|
|
28
|
-
onToggle:
|
|
29
|
-
onMove:
|
|
46
|
+
hidden: k,
|
|
47
|
+
onToggle: I,
|
|
48
|
+
onMove: T,
|
|
30
49
|
onMoveByKey: x,
|
|
31
50
|
minVisible: S = 5,
|
|
32
|
-
locale:
|
|
33
|
-
darkMode: r = !1
|
|
51
|
+
locale: _ = "ru",
|
|
52
|
+
darkMode: r = !1,
|
|
53
|
+
variant: E = "orange"
|
|
34
54
|
}) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
return document.addEventListener("mousedown",
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
55
|
+
const L = K(null), { handleClick: w } = U(L, N), f = W[_], v = X[E];
|
|
56
|
+
q(() => {
|
|
57
|
+
if (u)
|
|
58
|
+
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
59
|
+
}, [u, w]);
|
|
60
|
+
const D = Y(() => new Set(k), [k]), O = Y(() => {
|
|
41
61
|
let e = 0;
|
|
42
|
-
for (const t of i)
|
|
62
|
+
for (const t of i) D.has(t.key) || e++;
|
|
43
63
|
return e;
|
|
44
|
-
}, [i,
|
|
64
|
+
}, [i, D]), [y, P] = p(null), [z, A] = p(null), [$, R] = p(null), [m, C] = p("before"), j = h(
|
|
45
65
|
(e, t, a) => {
|
|
46
66
|
let n = a === "after" ? t + 1 : t;
|
|
47
67
|
return e < n && (n -= 1), n;
|
|
48
68
|
},
|
|
49
69
|
[]
|
|
50
|
-
),
|
|
51
|
-
|
|
52
|
-
}, []),
|
|
70
|
+
), d = h(() => {
|
|
71
|
+
P(null), R(null), A(null), C("before");
|
|
72
|
+
}, []), B = h(
|
|
53
73
|
(e, t, a) => {
|
|
54
|
-
|
|
74
|
+
P(t), R(String(a)), A(null), C("before"), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", String(t));
|
|
55
75
|
const n = new Image();
|
|
56
76
|
n.src = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", e.dataTransfer.setDragImage(n, 0, 0);
|
|
57
77
|
},
|
|
58
78
|
[]
|
|
59
|
-
),
|
|
79
|
+
), G = h(
|
|
60
80
|
(e, t) => {
|
|
61
81
|
e.preventDefault();
|
|
62
|
-
const a =
|
|
82
|
+
const a = y ?? Number.parseInt(e.dataTransfer.getData("text/plain") || "-1", 10);
|
|
63
83
|
if (!Number.isFinite(a) || a < 0) {
|
|
64
|
-
|
|
84
|
+
d();
|
|
65
85
|
return;
|
|
66
86
|
}
|
|
67
87
|
const n = i[a], b = i[t];
|
|
68
88
|
if (!n || !b) {
|
|
69
|
-
|
|
89
|
+
d();
|
|
70
90
|
return;
|
|
71
91
|
}
|
|
72
|
-
const o =
|
|
73
|
-
o !== a && (x ? x(n.key, b.key,
|
|
92
|
+
const o = j(a, t, m);
|
|
93
|
+
o !== a && (x ? x(n.key, b.key, m) : T(a, o)), d();
|
|
74
94
|
},
|
|
75
|
-
[i,
|
|
76
|
-
),
|
|
95
|
+
[i, j, y, m, T, x, d]
|
|
96
|
+
), H = h(
|
|
77
97
|
(e, t) => {
|
|
78
|
-
t ||
|
|
98
|
+
t || I(e);
|
|
79
99
|
},
|
|
80
|
-
[
|
|
100
|
+
[I]
|
|
81
101
|
);
|
|
82
|
-
return
|
|
102
|
+
return u ? /* @__PURE__ */ g(
|
|
83
103
|
"div",
|
|
84
104
|
{
|
|
85
|
-
ref:
|
|
86
|
-
className:
|
|
105
|
+
ref: L,
|
|
106
|
+
className: l(
|
|
87
107
|
"absolute right-0 top-full z-50 mt-2 w-[320px]",
|
|
88
108
|
"rounded-2xl p-4",
|
|
89
109
|
r ? "border border-neutral-200 bg-[#22242A] shadow-xl" : "border border-slate-200 bg-white"
|
|
90
110
|
),
|
|
91
111
|
children: [
|
|
92
112
|
/* @__PURE__ */ g("div", { className: "flex items-center justify-between gap-4", children: [
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ s("h4", { className: l("text-large font-normal", r ? "text-neutral-50" : "text-slate-600"), children: f.title }),
|
|
114
|
+
/* @__PURE__ */ s(
|
|
95
115
|
"button",
|
|
96
116
|
{
|
|
97
117
|
type: "button",
|
|
98
|
-
onClick:
|
|
99
|
-
className:
|
|
100
|
-
"rounded-lg px-2 py-1",
|
|
101
|
-
r ? "text-neutral-100 hover:bg-neutral-300" : "text-slate-500 hover:bg-slate-100"
|
|
118
|
+
onClick: N,
|
|
119
|
+
className: l(
|
|
120
|
+
"cursor-pointer rounded-lg px-2 py-1",
|
|
121
|
+
r ? l("text-neutral-100 hover:bg-neutral-300", v.darkClose) : l("text-slate-500 hover:bg-slate-100", v.close)
|
|
102
122
|
),
|
|
103
|
-
"aria-label":
|
|
123
|
+
"aria-label": f.close,
|
|
104
124
|
children: "✕"
|
|
105
125
|
}
|
|
106
126
|
)
|
|
107
127
|
] }),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */ g("p", { className:
|
|
110
|
-
|
|
128
|
+
/* @__PURE__ */ s("div", { className: l("my-4 h-px", r ? "bg-neutral-200" : "bg-slate-100") }),
|
|
129
|
+
/* @__PURE__ */ g("p", { className: l("mb-3 text-xs", r ? "text-neutral-100" : "text-slate-500"), children: [
|
|
130
|
+
f.activeColumns,
|
|
111
131
|
": ",
|
|
112
132
|
O,
|
|
113
133
|
"/",
|
|
114
134
|
i.length
|
|
115
135
|
] }),
|
|
116
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ s(
|
|
117
137
|
"div",
|
|
118
138
|
{
|
|
119
|
-
className:
|
|
139
|
+
className: l(
|
|
120
140
|
"max-h-[275px] overflow-auto",
|
|
121
141
|
"[&::-webkit-scrollbar]:w-1.5",
|
|
122
142
|
"[&::-webkit-scrollbar-track]:bg-transparent",
|
|
@@ -125,15 +145,15 @@ function te({
|
|
|
125
145
|
r ? "hover:[&::-webkit-scrollbar-thumb]:bg-neutral-100" : "hover:[&::-webkit-scrollbar-thumb]:bg-slate-300"
|
|
126
146
|
),
|
|
127
147
|
children: i.map((e, t) => {
|
|
128
|
-
const a = !
|
|
148
|
+
const a = !D.has(e.key), n = a && O <= S, b = z === t, o = $ === e.key;
|
|
129
149
|
return /* @__PURE__ */ g("div", { className: "relative", children: [
|
|
130
|
-
b && !o && /* @__PURE__ */
|
|
150
|
+
b && !o && /* @__PURE__ */ s(
|
|
131
151
|
"div",
|
|
132
152
|
{
|
|
133
|
-
className:
|
|
153
|
+
className: l(
|
|
134
154
|
"pointer-events-none absolute left-2 right-2 z-10 h-0.5 rounded-full",
|
|
135
|
-
r ?
|
|
136
|
-
|
|
155
|
+
r ? v.darkDropIndicator : v.dropIndicator,
|
|
156
|
+
m === "before" ? "top-0" : "bottom-0"
|
|
137
157
|
)
|
|
138
158
|
}
|
|
139
159
|
),
|
|
@@ -141,57 +161,58 @@ function te({
|
|
|
141
161
|
"div",
|
|
142
162
|
{
|
|
143
163
|
draggable: !0,
|
|
144
|
-
onDragStart: (
|
|
145
|
-
onDragOver: (
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
164
|
+
onDragStart: (c) => B(c, t, e.key),
|
|
165
|
+
onDragOver: (c) => {
|
|
166
|
+
if (y == null) return;
|
|
167
|
+
c.preventDefault(), c.dataTransfer.dropEffect = "move";
|
|
168
|
+
const F = c.currentTarget.getBoundingClientRect(), Q = c.clientY - F.top > F.height / 2 ? "after" : "before";
|
|
169
|
+
z !== t && A(t), m !== Q && C(Q);
|
|
150
170
|
},
|
|
151
|
-
onDrop: (
|
|
152
|
-
onDragEnd:
|
|
153
|
-
className:
|
|
171
|
+
onDrop: (c) => G(c, t),
|
|
172
|
+
onDragEnd: d,
|
|
173
|
+
className: l(
|
|
154
174
|
"group flex items-center py-2 px-1 gap-4",
|
|
155
175
|
"rounded-md box-border overflow-visible",
|
|
156
176
|
"transition-[background,transform] duration-150",
|
|
177
|
+
!o && "cursor-grab",
|
|
157
178
|
!o && !b && (r ? "hover:bg-neutral-300/60" : "hover:bg-slate-50"),
|
|
158
179
|
b && !o && (r ? "bg-neutral-300/60" : "bg-slate-50"),
|
|
159
180
|
o && (r ? "bg-neutral-300 opacity-100 scale-[0.99] cursor-grabbing" : "bg-slate-50 opacity-100 scale-[0.99] cursor-grabbing")
|
|
160
181
|
),
|
|
161
182
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ s(
|
|
163
184
|
"button",
|
|
164
185
|
{
|
|
165
186
|
type: "button",
|
|
166
|
-
className:
|
|
187
|
+
className: l(
|
|
167
188
|
"shrink-0",
|
|
168
189
|
r ? "text-neutral-100" : "text-slate-400",
|
|
169
190
|
"cursor-grab active:cursor-grabbing",
|
|
170
191
|
r ? "rounded-lg p-1 hover:bg-neutral-200" : "rounded-lg p-1 hover:bg-slate-100",
|
|
171
192
|
o && "cursor-grabbing"
|
|
172
193
|
),
|
|
173
|
-
"aria-label":
|
|
174
|
-
children: /* @__PURE__ */
|
|
194
|
+
"aria-label": f.drag,
|
|
195
|
+
children: /* @__PURE__ */ s(J, { weight: "Linear", size: 20 })
|
|
175
196
|
}
|
|
176
197
|
),
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
198
|
+
/* @__PURE__ */ s("div", { className: "shrink-0", children: /* @__PURE__ */ s(
|
|
199
|
+
V,
|
|
179
200
|
{
|
|
180
201
|
checked: a,
|
|
181
202
|
disabled: n,
|
|
182
|
-
onChange: () =>
|
|
183
|
-
variant:
|
|
203
|
+
onChange: () => H(e.key, n),
|
|
204
|
+
variant: E,
|
|
184
205
|
darkMode: r
|
|
185
206
|
}
|
|
186
207
|
) }),
|
|
187
208
|
/* @__PURE__ */ g("div", { className: "min-w-0 flex-1", children: [
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
n && /* @__PURE__ */
|
|
209
|
+
/* @__PURE__ */ s("h4", { className: l("truncate text-base font-medium", r ? "text-neutral-50" : "text-slate-700"), title: e.title, children: e.title }),
|
|
210
|
+
n && /* @__PURE__ */ s("p", { className: l("mt-0.5 text-xs", r ? "text-neutral-100" : "text-slate-400"), children: f.minColumns(S) })
|
|
190
211
|
] })
|
|
191
212
|
]
|
|
192
213
|
}
|
|
193
214
|
),
|
|
194
|
-
t !== i.length - 1 && /* @__PURE__ */
|
|
215
|
+
t !== i.length - 1 && /* @__PURE__ */ s("div", { className: l("mx-2 h-px", r ? "bg-neutral-200" : "bg-slate-100") })
|
|
195
216
|
] }, e.key);
|
|
196
217
|
})
|
|
197
218
|
}
|
|
@@ -201,5 +222,5 @@ function te({
|
|
|
201
222
|
) : null;
|
|
202
223
|
}
|
|
203
224
|
export {
|
|
204
|
-
|
|
225
|
+
ae as default
|
|
205
226
|
};
|