@dcs-tech/ui 0.9.0 → 0.10.0
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/CHANGELOG.md +126 -0
- package/README.md +40 -5
- package/dist/{ChartImageMenu-DDVNJNc6.js → ChartImageMenu-3OfqNFyt.js} +557 -546
- package/dist/{ChartView-CW3m4Z_1.js → ChartView-n4G5_2ro.js} +35 -31
- package/dist/{SummaryChart-CxRjK_HU.js → SummaryChart-i6fOdrDM.js} +2 -2
- package/dist/{SummaryImage-Crf1R-3a.js → SummaryImage-CCt5ozD9.js} +2 -2
- package/dist/{SummarySeeAll-BRHOMQRA.js → SummarySeeAll-BY8knsRe.js} +5 -5
- package/dist/{columnValue-DwUqueZ6.js → columnValue-74XDBcVF.js} +219 -192
- package/dist/{exportContext-BKFnNQ0q.js → exportContext-C52ZuHd8.js} +2 -2
- package/dist/{exportEngine-BFZD6djX.js → exportEngine-BmDly7iw.js} +1 -1
- package/dist/{geometry-yZmKN662.js → geometry-DG134nYI.js} +379 -273
- package/dist/index.js +12456 -9277
- package/dist/{labels-CnqqTrne.js → labels-BPItSeRU.js} +2 -0
- package/dist/scrollArea-D84Cwm4o.js +310 -0
- package/dist/style.css +1 -1
- package/dist/{summaryChartData-CARqGRUl.js → summaryChartData-BiQYJbYZ.js} +8 -2
- package/dist/types/components/Alert/Alert.d.ts +16 -0
- package/dist/types/components/Alert/index.d.ts +2 -0
- package/dist/types/components/Card/Card.d.ts +4 -3
- package/dist/types/components/Card/index.d.ts +1 -1
- package/dist/types/components/Charts/Funnel.d.ts +2 -1
- package/dist/types/components/Charts/chartImage.d.ts +1 -0
- package/dist/types/components/ChipInput/ChipTags.d.ts +3 -0
- package/dist/types/components/CommandPalette/CommandPaletteTrigger.d.ts +9 -0
- package/dist/types/components/CommandPalette/index.d.ts +2 -0
- package/dist/types/components/DataTable/TablePagination.d.ts +1 -1
- package/dist/types/components/DataTable/TableToolbar.d.ts +2 -1
- package/dist/types/components/DataTable/TableView.d.ts +1 -0
- package/dist/types/components/DataTable/cards/cardFields.d.ts +1 -0
- package/dist/types/components/DataTable/defaults.d.ts +4 -0
- package/dist/types/components/DataTable/index.d.ts +1 -1
- package/dist/types/components/DataTable/labels.d.ts +2 -0
- package/dist/types/components/DataTable/types.d.ts +18 -2
- package/dist/types/components/DataTable/ui-local/TableReorderList.d.ts +13 -0
- package/dist/types/components/DataTable/ui.d.ts +2 -1
- package/dist/types/components/DataTable/useTable.d.ts +1 -0
- package/dist/types/components/DatePicker/PeriodGrid.d.ts +13 -0
- package/dist/types/components/DatePicker/PeriodPicker.d.ts +19 -0
- package/dist/types/components/DatePicker/index.d.ts +1 -1
- package/dist/types/components/Dialog/dialogSlots.d.ts +9 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +8 -0
- package/dist/types/components/FieldWrapper/index.d.ts +1 -1
- package/dist/types/components/Fields/index.d.ts +1 -1
- package/dist/types/components/Image/ImageEditor.d.ts +21 -0
- package/dist/types/components/Image/ImagePicker.d.ts +10 -1
- package/dist/types/components/Image/imageRender.d.ts +33 -0
- package/dist/types/components/Image/index.d.ts +3 -1
- package/dist/types/components/Image/prepareImage.d.ts +4 -3
- package/dist/types/components/Link/Link.d.ts +22 -0
- package/dist/types/components/Link/index.d.ts +2 -0
- package/dist/types/components/NavList/NavList.d.ts +13 -0
- package/dist/types/components/NavList/index.d.ts +2 -0
- package/dist/types/components/PageProgress/PageProgress.d.ts +10 -0
- package/dist/types/components/PageProgress/index.d.ts +2 -0
- package/dist/types/components/Pagination/Pagination.d.ts +19 -0
- package/dist/types/components/Pagination/index.d.ts +2 -0
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Popover/floatingPosition.d.ts +4 -0
- package/dist/types/components/ReorderList/ReorderGroup.d.ts +16 -0
- package/dist/types/components/ReorderList/ReorderList.d.ts +55 -0
- package/dist/types/components/ReorderList/crossListDrag.d.ts +61 -0
- package/dist/types/components/ReorderList/index.d.ts +5 -0
- package/dist/types/components/ReorderList/useReorderDrag.d.ts +28 -0
- package/dist/types/components/Tooltip/useTooltip.d.ts +4 -0
- package/dist/types/components/UIProvider/UILabelsContext.d.ts +86 -0
- package/dist/types/core/hooks/index.d.ts +1 -0
- package/dist/types/core/hooks/useMeasuredState.d.ts +1 -0
- package/dist/types/core/logic/alert.logic.d.ts +3 -0
- package/dist/types/core/logic/commandPalette.logic.d.ts +2 -0
- package/dist/types/core/logic/datePicker.logic.d.ts +12 -0
- package/dist/types/core/logic/fieldWrapper.logic.d.ts +6 -1
- package/dist/types/core/logic/imageEditor.logic.d.ts +132 -0
- package/dist/types/core/logic/imageTransform.logic.d.ts +57 -0
- package/dist/types/core/logic/index.d.ts +9 -0
- package/dist/types/core/logic/inertProps.d.ts +3 -0
- package/dist/types/core/logic/pageProgress.logic.d.ts +3 -0
- package/dist/types/core/logic/pagination.logic.d.ts +7 -0
- package/dist/types/core/logic/periodPicker.logic.d.ts +86 -0
- package/dist/types/core/logic/reorder.logic.d.ts +49 -0
- package/dist/types/core/types/chipinput.types.d.ts +3 -1
- package/dist/types/core/types/collapsible.types.d.ts +3 -0
- package/dist/types/core/types/datePicker.types.d.ts +7 -0
- package/dist/types/core/types/field.types.d.ts +6 -3
- package/dist/types/core/types/fieldWrapper.types.d.ts +2 -0
- package/dist/types/core/types/fields.types.d.ts +6 -1
- package/dist/types/core/types/form.types.d.ts +1 -0
- package/dist/types/core/types/format.types.d.ts +2 -0
- package/dist/types/core/types/input.types.d.ts +2 -0
- package/dist/types/core/types/navigation.types.d.ts +1 -0
- package/dist/types/core/types/select.types.d.ts +2 -6
- package/dist/types/core/types/suggest.types.d.ts +2 -0
- package/dist/types/index.d.ts +24 -6
- package/package.json +1 -1
- package/dist/scrollArea-DbYFqbIH.js +0 -269
- package/dist/types/components/DataTable/ui-local/DragAndDropList/DragAndDropList.d.ts +0 -4
- package/dist/types/components/DataTable/ui-local/DragAndDropList/index.d.ts +0 -3
- package/dist/types/components/DataTable/ui-local/DragAndDropList/types.d.ts +0 -70
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Nn as e, wn as t } from "./geometry-yZmKN662.js";
|
|
3
|
-
import { n, t as r } from "./labels-CnqqTrne.js";
|
|
4
|
-
import { createContext as i, useCallback as ee, useContext as a, useEffect as o, useId as te, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
5
|
-
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
6
|
-
import { createPortal as ne } from "react-dom";
|
|
7
|
-
// src/components/Dialog/dialogOpen.tsx
|
|
8
|
-
var p = i(null), m = i(0), h = ({ children: e }) => {
|
|
9
|
-
let [t, n] = u(0), r = c(() => () => {
|
|
10
|
-
n((e) => e + 1);
|
|
11
|
-
let e = !1;
|
|
12
|
-
return () => {
|
|
13
|
-
e || (e = !0, n((e) => e - 1));
|
|
14
|
-
};
|
|
15
|
-
}, []);
|
|
16
|
-
return /* @__PURE__ */ d(p.Provider, {
|
|
17
|
-
value: r,
|
|
18
|
-
children: /* @__PURE__ */ d(m.Provider, {
|
|
19
|
-
value: t,
|
|
20
|
-
children: e
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
function g(e) {
|
|
25
|
-
let t = a(p);
|
|
26
|
-
o(() => e && t ? t() : void 0, [e, t]);
|
|
27
|
-
}
|
|
28
|
-
var _ = () => a(m), v = () => a(m) > 0, y = {
|
|
29
|
-
root: "_root_1rswg_7",
|
|
30
|
-
nonModal: "_nonModal_1rswg_30",
|
|
31
|
-
panel: "_panel_1rswg_3",
|
|
32
|
-
center: "_center_1rswg_41",
|
|
33
|
-
right: "_right_1rswg_42",
|
|
34
|
-
left: "_left_1rswg_43",
|
|
35
|
-
top: "_top_1rswg_44",
|
|
36
|
-
bottom: "_bottom_1rswg_45",
|
|
37
|
-
sm: "_sm_1rswg_86",
|
|
38
|
-
md: "_md_1rswg_87",
|
|
39
|
-
lg: "_lg_1rswg_88",
|
|
40
|
-
xl: "_xl_1rswg_89",
|
|
41
|
-
full: "_full_1rswg_90",
|
|
42
|
-
header: "_header_1rswg_96",
|
|
43
|
-
headText: "_headText_1rswg_106",
|
|
44
|
-
title: "_title_1rswg_108",
|
|
45
|
-
subtitle: "_subtitle_1rswg_114",
|
|
46
|
-
body: "_body_1rswg_120",
|
|
47
|
-
flush: "_flush_1rswg_128",
|
|
48
|
-
footer: "_footer_1rswg_130",
|
|
49
|
-
close: "_close_1rswg_141",
|
|
50
|
-
dialogPop: "_dialogPop_1rswg_1",
|
|
51
|
-
slideFromRight: "_slideFromRight_1rswg_1",
|
|
52
|
-
slideFromLeft: "_slideFromLeft_1rswg_1",
|
|
53
|
-
slideFromTop: "_slideFromTop_1rswg_1",
|
|
54
|
-
slideFromBottom: "_slideFromBottom_1rswg_1",
|
|
55
|
-
backdropIn: "_backdropIn_1rswg_1",
|
|
56
|
-
closing: "_closing_1rswg_168"
|
|
57
|
-
}, b = 0, x = null, re = (e) => {
|
|
58
|
-
if (typeof document < "u") {
|
|
59
|
-
if (b === 0) {
|
|
60
|
-
let t = document.body;
|
|
61
|
-
x = {
|
|
62
|
-
overflow: t.style.overflow,
|
|
63
|
-
paddingRight: t.style.paddingRight
|
|
64
|
-
};
|
|
65
|
-
let n = window.innerWidth - document.documentElement.clientWidth;
|
|
66
|
-
if (e && n > 0) {
|
|
67
|
-
let e = parseFloat(window.getComputedStyle(t).paddingRight) || 0;
|
|
68
|
-
t.style.paddingRight = `${e + n}px`;
|
|
69
|
-
}
|
|
70
|
-
t.style.overflow = "hidden";
|
|
71
|
-
}
|
|
72
|
-
b += 1;
|
|
73
|
-
}
|
|
74
|
-
}, ie = () => {
|
|
75
|
-
typeof document < "u" && (b = Math.max(0, b - 1), b === 0 && x && (document.body.style.overflow = x.overflow, document.body.style.paddingRight = x.paddingRight, x = null));
|
|
76
|
-
}, S = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, ae = /* @__PURE__ */ f("svg", {
|
|
77
|
-
width: "16",
|
|
78
|
-
height: "16",
|
|
79
|
-
viewBox: "0 0 24 24",
|
|
80
|
-
fill: "none",
|
|
81
|
-
stroke: "currentColor",
|
|
82
|
-
strokeWidth: "2",
|
|
83
|
-
strokeLinecap: "round",
|
|
84
|
-
"aria-hidden": "true",
|
|
85
|
-
children: [/* @__PURE__ */ d("line", {
|
|
86
|
-
x1: "18",
|
|
87
|
-
y1: "6",
|
|
88
|
-
x2: "6",
|
|
89
|
-
y2: "18"
|
|
90
|
-
}), /* @__PURE__ */ d("line", {
|
|
91
|
-
x1: "6",
|
|
92
|
-
y1: "6",
|
|
93
|
-
x2: "18",
|
|
94
|
-
y2: "18"
|
|
95
|
-
})]
|
|
96
|
-
}), oe = 0, C = "button:not([disabled]),a[href],input:not([disabled]):not([type=\"hidden\"]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"]),[contenteditable=\"true\"]", w = ({ open: n, onClose: r, onBeforeClose: i, onEscKeyDown: a, onOverlayClick: c, onAnimationEnd: p, children: m, title: h, subtitle: _, footer: v, modal: b = !0, placement: x = "center", size: w = "md", closeOnBackdrop: T = !0, closeOnEscape: E = !0, showCloseButton: D = !0, closeIcon: O, closeIconId: k, blockScroll: A = !0, reserveScrollBarGap: j = !0, initialFocusRef: M, container: se, animationDuration: ce = 200, padded: le = !0, classNames: N = {}, styleSlots: P = {}, className: ue = "", style: de, role: fe = "dialog", id: pe, "aria-label": F, "aria-labelledby": I, "aria-describedby": L }) => {
|
|
97
|
-
let R = e(), z = l(null), [me, he] = u(null), B = te(), [V, H] = u(n), [ge, U] = u(!1), [W, G] = u(!1), K = l(null), q = l(n);
|
|
98
|
-
q.current = n;
|
|
99
|
-
let J = l(null), Y = S() ? 0 : ce;
|
|
100
|
-
g(V), o(() => {
|
|
101
|
-
n ? (J.current &&= (clearTimeout(J.current), null), U(!1), H(!0)) : V && (U(!0), J.current = setTimeout(() => {
|
|
102
|
-
z.current?.close(), H(!1), G(!1), U(!1), p?.();
|
|
103
|
-
}, Y));
|
|
104
|
-
}, [n]), o(() => () => {
|
|
105
|
-
J.current && clearTimeout(J.current);
|
|
106
|
-
}, []);
|
|
107
|
-
let X = ee(() => {
|
|
108
|
-
i && i() === !1 || r?.();
|
|
109
|
-
}, [i, r]);
|
|
110
|
-
s(() => {
|
|
111
|
-
let e = z.current;
|
|
112
|
-
if (e && V) {
|
|
113
|
-
if (!e.open) {
|
|
114
|
-
let t = document.activeElement;
|
|
115
|
-
K.current = t instanceof HTMLElement && t !== document.body ? t : null, b && (e.dataset.modalOrder = String(++oe)), b ? e.showModal() : e.show();
|
|
116
|
-
}
|
|
117
|
-
G(!0);
|
|
118
|
-
}
|
|
119
|
-
}, [V, b]), s(() => {
|
|
120
|
-
let e = z.current;
|
|
121
|
-
if (!e || !W) return;
|
|
122
|
-
if (M?.current) {
|
|
123
|
-
M.current.focus({ focusVisible: !0 });
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
let t = document.activeElement;
|
|
127
|
-
t && t !== e && e.contains(t) || e.querySelector(C)?.focus();
|
|
128
|
-
}, [W]), s(() => () => {
|
|
129
|
-
let e = z.current, t = K.current;
|
|
130
|
-
if (!e?.open || !t) return;
|
|
131
|
-
let n = document.activeElement;
|
|
132
|
-
(!n || n === document.body || e.contains(n)) && queueMicrotask(() => {
|
|
133
|
-
let e = document.activeElement;
|
|
134
|
-
t.isConnected && (!e || e === document.body) && t.focus({ preventScroll: !0 });
|
|
135
|
-
});
|
|
136
|
-
}, []), o(() => {
|
|
137
|
-
if (V && A && b) return re(j), () => ie();
|
|
138
|
-
}, [
|
|
139
|
-
V,
|
|
140
|
-
b,
|
|
141
|
-
A,
|
|
142
|
-
j
|
|
143
|
-
]), o(() => {
|
|
144
|
-
let e = z.current;
|
|
145
|
-
if (!e || !V) return;
|
|
146
|
-
let t = (t) => {
|
|
147
|
-
t.key !== "Escape" || t.defaultPrevented || t.isComposing || t.target instanceof Node && e.contains(t.target) && (t.preventDefault(), a?.(t), E && X());
|
|
148
|
-
}, n = (e) => {
|
|
149
|
-
e.preventDefault(), a?.(e), E && X();
|
|
150
|
-
}, r = () => {
|
|
151
|
-
q.current && !e.open && e.isConnected && (b ? e.showModal() : e.show(), e.querySelector(C)?.focus());
|
|
152
|
-
}, i = e.ownerDocument.defaultView ?? window;
|
|
153
|
-
return i.addEventListener("keydown", t), e.addEventListener("cancel", n), e.addEventListener("close", r), () => {
|
|
154
|
-
i.removeEventListener("keydown", t), e.removeEventListener("cancel", n), e.removeEventListener("close", r);
|
|
155
|
-
};
|
|
156
|
-
}, [
|
|
157
|
-
V,
|
|
158
|
-
b,
|
|
159
|
-
E,
|
|
160
|
-
X,
|
|
161
|
-
a
|
|
162
|
-
]);
|
|
163
|
-
let Z = l(!1), _e = (e) => {
|
|
164
|
-
Z.current = e.target === z.current;
|
|
165
|
-
}, Q = (e) => {
|
|
166
|
-
let t = Z.current && e.target === z.current;
|
|
167
|
-
Z.current = !1, t && (c?.(e), T && X());
|
|
168
|
-
};
|
|
169
|
-
if (!V) return null;
|
|
170
|
-
let ve = h !== void 0 || _ !== void 0 || D, ye = I ?? (h !== void 0 && !F ? B : void 0), be = /* @__PURE__ */ d("dialog", {
|
|
171
|
-
ref: (e) => {
|
|
172
|
-
z.current = e, he(e);
|
|
173
|
-
},
|
|
174
|
-
id: pe,
|
|
175
|
-
"data-modal": b ? "" : void 0,
|
|
176
|
-
className: [
|
|
177
|
-
y.root,
|
|
178
|
-
y[x],
|
|
179
|
-
y[w],
|
|
180
|
-
b ? "" : y.nonModal,
|
|
181
|
-
ge ? y.closing : "",
|
|
182
|
-
N.root,
|
|
183
|
-
ue
|
|
184
|
-
].filter(Boolean).join(" "),
|
|
185
|
-
style: {
|
|
186
|
-
"--dialog-anim": `${Y}ms`,
|
|
187
|
-
...P.root,
|
|
188
|
-
...de
|
|
189
|
-
},
|
|
190
|
-
role: fe,
|
|
191
|
-
"aria-label": F,
|
|
192
|
-
"aria-labelledby": ye,
|
|
193
|
-
"aria-describedby": L,
|
|
194
|
-
"aria-modal": b || void 0,
|
|
195
|
-
onPointerDown: _e,
|
|
196
|
-
onPointerUp: Q,
|
|
197
|
-
children: /* @__PURE__ */ d(t.Provider, {
|
|
198
|
-
value: me,
|
|
199
|
-
children: W && /* @__PURE__ */ f("div", {
|
|
200
|
-
className: [y.panel, N.panel].filter(Boolean).join(" "),
|
|
201
|
-
style: P.panel,
|
|
202
|
-
children: [
|
|
203
|
-
ve && /* @__PURE__ */ f("div", {
|
|
204
|
-
className: [y.header, N.header].filter(Boolean).join(" "),
|
|
205
|
-
style: P.header,
|
|
206
|
-
children: [/* @__PURE__ */ f("span", {
|
|
207
|
-
className: y.headText,
|
|
208
|
-
children: [h !== void 0 && /* @__PURE__ */ d("span", {
|
|
209
|
-
className: y.title,
|
|
210
|
-
id: B,
|
|
211
|
-
children: h
|
|
212
|
-
}), _ !== void 0 && /* @__PURE__ */ d("span", {
|
|
213
|
-
className: y.subtitle,
|
|
214
|
-
children: _
|
|
215
|
-
})]
|
|
216
|
-
}), D && /* @__PURE__ */ d("button", {
|
|
217
|
-
type: "button",
|
|
218
|
-
id: k,
|
|
219
|
-
className: [y.close, N.closeButton].filter(Boolean).join(" "),
|
|
220
|
-
style: P.closeButton,
|
|
221
|
-
onClick: X,
|
|
222
|
-
"aria-label": R.dialog.close,
|
|
223
|
-
children: O ?? ae
|
|
224
|
-
})]
|
|
225
|
-
}),
|
|
226
|
-
m !== void 0 && /* @__PURE__ */ d("div", {
|
|
227
|
-
className: [
|
|
228
|
-
y.body,
|
|
229
|
-
le ? "scroll-fade-y scroll-gutter" : `${y.flush} scroll-fade-y`,
|
|
230
|
-
N.body
|
|
231
|
-
].filter(Boolean).join(" "),
|
|
232
|
-
style: P.body,
|
|
233
|
-
children: m
|
|
234
|
-
}),
|
|
235
|
-
v !== void 0 && /* @__PURE__ */ d("div", {
|
|
236
|
-
className: [y.footer, N.footer].filter(Boolean).join(" "),
|
|
237
|
-
style: P.footer,
|
|
238
|
-
children: v
|
|
239
|
-
})
|
|
240
|
-
]
|
|
241
|
-
})
|
|
242
|
-
})
|
|
243
|
-
}), $ = se ?? (typeof document > "u" ? null : document.body);
|
|
244
|
-
return $ ? ne(be, $) : null;
|
|
245
|
-
};
|
|
246
|
-
w.displayName = "Dialog";
|
|
247
|
-
var T = i({
|
|
248
|
-
authorize: () => !0,
|
|
249
|
-
exportOptions: {},
|
|
250
|
-
serverMode: !1,
|
|
251
|
-
labels: r,
|
|
252
|
-
format: n(),
|
|
253
|
-
text: {
|
|
254
|
-
yes: r.yes,
|
|
255
|
-
no: r.no
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
function E() {
|
|
259
|
-
return a(T);
|
|
260
|
-
}
|
|
261
|
-
function D() {
|
|
262
|
-
return a(T).labels;
|
|
263
|
-
}
|
|
264
|
-
function O(e, t, n) {
|
|
265
|
-
return !e || e(t, n) !== !1;
|
|
266
|
-
}
|
|
267
|
-
// src/components/DataTable/layout/scrollArea.ts
|
|
268
|
-
var k = "dt-scroll-area scroll-fade-y scroll-gutter", A = "dt-scroll-area scroll-fade-x scroll-fade-y scroll-gutter";
|
|
269
|
-
export { D as a, h as c, O as i, v as l, k as n, E as o, T as r, w as s, A as t, _ as u };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DragAndDropListProps, type DragAndDropItem } from './types';
|
|
3
|
-
import './DragAndDropList.css';
|
|
4
|
-
export default function DragAndDropList<T = DragAndDropItem>({ state, setState, renderKeys, onReorder, renderItem, getItemKey, className, showDragHandle, isItemDraggable, dragHandleProps, emptyMessage, showManualButtons, showSerialNumber, maxHeight, enableScrolling }: DragAndDropListProps<T>): React.JSX.Element;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode, type MouseEvent, type TouchEvent, type DragEvent } from 'react';
|
|
2
|
-
export type DragAndDropItem = any;
|
|
3
|
-
export type GetItemKeyFn<T = DragAndDropItem> = (item: T, index: number) => string | number;
|
|
4
|
-
export type IsItemDraggableFn<T = DragAndDropItem> = (item: T, index: number) => boolean;
|
|
5
|
-
export type OnReorderFn<T = DragAndDropItem> = (newItems: T[]) => void;
|
|
6
|
-
export type RenderItemFn<T = DragAndDropItem> = (item: T, index: number, isDragging: boolean, isDragOver: boolean, dragHandle: ReactNode, moveItem: (fromIndex: number, toIndex: number) => void) => ReactNode;
|
|
7
|
-
export interface DragHandleProps {
|
|
8
|
-
className?: string;
|
|
9
|
-
style?: CSSProperties;
|
|
10
|
-
title?: string;
|
|
11
|
-
'aria-label'?: string;
|
|
12
|
-
onClick?: (e: MouseEvent<HTMLSpanElement>) => void;
|
|
13
|
-
onMouseDown?: (e: MouseEvent<HTMLSpanElement>) => void;
|
|
14
|
-
}
|
|
15
|
-
export interface DragAndDropListProps<T = DragAndDropItem> {
|
|
16
|
-
state: T[];
|
|
17
|
-
setState?: (items: T[]) => void;
|
|
18
|
-
renderKeys?: string | string[];
|
|
19
|
-
onReorder?: OnReorderFn<T>;
|
|
20
|
-
renderItem?: RenderItemFn<T>;
|
|
21
|
-
getItemKey?: GetItemKeyFn<T>;
|
|
22
|
-
className?: string;
|
|
23
|
-
showDragHandle?: boolean;
|
|
24
|
-
isItemDraggable?: IsItemDraggableFn<T>;
|
|
25
|
-
dragHandleProps?: DragHandleProps;
|
|
26
|
-
emptyMessage?: string;
|
|
27
|
-
showManualButtons?: boolean;
|
|
28
|
-
showSerialNumber?: boolean;
|
|
29
|
-
maxHeight?: string | number;
|
|
30
|
-
enableScrolling?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface DragAndDropState {
|
|
33
|
-
draggedIndex: number | null;
|
|
34
|
-
dragOverIndex: number | null;
|
|
35
|
-
isDragging: boolean;
|
|
36
|
-
touchStartY: number | null;
|
|
37
|
-
touchCurrentY: number | null;
|
|
38
|
-
touchStartX: number | null;
|
|
39
|
-
isDragReady: boolean;
|
|
40
|
-
touchStartTime: number | null;
|
|
41
|
-
}
|
|
42
|
-
export type AutoScrollDirection = 'up' | 'down';
|
|
43
|
-
export interface TouchEventData {
|
|
44
|
-
clientX: number;
|
|
45
|
-
clientY: number;
|
|
46
|
-
startY: number;
|
|
47
|
-
startX: number;
|
|
48
|
-
startTime: number;
|
|
49
|
-
}
|
|
50
|
-
export interface DragEventHandlers {
|
|
51
|
-
handleDragStart: (e: DragEvent<HTMLDivElement>, index: number) => void;
|
|
52
|
-
handleDragEnd: () => void;
|
|
53
|
-
handleDragOver: (e: DragEvent<HTMLDivElement>) => void;
|
|
54
|
-
handleDragEnter: (e: DragEvent<HTMLDivElement>, index: number) => void;
|
|
55
|
-
handleDragLeave: (e: DragEvent<HTMLDivElement>) => void;
|
|
56
|
-
handleDrop: (e: DragEvent<HTMLDivElement>, dropIndex: number) => void;
|
|
57
|
-
}
|
|
58
|
-
export interface TouchEventHandlers {
|
|
59
|
-
handleTouchStart: (e: TouchEvent<HTMLDivElement>, index: number) => void;
|
|
60
|
-
handleTouchMove: (e: TouchEvent<HTMLDivElement>) => void;
|
|
61
|
-
handleTouchEnd: () => void;
|
|
62
|
-
}
|
|
63
|
-
export interface ItemRenderContext<T = DragAndDropItem> {
|
|
64
|
-
item: T;
|
|
65
|
-
index: number;
|
|
66
|
-
isCurrentDragging: boolean;
|
|
67
|
-
isCurrentDragOver: boolean;
|
|
68
|
-
isDraggable: boolean;
|
|
69
|
-
itemKey: string | number;
|
|
70
|
-
}
|