koddiv-dyn-table 0.1.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/README.md +491 -0
- package/dist/App.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +3 -0
- package/dist/components/Table/Table.types.d.ts +195 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/utils.d.ts +5 -0
- package/dist/components/Table/valueFormats.d.ts +3 -0
- package/dist/components/TableFormatters/TableFormatters.d.ts +12 -0
- package/dist/components/TableFormatters/index.d.ts +2 -0
- package/dist/components/TableRowActions/TableRowActions.d.ts +15 -0
- package/dist/components/TableRowActions/index.d.ts +2 -0
- package/dist/dyn-table.js +1387 -0
- package/dist/dyn-table.js.map +1 -0
- package/dist/dyn-table.umd.cjs +2 -0
- package/dist/dyn-table.umd.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/main.d.ts +1 -0
- package/dist/style.css +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,1387 @@
|
|
|
1
|
+
import { jsx as t, jsxs as o, Fragment as $t } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
function j(s) {
|
|
4
|
+
if (s == null) return;
|
|
5
|
+
if (typeof s == "number") return s;
|
|
6
|
+
const u = parseFloat(s);
|
|
7
|
+
return Number.isNaN(u) ? void 0 : u;
|
|
8
|
+
}
|
|
9
|
+
function X(s, u) {
|
|
10
|
+
if (u.valueGetter) return u.valueGetter(s);
|
|
11
|
+
if (u.accessorKey === void 0) return;
|
|
12
|
+
const h = u.accessorKey;
|
|
13
|
+
return s[h];
|
|
14
|
+
}
|
|
15
|
+
const on = "tr-TR";
|
|
16
|
+
function He(s) {
|
|
17
|
+
if (s == null) return null;
|
|
18
|
+
if (s instanceof Date) return s;
|
|
19
|
+
const u = typeof s == "number" ? s : Number(s);
|
|
20
|
+
if (!Number.isNaN(u)) return new Date(u);
|
|
21
|
+
const h = String(s).trim();
|
|
22
|
+
if (!h) return null;
|
|
23
|
+
const g = new Date(h);
|
|
24
|
+
return Number.isNaN(g.getTime()) ? null : g;
|
|
25
|
+
}
|
|
26
|
+
function Ee(s, u, h = {}) {
|
|
27
|
+
const g = h.locale ?? on;
|
|
28
|
+
switch (u) {
|
|
29
|
+
case "date": {
|
|
30
|
+
const f = He(s);
|
|
31
|
+
return f ? h.dateStyle != null ? f.toLocaleDateString(g, { dateStyle: h.dateStyle }) : f.toLocaleDateString(g, {
|
|
32
|
+
day: "2-digit",
|
|
33
|
+
month: "2-digit",
|
|
34
|
+
year: "numeric"
|
|
35
|
+
}) : s != null ? String(s) : "—";
|
|
36
|
+
}
|
|
37
|
+
case "datetime": {
|
|
38
|
+
const f = He(s);
|
|
39
|
+
return f ? f.toLocaleString(g, {
|
|
40
|
+
dateStyle: h.dateStyle ?? "short",
|
|
41
|
+
timeStyle: h.timeStyle ?? "short"
|
|
42
|
+
}) : s != null ? String(s) : "—";
|
|
43
|
+
}
|
|
44
|
+
case "time": {
|
|
45
|
+
const f = He(s);
|
|
46
|
+
return f ? f.toLocaleTimeString(g, {
|
|
47
|
+
timeStyle: h.timeStyle ?? "short"
|
|
48
|
+
}) : s != null ? String(s) : "—";
|
|
49
|
+
}
|
|
50
|
+
case "number": {
|
|
51
|
+
const f = typeof s == "number" ? s : Number(s);
|
|
52
|
+
return Number.isNaN(f) ? s != null ? String(s) : "—" : f.toLocaleString(g, {
|
|
53
|
+
minimumFractionDigits: h.minimumFractionDigits,
|
|
54
|
+
maximumFractionDigits: h.maximumFractionDigits ?? 2
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
case "currency": {
|
|
58
|
+
const f = typeof s == "number" ? s : Number(s);
|
|
59
|
+
return Number.isNaN(f) ? s != null ? String(s) : "—" : f.toLocaleString(g, {
|
|
60
|
+
style: "currency",
|
|
61
|
+
currency: h.currency ?? "TRY",
|
|
62
|
+
minimumFractionDigits: h.minimumFractionDigits,
|
|
63
|
+
maximumFractionDigits: h.maximumFractionDigits ?? 2
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
case "percent": {
|
|
67
|
+
const f = typeof s == "number" ? s : Number(s);
|
|
68
|
+
return Number.isNaN(f) ? s != null ? String(s) : "—" : f.toLocaleString(g, {
|
|
69
|
+
style: "percent",
|
|
70
|
+
minimumFractionDigits: h.minimumFractionDigits,
|
|
71
|
+
maximumFractionDigits: h.maximumFractionDigits ?? 2
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
return s != null ? String(s) : "—";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const un = {
|
|
79
|
+
status: { active: "Aktif", inactive: "Pasif" },
|
|
80
|
+
yesNo: { active: "Evet", inactive: "Hayır" },
|
|
81
|
+
onOff: { active: "Açık", inactive: "Kapalı" },
|
|
82
|
+
published: { active: "Yayında", inactive: "Taslak" },
|
|
83
|
+
approved: { active: "Onaylı", inactive: "Beklemede" },
|
|
84
|
+
badge: { active: "Evet", inactive: "Hayır" }
|
|
85
|
+
// özel için cellFormatOptions zorunlu önerilir
|
|
86
|
+
}, bn = "table-formatter-status table-formatter-status--active", hn = "table-formatter-status table-formatter-status--inactive";
|
|
87
|
+
function fn({
|
|
88
|
+
value: s,
|
|
89
|
+
activeLabel: u = "Aktif",
|
|
90
|
+
inactiveLabel: h = "Pasif",
|
|
91
|
+
activeClass: g = bn,
|
|
92
|
+
inactiveClass: f = hn
|
|
93
|
+
}) {
|
|
94
|
+
const F = s === !0 || s === "true" || s === 1;
|
|
95
|
+
return /* @__PURE__ */ t("span", { className: F ? g : f, children: F ? u : h });
|
|
96
|
+
}
|
|
97
|
+
function mn(s, u) {
|
|
98
|
+
const h = un[s];
|
|
99
|
+
return {
|
|
100
|
+
activeLabel: u.activeLabel ?? h.active,
|
|
101
|
+
inactiveLabel: u.inactiveLabel ?? h.inactive
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function Te(s, u, h, g = {}) {
|
|
105
|
+
const { activeLabel: f, inactiveLabel: F } = mn(s, g);
|
|
106
|
+
return /* @__PURE__ */ t(
|
|
107
|
+
fn,
|
|
108
|
+
{
|
|
109
|
+
value: u,
|
|
110
|
+
activeLabel: f,
|
|
111
|
+
inactiveLabel: F,
|
|
112
|
+
activeClass: g.activeClass,
|
|
113
|
+
inactiveClass: g.inactiveClass
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
const yn = [10, 25, 50, 100], Ot = 50, ge = 80;
|
|
118
|
+
function P(s) {
|
|
119
|
+
return j(s.minWidth) ?? (s.flex ? ge : Ot);
|
|
120
|
+
}
|
|
121
|
+
function Et({
|
|
122
|
+
colId: s,
|
|
123
|
+
minWidth: u,
|
|
124
|
+
maxWidth: h,
|
|
125
|
+
startWidth: g,
|
|
126
|
+
onResize: f
|
|
127
|
+
}) {
|
|
128
|
+
const F = d.useRef(null), I = d.useRef(f);
|
|
129
|
+
return I.current = f, d.useEffect(() => {
|
|
130
|
+
const z = F.current;
|
|
131
|
+
if (!z) return;
|
|
132
|
+
let S = 0, L = 0;
|
|
133
|
+
const q = (V) => {
|
|
134
|
+
V.preventDefault(), V.stopPropagation(), S = V.clientX, L = g, document.body.classList.add("dyn-table-resizing");
|
|
135
|
+
const _ = (W) => {
|
|
136
|
+
const w = W.clientX - S;
|
|
137
|
+
let M = Math.max(u, L + w);
|
|
138
|
+
h != null && (M = Math.min(h, M)), I.current(M);
|
|
139
|
+
}, c = () => {
|
|
140
|
+
document.removeEventListener("mousemove", _), document.removeEventListener("mouseup", c), document.body.classList.remove("dyn-table-resizing");
|
|
141
|
+
};
|
|
142
|
+
document.addEventListener("mousemove", _), document.addEventListener("mouseup", c);
|
|
143
|
+
};
|
|
144
|
+
return z.addEventListener("mousedown", q), () => z.removeEventListener("mousedown", q);
|
|
145
|
+
}, [s, u, h, g]), /* @__PURE__ */ t(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
ref: F,
|
|
149
|
+
className: "dyn-table-resize-handle",
|
|
150
|
+
role: "separator",
|
|
151
|
+
"aria-label": `${s} kolon genişliğini değiştir`
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
const U = 44;
|
|
156
|
+
function Tt({
|
|
157
|
+
displayData: s,
|
|
158
|
+
getRowKey: u,
|
|
159
|
+
selectedSet: h,
|
|
160
|
+
onToggleAll: g
|
|
161
|
+
}) {
|
|
162
|
+
const f = d.useRef(null), F = s.map((L) => u(L)), I = F.length > 0 && F.every((L) => h.has(L)), S = F.some((L) => h.has(L)) && !I;
|
|
163
|
+
return d.useEffect(() => {
|
|
164
|
+
f.current && (f.current.indeterminate = S);
|
|
165
|
+
}, [S]), /* @__PURE__ */ t("label", { className: "dyn-table-selection-header", children: /* @__PURE__ */ t(
|
|
166
|
+
"input",
|
|
167
|
+
{
|
|
168
|
+
ref: f,
|
|
169
|
+
type: "checkbox",
|
|
170
|
+
checked: I,
|
|
171
|
+
onChange: g,
|
|
172
|
+
"aria-label": "Tümünü seç"
|
|
173
|
+
}
|
|
174
|
+
) });
|
|
175
|
+
}
|
|
176
|
+
function pn(s, u, h, g, f) {
|
|
177
|
+
const F = s.some((c) => (c.flex ?? 0) > 0), z = s.filter((c) => (c.flex ?? 0) > 0).reduce((c, W) => c + (W.flex ?? 0), 0), S = [];
|
|
178
|
+
let L = 0;
|
|
179
|
+
for (const c of s) {
|
|
180
|
+
const W = j(c.minWidth) ?? (c.flex ? ge : Ot), w = j(c.maxWidth);
|
|
181
|
+
if (c.flex) {
|
|
182
|
+
const M = h[c.id];
|
|
183
|
+
M != null ? (S.push(Math.max(W, w != null ? Math.min(M, w) : M)), L += S[S.length - 1]) : S.push(-1);
|
|
184
|
+
} else {
|
|
185
|
+
const M = h[c.id] ?? j(c.width) ?? W;
|
|
186
|
+
S.push(w != null ? Math.min(M, w) : Math.max(W, M)), L += S[S.length - 1];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (!F || u <= 0 || z <= 0)
|
|
190
|
+
return S.map((c) => c === -1 ? ge : c);
|
|
191
|
+
const q = u - L - g - f;
|
|
192
|
+
if (q <= 0)
|
|
193
|
+
return S.map((c) => c === -1 ? ge : c);
|
|
194
|
+
const V = [...S];
|
|
195
|
+
let _ = 0;
|
|
196
|
+
for (let c = 0; c < s.length; c++) {
|
|
197
|
+
if (V[c] !== -1) continue;
|
|
198
|
+
const W = s[c], w = j(W.minWidth) ?? ge, M = j(W.maxWidth), re = (W.flex ?? 0) / z * q, Oe = M != null ? Math.min(re, M) : re;
|
|
199
|
+
V[c] = Math.max(w, Oe), _ += V[c];
|
|
200
|
+
}
|
|
201
|
+
return V;
|
|
202
|
+
}
|
|
203
|
+
function Nn({
|
|
204
|
+
data: s,
|
|
205
|
+
columns: u,
|
|
206
|
+
keyExtractor: h,
|
|
207
|
+
keyColumnId: g,
|
|
208
|
+
sortable: f = !0,
|
|
209
|
+
defaultSort: F = { id: "", direction: null },
|
|
210
|
+
onSort: I,
|
|
211
|
+
emptyMessage: z = "Veri yok",
|
|
212
|
+
theme: S = "light",
|
|
213
|
+
className: L = "",
|
|
214
|
+
headerClassName: q = "",
|
|
215
|
+
bodyClassName: V = "",
|
|
216
|
+
rowClassName: _,
|
|
217
|
+
actions: c,
|
|
218
|
+
actionsHeader: W = "İşlemler",
|
|
219
|
+
actionsAlign: w = "center",
|
|
220
|
+
actionsWidth: M,
|
|
221
|
+
pagination: ae = !1,
|
|
222
|
+
pageSize: re = 10,
|
|
223
|
+
pageSizeOptions: Oe = yn,
|
|
224
|
+
page: et,
|
|
225
|
+
defaultPage: zt = 1,
|
|
226
|
+
onPageChange: Ne,
|
|
227
|
+
totalCount: tt,
|
|
228
|
+
onBlockNeeded: he,
|
|
229
|
+
blockSize: vn,
|
|
230
|
+
minHeight: m,
|
|
231
|
+
height: y,
|
|
232
|
+
mobileBreakpoint: nt = 768,
|
|
233
|
+
rowSelection: N = !1,
|
|
234
|
+
selectedRowKeys: lt,
|
|
235
|
+
defaultSelectedRowKeys: At = [],
|
|
236
|
+
onSelectionChange: _e,
|
|
237
|
+
selectionToolbarLabel: ze,
|
|
238
|
+
filterable: Ae = !1,
|
|
239
|
+
filterModel: at,
|
|
240
|
+
defaultFilterModel: Rt = {},
|
|
241
|
+
onFilterChange: ke,
|
|
242
|
+
filterPanelWidth: Bt = 280,
|
|
243
|
+
virtualization: It = !1,
|
|
244
|
+
rowHeight: se = 44,
|
|
245
|
+
virtualizationOverscan: Re = 5,
|
|
246
|
+
columnVisibility: rt,
|
|
247
|
+
onColumnVisibilityChange: xe,
|
|
248
|
+
columnOrder: st,
|
|
249
|
+
onColumnOrderChange: Se,
|
|
250
|
+
columnReorder: Z = !0,
|
|
251
|
+
loading: fe = !1,
|
|
252
|
+
stickyHeader: Vt = !1
|
|
253
|
+
}) {
|
|
254
|
+
const C = d.useCallback(
|
|
255
|
+
(e, n) => {
|
|
256
|
+
if (h) return h(e);
|
|
257
|
+
if (g) {
|
|
258
|
+
const a = u.find((l) => l.id === g);
|
|
259
|
+
if (a) return X(e, a);
|
|
260
|
+
}
|
|
261
|
+
return String(n ?? 0);
|
|
262
|
+
},
|
|
263
|
+
[h, g, u]
|
|
264
|
+
), Be = d.useRef(null), [it, Kt] = d.useState(0), [Ie, Pt] = d.useState(0), [dt, ct] = d.useState(0), [ot, ut] = d.useState({});
|
|
265
|
+
d.useEffect(() => {
|
|
266
|
+
const e = Be.current;
|
|
267
|
+
if (!e) return;
|
|
268
|
+
const n = () => {
|
|
269
|
+
Kt(e.clientWidth), Pt(e.clientHeight);
|
|
270
|
+
}, a = new ResizeObserver(n);
|
|
271
|
+
return a.observe(e), n(), () => a.disconnect();
|
|
272
|
+
}, []);
|
|
273
|
+
const [A, bt] = d.useState(!1);
|
|
274
|
+
d.useEffect(() => {
|
|
275
|
+
const e = window.matchMedia(`(max-width: ${nt}px)`);
|
|
276
|
+
bt(e.matches);
|
|
277
|
+
const n = () => bt(e.matches);
|
|
278
|
+
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
279
|
+
}, [nt]);
|
|
280
|
+
const [$, jt] = d.useState(F), [Ut, Yt] = d.useState(zt), [E, Ve] = d.useState(re);
|
|
281
|
+
d.useEffect(() => {
|
|
282
|
+
Ve(re);
|
|
283
|
+
}, [re]);
|
|
284
|
+
const me = rt != null, [Gt, ht] = d.useState(
|
|
285
|
+
() => u.reduce((e, n) => ({ ...e, [n.id]: !n.hide }), {})
|
|
286
|
+
);
|
|
287
|
+
d.useEffect(() => {
|
|
288
|
+
me || ht((e) => {
|
|
289
|
+
const n = { ...e };
|
|
290
|
+
for (const a of u)
|
|
291
|
+
n[a.id] === void 0 && (n[a.id] = !a.hide);
|
|
292
|
+
return n;
|
|
293
|
+
});
|
|
294
|
+
}, [u, me]);
|
|
295
|
+
const ne = me ? rt : Gt, ft = d.useCallback(
|
|
296
|
+
(e) => {
|
|
297
|
+
me || ht(e), xe == null || xe(e);
|
|
298
|
+
},
|
|
299
|
+
[me, xe]
|
|
300
|
+
), ye = st != null, [Xt, mt] = d.useState(() => u.map((e) => e.id));
|
|
301
|
+
d.useEffect(() => {
|
|
302
|
+
ye || mt((e) => {
|
|
303
|
+
const n = u.map((i) => i.id), a = n.filter((i) => !e.includes(i)), l = e.filter((i) => !n.some((b) => b === i));
|
|
304
|
+
if (a.length === 0 && l.length === 0) return e;
|
|
305
|
+
let r = e.filter((i) => n.includes(i));
|
|
306
|
+
for (const i of a) r.push(i);
|
|
307
|
+
return r;
|
|
308
|
+
});
|
|
309
|
+
}, [u, ye]);
|
|
310
|
+
const ie = ye ? st : Xt, yt = d.useCallback(
|
|
311
|
+
(e) => {
|
|
312
|
+
ye || mt(e), Se == null || Se(e);
|
|
313
|
+
},
|
|
314
|
+
[ye, Se]
|
|
315
|
+
), Ke = et != null, de = Ke ? et : Ut, Pe = d.useCallback(
|
|
316
|
+
(e, n) => {
|
|
317
|
+
Ke || Yt(e), n !== E && Ve(n), Ne == null || Ne(e, n);
|
|
318
|
+
},
|
|
319
|
+
[Ke, E, Ne]
|
|
320
|
+
), je = d.useRef(null);
|
|
321
|
+
d.useEffect(() => {
|
|
322
|
+
if (!ae || !he) return;
|
|
323
|
+
const e = de * E;
|
|
324
|
+
if (s.length >= e) {
|
|
325
|
+
je.current = null;
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
je.current !== de && (je.current = de, he(de));
|
|
329
|
+
}, [ae, he, de, E, s.length]);
|
|
330
|
+
const pt = (e) => {
|
|
331
|
+
if (!f) return;
|
|
332
|
+
const n = $.id === e ? {
|
|
333
|
+
id: e,
|
|
334
|
+
direction: $.direction === "asc" ? "desc" : $.direction === "desc" ? null : "asc"
|
|
335
|
+
} : { id: e, direction: "asc" };
|
|
336
|
+
jt(n), I == null || I(n.id, n.direction);
|
|
337
|
+
}, v = d.useMemo(() => {
|
|
338
|
+
const n = ie.filter((i) => u.some((b) => b.id === i)).filter((i) => ne[i] !== !1).map((i) => u.find((b) => b.id === i)).filter(Boolean);
|
|
339
|
+
for (const i of u)
|
|
340
|
+
ne[i.id] !== !1 && !n.some((b) => b.id === i.id) && n.push(i);
|
|
341
|
+
const a = n.filter((i) => i.pinned === "left"), l = n.filter((i) => i.pinned !== "left" && i.pinned !== "right"), r = n.filter((i) => i.pinned === "right");
|
|
342
|
+
return [...a, ...l, ...r];
|
|
343
|
+
}, [u, ie, ne]), qt = d.useMemo(
|
|
344
|
+
() => v.filter((e) => e.filter != null),
|
|
345
|
+
[v]
|
|
346
|
+
), Ue = at != null, [Zt, Jt] = d.useState(
|
|
347
|
+
() => Rt ?? {}
|
|
348
|
+
), J = Ue ? at : Zt, ce = d.useCallback(
|
|
349
|
+
(e) => {
|
|
350
|
+
Ue || Jt(e), ke == null || ke(e);
|
|
351
|
+
},
|
|
352
|
+
[Ue, ke]
|
|
353
|
+
), pe = d.useMemo(() => {
|
|
354
|
+
const e = Object.entries(J).filter(
|
|
355
|
+
([n, a]) => a != null && a !== ""
|
|
356
|
+
);
|
|
357
|
+
return e.length === 0 ? s : s.filter((n) => {
|
|
358
|
+
for (const [a, l] of e) {
|
|
359
|
+
const r = u.find((b) => b.id === a);
|
|
360
|
+
if (!(r != null && r.filter)) continue;
|
|
361
|
+
const i = X(n, r);
|
|
362
|
+
if (r.filter === "text") {
|
|
363
|
+
const b = String(i ?? "").toLowerCase(), p = String(l).toLowerCase();
|
|
364
|
+
if (p && !b.includes(p)) return !1;
|
|
365
|
+
} else if (r.filter === "number") {
|
|
366
|
+
const b = typeof i == "number" ? i : Number(i), p = typeof l == "number" ? l : Number(l);
|
|
367
|
+
if (Number.isNaN(p)) continue;
|
|
368
|
+
if (Number.isNaN(b) || b !== p) return !1;
|
|
369
|
+
} else if (r.filter === "date") {
|
|
370
|
+
const b = i != null ? new Date(i).getTime() : NaN, p = new Date(l).getTime();
|
|
371
|
+
if (Number.isNaN(p)) continue;
|
|
372
|
+
if (Number.isNaN(b)) return !1;
|
|
373
|
+
const O = new Date(b).toDateString(), k = new Date(p).toDateString();
|
|
374
|
+
if (O !== k) return !1;
|
|
375
|
+
} else if (r.filter === "select") {
|
|
376
|
+
const b = i != null ? String(i) : "", p = String(l);
|
|
377
|
+
if (p && b !== p) return !1;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return !0;
|
|
381
|
+
});
|
|
382
|
+
}, [s, u, J]), Ce = tt ?? pe.length, vt = tt == null, Ye = Math.max(1, Math.ceil(Ce / E)), Y = Math.min(Math.max(1, de), Ye), R = c == null ? 0 : j(M) ?? 80, De = N ? U : 0, T = d.useMemo(
|
|
383
|
+
() => pn(
|
|
384
|
+
v,
|
|
385
|
+
it,
|
|
386
|
+
ot,
|
|
387
|
+
R,
|
|
388
|
+
De
|
|
389
|
+
),
|
|
390
|
+
[v, it, ot, R, De]
|
|
391
|
+
), { pinnedLeftOffsets: Q, pinnedRightOffsets: H } = d.useMemo(() => {
|
|
392
|
+
const e = [], n = [];
|
|
393
|
+
let a = De;
|
|
394
|
+
for (let r = 0; r < v.length; r++)
|
|
395
|
+
v[r].pinned === "left" ? (e[r] = a, a += T[r]) : e[r] = void 0;
|
|
396
|
+
let l = R;
|
|
397
|
+
for (let r = v.length - 1; r >= 0; r--)
|
|
398
|
+
v[r].pinned === "right" ? (n[r] = l, l += T[r]) : n[r] = void 0;
|
|
399
|
+
return {
|
|
400
|
+
pinnedLeftOffsets: e,
|
|
401
|
+
pinnedRightOffsets: n
|
|
402
|
+
};
|
|
403
|
+
}, [v, T, De, R]), Fe = d.useMemo(() => {
|
|
404
|
+
if (!$.direction || !$.id) return pe;
|
|
405
|
+
const e = u.find((n) => n.id === $.id);
|
|
406
|
+
return !(e != null && e.sortable) || e != null && e.suppressSort ? pe : [...pe].sort((n, a) => {
|
|
407
|
+
const l = X(n, e), r = X(a, e), i = e.comparator ? e.comparator(l, r, n, a) : typeof l == "number" && typeof r == "number" ? l - r : String(l ?? "").localeCompare(String(r ?? ""));
|
|
408
|
+
return $.direction === "asc" ? i : -i;
|
|
409
|
+
});
|
|
410
|
+
}, [pe, u, $]), x = d.useMemo(() => {
|
|
411
|
+
if (!ae) return Fe;
|
|
412
|
+
if (vt || he) {
|
|
413
|
+
const e = (Y - 1) * E;
|
|
414
|
+
return Fe.slice(e, e + E);
|
|
415
|
+
}
|
|
416
|
+
return Fe;
|
|
417
|
+
}, [ae, vt, he, Fe, Y, E]), Ge = lt != null, [Qt, Ht] = d.useState(
|
|
418
|
+
() => At
|
|
419
|
+
), B = Ge ? lt : Qt, D = d.useMemo(() => new Set(B), [B]), ee = d.useCallback(
|
|
420
|
+
(e) => {
|
|
421
|
+
Ge || Ht(e);
|
|
422
|
+
const n = s.filter((a) => e.includes(C(a)));
|
|
423
|
+
_e == null || _e(e, n);
|
|
424
|
+
},
|
|
425
|
+
[Ge, s, C, _e]
|
|
426
|
+
), oe = d.useCallback(
|
|
427
|
+
(e) => {
|
|
428
|
+
const n = D.has(e) ? B.filter((a) => a !== e) : [...B, e];
|
|
429
|
+
ee(n);
|
|
430
|
+
},
|
|
431
|
+
[B, D, ee]
|
|
432
|
+
), gt = d.useCallback(() => {
|
|
433
|
+
const e = x.map((l) => C(l)), a = e.length > 0 && e.every((l) => D.has(l)) ? B.filter((l) => !e.includes(l)) : [.../* @__PURE__ */ new Set([...B, ...e])];
|
|
434
|
+
ee(a);
|
|
435
|
+
}, [x, C, B, D, ee]), en = d.useMemo(
|
|
436
|
+
() => s.filter((e) => D.has(C(e))),
|
|
437
|
+
[s, D, C]
|
|
438
|
+
), tn = d.useCallback(() => {
|
|
439
|
+
ee(s.map((e) => C(e)));
|
|
440
|
+
}, [s, C, ee]), nn = d.useCallback(() => {
|
|
441
|
+
ee([]);
|
|
442
|
+
}, [ee]), [ve, Nt] = d.useState(!1), Xe = d.useRef(null);
|
|
443
|
+
d.useEffect(() => {
|
|
444
|
+
if (!ve) return;
|
|
445
|
+
const e = (n) => {
|
|
446
|
+
Xe.current && !Xe.current.contains(n.target) && Nt(!1);
|
|
447
|
+
};
|
|
448
|
+
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
449
|
+
}, [ve]);
|
|
450
|
+
const [Me, qe] = d.useState(!1), [ue, _t] = d.useState(!1), Ze = d.useRef(null);
|
|
451
|
+
d.useEffect(() => {
|
|
452
|
+
if (!ue) return;
|
|
453
|
+
const e = (n) => {
|
|
454
|
+
Ze.current && !Ze.current.contains(n.target) && _t(!1);
|
|
455
|
+
};
|
|
456
|
+
return document.addEventListener("click", e), () => document.removeEventListener("click", e);
|
|
457
|
+
}, [ue]);
|
|
458
|
+
const ln = d.useCallback(
|
|
459
|
+
(e) => {
|
|
460
|
+
ft({ ...ne, [e]: !ne[e] });
|
|
461
|
+
},
|
|
462
|
+
[ne, ft]
|
|
463
|
+
), [kt, xt] = d.useState(null), [St, Le] = d.useState(-1), Ct = d.useCallback((e, n) => {
|
|
464
|
+
e.dataTransfer.setData("text/plain", n), e.dataTransfer.effectAllowed = "move";
|
|
465
|
+
const a = e.currentTarget.closest("th");
|
|
466
|
+
a && e.dataTransfer.setDragImage(a, 0, 0), xt(n);
|
|
467
|
+
}, []), Dt = d.useCallback((e, n) => {
|
|
468
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "move", Le(n);
|
|
469
|
+
}, []), Ft = d.useCallback(() => {
|
|
470
|
+
Le(-1);
|
|
471
|
+
}, []), Mt = d.useCallback(
|
|
472
|
+
(e, n) => {
|
|
473
|
+
var O, k;
|
|
474
|
+
e.preventDefault(), Le(-1);
|
|
475
|
+
const a = e.dataTransfer.getData("text/plain");
|
|
476
|
+
if (!a || a === ((O = v[n]) == null ? void 0 : O.id)) return;
|
|
477
|
+
const l = ie.indexOf(a), r = (k = v[n]) == null ? void 0 : k.id, i = ie.indexOf(r);
|
|
478
|
+
if (l === -1 || i === -1) return;
|
|
479
|
+
const b = ie.slice();
|
|
480
|
+
b.splice(l, 1);
|
|
481
|
+
const p = b.indexOf(r);
|
|
482
|
+
b.splice(p, 0, a), yt(b);
|
|
483
|
+
},
|
|
484
|
+
[v, ie, yt]
|
|
485
|
+
), Lt = d.useCallback(() => {
|
|
486
|
+
xt(null), Le(-1);
|
|
487
|
+
}, []), Je = Object.values(J).filter(
|
|
488
|
+
(e) => e != null && e !== ""
|
|
489
|
+
).length, an = d.useCallback(() => {
|
|
490
|
+
ce({});
|
|
491
|
+
}, [ce]), K = It && !A && x.length > 0, We = Vt && !A, { virtualStart: we, virtualEnd: Qe } = d.useMemo(() => {
|
|
492
|
+
if (!K || Ie <= 0)
|
|
493
|
+
return { virtualStart: 0, virtualEnd: x.length };
|
|
494
|
+
const e = Math.ceil(Ie / se) + Re * 2, n = Math.max(0, Math.floor(dt / se) - Re), a = Math.min(x.length, n + e);
|
|
495
|
+
return { virtualStart: n, virtualEnd: a };
|
|
496
|
+
}, [K, Ie, dt, se, Re, x.length]), rn = (Y - 1) * E + 1, sn = Math.min(Y * E, Ce), $e = fe ? Math.min(E, 10) : 0;
|
|
497
|
+
function Wt(e, n, a) {
|
|
498
|
+
return n.cell != null ? n.cell(e) : n.valueFormatter != null ? n.valueFormatter(a, e) : n.valueFormat != null ? Ee(a, n.valueFormat, n.valueFormatOptions) : n.cellFormat != null ? Te(n.cellFormat, a, e, n.cellFormatOptions) : a;
|
|
499
|
+
}
|
|
500
|
+
const dn = S === "dark" ? "dyn-table-wrapper--dark" : "dyn-table-wrapper--light", cn = N || Ae || u.length > 1;
|
|
501
|
+
return /* @__PURE__ */ o("div", { className: `dyn-table-wrapper ${dn} ${L}`.trim(), children: [
|
|
502
|
+
cn && /* @__PURE__ */ t("div", { className: `dyn-table-toolbar ${A ? "dyn-table-toolbar--mobile" : ""}`.trim(), children: /* @__PURE__ */ o("div", { className: "dyn-table-toolbar__actions", children: [
|
|
503
|
+
N && /* @__PURE__ */ o($t, { children: [
|
|
504
|
+
/* @__PURE__ */ t(
|
|
505
|
+
"button",
|
|
506
|
+
{
|
|
507
|
+
type: "button",
|
|
508
|
+
className: "dyn-table-toolbar__btn",
|
|
509
|
+
onClick: tn,
|
|
510
|
+
"aria-label": "Tümünü seç",
|
|
511
|
+
children: "Tümünü seç"
|
|
512
|
+
}
|
|
513
|
+
),
|
|
514
|
+
/* @__PURE__ */ t(
|
|
515
|
+
"button",
|
|
516
|
+
{
|
|
517
|
+
type: "button",
|
|
518
|
+
className: "dyn-table-toolbar__btn",
|
|
519
|
+
onClick: nn,
|
|
520
|
+
disabled: B.length === 0,
|
|
521
|
+
"aria-label": "Seçimi kaldır",
|
|
522
|
+
children: "Kaldır"
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
/* @__PURE__ */ o("div", { ref: Xe, className: "dyn-table-toolbar__dropdown", children: [
|
|
526
|
+
/* @__PURE__ */ o(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
type: "button",
|
|
530
|
+
className: "dyn-table-toolbar__dropdown-trigger",
|
|
531
|
+
onClick: () => Nt((e) => !e),
|
|
532
|
+
disabled: B.length === 0,
|
|
533
|
+
"aria-expanded": ve,
|
|
534
|
+
"aria-haspopup": "listbox",
|
|
535
|
+
"aria-label": "Seçilenleri göster",
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ o("span", { children: [
|
|
538
|
+
B.length,
|
|
539
|
+
" seçili"
|
|
540
|
+
] }),
|
|
541
|
+
/* @__PURE__ */ t(
|
|
542
|
+
"svg",
|
|
543
|
+
{
|
|
544
|
+
className: `dyn-table-toolbar__dropdown-chevron ${ve ? "dyn-table-toolbar__dropdown-chevron--open" : ""}`,
|
|
545
|
+
viewBox: "0 0 24 24",
|
|
546
|
+
fill: "none",
|
|
547
|
+
stroke: "currentColor",
|
|
548
|
+
strokeWidth: "2",
|
|
549
|
+
width: "14",
|
|
550
|
+
height: "14",
|
|
551
|
+
children: /* @__PURE__ */ t("path", { d: "M6 9l6 6 6-6" })
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
ve && B.length > 0 && /* @__PURE__ */ t(
|
|
558
|
+
"div",
|
|
559
|
+
{
|
|
560
|
+
className: "dyn-table-toolbar__dropdown-panel",
|
|
561
|
+
role: "listbox",
|
|
562
|
+
"aria-label": "Seçilen satırlar",
|
|
563
|
+
children: /* @__PURE__ */ t("ul", { className: "dyn-table-toolbar__dropdown-list", children: en.map((e) => {
|
|
564
|
+
const n = C(e), a = (ze == null ? void 0 : ze(e)) ?? String(n);
|
|
565
|
+
return /* @__PURE__ */ o("li", { className: "dyn-table-toolbar__dropdown-item", children: [
|
|
566
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-toolbar__dropdown-item-label", children: a }),
|
|
567
|
+
/* @__PURE__ */ t(
|
|
568
|
+
"button",
|
|
569
|
+
{
|
|
570
|
+
type: "button",
|
|
571
|
+
className: "dyn-table-toolbar__dropdown-item-remove",
|
|
572
|
+
onClick: (l) => {
|
|
573
|
+
l.stopPropagation(), oe(n);
|
|
574
|
+
},
|
|
575
|
+
"aria-label": `${a} seçimini kaldır`,
|
|
576
|
+
children: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "12", height: "12", children: /* @__PURE__ */ t("path", { d: "M18 6L6 18M6 6l12 12" }) })
|
|
577
|
+
}
|
|
578
|
+
)
|
|
579
|
+
] }, String(n));
|
|
580
|
+
}) })
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
] })
|
|
584
|
+
] }),
|
|
585
|
+
Ae && /* @__PURE__ */ o(
|
|
586
|
+
"button",
|
|
587
|
+
{
|
|
588
|
+
type: "button",
|
|
589
|
+
className: `dyn-table-toolbar__btn dyn-table-toolbar__btn--filter ${Me ? "dyn-table-toolbar__btn--filter-active" : ""}`,
|
|
590
|
+
onClick: () => qe((e) => !e),
|
|
591
|
+
"aria-expanded": Me,
|
|
592
|
+
"aria-label": "Filtreler",
|
|
593
|
+
children: [
|
|
594
|
+
/* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "16", height: "16", children: /* @__PURE__ */ t("path", { d: "M22 3H2l8 9.46V19l4 2v-8.54L22 3z" }) }),
|
|
595
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-toolbar__btn-label", children: "Filtre" }),
|
|
596
|
+
Je > 0 && /* @__PURE__ */ t("span", { className: "dyn-table-toolbar__filter-count", children: Je })
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
),
|
|
600
|
+
u.length > 1 && /* @__PURE__ */ o("div", { ref: Ze, className: "dyn-table-toolbar__dropdown", children: [
|
|
601
|
+
/* @__PURE__ */ o(
|
|
602
|
+
"button",
|
|
603
|
+
{
|
|
604
|
+
type: "button",
|
|
605
|
+
className: `dyn-table-toolbar__dropdown-trigger ${ue ? "dyn-table-toolbar__dropdown-trigger--open" : ""}`,
|
|
606
|
+
onClick: () => _t((e) => !e),
|
|
607
|
+
"aria-expanded": ue,
|
|
608
|
+
"aria-haspopup": "dialog",
|
|
609
|
+
"aria-label": "Kolonları göster/gizle",
|
|
610
|
+
children: [
|
|
611
|
+
/* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "16", height: "16", children: /* @__PURE__ */ t("path", { d: "M3 6h18M3 12h18M3 18h18M7 6v12M11 12v6M15 6v12M19 12v6" }) }),
|
|
612
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-toolbar__btn-label", children: "Kolonlar" }),
|
|
613
|
+
/* @__PURE__ */ t(
|
|
614
|
+
"svg",
|
|
615
|
+
{
|
|
616
|
+
className: `dyn-table-toolbar__dropdown-chevron ${ue ? "dyn-table-toolbar__dropdown-chevron--open" : ""}`,
|
|
617
|
+
viewBox: "0 0 24 24",
|
|
618
|
+
fill: "none",
|
|
619
|
+
stroke: "currentColor",
|
|
620
|
+
strokeWidth: "2",
|
|
621
|
+
width: "14",
|
|
622
|
+
height: "14",
|
|
623
|
+
children: /* @__PURE__ */ t("path", { d: "M6 9l6 6 6-6" })
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
]
|
|
627
|
+
}
|
|
628
|
+
),
|
|
629
|
+
ue && /* @__PURE__ */ o(
|
|
630
|
+
"div",
|
|
631
|
+
{
|
|
632
|
+
className: "dyn-table-toolbar__dropdown-panel dyn-table-toolbar__dropdown-panel--columns",
|
|
633
|
+
role: "dialog",
|
|
634
|
+
"aria-label": "Kolon görünürlüğü",
|
|
635
|
+
children: [
|
|
636
|
+
/* @__PURE__ */ t("div", { className: "dyn-table-column-visibility__header", children: "Görünen kolonlar" }),
|
|
637
|
+
/* @__PURE__ */ t("ul", { className: "dyn-table-toolbar__dropdown-list", children: u.map((e) => {
|
|
638
|
+
const n = ne[e.id] !== !1, a = typeof e.header == "string" ? e.header : e.id;
|
|
639
|
+
return /* @__PURE__ */ t("li", { className: "dyn-table-toolbar__dropdown-item dyn-table-toolbar__dropdown-item--checkbox", children: /* @__PURE__ */ o("label", { className: "dyn-table-column-visibility__label", children: [
|
|
640
|
+
/* @__PURE__ */ t(
|
|
641
|
+
"input",
|
|
642
|
+
{
|
|
643
|
+
type: "checkbox",
|
|
644
|
+
checked: n,
|
|
645
|
+
onChange: () => ln(e.id),
|
|
646
|
+
"aria-label": `${a} ${n ? "gizle" : "göster"}`
|
|
647
|
+
}
|
|
648
|
+
),
|
|
649
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-toolbar__dropdown-item-label", children: a })
|
|
650
|
+
] }) }, e.id);
|
|
651
|
+
}) })
|
|
652
|
+
]
|
|
653
|
+
}
|
|
654
|
+
)
|
|
655
|
+
] })
|
|
656
|
+
] }) }),
|
|
657
|
+
Ae ? /* @__PURE__ */ o("div", { className: "dyn-table-main", children: [
|
|
658
|
+
Me && /* @__PURE__ */ t(
|
|
659
|
+
"div",
|
|
660
|
+
{
|
|
661
|
+
className: "dyn-table-filter-overlay",
|
|
662
|
+
role: "presentation",
|
|
663
|
+
onClick: () => qe(!1),
|
|
664
|
+
"aria-hidden": !0
|
|
665
|
+
}
|
|
666
|
+
),
|
|
667
|
+
/* @__PURE__ */ o(
|
|
668
|
+
"div",
|
|
669
|
+
{
|
|
670
|
+
className: `dyn-table-filter-panel ${Me ? "dyn-table-filter-panel--open" : ""}`,
|
|
671
|
+
style: { width: Bt },
|
|
672
|
+
"aria-label": "Filtreler paneli",
|
|
673
|
+
children: [
|
|
674
|
+
/* @__PURE__ */ o("div", { className: "dyn-table-filter-panel__header", children: [
|
|
675
|
+
/* @__PURE__ */ t("h3", { className: "dyn-table-filter-panel__title", children: "Filtreler" }),
|
|
676
|
+
/* @__PURE__ */ t(
|
|
677
|
+
"button",
|
|
678
|
+
{
|
|
679
|
+
type: "button",
|
|
680
|
+
className: "dyn-table-filter-panel__close",
|
|
681
|
+
onClick: () => qe(!1),
|
|
682
|
+
"aria-label": "Paneli kapat",
|
|
683
|
+
children: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", width: "20", height: "20", children: /* @__PURE__ */ t("path", { d: "M18 6L6 18M6 6l12 12" }) })
|
|
684
|
+
}
|
|
685
|
+
)
|
|
686
|
+
] }),
|
|
687
|
+
/* @__PURE__ */ o("div", { className: "dyn-table-filter-panel__body", children: [
|
|
688
|
+
Je > 0 && /* @__PURE__ */ t(
|
|
689
|
+
"button",
|
|
690
|
+
{
|
|
691
|
+
type: "button",
|
|
692
|
+
className: "dyn-table-filter-panel__clear",
|
|
693
|
+
onClick: an,
|
|
694
|
+
children: "Filtreleri temizle"
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
qt.map((e) => {
|
|
698
|
+
const n = typeof e.header == "string" ? e.header : e.id, a = J[e.id] ?? "";
|
|
699
|
+
return /* @__PURE__ */ o("div", { className: "dyn-table-filter-panel__item", children: [
|
|
700
|
+
/* @__PURE__ */ t("label", { className: "dyn-table-filter-panel__label", children: n }),
|
|
701
|
+
e.filter === "text" && /* @__PURE__ */ t(
|
|
702
|
+
"input",
|
|
703
|
+
{
|
|
704
|
+
type: "text",
|
|
705
|
+
className: "dyn-table-filter-panel__input",
|
|
706
|
+
value: a,
|
|
707
|
+
onChange: (l) => ce({ ...J, [e.id]: l.target.value || null }),
|
|
708
|
+
placeholder: "Ara..."
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
e.filter === "number" && /* @__PURE__ */ t(
|
|
712
|
+
"input",
|
|
713
|
+
{
|
|
714
|
+
type: "number",
|
|
715
|
+
className: "dyn-table-filter-panel__input",
|
|
716
|
+
value: a === "" || a === null ? "" : a,
|
|
717
|
+
onChange: (l) => {
|
|
718
|
+
const r = l.target.value;
|
|
719
|
+
ce({
|
|
720
|
+
...J,
|
|
721
|
+
[e.id]: r === "" ? null : Number(r)
|
|
722
|
+
});
|
|
723
|
+
},
|
|
724
|
+
placeholder: "—"
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
e.filter === "date" && /* @__PURE__ */ t(
|
|
728
|
+
"input",
|
|
729
|
+
{
|
|
730
|
+
type: "date",
|
|
731
|
+
className: "dyn-table-filter-panel__input",
|
|
732
|
+
value: a === "" || a === null ? "" : String(a),
|
|
733
|
+
onChange: (l) => ce({
|
|
734
|
+
...J,
|
|
735
|
+
[e.id]: l.target.value || null
|
|
736
|
+
})
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
e.filter === "select" && /* @__PURE__ */ o(
|
|
740
|
+
"select",
|
|
741
|
+
{
|
|
742
|
+
className: "dyn-table-filter-panel__select",
|
|
743
|
+
value: a === "" || a === null ? "" : String(a),
|
|
744
|
+
onChange: (l) => ce({
|
|
745
|
+
...J,
|
|
746
|
+
[e.id]: l.target.value === "" ? null : l.target.value
|
|
747
|
+
}),
|
|
748
|
+
children: [
|
|
749
|
+
/* @__PURE__ */ t("option", { value: "", children: "Tümü" }),
|
|
750
|
+
(e.filterSelectOptions ?? []).map((l) => /* @__PURE__ */ t("option", { value: String(l.value), children: l.label }, String(l.value)))
|
|
751
|
+
]
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
] }, e.id);
|
|
755
|
+
})
|
|
756
|
+
] })
|
|
757
|
+
]
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
/* @__PURE__ */ t("div", { className: "dyn-table-main__content", children: A ? /* @__PURE__ */ t(
|
|
761
|
+
"div",
|
|
762
|
+
{
|
|
763
|
+
className: "dyn-table-mobile",
|
|
764
|
+
style: {
|
|
765
|
+
...m != null && {
|
|
766
|
+
minHeight: typeof m == "number" ? `${m}px` : m
|
|
767
|
+
},
|
|
768
|
+
...y != null && {
|
|
769
|
+
height: typeof y == "number" ? `${y}px` : y
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
children: fe ? /* @__PURE__ */ t("div", { className: "dyn-table-cards", "aria-busy": !0, children: Array.from({ length: Math.min($e, 5) }, (e, n) => /* @__PURE__ */ o("div", { className: "dyn-table-card dyn-table-card--skeleton", children: [
|
|
773
|
+
N && /* @__PURE__ */ t("div", { className: "dyn-table-card__selection", children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton dyn-table-skeleton--checkbox" }) }),
|
|
774
|
+
v.map((a) => /* @__PURE__ */ o("div", { className: "dyn-table-card__row", children: [
|
|
775
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__label", children: typeof a.header == "string" ? a.header : a.id }),
|
|
776
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__value", children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton" }) })
|
|
777
|
+
] }, a.id)),
|
|
778
|
+
c != null && /* @__PURE__ */ t("div", { className: "dyn-table-card__actions" })
|
|
779
|
+
] }, `skeleton-card-${n}`)) }) : x.length === 0 ? /* @__PURE__ */ t("div", { className: "dyn-table-empty dyn-table-empty--card", children: z }) : /* @__PURE__ */ t("div", { className: "dyn-table-cards", children: x.map((e, n) => {
|
|
780
|
+
const a = C(e);
|
|
781
|
+
return /* @__PURE__ */ o(
|
|
782
|
+
"div",
|
|
783
|
+
{
|
|
784
|
+
className: `dyn-table-card ${typeof _ == "function" ? _(e, n) : _ ?? ""}`.trim(),
|
|
785
|
+
children: [
|
|
786
|
+
N && /* @__PURE__ */ t("div", { className: "dyn-table-card__selection", children: /* @__PURE__ */ t("label", { className: "dyn-table-selection-cell", children: /* @__PURE__ */ t(
|
|
787
|
+
"input",
|
|
788
|
+
{
|
|
789
|
+
type: "checkbox",
|
|
790
|
+
checked: D.has(a),
|
|
791
|
+
onChange: () => oe(a),
|
|
792
|
+
"aria-label": "Satırı seç"
|
|
793
|
+
}
|
|
794
|
+
) }) }),
|
|
795
|
+
v.map((l) => {
|
|
796
|
+
const r = X(e, l), i = Wt(e, l, r);
|
|
797
|
+
return /* @__PURE__ */ o("div", { className: "dyn-table-card__row", children: [
|
|
798
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__label", children: (typeof l.header == "string", l.header) }),
|
|
799
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__value", children: i })
|
|
800
|
+
] }, l.id);
|
|
801
|
+
}),
|
|
802
|
+
c != null && /* @__PURE__ */ t("div", { className: "dyn-table-card__actions", children: c(e) })
|
|
803
|
+
]
|
|
804
|
+
},
|
|
805
|
+
a
|
|
806
|
+
);
|
|
807
|
+
}) })
|
|
808
|
+
}
|
|
809
|
+
) : /* @__PURE__ */ t(
|
|
810
|
+
"div",
|
|
811
|
+
{
|
|
812
|
+
ref: Be,
|
|
813
|
+
className: `dyn-table-scroll ${K ? "dyn-table-scroll--virtualized" : ""} ${We ? "dyn-table-scroll--sticky-header" : ""}`.trim(),
|
|
814
|
+
style: {
|
|
815
|
+
...m != null && {
|
|
816
|
+
minHeight: typeof m == "number" ? `${m}px` : m
|
|
817
|
+
},
|
|
818
|
+
...y != null && {
|
|
819
|
+
height: typeof y == "number" ? `${y}px` : y
|
|
820
|
+
},
|
|
821
|
+
...K && {
|
|
822
|
+
overflowY: "auto",
|
|
823
|
+
height: y != null ? typeof y == "number" ? `${y}px` : y : m != null ? typeof m == "number" ? `${m}px` : m : 400
|
|
824
|
+
},
|
|
825
|
+
...We && !K && {
|
|
826
|
+
overflowY: "auto",
|
|
827
|
+
height: y != null ? typeof y == "number" ? `${y}px` : y : m != null ? typeof m == "number" ? `${m}px` : m : 400
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
onScroll: K ? (e) => ct(e.currentTarget.scrollTop) : void 0,
|
|
831
|
+
children: /* @__PURE__ */ o("table", { className: "dyn-table dyn-table--fixed", children: [
|
|
832
|
+
/* @__PURE__ */ o("colgroup", { children: [
|
|
833
|
+
N && /* @__PURE__ */ t("col", { style: { width: U } }),
|
|
834
|
+
v.map((e, n) => /* @__PURE__ */ t("col", { style: { width: T[n], minWidth: P(e) } }, e.id)),
|
|
835
|
+
c != null && /* @__PURE__ */ t("col", { style: { width: R } })
|
|
836
|
+
] }),
|
|
837
|
+
/* @__PURE__ */ t("thead", { className: q, children: /* @__PURE__ */ o("tr", { children: [
|
|
838
|
+
N && /* @__PURE__ */ t("th", { className: "dyn-table-th dyn-table-th--selection", style: { width: U }, children: /* @__PURE__ */ t(
|
|
839
|
+
Tt,
|
|
840
|
+
{
|
|
841
|
+
displayData: x,
|
|
842
|
+
getRowKey: C,
|
|
843
|
+
selectedSet: D,
|
|
844
|
+
onToggleAll: gt
|
|
845
|
+
}
|
|
846
|
+
) }),
|
|
847
|
+
v.map((e, n) => {
|
|
848
|
+
const a = f && e.sortable !== !1 && !e.suppressSort, l = $.id === e.id, r = e.pinned === "left", i = e.pinned === "right", b = kt === e.id, p = St === n, O = [
|
|
849
|
+
"dyn-table-th",
|
|
850
|
+
a ? "dyn-table-th--sortable" : "",
|
|
851
|
+
l ? "dyn-table-th--sorted" : "",
|
|
852
|
+
e.resizable ? "dyn-table-th--resizable" : "",
|
|
853
|
+
r ? "dyn-table-th--pinned-left" : "",
|
|
854
|
+
i ? "dyn-table-th--pinned-right" : "",
|
|
855
|
+
b ? "dyn-table-th--dragging" : "",
|
|
856
|
+
p ? "dyn-table-th--drag-over" : "",
|
|
857
|
+
e.headerClass ?? ""
|
|
858
|
+
].filter(Boolean).join(" ");
|
|
859
|
+
return /* @__PURE__ */ o(
|
|
860
|
+
"th",
|
|
861
|
+
{
|
|
862
|
+
className: O,
|
|
863
|
+
style: {
|
|
864
|
+
width: T[n],
|
|
865
|
+
minWidth: P(e),
|
|
866
|
+
maxWidth: j(e.maxWidth),
|
|
867
|
+
textAlign: e.headerAlign ?? e.align ?? "left",
|
|
868
|
+
...r && Q[n] != null ? { left: Q[n] } : {},
|
|
869
|
+
...i && H[n] != null ? { right: H[n] } : {},
|
|
870
|
+
...e.headerStyle
|
|
871
|
+
},
|
|
872
|
+
title: e.headerTooltip,
|
|
873
|
+
onClick: () => a && pt(e.id),
|
|
874
|
+
onDragOver: Z && !A ? (k) => Dt(k, n) : void 0,
|
|
875
|
+
onDragLeave: Z && !A ? Ft : void 0,
|
|
876
|
+
onDrop: Z && !A ? (k) => Mt(k, n) : void 0,
|
|
877
|
+
children: [
|
|
878
|
+
/* @__PURE__ */ o("span", { className: "dyn-table-th__content", children: [
|
|
879
|
+
Z && !A && /* @__PURE__ */ t(
|
|
880
|
+
"span",
|
|
881
|
+
{
|
|
882
|
+
className: "dyn-table-th__drag-handle",
|
|
883
|
+
draggable: !0,
|
|
884
|
+
onDragStart: (k) => Ct(k, e.id),
|
|
885
|
+
onDragEnd: Lt,
|
|
886
|
+
onClick: (k) => k.stopPropagation(),
|
|
887
|
+
"aria-label": `${e.id} kolonunu taşı`,
|
|
888
|
+
children: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ t("path", { d: "M8 6h2V4H8v2zm0 4h2V8H8v2zm0 4h2v-2H8v2zm4-8h2V4h-2v2zm0 4h2V8h-2v2zm0 4h2v-2h-2v2z" }) })
|
|
889
|
+
}
|
|
890
|
+
),
|
|
891
|
+
e.header,
|
|
892
|
+
a && /* @__PURE__ */ o("span", { className: "dyn-table-sort", "aria-hidden": !0, children: [
|
|
893
|
+
l && $.direction === "asc" && /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "currentColor", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M7 15l5-5 5 5H7z" }) }),
|
|
894
|
+
l && $.direction === "desc" && /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "currentColor", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M7 10l5 5 5-5H7z" }) }),
|
|
895
|
+
!l && /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M7 15l5-5 5 5H7z" }) })
|
|
896
|
+
] })
|
|
897
|
+
] }),
|
|
898
|
+
e.resizable && /* @__PURE__ */ t(
|
|
899
|
+
Et,
|
|
900
|
+
{
|
|
901
|
+
colId: e.id,
|
|
902
|
+
minWidth: P(e),
|
|
903
|
+
maxWidth: j(e.maxWidth),
|
|
904
|
+
startWidth: T[n],
|
|
905
|
+
onResize: (k) => ut((G) => ({ ...G, [e.id]: k }))
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
]
|
|
909
|
+
},
|
|
910
|
+
e.id
|
|
911
|
+
);
|
|
912
|
+
}),
|
|
913
|
+
c != null && /* @__PURE__ */ t(
|
|
914
|
+
"th",
|
|
915
|
+
{
|
|
916
|
+
className: "dyn-table-th dyn-table-th--actions",
|
|
917
|
+
style: {
|
|
918
|
+
width: R,
|
|
919
|
+
minWidth: R,
|
|
920
|
+
textAlign: w
|
|
921
|
+
},
|
|
922
|
+
children: W
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
] }) }),
|
|
926
|
+
/* @__PURE__ */ t("tbody", { className: V, children: fe ? Array.from({ length: $e }, (e, n) => /* @__PURE__ */ o("tr", { className: "dyn-table-row--skeleton", "aria-busy": !0, children: [
|
|
927
|
+
N && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--selection", style: { width: U }, children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton dyn-table-skeleton--checkbox" }) }),
|
|
928
|
+
v.map((a, l) => /* @__PURE__ */ t(
|
|
929
|
+
"td",
|
|
930
|
+
{
|
|
931
|
+
className: "dyn-table-td",
|
|
932
|
+
style: {
|
|
933
|
+
width: T[l],
|
|
934
|
+
minWidth: P(a),
|
|
935
|
+
textAlign: a.align ?? "left"
|
|
936
|
+
},
|
|
937
|
+
children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton" })
|
|
938
|
+
},
|
|
939
|
+
a.id
|
|
940
|
+
)),
|
|
941
|
+
c != null && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--actions", style: { width: R } })
|
|
942
|
+
] }, `skeleton-${n}`)) : x.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
|
|
943
|
+
"td",
|
|
944
|
+
{
|
|
945
|
+
colSpan: v.length + (c != null ? 1 : 0) + (N ? 1 : 0),
|
|
946
|
+
className: "dyn-table-empty",
|
|
947
|
+
children: z
|
|
948
|
+
}
|
|
949
|
+
) }) : K ? /* @__PURE__ */ o($t, { children: [
|
|
950
|
+
we > 0 && /* @__PURE__ */ t("tr", { "aria-hidden": !0, className: "dyn-table-virtual-spacer", children: /* @__PURE__ */ t(
|
|
951
|
+
"td",
|
|
952
|
+
{
|
|
953
|
+
colSpan: v.length + (c != null ? 1 : 0) + (N ? 1 : 0),
|
|
954
|
+
style: { height: we * se, padding: 0, border: "none", verticalAlign: "top", lineHeight: 0 }
|
|
955
|
+
}
|
|
956
|
+
) }),
|
|
957
|
+
x.slice(we, Qe).map((e, n) => {
|
|
958
|
+
const a = we + n, l = C(e);
|
|
959
|
+
return /* @__PURE__ */ o(
|
|
960
|
+
"tr",
|
|
961
|
+
{
|
|
962
|
+
style: { height: se },
|
|
963
|
+
className: [
|
|
964
|
+
typeof _ == "function" ? _(e, a) : _ ?? "",
|
|
965
|
+
N && D.has(l) ? "dyn-table-row--selected" : ""
|
|
966
|
+
].filter(Boolean).join(" "),
|
|
967
|
+
children: [
|
|
968
|
+
N && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--selection", style: { width: U }, children: /* @__PURE__ */ t("label", { className: "dyn-table-selection-cell", children: /* @__PURE__ */ t(
|
|
969
|
+
"input",
|
|
970
|
+
{
|
|
971
|
+
type: "checkbox",
|
|
972
|
+
checked: D.has(l),
|
|
973
|
+
onChange: () => oe(l),
|
|
974
|
+
"aria-label": "Satırı seç"
|
|
975
|
+
}
|
|
976
|
+
) }) }),
|
|
977
|
+
v.map((r, i) => {
|
|
978
|
+
var wt;
|
|
979
|
+
const b = X(e, r), p = r.cell != null ? r.cell(e) : r.valueFormatter != null ? r.valueFormatter(b, e) : r.valueFormat != null ? Ee(b, r.valueFormat, r.valueFormatOptions) : r.cellFormat != null ? Te(r.cellFormat, b, e, r.cellFormatOptions) : b, O = typeof r.cellClass == "function" ? r.cellClass(e, b) : r.cellClass ?? "", k = typeof r.cellStyle == "function" ? r.cellStyle(e, b) : r.cellStyle ?? {}, G = (wt = r.tooltip) == null ? void 0 : wt.call(r, e, b), te = r.pinned === "left", be = r.pinned === "right", le = [
|
|
980
|
+
"dyn-table-td",
|
|
981
|
+
te ? "dyn-table-td--pinned-left" : "",
|
|
982
|
+
be ? "dyn-table-td--pinned-right" : "",
|
|
983
|
+
O
|
|
984
|
+
].filter(Boolean).join(" ");
|
|
985
|
+
return /* @__PURE__ */ t(
|
|
986
|
+
"td",
|
|
987
|
+
{
|
|
988
|
+
className: le.trim(),
|
|
989
|
+
style: {
|
|
990
|
+
width: T[i],
|
|
991
|
+
minWidth: P(r),
|
|
992
|
+
textAlign: r.align ?? "left",
|
|
993
|
+
...r.wrapText ? { whiteSpace: "normal" } : {},
|
|
994
|
+
...te && Q[i] != null ? { left: Q[i] } : {},
|
|
995
|
+
...be && H[i] != null ? { right: H[i] } : {},
|
|
996
|
+
...k
|
|
997
|
+
},
|
|
998
|
+
title: G,
|
|
999
|
+
children: p
|
|
1000
|
+
},
|
|
1001
|
+
r.id
|
|
1002
|
+
);
|
|
1003
|
+
}),
|
|
1004
|
+
c != null && /* @__PURE__ */ t(
|
|
1005
|
+
"td",
|
|
1006
|
+
{
|
|
1007
|
+
className: "dyn-table-td dyn-table-td--actions",
|
|
1008
|
+
style: { textAlign: w },
|
|
1009
|
+
children: c(e)
|
|
1010
|
+
}
|
|
1011
|
+
)
|
|
1012
|
+
]
|
|
1013
|
+
},
|
|
1014
|
+
l
|
|
1015
|
+
);
|
|
1016
|
+
}),
|
|
1017
|
+
Qe < x.length && /* @__PURE__ */ t("tr", { "aria-hidden": !0, className: "dyn-table-virtual-spacer", children: /* @__PURE__ */ t(
|
|
1018
|
+
"td",
|
|
1019
|
+
{
|
|
1020
|
+
colSpan: v.length + (c != null ? 1 : 0) + (N ? 1 : 0),
|
|
1021
|
+
style: { height: (x.length - Qe) * se, padding: 0, border: "none", verticalAlign: "top", lineHeight: 0 }
|
|
1022
|
+
}
|
|
1023
|
+
) })
|
|
1024
|
+
] }) : x.map((e, n) => {
|
|
1025
|
+
const a = C(e);
|
|
1026
|
+
return /* @__PURE__ */ o(
|
|
1027
|
+
"tr",
|
|
1028
|
+
{
|
|
1029
|
+
className: [
|
|
1030
|
+
typeof _ == "function" ? _(e, n) : _ ?? "",
|
|
1031
|
+
N && D.has(a) ? "dyn-table-row--selected" : ""
|
|
1032
|
+
].filter(Boolean).join(" "),
|
|
1033
|
+
children: [
|
|
1034
|
+
N && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--selection", style: { width: U }, children: /* @__PURE__ */ t("label", { className: "dyn-table-selection-cell", children: /* @__PURE__ */ t(
|
|
1035
|
+
"input",
|
|
1036
|
+
{
|
|
1037
|
+
type: "checkbox",
|
|
1038
|
+
checked: D.has(a),
|
|
1039
|
+
onChange: () => oe(a),
|
|
1040
|
+
"aria-label": "Satırı seç"
|
|
1041
|
+
}
|
|
1042
|
+
) }) }),
|
|
1043
|
+
v.map((l, r) => {
|
|
1044
|
+
var le;
|
|
1045
|
+
const i = X(e, l), b = l.cell != null ? l.cell(e) : l.valueFormatter != null ? l.valueFormatter(i, e) : l.valueFormat != null ? Ee(i, l.valueFormat, l.valueFormatOptions) : l.cellFormat != null ? Te(l.cellFormat, i, e, l.cellFormatOptions) : i, p = typeof l.cellClass == "function" ? l.cellClass(e, i) : l.cellClass ?? "", O = typeof l.cellStyle == "function" ? l.cellStyle(e, i) : l.cellStyle ?? {}, k = (le = l.tooltip) == null ? void 0 : le.call(l, e, i), G = l.pinned === "left", te = l.pinned === "right", be = [
|
|
1046
|
+
"dyn-table-td",
|
|
1047
|
+
G ? "dyn-table-td--pinned-left" : "",
|
|
1048
|
+
te ? "dyn-table-td--pinned-right" : "",
|
|
1049
|
+
p
|
|
1050
|
+
].filter(Boolean).join(" ");
|
|
1051
|
+
return /* @__PURE__ */ t(
|
|
1052
|
+
"td",
|
|
1053
|
+
{
|
|
1054
|
+
className: be.trim(),
|
|
1055
|
+
style: {
|
|
1056
|
+
width: T[r],
|
|
1057
|
+
minWidth: P(l),
|
|
1058
|
+
textAlign: l.align ?? "left",
|
|
1059
|
+
...l.wrapText ? { whiteSpace: "normal" } : {},
|
|
1060
|
+
...G && Q[r] != null ? { left: Q[r] } : {},
|
|
1061
|
+
...te && H[r] != null ? { right: H[r] } : {},
|
|
1062
|
+
...O
|
|
1063
|
+
},
|
|
1064
|
+
title: k,
|
|
1065
|
+
children: b
|
|
1066
|
+
},
|
|
1067
|
+
l.id
|
|
1068
|
+
);
|
|
1069
|
+
}),
|
|
1070
|
+
c != null && /* @__PURE__ */ t(
|
|
1071
|
+
"td",
|
|
1072
|
+
{
|
|
1073
|
+
className: "dyn-table-td dyn-table-td--actions",
|
|
1074
|
+
style: { textAlign: w },
|
|
1075
|
+
children: c(e)
|
|
1076
|
+
}
|
|
1077
|
+
)
|
|
1078
|
+
]
|
|
1079
|
+
},
|
|
1080
|
+
a
|
|
1081
|
+
);
|
|
1082
|
+
}) })
|
|
1083
|
+
] })
|
|
1084
|
+
}
|
|
1085
|
+
) })
|
|
1086
|
+
] }) : A ? /* @__PURE__ */ t(
|
|
1087
|
+
"div",
|
|
1088
|
+
{
|
|
1089
|
+
className: "dyn-table-mobile",
|
|
1090
|
+
style: {
|
|
1091
|
+
...m != null && {
|
|
1092
|
+
minHeight: typeof m == "number" ? `${m}px` : m
|
|
1093
|
+
},
|
|
1094
|
+
...y != null && {
|
|
1095
|
+
height: typeof y == "number" ? `${y}px` : y
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
children: fe ? /* @__PURE__ */ t("div", { className: "dyn-table-cards", "aria-busy": !0, children: Array.from({ length: Math.min($e, 5) }, (e, n) => /* @__PURE__ */ o("div", { className: "dyn-table-card dyn-table-card--skeleton", children: [
|
|
1099
|
+
N && /* @__PURE__ */ t("div", { className: "dyn-table-card__selection", children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton dyn-table-skeleton--checkbox" }) }),
|
|
1100
|
+
v.map((a) => /* @__PURE__ */ o("div", { className: "dyn-table-card__row", children: [
|
|
1101
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__label", children: typeof a.header == "string" ? a.header : a.id }),
|
|
1102
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__value", children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton" }) })
|
|
1103
|
+
] }, a.id)),
|
|
1104
|
+
c != null && /* @__PURE__ */ t("div", { className: "dyn-table-card__actions" })
|
|
1105
|
+
] }, `skeleton-card-${n}`)) }) : x.length === 0 ? /* @__PURE__ */ t("div", { className: "dyn-table-empty dyn-table-empty--card", children: z }) : /* @__PURE__ */ t("div", { className: "dyn-table-cards", children: x.map((e) => {
|
|
1106
|
+
const n = C(e);
|
|
1107
|
+
return /* @__PURE__ */ o(
|
|
1108
|
+
"div",
|
|
1109
|
+
{
|
|
1110
|
+
className: `dyn-table-card ${typeof _ == "function" ? _(e, 0) : _ ?? ""}`.trim(),
|
|
1111
|
+
children: [
|
|
1112
|
+
N && /* @__PURE__ */ t("div", { className: "dyn-table-card__selection", children: /* @__PURE__ */ t("label", { className: "dyn-table-selection-cell", children: /* @__PURE__ */ t(
|
|
1113
|
+
"input",
|
|
1114
|
+
{
|
|
1115
|
+
type: "checkbox",
|
|
1116
|
+
checked: D.has(n),
|
|
1117
|
+
onChange: () => oe(n),
|
|
1118
|
+
"aria-label": "Satırı seç"
|
|
1119
|
+
}
|
|
1120
|
+
) }) }),
|
|
1121
|
+
v.map((a) => {
|
|
1122
|
+
const l = X(e, a), r = Wt(e, a, l);
|
|
1123
|
+
return /* @__PURE__ */ o("div", { className: "dyn-table-card__row", children: [
|
|
1124
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__label", children: (typeof a.header == "string", a.header) }),
|
|
1125
|
+
/* @__PURE__ */ t("span", { className: "dyn-table-card__value", children: r })
|
|
1126
|
+
] }, a.id);
|
|
1127
|
+
}),
|
|
1128
|
+
c != null && /* @__PURE__ */ t("div", { className: "dyn-table-card__actions", children: c(e) })
|
|
1129
|
+
]
|
|
1130
|
+
},
|
|
1131
|
+
n
|
|
1132
|
+
);
|
|
1133
|
+
}) })
|
|
1134
|
+
}
|
|
1135
|
+
) : /* @__PURE__ */ t(
|
|
1136
|
+
"div",
|
|
1137
|
+
{
|
|
1138
|
+
ref: Be,
|
|
1139
|
+
className: `dyn-table-scroll ${K ? "dyn-table-scroll--virtualized" : ""} ${We ? "dyn-table-scroll--sticky-header" : ""}`.trim(),
|
|
1140
|
+
style: {
|
|
1141
|
+
...m != null && {
|
|
1142
|
+
minHeight: typeof m == "number" ? `${m}px` : m
|
|
1143
|
+
},
|
|
1144
|
+
...y != null && {
|
|
1145
|
+
height: typeof y == "number" ? `${y}px` : y
|
|
1146
|
+
},
|
|
1147
|
+
...K && {
|
|
1148
|
+
overflowY: "auto",
|
|
1149
|
+
height: y != null ? typeof y == "number" ? `${y}px` : y : m != null ? typeof m == "number" ? `${m}px` : m : 400
|
|
1150
|
+
},
|
|
1151
|
+
...We && !K && {
|
|
1152
|
+
overflowY: "auto",
|
|
1153
|
+
height: y != null ? typeof y == "number" ? `${y}px` : y : m != null ? typeof m == "number" ? `${m}px` : m : 400
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
onScroll: K ? (e) => ct(e.currentTarget.scrollTop) : void 0,
|
|
1157
|
+
children: /* @__PURE__ */ o("table", { className: "dyn-table dyn-table--fixed", children: [
|
|
1158
|
+
/* @__PURE__ */ o("colgroup", { children: [
|
|
1159
|
+
N && /* @__PURE__ */ t("col", { style: { width: U } }),
|
|
1160
|
+
v.map((e, n) => /* @__PURE__ */ t("col", { style: { width: T[n], minWidth: P(e) } }, e.id)),
|
|
1161
|
+
c != null && /* @__PURE__ */ t("col", { style: { width: R } })
|
|
1162
|
+
] }),
|
|
1163
|
+
/* @__PURE__ */ t("thead", { className: q, children: /* @__PURE__ */ o("tr", { children: [
|
|
1164
|
+
N && /* @__PURE__ */ t("th", { className: "dyn-table-th dyn-table-th--selection", style: { width: U }, children: /* @__PURE__ */ t(
|
|
1165
|
+
Tt,
|
|
1166
|
+
{
|
|
1167
|
+
displayData: x,
|
|
1168
|
+
getRowKey: C,
|
|
1169
|
+
selectedSet: D,
|
|
1170
|
+
onToggleAll: gt
|
|
1171
|
+
}
|
|
1172
|
+
) }),
|
|
1173
|
+
v.map((e, n) => {
|
|
1174
|
+
const a = f && e.sortable !== !1 && !e.suppressSort, l = $.id === e.id, r = kt === e.id, i = St === n, b = [
|
|
1175
|
+
"dyn-table-th",
|
|
1176
|
+
a ? "dyn-table-th--sortable" : "",
|
|
1177
|
+
l ? "dyn-table-th--sorted" : "",
|
|
1178
|
+
e.resizable ? "dyn-table-th--resizable" : "",
|
|
1179
|
+
r ? "dyn-table-th--dragging" : "",
|
|
1180
|
+
i ? "dyn-table-th--drag-over" : "",
|
|
1181
|
+
e.headerClass ?? ""
|
|
1182
|
+
].filter(Boolean).join(" ");
|
|
1183
|
+
return /* @__PURE__ */ o(
|
|
1184
|
+
"th",
|
|
1185
|
+
{
|
|
1186
|
+
className: b,
|
|
1187
|
+
style: {
|
|
1188
|
+
width: T[n],
|
|
1189
|
+
minWidth: P(e),
|
|
1190
|
+
maxWidth: j(e.maxWidth),
|
|
1191
|
+
textAlign: e.headerAlign ?? e.align ?? "left",
|
|
1192
|
+
...e.headerStyle
|
|
1193
|
+
},
|
|
1194
|
+
title: e.headerTooltip,
|
|
1195
|
+
onClick: () => a && pt(e.id),
|
|
1196
|
+
onDragOver: Z && !A ? (p) => Dt(p, n) : void 0,
|
|
1197
|
+
onDragLeave: Z && !A ? Ft : void 0,
|
|
1198
|
+
onDrop: Z && !A ? (p) => Mt(p, n) : void 0,
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ o("span", { className: "dyn-table-th__content", children: [
|
|
1201
|
+
Z && !A && /* @__PURE__ */ t(
|
|
1202
|
+
"span",
|
|
1203
|
+
{
|
|
1204
|
+
className: "dyn-table-th__drag-handle",
|
|
1205
|
+
draggable: !0,
|
|
1206
|
+
onDragStart: (p) => Ct(p, e.id),
|
|
1207
|
+
onDragEnd: Lt,
|
|
1208
|
+
onClick: (p) => p.stopPropagation(),
|
|
1209
|
+
"aria-label": `${e.id} kolonunu taşı`,
|
|
1210
|
+
children: /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ t("path", { d: "M8 6h2V4H8v2zm0 4h2V8H8v2zm0 4h2v-2H8v2zm4-8h2V4h-2v2zm0 4h2V8h-2v2zm0 4h2v-2h-2v2z" }) })
|
|
1211
|
+
}
|
|
1212
|
+
),
|
|
1213
|
+
e.header,
|
|
1214
|
+
a && /* @__PURE__ */ o("span", { className: "dyn-table-sort", "aria-hidden": !0, children: [
|
|
1215
|
+
l && $.direction === "asc" && /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "currentColor", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M7 15l5-5 5 5H7z" }) }),
|
|
1216
|
+
l && $.direction === "desc" && /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "currentColor", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M7 10l5 5 5-5H7z" }) }),
|
|
1217
|
+
!l && /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ t("path", { d: "M7 15l5-5 5 5H7z" }) })
|
|
1218
|
+
] })
|
|
1219
|
+
] }),
|
|
1220
|
+
e.resizable && /* @__PURE__ */ t(
|
|
1221
|
+
Et,
|
|
1222
|
+
{
|
|
1223
|
+
colId: e.id,
|
|
1224
|
+
minWidth: P(e),
|
|
1225
|
+
maxWidth: j(e.maxWidth),
|
|
1226
|
+
startWidth: T[n],
|
|
1227
|
+
onResize: (p) => ut((O) => ({ ...O, [e.id]: p }))
|
|
1228
|
+
}
|
|
1229
|
+
)
|
|
1230
|
+
]
|
|
1231
|
+
},
|
|
1232
|
+
e.id
|
|
1233
|
+
);
|
|
1234
|
+
}),
|
|
1235
|
+
c != null && /* @__PURE__ */ t(
|
|
1236
|
+
"th",
|
|
1237
|
+
{
|
|
1238
|
+
className: "dyn-table-th dyn-table-th--actions",
|
|
1239
|
+
style: {
|
|
1240
|
+
width: R,
|
|
1241
|
+
minWidth: R,
|
|
1242
|
+
textAlign: w
|
|
1243
|
+
},
|
|
1244
|
+
children: W
|
|
1245
|
+
}
|
|
1246
|
+
)
|
|
1247
|
+
] }) }),
|
|
1248
|
+
/* @__PURE__ */ t("tbody", { className: V, children: fe ? Array.from({ length: $e }, (e, n) => /* @__PURE__ */ o("tr", { className: "dyn-table-row--skeleton", "aria-busy": !0, children: [
|
|
1249
|
+
N && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--selection", style: { width: U }, children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton dyn-table-skeleton--checkbox" }) }),
|
|
1250
|
+
v.map((a, l) => /* @__PURE__ */ t(
|
|
1251
|
+
"td",
|
|
1252
|
+
{
|
|
1253
|
+
className: "dyn-table-td",
|
|
1254
|
+
style: { width: T[l], minWidth: P(a), textAlign: a.align ?? "left" },
|
|
1255
|
+
children: /* @__PURE__ */ t("span", { className: "dyn-table-skeleton" })
|
|
1256
|
+
},
|
|
1257
|
+
a.id
|
|
1258
|
+
)),
|
|
1259
|
+
c != null && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--actions", style: { width: R } })
|
|
1260
|
+
] }, `skeleton-${n}`)) : x.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t(
|
|
1261
|
+
"td",
|
|
1262
|
+
{
|
|
1263
|
+
colSpan: v.length + (c != null ? 1 : 0) + (N ? 1 : 0),
|
|
1264
|
+
className: "dyn-table-empty",
|
|
1265
|
+
children: z
|
|
1266
|
+
}
|
|
1267
|
+
) }) : x.map((e, n) => {
|
|
1268
|
+
const a = C(e);
|
|
1269
|
+
return /* @__PURE__ */ o(
|
|
1270
|
+
"tr",
|
|
1271
|
+
{
|
|
1272
|
+
className: [
|
|
1273
|
+
typeof _ == "function" ? _(e, n) : _ ?? "",
|
|
1274
|
+
N && D.has(a) ? "dyn-table-row--selected" : ""
|
|
1275
|
+
].filter(Boolean).join(" "),
|
|
1276
|
+
children: [
|
|
1277
|
+
N && /* @__PURE__ */ t("td", { className: "dyn-table-td dyn-table-td--selection", style: { width: U }, children: /* @__PURE__ */ t("label", { className: "dyn-table-selection-cell", children: /* @__PURE__ */ t(
|
|
1278
|
+
"input",
|
|
1279
|
+
{
|
|
1280
|
+
type: "checkbox",
|
|
1281
|
+
checked: D.has(a),
|
|
1282
|
+
onChange: () => oe(a),
|
|
1283
|
+
"aria-label": "Satırı seç"
|
|
1284
|
+
}
|
|
1285
|
+
) }) }),
|
|
1286
|
+
v.map((l, r) => {
|
|
1287
|
+
var le;
|
|
1288
|
+
const i = X(e, l), b = l.cell != null ? l.cell(e) : l.valueFormatter != null ? l.valueFormatter(i, e) : l.valueFormat != null ? Ee(i, l.valueFormat, l.valueFormatOptions) : l.cellFormat != null ? Te(l.cellFormat, i, e, l.cellFormatOptions) : i, p = typeof l.cellClass == "function" ? l.cellClass(e, i) : l.cellClass ?? "", O = typeof l.cellStyle == "function" ? l.cellStyle(e, i) : l.cellStyle ?? {}, k = (le = l.tooltip) == null ? void 0 : le.call(l, e, i), G = l.pinned === "left", te = l.pinned === "right", be = [
|
|
1289
|
+
"dyn-table-td",
|
|
1290
|
+
G ? "dyn-table-td--pinned-left" : "",
|
|
1291
|
+
te ? "dyn-table-td--pinned-right" : "",
|
|
1292
|
+
p
|
|
1293
|
+
].filter(Boolean).join(" ");
|
|
1294
|
+
return /* @__PURE__ */ t(
|
|
1295
|
+
"td",
|
|
1296
|
+
{
|
|
1297
|
+
className: be.trim(),
|
|
1298
|
+
style: {
|
|
1299
|
+
width: T[r],
|
|
1300
|
+
minWidth: P(l),
|
|
1301
|
+
textAlign: l.align ?? "left",
|
|
1302
|
+
...l.wrapText ? { whiteSpace: "normal" } : {},
|
|
1303
|
+
...G && Q[r] != null ? { left: Q[r] } : {},
|
|
1304
|
+
...te && H[r] != null ? { right: H[r] } : {},
|
|
1305
|
+
...O
|
|
1306
|
+
},
|
|
1307
|
+
title: k,
|
|
1308
|
+
children: b
|
|
1309
|
+
},
|
|
1310
|
+
l.id
|
|
1311
|
+
);
|
|
1312
|
+
}),
|
|
1313
|
+
c != null && /* @__PURE__ */ t(
|
|
1314
|
+
"td",
|
|
1315
|
+
{
|
|
1316
|
+
className: "dyn-table-td dyn-table-td--actions",
|
|
1317
|
+
style: { textAlign: w },
|
|
1318
|
+
children: c(e)
|
|
1319
|
+
}
|
|
1320
|
+
)
|
|
1321
|
+
]
|
|
1322
|
+
},
|
|
1323
|
+
a
|
|
1324
|
+
);
|
|
1325
|
+
}) })
|
|
1326
|
+
] })
|
|
1327
|
+
}
|
|
1328
|
+
),
|
|
1329
|
+
ae && Ce > 0 && /* @__PURE__ */ o("div", { className: "dyn-table-pagination", children: [
|
|
1330
|
+
/* @__PURE__ */ o("div", { className: "dyn-table-pagination__info", children: [
|
|
1331
|
+
rn,
|
|
1332
|
+
"-",
|
|
1333
|
+
sn,
|
|
1334
|
+
" / ",
|
|
1335
|
+
Ce,
|
|
1336
|
+
" kayıt"
|
|
1337
|
+
] }),
|
|
1338
|
+
/* @__PURE__ */ o("div", { className: "dyn-table-pagination__controls", children: [
|
|
1339
|
+
/* @__PURE__ */ t(
|
|
1340
|
+
"select",
|
|
1341
|
+
{
|
|
1342
|
+
className: "dyn-table-pagination__pagesize",
|
|
1343
|
+
value: E,
|
|
1344
|
+
onChange: (e) => {
|
|
1345
|
+
const n = Number(e.target.value);
|
|
1346
|
+
Ve(n), Pe(1, n);
|
|
1347
|
+
},
|
|
1348
|
+
"aria-label": "Sayfa başına kayıt",
|
|
1349
|
+
children: Oe.map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e))
|
|
1350
|
+
}
|
|
1351
|
+
),
|
|
1352
|
+
/* @__PURE__ */ t(
|
|
1353
|
+
"button",
|
|
1354
|
+
{
|
|
1355
|
+
type: "button",
|
|
1356
|
+
className: "dyn-table-pagination__btn",
|
|
1357
|
+
disabled: Y <= 1,
|
|
1358
|
+
onClick: () => Pe(Y - 1, E),
|
|
1359
|
+
"aria-label": "Önceki sayfa",
|
|
1360
|
+
children: "Önceki"
|
|
1361
|
+
}
|
|
1362
|
+
),
|
|
1363
|
+
/* @__PURE__ */ o("span", { className: "dyn-table-pagination__page", children: [
|
|
1364
|
+
"Sayfa ",
|
|
1365
|
+
Y,
|
|
1366
|
+
" / ",
|
|
1367
|
+
Ye
|
|
1368
|
+
] }),
|
|
1369
|
+
/* @__PURE__ */ t(
|
|
1370
|
+
"button",
|
|
1371
|
+
{
|
|
1372
|
+
type: "button",
|
|
1373
|
+
className: "dyn-table-pagination__btn",
|
|
1374
|
+
disabled: Y >= Ye,
|
|
1375
|
+
onClick: () => Pe(Y + 1, E),
|
|
1376
|
+
"aria-label": "Sonraki sayfa",
|
|
1377
|
+
children: "Sonraki"
|
|
1378
|
+
}
|
|
1379
|
+
)
|
|
1380
|
+
] })
|
|
1381
|
+
] })
|
|
1382
|
+
] });
|
|
1383
|
+
}
|
|
1384
|
+
export {
|
|
1385
|
+
Nn as Table
|
|
1386
|
+
};
|
|
1387
|
+
//# sourceMappingURL=dyn-table.js.map
|