@ztwoint/z-ui 0.1.108 → 0.1.109
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.
|
@@ -9,17 +9,16 @@ import "clsx";
|
|
|
9
9
|
import "tailwind-merge";
|
|
10
10
|
import { isColumnData as s } from "./components/column-item/column-item.util.js";
|
|
11
11
|
import "../button/button.js";
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const [t, a] = I(o);
|
|
12
|
+
const $ = ({ columns: e, onReorder: r }) => {
|
|
13
|
+
const [t, a] = I(e);
|
|
15
14
|
return p(() => {
|
|
16
|
-
a(
|
|
17
|
-
}, [
|
|
18
|
-
canMonitor({ source:
|
|
19
|
-
return s(
|
|
15
|
+
a(e);
|
|
16
|
+
}, [e]), p(() => C({
|
|
17
|
+
canMonitor({ source: o }) {
|
|
18
|
+
return s(o.data);
|
|
20
19
|
},
|
|
21
|
-
onDrop({ location:
|
|
22
|
-
const c =
|
|
20
|
+
onDrop({ location: o, source: g }) {
|
|
21
|
+
const c = o.current.dropTargets[0];
|
|
23
22
|
if (!c)
|
|
24
23
|
return;
|
|
25
24
|
const n = g.data, i = c.data;
|
|
@@ -44,5 +43,5 @@ const b = ({ columns: o, onReorder: r }) => {
|
|
|
44
43
|
}), [t, r]), { internalColumns: t };
|
|
45
44
|
};
|
|
46
45
|
export {
|
|
47
|
-
|
|
46
|
+
$ as useColumnReorder
|
|
48
47
|
};
|
|
@@ -1,128 +1,87 @@
|
|
|
1
1
|
import { jsxs as l, Fragment as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { cn as
|
|
5
|
-
import { useColumnItemDragAndDrop as
|
|
6
|
-
import { Button as
|
|
7
|
-
import
|
|
8
|
-
import { parseColumnLabel as
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
const L = {
|
|
2
|
+
import { createPortal as x } from "react-dom";
|
|
3
|
+
import "react";
|
|
4
|
+
import { cn as c } from "../../../../lib/utils.js";
|
|
5
|
+
import { useColumnItemDragAndDrop as h } from "./column-item.hook.js";
|
|
6
|
+
import { Button as b } from "../../../button/button.js";
|
|
7
|
+
import N from "../../../assets/icons/x.js";
|
|
8
|
+
import { parseColumnLabel as g } from "./column-item.util.js";
|
|
9
|
+
import u from "../../../assets/icons/drag-handle.js";
|
|
10
|
+
const y = {
|
|
12
11
|
"is-dragging": "opacity-40",
|
|
13
12
|
"is-dragging-over": "bg-background-neutral-medium"
|
|
14
|
-
},
|
|
15
|
-
const i = x(null), [o, m] = h(!1);
|
|
16
|
-
b(() => {
|
|
17
|
-
const n = () => {
|
|
18
|
-
if (i.current) {
|
|
19
|
-
const c = i.current;
|
|
20
|
-
m(c.scrollWidth > c.clientWidth);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
24
|
-
}, [t]);
|
|
25
|
-
const a = /* @__PURE__ */ e("span", { ref: i, className: u("truncate min-w-0", s), children: t });
|
|
26
|
-
return o && r ? /* @__PURE__ */ e(w, { message: r, side: "top", children: a }) : a;
|
|
27
|
-
}, T = ({
|
|
13
|
+
}, i = ({ text: t, className: r }) => /* @__PURE__ */ e("span", { className: c("truncate min-w-0", r), children: t }), k = ({
|
|
28
14
|
edge: t,
|
|
29
|
-
isFirstElement:
|
|
15
|
+
isFirstElement: r = !1
|
|
30
16
|
}) => /* @__PURE__ */ e(
|
|
31
17
|
"div",
|
|
32
18
|
{
|
|
33
|
-
className:
|
|
19
|
+
className: c(
|
|
34
20
|
"absolute left-0 right-0 h-0.5 bg-blue-500",
|
|
35
|
-
t === "top" ?
|
|
21
|
+
t === "top" ? r ? "top-0" : "top-[-3px]" : "bottom-0"
|
|
36
22
|
)
|
|
37
23
|
}
|
|
38
24
|
);
|
|
39
|
-
function
|
|
40
|
-
const { groupLabel:
|
|
25
|
+
function v({ column: t }) {
|
|
26
|
+
const { groupLabel: r, fieldLabel: a } = g(t);
|
|
41
27
|
return /* @__PURE__ */ l("div", { className: "flex items-center gap-3 p-1 bg-background-neutral-default border border-stroke-solid-light rounded-xl ", children: [
|
|
42
|
-
/* @__PURE__ */ e(
|
|
28
|
+
/* @__PURE__ */ e(u, {}),
|
|
43
29
|
/* @__PURE__ */ e("div", { className: "shrink-0 flex items-center justify-center w-3.5 h-3.5 ", children: t.icon }),
|
|
44
30
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-0.5 min-w-0 flex-1 leading-none-regular-sm", children: [
|
|
45
|
-
/* @__PURE__ */ e(
|
|
46
|
-
d,
|
|
47
|
-
{
|
|
48
|
-
text: s,
|
|
49
|
-
className: "text-text-neutral-secondary",
|
|
50
|
-
tooltipMessage: `Group: ${s}`
|
|
51
|
-
}
|
|
52
|
-
),
|
|
31
|
+
/* @__PURE__ */ e(i, { text: r, className: "text-text-neutral-secondary" }),
|
|
53
32
|
/* @__PURE__ */ e("span", { className: "text-text-neutral-muted flex-shrink-0", children: "/" }),
|
|
54
|
-
/* @__PURE__ */ e(
|
|
55
|
-
d,
|
|
56
|
-
{
|
|
57
|
-
text: r,
|
|
58
|
-
className: "text-text-neutral-primary",
|
|
59
|
-
tooltipMessage: `Field: ${r}`
|
|
60
|
-
}
|
|
61
|
-
)
|
|
33
|
+
/* @__PURE__ */ e(i, { text: a, className: "text-text-neutral-primary" })
|
|
62
34
|
] })
|
|
63
35
|
] });
|
|
64
36
|
}
|
|
65
|
-
const
|
|
37
|
+
const T = ({
|
|
66
38
|
column: t,
|
|
67
|
-
index:
|
|
68
|
-
onRemove:
|
|
69
|
-
renderAction:
|
|
70
|
-
disabled:
|
|
39
|
+
index: r,
|
|
40
|
+
onRemove: a,
|
|
41
|
+
renderAction: o,
|
|
42
|
+
disabled: n = !1
|
|
71
43
|
}) => {
|
|
72
|
-
const { ref:
|
|
44
|
+
const { ref: p, state: s } = h(t, r, n), { groupLabel: d, fieldLabel: m } = g(t);
|
|
73
45
|
return /* @__PURE__ */ l(f, { children: [
|
|
74
46
|
/* @__PURE__ */ l("div", { className: "relative border-b-0.5", children: [
|
|
75
47
|
/* @__PURE__ */ l(
|
|
76
48
|
"div",
|
|
77
49
|
{
|
|
78
50
|
"data-column-id": t.id,
|
|
79
|
-
ref:
|
|
80
|
-
|
|
51
|
+
ref: p,
|
|
52
|
+
title: `${d} / ${m}`,
|
|
53
|
+
className: c(
|
|
81
54
|
"flex items-center gap-2 p-1 pl-3 bg-background-neutral-default transition-colors",
|
|
82
|
-
|
|
83
|
-
|
|
55
|
+
n ? "cursor-default" : "cursor-grab hover:bg-background-neutral-medium",
|
|
56
|
+
y[s.type] ?? ""
|
|
84
57
|
),
|
|
85
58
|
children: [
|
|
86
|
-
!
|
|
59
|
+
!n && /* @__PURE__ */ e(u, {}),
|
|
87
60
|
/* @__PURE__ */ e("div", { className: "shrink-0 flex items-center justify-center w-3.5 h-3.5", children: t.icon }),
|
|
88
61
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-0.5 min-w-0 flex-1 leading-none-regular-sm", children: [
|
|
89
|
-
/* @__PURE__ */ e(
|
|
90
|
-
d,
|
|
91
|
-
{
|
|
92
|
-
text: n,
|
|
93
|
-
className: "text-text-neutral-secondary",
|
|
94
|
-
tooltipMessage: `Group: ${n}`
|
|
95
|
-
}
|
|
96
|
-
),
|
|
62
|
+
/* @__PURE__ */ e(i, { text: d, className: "text-text-neutral-secondary" }),
|
|
97
63
|
/* @__PURE__ */ e("span", { className: "text-text-neutral-muted flex-shrink-0", children: "/" }),
|
|
98
|
-
/* @__PURE__ */ e(
|
|
99
|
-
d,
|
|
100
|
-
{
|
|
101
|
-
text: c,
|
|
102
|
-
className: "text-text-neutral-primary",
|
|
103
|
-
tooltipMessage: `Field: ${c}`
|
|
104
|
-
}
|
|
105
|
-
)
|
|
64
|
+
/* @__PURE__ */ e(i, { text: m, className: "text-text-neutral-primary" })
|
|
106
65
|
] }),
|
|
107
|
-
/* @__PURE__ */ e("div", { className: "ml-auto flex items-center gap-3", children:
|
|
108
|
-
|
|
66
|
+
/* @__PURE__ */ e("div", { className: "ml-auto flex items-center gap-3", children: o ? o(t, a) : /* @__PURE__ */ e(
|
|
67
|
+
b,
|
|
109
68
|
{
|
|
110
|
-
onClick: () =>
|
|
69
|
+
onClick: () => a == null ? void 0 : a(t.id),
|
|
111
70
|
variant: "ghost",
|
|
112
71
|
shade: "neutral",
|
|
113
72
|
size: "medium",
|
|
114
|
-
leftIcon: /* @__PURE__ */ e(
|
|
73
|
+
leftIcon: /* @__PURE__ */ e(N, { className: "w-4 h-4" })
|
|
115
74
|
}
|
|
116
75
|
) })
|
|
117
76
|
]
|
|
118
77
|
}
|
|
119
78
|
),
|
|
120
|
-
|
|
79
|
+
s.type === "is-dragging-over" && s.closestEdge && /* @__PURE__ */ e(k, { edge: s.closestEdge, isFirstElement: r === 0 })
|
|
121
80
|
] }),
|
|
122
|
-
|
|
81
|
+
s.type === "preview" && x(/* @__PURE__ */ e(v, { column: t }), s.container)
|
|
123
82
|
] });
|
|
124
83
|
};
|
|
125
84
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
85
|
+
T as ColumnItem,
|
|
86
|
+
T as default
|
|
128
87
|
};
|