impact-nova 2.5.0 → 2.5.2
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/data/data-table/build-column-state-from-tree.d.ts +7 -0
- package/dist/components/data/data-table/build-column-state-from-tree.js +34 -0
- package/dist/components/data/data-table/column-runtime-state-guard.d.ts +17 -0
- package/dist/components/data/data-table/column-runtime-state-guard.js +69 -0
- package/dist/components/data/data-table/data-table-column-apply.d.ts +4 -0
- package/dist/components/data/data-table/data-table-column-apply.js +82 -65
- package/dist/components/data/data-table/data-table-column-list-sync.d.ts +4 -3
- package/dist/components/data/data-table/data-table-column-list-sync.js +6 -5
- package/dist/components/data/data-table/data-table-column-list.js +34 -36
- package/dist/components/data/data-table/data-table-column-tree-cache.d.ts +6 -4
- package/dist/components/data/data-table/data-table-column-tree-cache.js +102 -69
- package/dist/components/data/data-table/data-table.js +66 -61
- package/dist/components/data/data-table/index.d.ts +1 -0
- package/dist/components/data/data-table/index.js +50 -44
- package/dist/components/data/data-table/patch-column-tree-visibility-from-grid.d.ts +3 -0
- package/dist/components/data/data-table/patch-column-tree-visibility-from-grid.js +35 -0
- package/dist/components/data/data-table/use-data-table-column-list-sync.d.ts +0 -1
- package/dist/components/data/data-table/use-data-table-column-list-sync.js +194 -263
- package/dist/components/data/nested-list/components/SortableItem.js +43 -42
- package/dist/components/data/nested-list/nested-list-tree-utils.d.ts +8 -0
- package/dist/components/data/nested-list/nested-list-tree-utils.js +38 -12
- package/dist/index.js +292 -286
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useSortable as
|
|
4
|
-
import { useDroppable as
|
|
5
|
-
import { Checkbox as
|
|
6
|
-
import { ChevronRight as
|
|
1
|
+
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import C, { useMemo as R } from "react";
|
|
3
|
+
import { useSortable as j } from "@dnd-kit/sortable";
|
|
4
|
+
import { useDroppable as _ } from "@dnd-kit/core";
|
|
5
|
+
import { Checkbox as H } from "../../../forms/checkbox/checkbox.js";
|
|
6
|
+
import { ChevronRight as D, Drag as $ } from "impact-nova-icons";
|
|
7
7
|
import { cn as d } from "../../../../lib/utils.js";
|
|
8
|
-
import { useImpactNovaI18n as
|
|
8
|
+
import { useImpactNovaI18n as v } from "../../../../i18n/use-impact-nova-i18n.js";
|
|
9
|
+
import { isNestedListSubtreeIndeterminate as E } from "../nested-list-tree-utils.js";
|
|
9
10
|
const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 items-center justify-center", O = "flex h-5 w-5 shrink-0 cursor-grab active:cursor-grabbing items-center justify-center rounded-sm text-content-icon transition-colors hover:bg-canvas-muted hover:text-content", P = (e, r) => {
|
|
10
11
|
const s = "group flex items-start gap-2 py-1 pr-2 rounded transition-colors duration-150 min-w-0";
|
|
11
12
|
return e ? d(s, "opacity-40 bg-canvas-muted") : r ? d(s, "bg-feedback-error-surface border border-destructive animate-pulse") : d(s, "hover:bg-canvas-muted");
|
|
12
13
|
}, G = ({ item: e, isAnyDragging: r, renderActions: s }) => {
|
|
13
|
-
const { t: n } =
|
|
14
|
+
const { t: n } = v(), a = !e.children || e.children.length === 0, {
|
|
14
15
|
setNodeRef: l,
|
|
15
16
|
isOver: o
|
|
16
|
-
} =
|
|
17
|
+
} = _({
|
|
17
18
|
id: `droppable-${e.id}`,
|
|
18
19
|
data: { sectionId: e.id },
|
|
19
20
|
disabled: !a
|
|
20
21
|
});
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ c("div", { ref: a ? l : void 0, children: [
|
|
23
|
+
/* @__PURE__ */ c(
|
|
23
24
|
"div",
|
|
24
25
|
{
|
|
25
26
|
className: d(
|
|
@@ -28,7 +29,7 @@ const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 i
|
|
|
28
29
|
o && r && a && "bg-canvas-tint rounded"
|
|
29
30
|
),
|
|
30
31
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
32
33
|
e.label,
|
|
33
34
|
o && r && a && /* @__PURE__ */ t("span", { className: "ml-2 text-brand text-[11px]", children: n("nestedList.dropHere") })
|
|
34
35
|
] }),
|
|
@@ -57,56 +58,56 @@ const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 i
|
|
|
57
58
|
isAnyDragging: o = !1,
|
|
58
59
|
enableDragDrop: N = !0,
|
|
59
60
|
enableCollapse: g = !0,
|
|
60
|
-
shouldBlink:
|
|
61
|
-
isDragDisabled:
|
|
62
|
-
renderLabelExtras:
|
|
63
|
-
renderActions:
|
|
61
|
+
shouldBlink: k = !1,
|
|
62
|
+
isDragDisabled: u = !1,
|
|
63
|
+
renderLabelExtras: f,
|
|
64
|
+
renderActions: m
|
|
64
65
|
}) => {
|
|
65
|
-
const { t: h } =
|
|
66
|
-
attributes:
|
|
67
|
-
listeners:
|
|
68
|
-
setNodeRef:
|
|
66
|
+
const { t: h } = v(), x = e.category === "structure", p = e.children && e.children.length > 0, b = !p && e.category !== "structure", L = R(() => !e.children || e.children.length === 0 ? !1 : E(e.children), [e.children]), {
|
|
67
|
+
attributes: y,
|
|
68
|
+
listeners: S,
|
|
69
|
+
setNodeRef: w,
|
|
69
70
|
isDragging: I
|
|
70
|
-
} =
|
|
71
|
+
} = j({
|
|
71
72
|
id: e.id,
|
|
72
73
|
data: {
|
|
73
74
|
level: r,
|
|
74
75
|
hasChildren: p,
|
|
75
76
|
isExpanded: !n
|
|
76
77
|
},
|
|
77
|
-
disabled:
|
|
78
|
+
disabled: x || e.disabled || u
|
|
78
79
|
});
|
|
79
|
-
return
|
|
80
|
+
return x ? /* @__PURE__ */ t(G, { item: e, isAnyDragging: o, renderActions: m }) : /* @__PURE__ */ t(
|
|
80
81
|
"div",
|
|
81
82
|
{
|
|
82
|
-
ref:
|
|
83
|
+
ref: w,
|
|
83
84
|
className: "relative",
|
|
84
85
|
"data-item-id": e.id,
|
|
85
86
|
"data-level": r,
|
|
86
87
|
"data-checked": e.checked,
|
|
87
88
|
"data-disabled": e.disabled,
|
|
88
89
|
"data-collapsed": n,
|
|
89
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ c(
|
|
90
91
|
"div",
|
|
91
92
|
{
|
|
92
|
-
className: P(I,
|
|
93
|
+
className: P(I, k),
|
|
93
94
|
style: {
|
|
94
95
|
paddingLeft: `${8 + s * 20}px`
|
|
95
96
|
},
|
|
96
97
|
children: [
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ c("div", { className: z, children: [
|
|
98
99
|
/* @__PURE__ */ t("div", { className: A, children: g && p && /* @__PURE__ */ t(
|
|
99
100
|
"button",
|
|
100
101
|
{
|
|
101
102
|
type: "button",
|
|
102
|
-
onClick: (
|
|
103
|
-
|
|
103
|
+
onClick: (i) => {
|
|
104
|
+
i.stopPropagation(), l(e.id);
|
|
104
105
|
},
|
|
105
|
-
onMouseDown: (
|
|
106
|
+
onMouseDown: (i) => i.stopPropagation(),
|
|
106
107
|
className: "flex h-4 w-4 items-center justify-center rounded-full p-0 hover:bg-canvas-muted transition-colors text-content-icon hover:text-brand",
|
|
107
108
|
"aria-label": h(n ? "nestedList.expand" : "nestedList.collapse"),
|
|
108
109
|
children: /* @__PURE__ */ t(
|
|
109
|
-
|
|
110
|
+
D,
|
|
110
111
|
{
|
|
111
112
|
size: "16px",
|
|
112
113
|
className: d("transition-transform", !n && "rotate-90")
|
|
@@ -115,21 +116,21 @@ const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 i
|
|
|
115
116
|
}
|
|
116
117
|
) }),
|
|
117
118
|
/* @__PURE__ */ t("div", { className: "flex h-5 w-4 shrink-0 items-center justify-center", children: /* @__PURE__ */ t(
|
|
118
|
-
|
|
119
|
+
H,
|
|
119
120
|
{
|
|
120
121
|
id: `checkbox-${e.id}`,
|
|
121
|
-
checked:
|
|
122
|
+
checked: L ? "indeterminate" : e.checked,
|
|
122
123
|
onCheckedChange: () => a(e.id),
|
|
123
124
|
disabled: e.disabled,
|
|
124
125
|
className: "mr-0",
|
|
125
126
|
"aria-label": e.label
|
|
126
127
|
}
|
|
127
128
|
) }),
|
|
128
|
-
N && !
|
|
129
|
+
N && !u ? /* @__PURE__ */ t(
|
|
129
130
|
"div",
|
|
130
131
|
{
|
|
131
|
-
...
|
|
132
|
-
...
|
|
132
|
+
...y,
|
|
133
|
+
...S,
|
|
133
134
|
"aria-label": `${h("aria.dragHandle")}: ${e.label}`,
|
|
134
135
|
className: O,
|
|
135
136
|
style: {
|
|
@@ -138,10 +139,10 @@ const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 i
|
|
|
138
139
|
zIndex: 30,
|
|
139
140
|
touchAction: "none"
|
|
140
141
|
},
|
|
141
|
-
onPointerDown: (
|
|
142
|
-
|
|
142
|
+
onPointerDown: (i) => {
|
|
143
|
+
i.stopPropagation();
|
|
143
144
|
},
|
|
144
|
-
children: /* @__PURE__ */ t(
|
|
145
|
+
children: /* @__PURE__ */ t($, { size: "14px" })
|
|
145
146
|
}
|
|
146
147
|
) : /* @__PURE__ */ t("div", { className: "w-5 shrink-0", "aria-hidden": !0 })
|
|
147
148
|
] }),
|
|
@@ -153,14 +154,14 @@ const z = "flex shrink-0 items-center h-5 gap-0.5", A = "flex h-5 w-4 shrink-0 i
|
|
|
153
154
|
children: /* @__PURE__ */ t("span", { className: "break-words", children: e.label })
|
|
154
155
|
}
|
|
155
156
|
),
|
|
156
|
-
|
|
157
|
-
/* @__PURE__ */ t("div", { className: "shrink-0 self-center flex items-center", children:
|
|
157
|
+
f?.(e, { isLeaf: b, level: r }) ? /* @__PURE__ */ t("div", { className: "shrink-0 self-center flex items-center", children: f(e, { isLeaf: b, level: r }) }) : null,
|
|
158
|
+
/* @__PURE__ */ t("div", { className: "shrink-0 self-center flex items-center", children: m?.(e, { isLeaf: b, level: r }) })
|
|
158
159
|
]
|
|
159
160
|
}
|
|
160
161
|
)
|
|
161
162
|
}
|
|
162
163
|
);
|
|
163
|
-
}, W =
|
|
164
|
+
}, W = C.memo(M);
|
|
164
165
|
export {
|
|
165
166
|
O as DRAG_HANDLE_CLASS,
|
|
166
167
|
z as LEADING_RAIL_CLASS,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { NestedListItem } from './nested-list.types';
|
|
2
|
+
export interface NestedListSubtreeLeafSelection {
|
|
3
|
+
totalLeafCount: number;
|
|
4
|
+
checkedLeafCount: number;
|
|
5
|
+
}
|
|
6
|
+
/** Counts selectable leaves under a subtree (skips structure section nodes). */
|
|
7
|
+
export declare function computeNestedListSubtreeLeafSelection(items: NestedListItem[]): NestedListSubtreeLeafSelection;
|
|
8
|
+
/** True when some but not all selectable leaves in the subtree are checked. */
|
|
9
|
+
export declare function isNestedListSubtreeIndeterminate(items: NestedListItem[]): boolean;
|
|
2
10
|
export declare function countNestedListLeaves(items: NestedListItem[]): number;
|
|
3
11
|
export declare function buildCollapsedStateForAllGroups(items: NestedListItem[]): Record<string, boolean>;
|
|
@@ -1,24 +1,50 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
function i(n) {
|
|
2
|
+
return !!(n.category === "group" || n.children && n.children.length > 0);
|
|
3
|
+
}
|
|
4
|
+
function l(n) {
|
|
5
|
+
let c = 0, t = 0;
|
|
6
|
+
const o = (e) => {
|
|
7
|
+
for (const r of e) {
|
|
8
|
+
if (r.category === "structure") {
|
|
9
|
+
r.children && r.children.length > 0 && o(r.children);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (i(r) && r.children) {
|
|
13
|
+
o(r.children);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
c += 1, r.checked && (t += 1);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return o(n), { totalLeafCount: c, checkedLeafCount: t };
|
|
20
|
+
}
|
|
21
|
+
function u(n) {
|
|
22
|
+
const { totalLeafCount: c, checkedLeafCount: t } = l(n);
|
|
23
|
+
return c === 0 ? !1 : t > 0 && t < c;
|
|
24
|
+
}
|
|
25
|
+
function d(n) {
|
|
26
|
+
let c = 0;
|
|
27
|
+
const t = (o) => {
|
|
4
28
|
for (const e of o)
|
|
5
|
-
e.children && e.children.length > 0 ?
|
|
29
|
+
e.children && e.children.length > 0 ? t(e.children) : c += 1;
|
|
6
30
|
};
|
|
7
|
-
return n
|
|
31
|
+
return t(n), c;
|
|
8
32
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
33
|
+
function s(n) {
|
|
34
|
+
const c = {}, t = (o) => {
|
|
11
35
|
for (const e of o) {
|
|
12
36
|
if (e.category === "structure") {
|
|
13
|
-
e.children && e.children.length > 0 &&
|
|
37
|
+
e.children && e.children.length > 0 && t(e.children);
|
|
14
38
|
continue;
|
|
15
39
|
}
|
|
16
|
-
e.children && e.children.length > 0 && (
|
|
40
|
+
e.children && e.children.length > 0 && (c[e.id] = !0, t(e.children));
|
|
17
41
|
}
|
|
18
42
|
};
|
|
19
|
-
return n
|
|
43
|
+
return t(n), c;
|
|
20
44
|
}
|
|
21
45
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
46
|
+
s as buildCollapsedStateForAllGroups,
|
|
47
|
+
l as computeNestedListSubtreeLeafSelection,
|
|
48
|
+
d as countNestedListLeaves,
|
|
49
|
+
u as isNestedListSubtreeIndeterminate
|
|
24
50
|
};
|