@ynput/ayon-frontend-shared 0.7.2 → 0.7.4

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.
Files changed (66) hide show
  1. package/LICENSE +105 -0
  2. package/dist/DetailsPanel.es.js +1088 -969
  3. package/dist/ListTable.es.js +70 -67
  4. package/dist/NewEntity.es.js +8 -5
  5. package/dist/ProjectTreeTable.es.js +4134 -3825
  6. package/dist/ProjectsTable.es.js +526 -0
  7. package/dist/Slicer.es.js +75 -73
  8. package/dist/Views.es.js +86 -84
  9. package/dist/chunks/Actions.es.js +4 -2
  10. package/dist/chunks/ColumnDropIndicator.es.js +21 -18
  11. package/dist/chunks/ColumnDropIndicator.styled.es.js +14 -13
  12. package/dist/chunks/ColumnHeaderMenuUI.es.js +9 -7
  13. package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +12 -11
  14. package/dist/chunks/EmptyPlaceholder.es.js +9 -8
  15. package/dist/chunks/EntityPath.es.js +15 -14
  16. package/dist/chunks/EntityPickerDialog.es.js +5 -3
  17. package/dist/chunks/EntityTooltip.es.js +10 -8
  18. package/dist/chunks/EntityUpdatesContext.es.js +13 -12
  19. package/dist/chunks/Feed.es.js +12 -11
  20. package/dist/chunks/FilterErrorActions.es.js +6 -4
  21. package/dist/chunks/GroupSettingsFallback.es.js +75 -0
  22. package/dist/chunks/JsonViewer.es.js +3 -2
  23. package/dist/chunks/Menu.es.js +105 -103
  24. package/dist/chunks/MetaWidget.es.js +278 -275
  25. package/dist/chunks/PlayableIcon.es.js +868 -862
  26. package/dist/chunks/ProjectContext.es.js +5 -4
  27. package/dist/chunks/RepresentationsList.es.js +3 -2
  28. package/dist/chunks/ReviewablesSelector.es.js +3471 -2067
  29. package/dist/chunks/SimpleTable.es.js +492 -402
  30. package/dist/chunks/Slicer.es.js +936 -896
  31. package/dist/chunks/TableExportContextInstance.es.js +437 -339
  32. package/dist/chunks/TableSettingsFallback.es.js +5 -3
  33. package/dist/chunks/ThumbnailSimple.es.js +15 -13
  34. package/dist/chunks/VideoPlayer.es.js +14 -12
  35. package/dist/chunks/Watchers.es.js +97 -95
  36. package/dist/chunks/getProjectDisplayName.es.js +4 -0
  37. package/dist/chunks/getUris.es.js +375 -374
  38. package/dist/chunks/useHierarchySelection.es.js +5 -3
  39. package/dist/chunks/useLoadModule.es.js +10 -8
  40. package/dist/chunks/viewUpdateHelper.es.js +12 -10
  41. package/dist/components.es.js +1488 -1186
  42. package/dist/context.es.js +589 -539
  43. package/dist/hooks.es.js +169 -212
  44. package/dist/index.es.js +17 -12
  45. package/dist/types/Actions.d.ts +17 -14
  46. package/dist/types/ContextMenu.d.ts +17 -14
  47. package/dist/types/DetailsPanel.d.ts +17 -14
  48. package/dist/types/EntityPickerDialog.d.ts +17 -14
  49. package/dist/types/Feed.d.ts +17 -14
  50. package/dist/types/ListTable.d.ts +17 -14
  51. package/dist/types/NewEntity.d.ts +17 -14
  52. package/dist/types/ProjectTreeTable.d.ts +749 -15
  53. package/dist/types/ProjectsTable.d.ts +228 -0
  54. package/dist/types/RepresentationsList.d.ts +17 -14
  55. package/dist/types/SimpleTable.d.ts +31 -14
  56. package/dist/types/Slicer.d.ts +18 -14
  57. package/dist/types/Views.d.ts +17 -14
  58. package/dist/types/api.d.ts +17 -14
  59. package/dist/types/components.d.ts +822 -25
  60. package/dist/types/context.d.ts +53 -15
  61. package/dist/types/hooks.d.ts +17 -14
  62. package/dist/types/index.d.ts +17 -14
  63. package/dist/types/util.d.ts +21 -14
  64. package/dist/util.es.js +152 -144
  65. package/package.json +16 -9
  66. /package/dist/{ContextMenuContextInstance.css → style.css} +0 -0
@@ -0,0 +1,526 @@
1
+ import { jsxs as R, jsx as a } from "react/jsx-runtime";
2
+ import { H as ot, b as W, c as mt, S as ft, a as ut, e as Z } from "./chunks/SimpleTable.es.js";
3
+ import { useCallback as x, useMemo as tt } from "react";
4
+ import "./chunks/ReviewablesSelector.es.js";
5
+ import "match-sorter";
6
+ import { theme as ht } from "@ynput/ayon-react-components";
7
+ import X from "clsx";
8
+ import "./chunks/SimpleForm.es.js";
9
+ import "./chunks/MetaWidget.es.js";
10
+ import "react-dom";
11
+ import "date-fns";
12
+ import "./chunks/PlayableIcon.es.js";
13
+ import { u as gt, o as bt } from "./chunks/TableExportContextInstance.es.js";
14
+ import "lodash";
15
+ import "primereact/confirmdialog";
16
+ import "react-toastify";
17
+ import "uuid";
18
+ import "./chunks/searchTerms.es.js";
19
+ import "axios";
20
+ import "./chunks/getUris.es.js";
21
+ import "./chunks/JsonViewer.es.js";
22
+ import "./chunks/Watchers.es.js";
23
+ import "lexical";
24
+ import "@lexical/markdown";
25
+ import "@lexical/code";
26
+ import "@lexical/list";
27
+ import "@lexical/rich-text";
28
+ import "@lexical/selection";
29
+ import "@lexical/utils";
30
+ import "@lexical/react/LexicalBlockWithAlignableContents";
31
+ import "@lexical/react/LexicalDecoratorBlockNode";
32
+ import "@module-federation/enhanced/runtime";
33
+ import "@ynput/ayon-addon/host";
34
+ import "semver";
35
+ import "./chunks/ContextMenuContextInstance.es.js";
36
+ import "react-redux";
37
+ import { useNavigate as vt } from "react-router-dom";
38
+ import "./chunks/EmptyPlaceholder.es.js";
39
+ import "./chunks/EmptyPlaceholderFlex.styled.es.js";
40
+ import "./chunks/InfoMessage.es.js";
41
+ import "@dnd-kit/core";
42
+ import "@dnd-kit/sortable";
43
+ import "@dnd-kit/utilities";
44
+ import "./chunks/VersionUploadContextInstance.es.js";
45
+ import "./chunks/EntityTooltip.es.js";
46
+ import "./chunks/ColumnDropIndicator.styled.es.js";
47
+ import "@tanstack/react-table";
48
+ import "@ynput/ayon-addon";
49
+ import { T as Ct } from "./chunks/EntityPickerDialog.es.js";
50
+ import "remark-gfm";
51
+ import "react-markdown";
52
+ import "primereact/splitter";
53
+ import "./chunks/Slicer.es.js";
54
+ import "./chunks/NewEntityContextInstance.es.js";
55
+ import { M as It, a as Nt } from "./chunks/Menu.es.js";
56
+ import "./chunks/ThumbnailSimple.es.js";
57
+ import F from "styled-components";
58
+ import { b as jt } from "./chunks/buildHierarchicalTableRows.es.js";
59
+ import { g as Pt } from "./chunks/getProjectDisplayName.es.js";
60
+ import "custom-protocol-check";
61
+ import "./chunks/GroupSettingsFallback.es.js";
62
+ const $ = "projects-list-menu", wt = F(ot)`
63
+ flex-direction: column;
64
+ `, xt = F(ot)`
65
+ padding: 0;
66
+ border: none;
67
+
68
+ container-type: inline-size;
69
+
70
+ /* when this container gets smaller than */
71
+ /* 188px remove add-project button */
72
+ @container (max-width: 188px) {
73
+ .add-project {
74
+ display: none;
75
+ }
76
+ }
77
+ /* 155px remove select all button */
78
+ @container (max-width: 155px) {
79
+ .select-all {
80
+ display: none;
81
+ }
82
+ }
83
+
84
+ /* 125px remove search */
85
+ @container (max-width: 125px) {
86
+ .search-projects {
87
+ display: none;
88
+ }
89
+ }
90
+ `, yt = F.span`
91
+ display: flex;
92
+ align-items: center;
93
+ ${ht.labelLarge}
94
+ height: 32px;
95
+ padding-left: 4px;
96
+ white-space: nowrap;
97
+ overflow: hidden;
98
+ width: 100%;
99
+ `, Tt = F.div`
100
+ display: flex;
101
+ gap: var(--base-gap-small);
102
+ `, St = ({
103
+ title: r,
104
+ search: c,
105
+ onSearch: g,
106
+ onSelectAll: d,
107
+ buttonLabels: b = {},
108
+ hiddenButtons: i = [],
109
+ onNewProject: m,
110
+ showAddProject: C = !1,
111
+ menuItems: f = [],
112
+ toggleMenu: v
113
+ }) => {
114
+ const { menuOpen: u } = gt(), h = u === $, t = {
115
+ icon: "add",
116
+ tooltip: "Add new project",
117
+ ...b.add
118
+ }, e = {
119
+ icon: "search",
120
+ tooltip: "Search projects",
121
+ ...b.search
122
+ };
123
+ return /* @__PURE__ */ R(wt, { className: "projects-list-header", children: [
124
+ /* @__PURE__ */ R(xt, { className: "projects-list-header-top", children: [
125
+ /* @__PURE__ */ a(yt, { children: r }),
126
+ /* @__PURE__ */ R(Tt, { className: "projects-list-header-buttons", children: [
127
+ /* @__PURE__ */ a(
128
+ W,
129
+ {
130
+ icon: "more_horiz",
131
+ onClick: () => v?.(!0),
132
+ id: $,
133
+ className: X("list-menu", { active: h })
134
+ }
135
+ ),
136
+ /* @__PURE__ */ a(It, { targetId: $, id: $, align: "left", children: /* @__PURE__ */ a(Nt, { menu: f, onClose: () => v?.(!1) }) }),
137
+ C && /* @__PURE__ */ a(
138
+ W,
139
+ {
140
+ icon: t.icon,
141
+ "data-tooltip": t.tooltip,
142
+ "data-shortcut": t.shortcut,
143
+ onClick: m,
144
+ className: "add-project"
145
+ }
146
+ ),
147
+ !i.includes("select-all") && d && /* @__PURE__ */ a(
148
+ W,
149
+ {
150
+ icon: "checklist",
151
+ "data-tooltip": "Select all",
152
+ onClick: d,
153
+ className: "select-all"
154
+ }
155
+ ),
156
+ !i.includes("search") && /* @__PURE__ */ a(
157
+ W,
158
+ {
159
+ icon: e.icon,
160
+ "data-tooltip": e.tooltip,
161
+ "data-shortcut": e.shortcut,
162
+ onClick: () => typeof c != "string" && g(""),
163
+ className: "search-projects"
164
+ }
165
+ )
166
+ ] })
167
+ ] }),
168
+ typeof c == "string" && /* @__PURE__ */ a(Ct, { value: c, onChange: g, onClose: () => g(void 0) })
169
+ ] });
170
+ }, Mt = "folder", q = "folder", Rt = (r) => `${q}-${r}`, z = (r) => !r || typeof r != "string" ? null : r.startsWith(q + "-") ? r.substring((q + "-").length) : null, He = (r = [], c = [], g = !0, d = !1) => {
171
+ const b = /* @__PURE__ */ new Map();
172
+ for (const t of c)
173
+ b.set(String(t.id), t);
174
+ const i = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Set();
175
+ for (const t of c)
176
+ i.set(t.id, {
177
+ id: t.id,
178
+ folder: t,
179
+ children: /* @__PURE__ */ new Map(),
180
+ items: [],
181
+ hasAnyItems: !1
182
+ }), t.parentId || m.add(t.id);
183
+ for (const t of c)
184
+ if (t.parentId && i.has(t.parentId)) {
185
+ const e = i.get(t.parentId), o = i.get(t.id);
186
+ e.children.set(t.id, o);
187
+ }
188
+ const C = [];
189
+ for (const t of r) {
190
+ const e = t.projectFolder;
191
+ if (d && e && b.has(e)) {
192
+ const o = i.get(e);
193
+ o.items.push(t), o.hasAnyItems = !0;
194
+ } else
195
+ C.push(t);
196
+ }
197
+ for (const t of i.values())
198
+ if (t.hasAnyItems) {
199
+ let e = t.folder;
200
+ for (; e.parentId; ) {
201
+ const o = i.get(e.parentId);
202
+ if (o)
203
+ o.hasAnyItems = !0, e = o.folder;
204
+ else
205
+ break;
206
+ }
207
+ }
208
+ const f = (t) => ({
209
+ id: t.name,
210
+ name: t.name,
211
+ label: Pt(t),
212
+ inactive: !t.active,
213
+ subRows: [],
214
+ data: {
215
+ id: t.name,
216
+ active: t.active,
217
+ code: t.code || t.name,
218
+ projectLabel: t.label || void 0
219
+ }
220
+ }), u = jt({
221
+ folderNodes: i,
222
+ rootFolderIds: m,
223
+ showEmptyFolders: g,
224
+ buildFolderRowId: Rt,
225
+ createItemRow: f,
226
+ sortFolderNodes: (t) => t.sort((e, o) => e.folder.position !== void 0 && o.folder.position !== void 0 ? e.folder.position - o.folder.position : e.folder.label.localeCompare(o.folder.label)),
227
+ getFolderLabel: (t) => t.label,
228
+ getFolderIcon: (t) => t.data?.icon || Mt,
229
+ getFolderColor: (t) => t.data?.color,
230
+ getItemCount: (t) => t.items.length + Array.from(t.children.values()).reduce((e, o) => e + o.items.length, 0),
231
+ getFolderIsEmpty: (t) => t.isEmpty
232
+ }), h = C.map((t) => f(t));
233
+ return [...u, ...h];
234
+ }, et = ({
235
+ tableData: r,
236
+ search: c,
237
+ isLoading: g,
238
+ multiSelect: d,
239
+ error: b,
240
+ readonly: i,
241
+ rowContextMenuBuilders: m = [],
242
+ renamingFolder: C,
243
+ onSubmitRenameFolder: f,
244
+ closeRenameFolder: v,
245
+ renamingProject: u,
246
+ onSubmitRenameProject: h,
247
+ closeRenameProject: t,
248
+ onRenameFolder: e,
249
+ onRenameProject: o,
250
+ onOpenProject: y,
251
+ fitContent: _,
252
+ hidePinned: T,
253
+ onSettingsClick: S,
254
+ enableClickToDeselect: J = !1,
255
+ ...U
256
+ }) => {
257
+ const D = vt(), k = x(
258
+ (n) => {
259
+ S ? S(n) : D("/manageProjects/projectSettings?project=" + n);
260
+ },
261
+ [S, D]
262
+ ), V = x(
263
+ (n) => {
264
+ !!z(n) ? e?.(n) : o?.(n);
265
+ },
266
+ [e, o]
267
+ ), E = x(
268
+ (n, s) => {
269
+ !!z(n) ? f?.(s) : h?.(s);
270
+ },
271
+ [f, h]
272
+ ), L = x(() => {
273
+ v?.(), t?.();
274
+ }, [v, t]), O = C || u, A = x(
275
+ (n) => {
276
+ console.log("onRowDoubleClick", n), !i && (z(n) || y?.(n));
277
+ },
278
+ [i, y]
279
+ ), H = x(
280
+ (n, s) => {
281
+ const N = !!z(s.id || ""), P = s.getIsPinned() === "top", B = N ? [] : [
282
+ {
283
+ icon: "settings_applications",
284
+ className: "settings-icon",
285
+ onClick: (w) => {
286
+ w.stopPropagation(), k?.(s.id);
287
+ }
288
+ },
289
+ {
290
+ icon: "push_pin",
291
+ className: X("pin", { active: P }),
292
+ show: P ? "always" : "hover",
293
+ onClick: (w) => {
294
+ w.stopPropagation(), i || s.pin(P ? !1 : "top");
295
+ }
296
+ }
297
+ ];
298
+ return /* @__PURE__ */ a(
299
+ mt,
300
+ {
301
+ ...n,
302
+ id: s.id,
303
+ className: X(n.className, { pinned: P, hidePinned: T }),
304
+ actions: B,
305
+ badge: N ? s.original.data.count : s.original.data.code,
306
+ renamePlaceholder: N ? void 0 : "Project label",
307
+ enableNonFolderIndent: !1,
308
+ inactive: s.original.data.active === !1,
309
+ renameInitialValue: s.id === u ? s.original.data.projectLabel || "" : void 0
310
+ }
311
+ );
312
+ },
313
+ [k, i, u, T]
314
+ );
315
+ return /* @__PURE__ */ a(
316
+ ft,
317
+ {
318
+ data: r,
319
+ globalFilter: c ?? void 0,
320
+ isExpandable: r.some((n) => n.subRows.length > 0),
321
+ isLoading: !!g,
322
+ isMultiSelect: d,
323
+ error: b,
324
+ enableClickToDeselect: J,
325
+ enableNonFolderIndent: !0,
326
+ fitContent: _,
327
+ rowContextMenuBuilders: i ? [] : m,
328
+ addonShortcuts: { table: "projects", projectName: null },
329
+ meta: {
330
+ renamingFolder: C,
331
+ onSubmitRenameFolder: f,
332
+ closeRenameFolder: v,
333
+ renamingProject: u,
334
+ onSubmitRenameProject: h,
335
+ closeRenameProject: t
336
+ },
337
+ onRename: i ? void 0 : V,
338
+ onSubmitRename: E,
339
+ onCancelRename: L,
340
+ onRowDoubleClick: A,
341
+ renamingId: O,
342
+ ...U,
343
+ children: H
344
+ }
345
+ );
346
+ }, Ft = F.hr`
347
+ margin: 0;
348
+ width: 100%;
349
+ border-style: solid;
350
+ border-width: 1px 0 0 0;
351
+ border-color: var(--md-sys-color-outline-variant);
352
+ `, Be = ({
353
+ data: r,
354
+ isLoading: c,
355
+ error: g,
356
+ search: d,
357
+ onSearch: b,
358
+ onRowSelectionChange: i,
359
+ rowPinning: m,
360
+ onRowPinningChange: C,
361
+ expanded: f,
362
+ setExpanded: v,
363
+ multiSelect: u,
364
+ readonly: h = !1,
365
+ buildMenuItems: t,
366
+ rowContextMenuBuilders: e = [],
367
+ selection: o,
368
+ onSelect: y,
369
+ onOpenProject: _,
370
+ onSettingsClick: T,
371
+ title: S = "Projects",
372
+ showAddProject: J,
373
+ onNewProject: U,
374
+ toggleMenu: D,
375
+ onSelectAll: k,
376
+ hiddenButtons: V = [],
377
+ renamingFolder: E,
378
+ onSubmitRenameFolder: L,
379
+ closeRenameFolder: O,
380
+ renamingProject: A,
381
+ onSubmitRenameProject: H,
382
+ closeRenameProject: n,
383
+ onRenameFolder: s,
384
+ onRenameProject: N,
385
+ containerClassName: P,
386
+ enableClickToDeselect: B,
387
+ pt: w
388
+ }) => {
389
+ const [M, j] = bt(
390
+ "project-list-selection",
391
+ "all"
392
+ ), G = o.reduce((l, p) => (l[p] = !0, l), {}), it = o.some((l) => m.includes(l)), K = M === "pinned" && o.length && !it ? "all" : M, nt = K === "pinned" ? G : {}, st = K === "all" ? G : {}, lt = (l) => {
393
+ M !== "pinned" && j("pinned");
394
+ const p = Object.keys(l).filter((I) => l[I]);
395
+ y?.(p), i?.(l);
396
+ }, rt = (l) => {
397
+ M !== "all" && j("all");
398
+ const p = Object.keys(l).filter((I) => l[I]);
399
+ y?.(p), i?.(l);
400
+ }, at = tt(
401
+ () => [
402
+ ...e,
403
+ (() => (j("pinned"), []))
404
+ ],
405
+ [e, j]
406
+ ), ct = tt(
407
+ () => [
408
+ ...e,
409
+ (() => (j("all"), []))
410
+ ],
411
+ [e, j]
412
+ ), Q = (l) => {
413
+ const p = l?.top || [];
414
+ M === "pinned" && o.length > 0 && (o.some((pt) => p.includes(pt)) || j("all")), C?.(l);
415
+ }, dt = new Set(m), Y = r.flatMap(function l(p) {
416
+ const I = [];
417
+ return dt.has(p.name) && I.push(p), p.subRows?.length && I.push(...p.subRows.flatMap(l)), I;
418
+ });
419
+ return /* @__PURE__ */ R(
420
+ ut,
421
+ {
422
+ ...w?.container,
423
+ className: P,
424
+ style: { height: "100%", minWidth: 50, ...w?.container?.style },
425
+ children: [
426
+ !h && b && /* @__PURE__ */ a(
427
+ St,
428
+ {
429
+ title: S,
430
+ search: d,
431
+ onSearch: b,
432
+ showAddProject: J,
433
+ onNewProject: U,
434
+ menuItems: t?.(o),
435
+ toggleMenu: D,
436
+ onSelectAll: k,
437
+ hiddenButtons: V
438
+ }
439
+ ),
440
+ Y.length > 0 && !d && /* @__PURE__ */ R(
441
+ Z,
442
+ {
443
+ rowSelection: nt,
444
+ onRowSelectionChange: lt,
445
+ rowPinning: { top: m },
446
+ onRowPinningChange: Q,
447
+ expanded: f,
448
+ setExpanded: v,
449
+ children: [
450
+ /* @__PURE__ */ a(
451
+ et,
452
+ {
453
+ tableData: Y,
454
+ search: d,
455
+ isLoading: c,
456
+ multiSelect: u,
457
+ error: g,
458
+ readonly: h,
459
+ rowContextMenuBuilders: at,
460
+ renamingFolder: E,
461
+ onSubmitRenameFolder: L,
462
+ closeRenameFolder: O,
463
+ renamingProject: A,
464
+ onSubmitRenameProject: H,
465
+ closeRenameProject: n,
466
+ onRenameFolder: s,
467
+ onRenameProject: N,
468
+ onOpenProject: _,
469
+ onSettingsClick: T,
470
+ enableClickToDeselect: B,
471
+ fitContent: !0,
472
+ className: "pinned-projects"
473
+ }
474
+ ),
475
+ /* @__PURE__ */ a(Ft, {})
476
+ ]
477
+ }
478
+ ),
479
+ /* @__PURE__ */ a(
480
+ Z,
481
+ {
482
+ rowSelection: st,
483
+ onRowSelectionChange: rt,
484
+ rowPinning: { top: m },
485
+ onRowPinningChange: Q,
486
+ expanded: f,
487
+ setExpanded: v,
488
+ children: /* @__PURE__ */ a(
489
+ et,
490
+ {
491
+ tableData: r,
492
+ search: d,
493
+ isLoading: c,
494
+ multiSelect: u,
495
+ error: g,
496
+ readonly: h,
497
+ rowContextMenuBuilders: ct,
498
+ renamingFolder: E,
499
+ onSubmitRenameFolder: L,
500
+ closeRenameFolder: O,
501
+ renamingProject: A,
502
+ onSubmitRenameProject: H,
503
+ closeRenameProject: n,
504
+ onRenameFolder: s,
505
+ onRenameProject: N,
506
+ onOpenProject: _,
507
+ onSettingsClick: T,
508
+ enableClickToDeselect: B,
509
+ hidePinned: !d,
510
+ className: "all-projects"
511
+ }
512
+ )
513
+ }
514
+ )
515
+ ]
516
+ }
517
+ );
518
+ };
519
+ export {
520
+ $ as PROJECTS_LIST_MENU_ID,
521
+ q as PROJECT_FOLDER_ROW_ID_PREFIX,
522
+ Be as ProjectsTable,
523
+ Rt as buildProjectFolderRowId,
524
+ He as buildProjectsTableData,
525
+ z as parseProjectFolderRowId
526
+ };