@ynput/ayon-frontend-shared 0.4.7 → 0.5.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/dist/DetailsPanel.es.js +684 -651
- package/dist/ListTable.es.js +8 -7
- package/dist/ProjectTreeTable.es.js +2223 -2184
- package/dist/Slicer.es.js +152 -120
- package/dist/api.es.js +202 -201
- package/dist/chunks/Actions.es.js +20 -20
- package/dist/chunks/ColumnDropIndicator.es.js +127 -241
- package/dist/chunks/DeleteEntitiesContext.es.js +36 -36
- package/dist/chunks/DetailsDialog.es.js +3 -3
- package/dist/chunks/EntityPath.es.js +22 -22
- package/dist/chunks/EntityPickerDialog.es.js +1 -1
- package/dist/chunks/EntityTooltip.es.js +12 -12
- package/dist/chunks/Feed.es.js +2 -2
- package/dist/chunks/FilterErrorActions.es.js +5 -5
- package/dist/chunks/GlobalContext.es.js +14 -14
- package/dist/chunks/InfoMessage.es.js +146 -0
- package/dist/chunks/Menu.es.js +5 -5
- package/dist/chunks/MenuContext.es.js +75 -73
- package/dist/chunks/MetaWidget.es.js +1968 -1960
- package/dist/chunks/NewEntityContext.es.js +538 -543
- package/dist/chunks/PlayableIcon.es.js +54 -54
- package/dist/chunks/ProjectContext.es.js +12 -12
- package/dist/chunks/ProjectFoldersContext.es.js +84 -76
- package/dist/chunks/RepresentationsList.es.js +1 -1
- package/dist/chunks/ReviewablesSelector.es.js +387 -384
- package/dist/chunks/SimpleTable.es.js +286 -283
- package/dist/chunks/Slicer.es.js +1121 -683
- package/dist/chunks/VersionUploadContext.es.js +26 -26
- package/dist/chunks/ViewsContext.es.js +31 -31
- package/dist/chunks/Watchers.es.js +1 -1
- package/dist/chunks/entityDefinitions.es.js +275 -133
- package/dist/chunks/getUris.es.js +236 -231
- package/dist/chunks/searchTerms.es.js +9 -0
- package/dist/chunks/useAttributeEnums.es.js +69 -61
- package/dist/chunks/useLocalStorage.es.js +10 -10
- package/dist/chunks/viewUpdateHelper.es.js +23 -23
- package/dist/components.es.js +166 -166
- package/dist/hooks.es.js +44 -43
- package/dist/index.es.js +11 -10
- package/dist/types/DetailsPanel.d.ts +6 -0
- package/dist/types/ProjectTreeTable.d.ts +28 -6
- package/dist/types/RepresentationsList.d.ts +3 -0
- package/dist/types/SimpleTable.d.ts +1 -0
- package/dist/types/Slicer.d.ts +103 -18
- package/dist/types/api.d.ts +13 -0
- package/dist/types/components.d.ts +7 -5
- package/package.json +11 -10
- package/dist/chunks/useSlicerSplitter.es.js +0 -18
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
2
|
-
import { useCallback as w, createContext as
|
|
3
|
-
import { theme as
|
|
4
|
-
import
|
|
5
|
-
import { functionalUpdate as
|
|
6
|
-
import { useVirtualizer as
|
|
7
|
-
import
|
|
8
|
-
import { compareItems as
|
|
1
|
+
import { jsx as d, jsxs as G, Fragment as $e } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as w, createContext as Ie, useContext as Le, forwardRef as je, useState as Pe, useEffect as ye, useRef as R, useMemo as se } from "react";
|
|
3
|
+
import { theme as He, Button as xe, Icon as fe, InputText as Ve, Spacer as Be } from "@ynput/ayon-react-components";
|
|
4
|
+
import L from "styled-components";
|
|
5
|
+
import { functionalUpdate as he, useReactTable as qe, getExpandedRowModel as Oe, getFilteredRowModel as Ge, getCoreRowModel as _e, flexRender as Qe, sortingFns as Je } from "@tanstack/react-table";
|
|
6
|
+
import { useVirtualizer as Ue } from "@tanstack/react-virtual";
|
|
7
|
+
import K from "clsx";
|
|
8
|
+
import { compareItems as We } from "@tanstack/match-sorter-utils";
|
|
9
9
|
import "lodash";
|
|
10
10
|
import "primereact/confirmdialog";
|
|
11
11
|
import "react-toastify";
|
|
12
12
|
import "uuid";
|
|
13
|
-
import { bq as
|
|
14
|
-
import { E as
|
|
15
|
-
import { a as
|
|
13
|
+
import { bq as Ye, br as Xe } from "./searchTerms.es.js";
|
|
14
|
+
import { E as Ze } from "./EmptyPlaceholder.es.js";
|
|
15
|
+
import { a as et } from "./useCreateContextMenu.es.js";
|
|
16
16
|
import "primereact-context/contextmenu";
|
|
17
|
-
const
|
|
17
|
+
const tt = L.div`
|
|
18
18
|
display: flex;
|
|
19
19
|
|
|
20
20
|
height: 100%;
|
|
@@ -40,7 +40,7 @@ const Xe = P.div`
|
|
|
40
40
|
font-size: 32px;
|
|
41
41
|
}
|
|
42
42
|
h3 {
|
|
43
|
-
${
|
|
43
|
+
${He.titleMedium}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -70,7 +70,7 @@ const Xe = P.div`
|
|
|
70
70
|
padding: 1px 0px;
|
|
71
71
|
width: 100%;
|
|
72
72
|
}
|
|
73
|
-
`,
|
|
73
|
+
`, nt = L.div`
|
|
74
74
|
width: 100%;
|
|
75
75
|
min-height: 32px;
|
|
76
76
|
user-select: none;
|
|
@@ -261,7 +261,7 @@ const Xe = P.div`
|
|
|
261
261
|
border-radius: 2px;
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
`,
|
|
264
|
+
`, ot = L(xe)`
|
|
265
265
|
&.expander {
|
|
266
266
|
background-color: unset;
|
|
267
267
|
padding: 2px;
|
|
@@ -270,7 +270,7 @@ const Xe = P.div`
|
|
|
270
270
|
background-color: var(--md-sys-color-surface-container-high-hover);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`,
|
|
273
|
+
`, Mt = L.div`
|
|
274
274
|
border-radius: var(--border-radius-m);
|
|
275
275
|
overflow: hidden;
|
|
276
276
|
background-color: var(--md-sys-color-surface-container-low);
|
|
@@ -280,7 +280,7 @@ const Xe = P.div`
|
|
|
280
280
|
display: flex;
|
|
281
281
|
flex-direction: column;
|
|
282
282
|
position: relative;
|
|
283
|
-
`,
|
|
283
|
+
`, Ft = L.div`
|
|
284
284
|
padding: 2px;
|
|
285
285
|
width: 100%;
|
|
286
286
|
justify-content: space-between;
|
|
@@ -291,7 +291,7 @@ const Xe = P.div`
|
|
|
291
291
|
gap: var(--base-gap-small);
|
|
292
292
|
|
|
293
293
|
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
294
|
-
`,
|
|
294
|
+
`, Nt = L(xe)`
|
|
295
295
|
background-color: unset !important;
|
|
296
296
|
z-index: 110;
|
|
297
297
|
position: relative;
|
|
@@ -312,7 +312,7 @@ const Xe = P.div`
|
|
|
312
312
|
background-color: var(--md-sys-color-surface-container-hover) !important;
|
|
313
313
|
}
|
|
314
314
|
`;
|
|
315
|
-
function
|
|
315
|
+
function rt({
|
|
316
316
|
handleRowSelect: t,
|
|
317
317
|
handleArrowNavigation: a,
|
|
318
318
|
handleRename: l
|
|
@@ -323,26 +323,26 @@ function tt({
|
|
|
323
323
|
n.preventDefault(), n.stopPropagation(), t(n, p);
|
|
324
324
|
else if (n.key === "ArrowDown" || n.key === "ArrowUp") {
|
|
325
325
|
n.preventDefault(), n.stopPropagation();
|
|
326
|
-
const
|
|
327
|
-
a?.(
|
|
326
|
+
const b = n.key === "ArrowDown" ? "down" : "up";
|
|
327
|
+
a?.(b, p, n);
|
|
328
328
|
} else n.key.toLowerCase() === "r" && !n.ctrlKey && !n.metaKey && (n.preventDefault(), n.stopPropagation(), l?.(n, p));
|
|
329
329
|
},
|
|
330
330
|
[t, a, l]
|
|
331
331
|
) };
|
|
332
332
|
}
|
|
333
|
-
const
|
|
334
|
-
const t =
|
|
333
|
+
const be = Ie(void 0), Dt = ({ children: t, ...a }) => /* @__PURE__ */ d(be.Provider, { value: { ...a }, children: t }), at = () => {
|
|
334
|
+
const t = Le(be);
|
|
335
335
|
if (t === void 0)
|
|
336
336
|
throw new Error("useSimpleTableContext must be used within a SimpleTableProvider");
|
|
337
337
|
return t;
|
|
338
|
-
},
|
|
338
|
+
}, it = ({
|
|
339
339
|
isRowExpandable: t,
|
|
340
340
|
isRowExpanded: a,
|
|
341
341
|
enableNonFolderIndent: l = !0,
|
|
342
342
|
isTableExpandable: u,
|
|
343
343
|
onExpandClick: n
|
|
344
344
|
}) => t ? /* @__PURE__ */ d(
|
|
345
|
-
|
|
345
|
+
ot,
|
|
346
346
|
{
|
|
347
347
|
onClick: (p) => {
|
|
348
348
|
p.stopPropagation(), n?.(p);
|
|
@@ -351,7 +351,7 @@ const he = Te(void 0), Mt = ({ children: t, ...a }) => /* @__PURE__ */ d(he.Prov
|
|
|
351
351
|
className: "expander",
|
|
352
352
|
style: { cursor: "pointer" }
|
|
353
353
|
}
|
|
354
|
-
) : u && l && /* @__PURE__ */ d("div", { style: { display: "inline-block", minWidth: 24 } }),
|
|
354
|
+
) : u && l && /* @__PURE__ */ d("div", { style: { display: "inline-block", minWidth: 24 } }), lt = je(
|
|
355
355
|
({
|
|
356
356
|
value: t,
|
|
357
357
|
icon: a,
|
|
@@ -359,95 +359,95 @@ const he = Te(void 0), Mt = ({ children: t, ...a }) => /* @__PURE__ */ d(he.Prov
|
|
|
359
359
|
iconColor: u,
|
|
360
360
|
iconFilled: n,
|
|
361
361
|
img: p,
|
|
362
|
-
imgShape:
|
|
363
|
-
imgRatio:
|
|
364
|
-
imgPosition:
|
|
365
|
-
isRowExpandable:
|
|
366
|
-
isRowExpanded:
|
|
367
|
-
isTableExpandable:
|
|
368
|
-
enableNonFolderIndent:
|
|
369
|
-
onExpandClick:
|
|
370
|
-
startContent:
|
|
371
|
-
endContent:
|
|
372
|
-
badge:
|
|
373
|
-
actions:
|
|
374
|
-
isRenaming:
|
|
375
|
-
renameInitialValue:
|
|
376
|
-
onSubmitRename:
|
|
377
|
-
onCancelRename:
|
|
378
|
-
renamePlaceholder:
|
|
379
|
-
depth:
|
|
380
|
-
isDisabled:
|
|
381
|
-
disabledMessage:
|
|
382
|
-
active:
|
|
383
|
-
inactive:
|
|
384
|
-
style:
|
|
362
|
+
imgShape: b = "square",
|
|
363
|
+
imgRatio: x,
|
|
364
|
+
imgPosition: M = "start",
|
|
365
|
+
isRowExpandable: _,
|
|
366
|
+
isRowExpanded: j,
|
|
367
|
+
isTableExpandable: Q,
|
|
368
|
+
enableNonFolderIndent: J = !0,
|
|
369
|
+
onExpandClick: P,
|
|
370
|
+
startContent: U,
|
|
371
|
+
endContent: H,
|
|
372
|
+
badge: C,
|
|
373
|
+
actions: F,
|
|
374
|
+
isRenaming: E,
|
|
375
|
+
renameInitialValue: N,
|
|
376
|
+
onSubmitRename: W,
|
|
377
|
+
onCancelRename: V,
|
|
378
|
+
renamePlaceholder: Y,
|
|
379
|
+
depth: k = 0,
|
|
380
|
+
isDisabled: X,
|
|
381
|
+
disabledMessage: Z,
|
|
382
|
+
active: ee,
|
|
383
|
+
inactive: D,
|
|
384
|
+
style: re,
|
|
385
385
|
pt: y,
|
|
386
|
-
...
|
|
387
|
-
},
|
|
388
|
-
const [
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}, [t,
|
|
392
|
-
const
|
|
386
|
+
...te
|
|
387
|
+
}, z) => {
|
|
388
|
+
const [B, T] = Pe(N ?? t);
|
|
389
|
+
ye(() => {
|
|
390
|
+
E && T(N ?? t);
|
|
391
|
+
}, [t, E, N]);
|
|
392
|
+
const S = p ? /* @__PURE__ */ d(
|
|
393
393
|
"img",
|
|
394
394
|
{
|
|
395
395
|
src: p,
|
|
396
396
|
...y?.img,
|
|
397
397
|
alt: "",
|
|
398
|
-
className:
|
|
398
|
+
className: K("image", b, `img-${M}`, y?.img?.className),
|
|
399
399
|
style: {
|
|
400
|
-
aspectRatio: (
|
|
400
|
+
aspectRatio: (x ?? 1).toString(),
|
|
401
401
|
...y?.img?.style
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
) : (
|
|
405
405
|
// keep the slot so rows don't shift when a thumbnail is missing
|
|
406
|
-
|
|
406
|
+
x !== void 0 && /* @__PURE__ */ d(
|
|
407
407
|
"div",
|
|
408
408
|
{
|
|
409
|
-
className:
|
|
409
|
+
className: K("image", b, `img-${M}`, y?.img?.className),
|
|
410
410
|
style: {
|
|
411
|
-
aspectRatio:
|
|
411
|
+
aspectRatio: x.toString(),
|
|
412
412
|
...y?.img?.style
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
)
|
|
416
416
|
);
|
|
417
|
-
return /* @__PURE__ */
|
|
418
|
-
|
|
417
|
+
return /* @__PURE__ */ G(
|
|
418
|
+
nt,
|
|
419
419
|
{
|
|
420
|
-
...
|
|
421
|
-
ref:
|
|
422
|
-
className:
|
|
423
|
-
disabled:
|
|
424
|
-
inactive:
|
|
425
|
-
"has-actions": !!
|
|
420
|
+
...te,
|
|
421
|
+
ref: z,
|
|
422
|
+
className: K(te.className, {
|
|
423
|
+
disabled: X,
|
|
424
|
+
inactive: D || ee === !1,
|
|
425
|
+
"has-actions": !!F?.length
|
|
426
426
|
}),
|
|
427
427
|
style: {
|
|
428
|
-
...
|
|
429
|
-
paddingLeft: `calc(${
|
|
428
|
+
...re,
|
|
429
|
+
paddingLeft: `calc(${k * 1.5}rem + 4px)`
|
|
430
430
|
},
|
|
431
|
-
title:
|
|
431
|
+
title: X ? Z : void 0,
|
|
432
432
|
children: [
|
|
433
433
|
/* @__PURE__ */ d(
|
|
434
|
-
|
|
434
|
+
it,
|
|
435
435
|
{
|
|
436
|
-
isRowExpandable:
|
|
437
|
-
isRowExpanded:
|
|
438
|
-
isTableExpandable:
|
|
439
|
-
onExpandClick:
|
|
440
|
-
enableNonFolderIndent:
|
|
436
|
+
isRowExpandable: _,
|
|
437
|
+
isRowExpanded: j,
|
|
438
|
+
isTableExpandable: Q,
|
|
439
|
+
onExpandClick: P,
|
|
440
|
+
enableNonFolderIndent: J,
|
|
441
441
|
...y?.expander
|
|
442
442
|
}
|
|
443
443
|
),
|
|
444
|
-
|
|
445
|
-
|
|
444
|
+
M === "start" && S,
|
|
445
|
+
U,
|
|
446
446
|
a && /* @__PURE__ */ d(
|
|
447
|
-
|
|
447
|
+
fe,
|
|
448
448
|
{
|
|
449
449
|
icon: a,
|
|
450
|
-
className:
|
|
450
|
+
className: K({ filled: n }, y?.icon?.className),
|
|
451
451
|
style: {
|
|
452
452
|
color: u,
|
|
453
453
|
...y?.icon?.style
|
|
@@ -455,129 +455,132 @@ const he = Te(void 0), Mt = ({ children: t, ...a }) => /* @__PURE__ */ d(he.Prov
|
|
|
455
455
|
...y?.icon
|
|
456
456
|
}
|
|
457
457
|
),
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
E ? /* @__PURE__ */ d(
|
|
459
|
+
Ve,
|
|
460
460
|
{
|
|
461
461
|
autoFocus: !0,
|
|
462
462
|
style: { flex: 1 },
|
|
463
|
-
onChange: (
|
|
464
|
-
value:
|
|
465
|
-
placeholder:
|
|
466
|
-
onKeyDown: (
|
|
467
|
-
|
|
463
|
+
onChange: (f) => T(f.target.value),
|
|
464
|
+
value: B,
|
|
465
|
+
placeholder: Y,
|
|
466
|
+
onKeyDown: (f) => {
|
|
467
|
+
f.key === "Enter" && W?.(B), f.key === "Escape" && V?.();
|
|
468
468
|
},
|
|
469
469
|
onBlur: () => {
|
|
470
|
-
|
|
470
|
+
V?.();
|
|
471
471
|
},
|
|
472
|
-
onFocus: (
|
|
473
|
-
|
|
472
|
+
onFocus: (f) => {
|
|
473
|
+
f.target.select();
|
|
474
474
|
},
|
|
475
475
|
...y?.input
|
|
476
476
|
}
|
|
477
|
-
) : /* @__PURE__ */
|
|
478
|
-
l &&
|
|
477
|
+
) : /* @__PURE__ */ G("div", { className: "text", ...y?.text, children: [
|
|
478
|
+
l && k === 0 && /* @__PURE__ */ G("span", { className: "path", children: [
|
|
479
479
|
l.join(" / "),
|
|
480
480
|
" / "
|
|
481
481
|
] }),
|
|
482
482
|
/* @__PURE__ */ d("span", { className: "value", children: t })
|
|
483
483
|
] }),
|
|
484
|
-
!
|
|
485
|
-
/* @__PURE__ */ d(
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
const { show:
|
|
489
|
-
return
|
|
490
|
-
|
|
484
|
+
!E && /* @__PURE__ */ G($e, { children: [
|
|
485
|
+
/* @__PURE__ */ d(Be, { className: "spacer" }),
|
|
486
|
+
C?.toString() && /* @__PURE__ */ d("div", { className: "badges", children: typeof C == "string" ? /* @__PURE__ */ d("span", { children: C }) : C }),
|
|
487
|
+
F && /* @__PURE__ */ d("div", { className: "actions", children: F.map((f, q) => {
|
|
488
|
+
const { show: A = "hover", ...$ } = f;
|
|
489
|
+
return A === "hidden" ? null : /* @__PURE__ */ d(
|
|
490
|
+
fe,
|
|
491
491
|
{
|
|
492
|
-
|
|
493
|
-
className:
|
|
492
|
+
...$,
|
|
493
|
+
className: K($.className, { "show-always": A === "always" })
|
|
494
494
|
},
|
|
495
|
-
|
|
495
|
+
$.icon + q.toString()
|
|
496
496
|
);
|
|
497
497
|
}) })
|
|
498
498
|
] }),
|
|
499
|
-
|
|
500
|
-
|
|
499
|
+
M === "end" && S,
|
|
500
|
+
H && H
|
|
501
501
|
]
|
|
502
502
|
}
|
|
503
503
|
);
|
|
504
504
|
}
|
|
505
|
-
),
|
|
506
|
-
t.toggleExpanded(a), t.subRows.forEach((l) =>
|
|
507
|
-
},
|
|
505
|
+
), st = (t) => t ? Array.isArray(t) ? t.filter(Boolean) : [t] : [], we = (t, a) => {
|
|
506
|
+
t.toggleExpanded(a), t.subRows.forEach((l) => we(l, a));
|
|
507
|
+
}, ve = (t, a, l, u) => {
|
|
508
508
|
const n = t.getValue(a);
|
|
509
509
|
let p = typeof n == "string" ? n : Array.isArray(n) ? n.join(" ") : JSON.stringify(n);
|
|
510
510
|
a === "label" && (p = [t.original.label, t.original.name, ...t.original.parents || []].join(
|
|
511
511
|
" "
|
|
512
512
|
));
|
|
513
|
-
const
|
|
514
|
-
return u({ itemRank:
|
|
513
|
+
const b = Ye(p, l);
|
|
514
|
+
return u({ itemRank: b }), b.passed;
|
|
515
515
|
};
|
|
516
|
-
|
|
517
|
-
const
|
|
516
|
+
ve.resolveFilterValue = Xe;
|
|
517
|
+
const ct = (t, a, l) => {
|
|
518
518
|
let u = 0;
|
|
519
|
-
return t.columnFiltersMeta[l] && (u =
|
|
519
|
+
return t.columnFiltersMeta[l] && (u = We(
|
|
520
520
|
t.columnFiltersMeta[l]?.itemRank,
|
|
521
521
|
a.columnFiltersMeta[l]?.itemRank
|
|
522
|
-
)), u === 0 ?
|
|
522
|
+
)), u === 0 ? Je.alphanumeric(t, a, l) : u;
|
|
523
523
|
};
|
|
524
|
-
function
|
|
524
|
+
function dt(t, a, l) {
|
|
525
525
|
let u = -1, n = -1;
|
|
526
|
-
for (let
|
|
526
|
+
for (let x = 0; x < t.length && (t[x].id === a && (u = x), t[x].id === l && (n = x), !(u !== -1 && n !== -1)); x++)
|
|
527
527
|
;
|
|
528
528
|
if (u === -1 || n === -1) return [];
|
|
529
|
-
const p = Math.min(u, n),
|
|
530
|
-
return t.slice(p,
|
|
529
|
+
const p = Math.min(u, n), b = Math.max(u, n);
|
|
530
|
+
return t.slice(p, b + 1);
|
|
531
531
|
}
|
|
532
|
-
const
|
|
532
|
+
const zt = ({
|
|
533
533
|
data: t = [],
|
|
534
534
|
isLoading: a,
|
|
535
535
|
error: l,
|
|
536
536
|
isExpandable: u,
|
|
537
537
|
isMultiSelect: n = !0,
|
|
538
538
|
enableClickToDeselect: p = !0,
|
|
539
|
-
enableNonFolderIndent:
|
|
540
|
-
forceUpdateTable:
|
|
541
|
-
globalFilter:
|
|
542
|
-
meta:
|
|
543
|
-
rowHeight:
|
|
544
|
-
imgRatio:
|
|
545
|
-
imgPosition:
|
|
546
|
-
onScrollBottom:
|
|
547
|
-
onRename:
|
|
548
|
-
renamingId:
|
|
549
|
-
renameInitialValue:
|
|
550
|
-
onSubmitRename:
|
|
551
|
-
onCancelRename:
|
|
552
|
-
onRowDoubleClick:
|
|
553
|
-
onRowOptionClick:
|
|
554
|
-
rowContextMenuBuilders:
|
|
555
|
-
children:
|
|
556
|
-
pt:
|
|
557
|
-
fitContent:
|
|
558
|
-
|
|
539
|
+
enableNonFolderIndent: b = !0,
|
|
540
|
+
forceUpdateTable: x,
|
|
541
|
+
globalFilter: M,
|
|
542
|
+
meta: _,
|
|
543
|
+
rowHeight: j,
|
|
544
|
+
imgRatio: Q,
|
|
545
|
+
imgPosition: J,
|
|
546
|
+
onScrollBottom: P,
|
|
547
|
+
onRename: U,
|
|
548
|
+
renamingId: H,
|
|
549
|
+
renameInitialValue: C,
|
|
550
|
+
onSubmitRename: F,
|
|
551
|
+
onCancelRename: E,
|
|
552
|
+
onRowDoubleClick: N,
|
|
553
|
+
onRowOptionClick: W,
|
|
554
|
+
rowContextMenuBuilders: V = [],
|
|
555
|
+
children: Y,
|
|
556
|
+
pt: k,
|
|
557
|
+
fitContent: X,
|
|
558
|
+
rowIdPrefix: Z,
|
|
559
|
+
...ee
|
|
559
560
|
}) => {
|
|
560
561
|
const {
|
|
561
|
-
rowSelection:
|
|
562
|
+
rowSelection: D,
|
|
562
563
|
expanded: re,
|
|
563
|
-
setExpanded:
|
|
564
|
-
onExpandedChange:
|
|
565
|
-
onRowSelectionChange:
|
|
566
|
-
rowPinning:
|
|
567
|
-
onRowPinningChange:
|
|
568
|
-
} =
|
|
569
|
-
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
const
|
|
573
|
-
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
const
|
|
564
|
+
setExpanded: y,
|
|
565
|
+
onExpandedChange: te,
|
|
566
|
+
onRowSelectionChange: z,
|
|
567
|
+
rowPinning: B,
|
|
568
|
+
onRowPinningChange: T
|
|
569
|
+
} = at(), S = R(null), f = R(null), q = R(Z);
|
|
570
|
+
q.current = Z;
|
|
571
|
+
const A = (e) => q.current ? `${q.current}-${e}` : e, [$] = et(), ce = R(N);
|
|
572
|
+
ce.current = N;
|
|
573
|
+
const ae = R(H);
|
|
574
|
+
ae.current = H;
|
|
575
|
+
const de = R(C);
|
|
576
|
+
de.current = C;
|
|
577
|
+
const ie = R(F);
|
|
578
|
+
ie.current = F;
|
|
579
|
+
const ue = R(E);
|
|
580
|
+
ue.current = E;
|
|
581
|
+
const pe = R(U);
|
|
582
|
+
pe.current = U;
|
|
583
|
+
const Re = se(() => a ? Array.from({ length: 10 }, (e, i) => ({
|
|
581
584
|
id: `placeholder-${i}`,
|
|
582
585
|
name: `placeholder-${i}`,
|
|
583
586
|
label: `placeholder-${i}`,
|
|
@@ -587,31 +590,31 @@ const Ft = ({
|
|
|
587
590
|
data: {
|
|
588
591
|
id: `placeholder-${i}`
|
|
589
592
|
}
|
|
590
|
-
})) : t, [a, t,
|
|
593
|
+
})) : t, [a, t, x]), I = w(
|
|
591
594
|
(e, i, r, c) => {
|
|
592
|
-
const s = i, g = e.getRowModel(), o = g.rows,
|
|
593
|
-
if (!
|
|
594
|
-
if (
|
|
595
|
-
return { ...
|
|
596
|
-
if (p && !r && !c && Object.keys(
|
|
597
|
-
return e.setRowSelection({}),
|
|
595
|
+
const s = i, g = e.getRowModel(), o = g.rows, v = g.rowsById[s], h = e.getState().rowSelection || {};
|
|
596
|
+
if (!v) return { ...h };
|
|
597
|
+
if (v.original.isDisabled)
|
|
598
|
+
return { ...h };
|
|
599
|
+
if (p && !r && !c && Object.keys(h).length === 1 && h[s])
|
|
600
|
+
return e.setRowSelection({}), S.current = null, {};
|
|
598
601
|
let m;
|
|
599
|
-
if (n && r &&
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
} else n && c ? (m = { ...
|
|
603
|
-
return e.setRowSelection(m),
|
|
602
|
+
if (n && r && S.current) {
|
|
603
|
+
const Te = S.current, me = dt(o, s, Te);
|
|
604
|
+
me.length === 0 ? m = { ...h, [s]: !0 } : (m = { ...h }, me.forEach((Ae) => m[Ae.id] = !0));
|
|
605
|
+
} else n && c ? (m = { ...h }, m[s] ? delete m[s] : m[s] = !0) : (m = { ...h }, Object.keys(m).length === 1 && m[s] || (m = { [s]: !0 }));
|
|
606
|
+
return e.setRowSelection(m), S.current = s, m;
|
|
604
607
|
},
|
|
605
608
|
[n, p]
|
|
606
|
-
),
|
|
609
|
+
), Se = w(
|
|
607
610
|
(e, i) => {
|
|
608
|
-
if (!
|
|
611
|
+
if (!f.current) {
|
|
609
612
|
console.warn("tableRef not yet available in handleRowSelectForKeydown");
|
|
610
613
|
return;
|
|
611
614
|
}
|
|
612
615
|
const r = e.shiftKey, c = e.ctrlKey || e.metaKey;
|
|
613
616
|
I(
|
|
614
|
-
|
|
617
|
+
f.current,
|
|
615
618
|
// Pass the main table instance
|
|
616
619
|
i.id,
|
|
617
620
|
r,
|
|
@@ -620,10 +623,10 @@ const Ft = ({
|
|
|
620
623
|
},
|
|
621
624
|
[I]
|
|
622
625
|
// Depends only on handleSelectionLogic
|
|
623
|
-
),
|
|
626
|
+
), Ce = w(
|
|
624
627
|
(e, i, r) => {
|
|
625
|
-
if (!
|
|
626
|
-
const c =
|
|
628
|
+
if (!f.current) return;
|
|
629
|
+
const c = f.current.getRowModel().rows, s = c.findIndex((o) => o.id === i.id);
|
|
627
630
|
if (s === -1) return;
|
|
628
631
|
let g = e === "down" ? s + 1 : s - 1;
|
|
629
632
|
if (!(g < 0 || g >= c.length))
|
|
@@ -631,12 +634,12 @@ const Ft = ({
|
|
|
631
634
|
const o = c[g];
|
|
632
635
|
if (!o.original.isDisabled) {
|
|
633
636
|
I(
|
|
634
|
-
|
|
637
|
+
f.current,
|
|
635
638
|
o.id,
|
|
636
639
|
r.shiftKey,
|
|
637
640
|
r.ctrlKey || r.metaKey
|
|
638
641
|
), requestAnimationFrame(() => {
|
|
639
|
-
const
|
|
642
|
+
const v = le.current, m = (v ? v.querySelector(`#${CSS.escape(A(o.id))}`) : document.getElementById(A(o.id)))?.querySelector('[tabindex="0"]');
|
|
640
643
|
m && (m.focus(), m.scrollIntoView({ block: "nearest", behavior: "smooth" }));
|
|
641
644
|
});
|
|
642
645
|
return;
|
|
@@ -645,38 +648,38 @@ const Ft = ({
|
|
|
645
648
|
}
|
|
646
649
|
},
|
|
647
650
|
[I]
|
|
648
|
-
),
|
|
651
|
+
), Ee = w(
|
|
649
652
|
(e, i) => {
|
|
650
|
-
i.original.isDisabled ||
|
|
653
|
+
i.original.isDisabled || pe.current?.(i.id, i);
|
|
651
654
|
},
|
|
652
655
|
[]
|
|
653
656
|
// eslint-disable-line react-hooks/exhaustive-deps
|
|
654
|
-
), { handleRowKeyDown:
|
|
655
|
-
handleRowSelect:
|
|
656
|
-
handleArrowNavigation:
|
|
657
|
-
handleRename:
|
|
658
|
-
}),
|
|
657
|
+
), { handleRowKeyDown: ge } = rt({
|
|
658
|
+
handleRowSelect: Se,
|
|
659
|
+
handleArrowNavigation: Ce,
|
|
660
|
+
handleRename: Ee
|
|
661
|
+
}), ke = se(
|
|
659
662
|
() => [
|
|
660
663
|
{
|
|
661
664
|
accessorKey: "label",
|
|
662
665
|
header: void 0,
|
|
663
666
|
filterFn: "fuzzy",
|
|
664
|
-
sortingFn:
|
|
667
|
+
sortingFn: ct,
|
|
665
668
|
//sort by fuzzy rank (falls back to alphanumeric)
|
|
666
669
|
cell: ({ row: e, getValue: i, table: r }) => {
|
|
667
670
|
const c = r.options.meta, s = (o) => {
|
|
668
671
|
if (o.target instanceof HTMLInputElement || o.target instanceof HTMLButtonElement || o.target instanceof HTMLTextAreaElement || o.target instanceof HTMLSelectElement || o.target instanceof HTMLAnchorElement || o.target.closest("button, a, input, textarea, select"))
|
|
669
672
|
return;
|
|
670
|
-
const
|
|
673
|
+
const h = o.altKey && e.getIsSelected() && !o.shiftKey && !o.ctrlKey && !o.metaKey ? r.getState().rowSelection || {} : I(
|
|
671
674
|
r,
|
|
672
675
|
// Pass the cell's table instance
|
|
673
676
|
e.id,
|
|
674
677
|
o.shiftKey,
|
|
675
678
|
o.ctrlKey || o.metaKey
|
|
676
679
|
);
|
|
677
|
-
o.altKey &&
|
|
680
|
+
o.altKey && W?.(e.original, Object.keys(h));
|
|
678
681
|
}, g = {
|
|
679
|
-
className:
|
|
682
|
+
className: K({
|
|
680
683
|
selected: e.getIsSelected(),
|
|
681
684
|
loading: c?.isLoading,
|
|
682
685
|
disabled: e.original.isDisabled,
|
|
@@ -685,7 +688,7 @@ const Ft = ({
|
|
|
685
688
|
// false: archived items but still selectable
|
|
686
689
|
}),
|
|
687
690
|
onKeyDown: (o) => {
|
|
688
|
-
o.target instanceof HTMLInputElement ||
|
|
691
|
+
o.target instanceof HTMLInputElement || ge(o, e);
|
|
689
692
|
},
|
|
690
693
|
depth: e.depth,
|
|
691
694
|
tabIndex: 0,
|
|
@@ -696,160 +699,160 @@ const Ft = ({
|
|
|
696
699
|
iconFilled: e.original.iconFilled,
|
|
697
700
|
img: e.original.img,
|
|
698
701
|
imgShape: e.original.imgShape,
|
|
699
|
-
imgRatio:
|
|
700
|
-
imgPosition:
|
|
702
|
+
imgRatio: Q,
|
|
703
|
+
imgPosition: J,
|
|
701
704
|
isRowExpandable: e.getCanExpand(),
|
|
702
|
-
enableNonFolderIndent:
|
|
705
|
+
enableNonFolderIndent: b,
|
|
703
706
|
isRowExpanded: e.getIsExpanded(),
|
|
704
707
|
isTableExpandable: c?.isExpandable,
|
|
705
708
|
onExpandClick: (o) => {
|
|
706
|
-
o?.altKey ?
|
|
709
|
+
o?.altKey ? we(e, !e.getIsExpanded()) : e.toggleExpanded();
|
|
707
710
|
},
|
|
708
711
|
startContent: e.original.startContent,
|
|
709
712
|
endContent: e.original.endContent,
|
|
710
713
|
badge: e.original.badge,
|
|
711
714
|
isDisabled: e.original.isDisabled,
|
|
712
715
|
disabledMessage: e.original.disabledMessage,
|
|
713
|
-
isRenaming: e.id ===
|
|
714
|
-
renameInitialValue: e.id ===
|
|
715
|
-
onSubmitRename:
|
|
716
|
-
onCancelRename:
|
|
717
|
-
...
|
|
716
|
+
isRenaming: e.id === ae.current,
|
|
717
|
+
renameInitialValue: e.id === ae.current ? de.current : void 0,
|
|
718
|
+
onSubmitRename: ie.current ? (o) => ie.current(e.id, o) : void 0,
|
|
719
|
+
onCancelRename: ue.current,
|
|
720
|
+
...k?.cell,
|
|
718
721
|
onClick: s,
|
|
719
722
|
// Added onClick handler
|
|
720
|
-
onDoubleClick: (o) =>
|
|
723
|
+
onDoubleClick: (o) => ce.current?.(e.id, e)
|
|
721
724
|
};
|
|
722
|
-
return c?.children ? c.children(g, e, r) : /* @__PURE__ */ d(
|
|
725
|
+
return c?.children ? c.children(g, e, r) : /* @__PURE__ */ d(lt, { ...g, ...k?.cell });
|
|
723
726
|
}
|
|
724
727
|
}
|
|
725
728
|
],
|
|
726
729
|
[
|
|
727
|
-
|
|
730
|
+
x,
|
|
728
731
|
I,
|
|
729
|
-
|
|
732
|
+
ge,
|
|
730
733
|
p,
|
|
731
|
-
|
|
732
|
-
_,
|
|
734
|
+
b,
|
|
733
735
|
Q,
|
|
734
|
-
|
|
736
|
+
J,
|
|
737
|
+
W
|
|
735
738
|
]
|
|
736
|
-
),
|
|
739
|
+
), Ke = w(
|
|
737
740
|
(e) => {
|
|
738
|
-
|
|
741
|
+
z(he(e, D));
|
|
739
742
|
},
|
|
740
|
-
[
|
|
741
|
-
),
|
|
743
|
+
[z]
|
|
744
|
+
), Me = w(
|
|
742
745
|
(e) => {
|
|
743
|
-
|
|
746
|
+
T?.(he(e, B || {}));
|
|
744
747
|
},
|
|
745
|
-
[
|
|
746
|
-
),
|
|
748
|
+
[T]
|
|
749
|
+
), Fe = w(
|
|
747
750
|
(e) => {
|
|
748
|
-
|
|
751
|
+
y?.((i) => {
|
|
749
752
|
const r = e instanceof Function ? e(i) : e;
|
|
750
|
-
return
|
|
753
|
+
return te?.(r), r;
|
|
751
754
|
});
|
|
752
755
|
},
|
|
753
|
-
[
|
|
754
|
-
),
|
|
755
|
-
data:
|
|
756
|
-
columns:
|
|
756
|
+
[y]
|
|
757
|
+
), O = qe({
|
|
758
|
+
data: Re,
|
|
759
|
+
columns: ke,
|
|
757
760
|
state: {
|
|
758
761
|
expanded: re,
|
|
759
|
-
rowSelection:
|
|
760
|
-
globalFilter:
|
|
761
|
-
rowPinning:
|
|
762
|
+
rowSelection: D,
|
|
763
|
+
globalFilter: M,
|
|
764
|
+
rowPinning: B
|
|
762
765
|
},
|
|
763
|
-
onRowSelectionChange:
|
|
764
|
-
onRowPinningChange:
|
|
766
|
+
onRowSelectionChange: Ke,
|
|
767
|
+
onRowPinningChange: Me,
|
|
765
768
|
filterFns: {
|
|
766
|
-
fuzzy:
|
|
769
|
+
fuzzy: ve
|
|
767
770
|
},
|
|
768
771
|
globalFilterFn: "fuzzy",
|
|
769
772
|
enableRowSelection: !0,
|
|
770
773
|
//enable row selection for all rows
|
|
771
|
-
enableRowPinning: !!
|
|
774
|
+
enableRowPinning: !!T,
|
|
772
775
|
getRowId: (e) => e.id,
|
|
773
776
|
enableSubRowSelection: !1,
|
|
774
777
|
//disable sub row selection
|
|
775
|
-
onExpandedChange:
|
|
778
|
+
onExpandedChange: Fe,
|
|
776
779
|
getSubRows: (e) => e.subRows,
|
|
777
|
-
getCoreRowModel:
|
|
778
|
-
getFilteredRowModel:
|
|
779
|
-
getExpandedRowModel:
|
|
780
|
+
getCoreRowModel: _e(),
|
|
781
|
+
getFilteredRowModel: Ge(),
|
|
782
|
+
getExpandedRowModel: Oe(),
|
|
780
783
|
filterFromLeafRows: !0,
|
|
781
784
|
// debugTable: true,
|
|
782
785
|
// @ts-expect-error: updateData is not required
|
|
783
|
-
meta:
|
|
786
|
+
meta: se(
|
|
784
787
|
() => ({
|
|
785
788
|
isExpandable: !!u,
|
|
786
789
|
isLoading: a,
|
|
787
|
-
children:
|
|
788
|
-
...
|
|
790
|
+
children: Y,
|
|
791
|
+
..._
|
|
789
792
|
}),
|
|
790
|
-
[u, a,
|
|
793
|
+
[u, a, Y, _]
|
|
791
794
|
)
|
|
792
795
|
});
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}, [
|
|
796
|
-
const { rows: ne } =
|
|
796
|
+
ye(() => {
|
|
797
|
+
f.current = O;
|
|
798
|
+
}, [O]);
|
|
799
|
+
const { rows: ne } = O.getRowModel(), Ne = w(
|
|
797
800
|
(e, i, r) => {
|
|
798
|
-
if (!
|
|
801
|
+
if (!f.current) return;
|
|
799
802
|
const c = ne[i];
|
|
800
803
|
if (!c || c.original === void 0) return;
|
|
801
804
|
r.preventDefault(), r.stopPropagation();
|
|
802
|
-
const s = Object.keys(
|
|
805
|
+
const s = Object.keys(D), g = s.includes(e) ? s : [e];
|
|
803
806
|
if (!s.includes(e)) {
|
|
804
|
-
const
|
|
805
|
-
|
|
807
|
+
const v = { [e]: !0 };
|
|
808
|
+
z?.(v);
|
|
806
809
|
}
|
|
807
|
-
const o =
|
|
808
|
-
(
|
|
809
|
-
|
|
810
|
+
const o = V.flatMap(
|
|
811
|
+
(v) => st(
|
|
812
|
+
v(r, {
|
|
810
813
|
rowId: e,
|
|
811
814
|
rowIndex: i,
|
|
812
815
|
row: c,
|
|
813
816
|
selectedRows: g,
|
|
814
|
-
selectedTableRows: g.map((
|
|
817
|
+
selectedTableRows: g.map((h) => O.getRowModel().rowsById[h]).filter((h) => !!h),
|
|
815
818
|
isSelected: g.includes(e)
|
|
816
819
|
})
|
|
817
820
|
)
|
|
818
821
|
);
|
|
819
|
-
o.length > 0 &&
|
|
822
|
+
o.length > 0 && $(r, o);
|
|
820
823
|
},
|
|
821
|
-
[
|
|
822
|
-
),
|
|
824
|
+
[V, ne, D, z, $]
|
|
825
|
+
), le = R(null), oe = Ue({
|
|
823
826
|
count: ne.length,
|
|
824
|
-
estimateSize: () =>
|
|
827
|
+
estimateSize: () => j || 34,
|
|
825
828
|
//estimate row height for accurate scrollbar dragging
|
|
826
|
-
getScrollElement: () =>
|
|
829
|
+
getScrollElement: () => le.current,
|
|
827
830
|
//measure dynamic row height, except in firefox because it measures table border height incorrectly
|
|
828
|
-
measureElement:
|
|
831
|
+
measureElement: j ? () => j : typeof window < "u" && navigator.userAgent.indexOf("Firefox") === -1 ? (e) => e?.getBoundingClientRect().height : void 0,
|
|
829
832
|
overscan: 5
|
|
830
|
-
}),
|
|
833
|
+
}), De = w(
|
|
831
834
|
(e) => {
|
|
832
835
|
e && oe.measureElement(e);
|
|
833
836
|
},
|
|
834
837
|
[oe]
|
|
835
|
-
),
|
|
838
|
+
), ze = w(
|
|
836
839
|
(e) => {
|
|
837
|
-
if (!
|
|
840
|
+
if (!P) return;
|
|
838
841
|
const i = e.currentTarget, { scrollTop: r, scrollHeight: c, clientHeight: s } = i;
|
|
839
|
-
c - r - s < 100 && !a &&
|
|
842
|
+
c - r - s < 100 && !a && P();
|
|
840
843
|
},
|
|
841
|
-
[
|
|
844
|
+
[P, a]
|
|
842
845
|
);
|
|
843
|
-
return /* @__PURE__ */
|
|
844
|
-
|
|
846
|
+
return /* @__PURE__ */ G(
|
|
847
|
+
tt,
|
|
845
848
|
{
|
|
846
|
-
ref:
|
|
847
|
-
onScroll:
|
|
849
|
+
ref: le,
|
|
850
|
+
onScroll: ze,
|
|
848
851
|
onClick: (e) => {
|
|
849
|
-
p && !e.target.closest("tr") && (
|
|
852
|
+
p && !e.target.closest("tr") && (O.setRowSelection({}), S.current = null);
|
|
850
853
|
},
|
|
851
|
-
...
|
|
852
|
-
className:
|
|
854
|
+
...ee,
|
|
855
|
+
className: K(ee.className, { isLoading: a, fitContent: X }),
|
|
853
856
|
children: [
|
|
854
857
|
!l && /* @__PURE__ */ d("table", { children: /* @__PURE__ */ d(
|
|
855
858
|
"tbody",
|
|
@@ -864,38 +867,38 @@ const Ft = ({
|
|
|
864
867
|
"tr",
|
|
865
868
|
{
|
|
866
869
|
"data-index": e.index,
|
|
867
|
-
ref:
|
|
868
|
-
id: i.id,
|
|
869
|
-
onContextMenu: (r) =>
|
|
870
|
-
...
|
|
870
|
+
ref: De,
|
|
871
|
+
id: A(i.id),
|
|
872
|
+
onContextMenu: (r) => Ne(i.id, e.index, r),
|
|
873
|
+
...k?.row,
|
|
871
874
|
style: {
|
|
872
875
|
transform: `translateY(${e.start}px)`,
|
|
873
876
|
//this should always be a `style` as it changes on scroll
|
|
874
|
-
...
|
|
877
|
+
...k?.row?.style
|
|
875
878
|
// custom styles to be passed
|
|
876
879
|
},
|
|
877
|
-
children: i.getVisibleCells().map((r) => /* @__PURE__ */ d("td", { children:
|
|
880
|
+
children: i.getVisibleCells().map((r) => /* @__PURE__ */ d("td", { children: Qe(r.column.columnDef.cell, r.getContext()) }, r.id))
|
|
878
881
|
},
|
|
879
882
|
i.id
|
|
880
883
|
);
|
|
881
884
|
})
|
|
882
885
|
}
|
|
883
886
|
) }),
|
|
884
|
-
!!l && /* @__PURE__ */ d(
|
|
887
|
+
!!l && /* @__PURE__ */ d(Ze, { error: l })
|
|
885
888
|
]
|
|
886
889
|
}
|
|
887
890
|
);
|
|
888
891
|
};
|
|
889
892
|
export {
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
893
|
+
nt as C,
|
|
894
|
+
ot as E,
|
|
895
|
+
Ft as H,
|
|
896
|
+
it as R,
|
|
897
|
+
zt as S,
|
|
898
|
+
tt as T,
|
|
899
|
+
Mt as a,
|
|
900
|
+
Nt as b,
|
|
901
|
+
lt as c,
|
|
902
|
+
Dt as d,
|
|
903
|
+
at as u
|
|
901
904
|
};
|