@ynput/ayon-frontend-shared 0.5.0 → 0.6.1
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/ContextMenu.es.js +34 -16
- package/dist/DetailsPanel.es.js +307 -311
- package/dist/Feed.es.js +179 -50
- package/dist/ListTable.es.js +99 -92
- package/dist/NewEntity.es.js +1256 -11
- package/dist/ProjectTreeTable.es.js +4459 -2959
- package/dist/SimpleTable.es.js +8 -7
- package/dist/Slicer.es.js +451 -147
- package/dist/Views.es.js +918 -310
- package/dist/api.es.js +331 -329
- package/dist/chunks/Actions.es.js +32 -27
- package/dist/chunks/ColumnDropIndicator.es.js +174 -328
- package/dist/chunks/ColumnDropIndicator.styled.es.js +281 -0
- package/dist/chunks/ColumnHeaderMenuUI.es.js +52 -0
- package/dist/chunks/ContextMenuContextInstance.es.js +12 -0
- package/dist/chunks/DeleteEntitiesConfirmDialog.es.js +229 -0
- package/dist/chunks/DeleteEntitiesContextInstance.es.js +827 -0
- package/dist/chunks/DetailsDialog.es.js +3 -3
- package/dist/chunks/EmptyPlaceholder.es.js +4 -4
- package/dist/chunks/EntityPath.es.js +74 -69
- package/dist/chunks/EntityPickerDialog.es.js +25 -21
- package/dist/chunks/EntityTooltip.es.js +29 -22
- package/dist/chunks/EntityUpdatesContext.es.js +38 -96
- package/dist/chunks/Feed.es.js +2321 -2668
- package/dist/chunks/FilterErrorActions.es.js +25 -229
- package/dist/chunks/Menu.es.js +21 -17
- package/dist/chunks/MenuContext.es.js +14 -256
- package/dist/chunks/MenuItem.es.js +34 -24
- package/dist/chunks/MetaWidget.es.js +2895 -4919
- package/dist/chunks/NewEntityContextInstance.es.js +11 -0
- package/dist/chunks/PlayableIcon.es.js +4215 -1179
- package/dist/chunks/ProjectContext.es.js +102 -66
- package/dist/chunks/RepresentationsList.es.js +4 -4
- package/dist/chunks/ReviewablesSelector.es.js +468 -460
- package/dist/chunks/SimpleForm.es.js +18 -18
- package/dist/chunks/SimpleTable.es.js +15 -13
- package/dist/chunks/Slicer.es.js +109 -98
- package/dist/chunks/TableSettingsFallback.es.js +22 -10
- package/dist/chunks/ThumbnailSimple.es.js +290 -52
- package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
- package/dist/chunks/VideoPlayer.es.js +24 -28
- package/dist/chunks/Watchers.es.js +669 -644
- package/dist/chunks/entityDefinitions.es.js +2 -350
- package/dist/chunks/expandRelativeDates.es.js +27 -0
- package/dist/chunks/extractVersionFromFilename.es.js +28 -0
- package/dist/chunks/getBundleMode.es.js +1 -1
- package/dist/chunks/getUris.es.js +737 -710
- package/dist/chunks/queryFilterToClientFilter.es.js +11 -10
- package/dist/chunks/searchTerms.es.js +179 -174
- package/dist/chunks/useAttributeEnums.es.js +9 -9
- package/dist/chunks/useCreateContextMenu.es.js +66 -90
- package/dist/chunks/useDateRangeFilter.es.js +3 -3
- package/dist/chunks/useHierarchySelection.es.js +24 -0
- package/dist/chunks/useLoadModule.es.js +74 -0
- package/dist/chunks/useQueryArgumentChangeLoading.es.js +11 -0
- package/dist/chunks/versionUploadHelpers.es.js +16 -42
- package/dist/chunks/viewUpdateHelper.es.js +74 -57
- package/dist/components.es.js +1432 -1001
- package/dist/context.es.js +791 -78
- package/dist/hooks.es.js +95 -94
- package/dist/index.es.js +27 -26
- package/dist/types/Actions.d.ts +15 -15
- package/dist/types/ContextMenu.d.ts +19 -16
- package/dist/types/DetailsPanel.d.ts +110 -17
- package/dist/types/EntityPickerDialog.d.ts +15 -15
- package/dist/types/Feed.d.ts +19 -16
- package/dist/types/ListTable.d.ts +15 -15
- package/dist/types/NewEntity.d.ts +24 -18
- package/dist/types/ProjectTreeTable.d.ts +34 -123
- package/dist/types/RepresentationsList.d.ts +15 -15
- package/dist/types/SimpleTable.d.ts +19 -16
- package/dist/types/Slicer.d.ts +18 -15
- package/dist/types/Views.d.ts +19 -16
- package/dist/types/api.d.ts +515 -207
- package/dist/types/components.d.ts +84 -20
- package/dist/types/context.d.ts +108 -25
- package/dist/types/hooks.d.ts +15 -15
- package/dist/types/index.d.ts +15 -15
- package/dist/types/util.d.ts +20 -15
- package/dist/util.es.js +117 -105
- package/package.json +16 -4
- package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
- package/dist/chunks/GlobalContext.es.js +0 -52
- package/dist/chunks/NewEntityContext.es.js +0 -1242
- package/dist/chunks/ProjectFoldersContext.es.js +0 -134
- package/dist/chunks/ProjectFoldersContextInstance.es.js +0 -7
- package/dist/chunks/VersionUploadContext.es.js +0 -232
- package/dist/chunks/ViewsContext.es.js +0 -878
- package/dist/chunks/mentionTypeOptions.es.js +0 -15
- package/dist/chunks/useColumnDragRestriction.es.js +0 -148
- package/dist/chunks/useLocalStorage.es.js +0 -355
- /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
|
@@ -1,878 +0,0 @@
|
|
|
1
|
-
import { jsxs as ae, jsx as v } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as Z, useMemo as F, useCallback as b, useRef as De, useState as Y, createContext as Ie, useContext as Ee } from "react";
|
|
3
|
-
import "./searchTerms.es.js";
|
|
4
|
-
import { aP as j, bq as Pe, d1 as N, b3 as ne, dr as ce, du as P, S as J, ce as Me, cS as _e, cz as We, bm as oe, cx as Re } from "./getUris.es.js";
|
|
5
|
-
import { confirmDialog as Fe } from "primereact/confirmdialog";
|
|
6
|
-
import { Button as Oe, theme as le, Icon as de } from "@ynput/ayon-react-components";
|
|
7
|
-
import M from "styled-components";
|
|
8
|
-
import K from "clsx";
|
|
9
|
-
import { a as qe, K as re } from "./platform.es.js";
|
|
10
|
-
import "lodash";
|
|
11
|
-
import { toast as m } from "react-toastify";
|
|
12
|
-
import { v4 as Ge } from "uuid";
|
|
13
|
-
import { u as Qe } from "./GlobalContext.es.js";
|
|
14
|
-
import { u as ue, a as Ue, e as Ke } from "./useLocalStorage.es.js";
|
|
15
|
-
import { useDispatch as ze } from "react-redux";
|
|
16
|
-
const He = () => Ge().replace(/-/g, ""), we = (e = {}) => ({
|
|
17
|
-
id: He(),
|
|
18
|
-
label: "Working",
|
|
19
|
-
working: !0,
|
|
20
|
-
settings: e
|
|
21
|
-
}), St = [
|
|
22
|
-
"overview",
|
|
23
|
-
"taskProgress",
|
|
24
|
-
"versions",
|
|
25
|
-
"lists",
|
|
26
|
-
"reviews",
|
|
27
|
-
"reports"
|
|
28
|
-
], ge = "_working_", Lt = "_new_view_", Ve = "__base__", Ae = M.li`
|
|
29
|
-
position: relative;
|
|
30
|
-
padding: 4px 6px 4px 12px;
|
|
31
|
-
user-select: none;
|
|
32
|
-
|
|
33
|
-
&:has(.start-icon) {
|
|
34
|
-
padding-left: 8px;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
height: 32px;
|
|
38
|
-
border-radius: var(--border-radius-m);
|
|
39
|
-
|
|
40
|
-
display: flex;
|
|
41
|
-
align-items: center;
|
|
42
|
-
gap: var(--base-gap-small);
|
|
43
|
-
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
|
|
46
|
-
.label {
|
|
47
|
-
flex: 1;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
background-color: var(--md-sys-color-surface-container-high-hover);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&.selected {
|
|
55
|
-
background-color: var(--md-sys-color-primary-container);
|
|
56
|
-
&,
|
|
57
|
-
.icon {
|
|
58
|
-
color: var(--md-sys-color-on-primary-container);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.more {
|
|
62
|
-
&:hover {
|
|
63
|
-
background-color: var(--md-sys-color-primary-container-hover);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
.reset {
|
|
67
|
-
&:hover {
|
|
68
|
-
background-color: var(--md-sys-color-primary-container-hover);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/* hide save button by default */
|
|
73
|
-
.save {
|
|
74
|
-
display: none;
|
|
75
|
-
}
|
|
76
|
-
&:hover {
|
|
77
|
-
.save {
|
|
78
|
-
display: flex;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`, X = M(Oe)`
|
|
82
|
-
&.hasIcon {
|
|
83
|
-
padding: 2px;
|
|
84
|
-
}
|
|
85
|
-
&:hover {
|
|
86
|
-
background-color: var(--md-sys-color-surface-container-highest-hover);
|
|
87
|
-
}
|
|
88
|
-
&.active {
|
|
89
|
-
display: flex !important;
|
|
90
|
-
&:not(.reset) {
|
|
91
|
-
background-color: var(--md-sys-color-primary);
|
|
92
|
-
color: var(--md-sys-color-on-primary);
|
|
93
|
-
|
|
94
|
-
&:hover {
|
|
95
|
-
background-color: var(--md-sys-color-primary-hover);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`, Je = Z(
|
|
100
|
-
({
|
|
101
|
-
id: e,
|
|
102
|
-
label: t,
|
|
103
|
-
startContent: n,
|
|
104
|
-
endContent: s,
|
|
105
|
-
isSelected: o,
|
|
106
|
-
isEditable: d,
|
|
107
|
-
isSaveable: u,
|
|
108
|
-
highlighted: V,
|
|
109
|
-
onEdit: g,
|
|
110
|
-
onSave: i,
|
|
111
|
-
onResetView: f,
|
|
112
|
-
className: x,
|
|
113
|
-
...$
|
|
114
|
-
}, w) => {
|
|
115
|
-
const { viewAlias: l } = lt(), c = (a, h) => {
|
|
116
|
-
a.stopPropagation(), h ? Fe({
|
|
117
|
-
message: `Save current ${l} settings and overwrite this ${l}?`,
|
|
118
|
-
header: "Confirm save",
|
|
119
|
-
accept: () => i && i(a, e)
|
|
120
|
-
}) : i && i(a, e);
|
|
121
|
-
};
|
|
122
|
-
return /* @__PURE__ */ ae(
|
|
123
|
-
Ae,
|
|
124
|
-
{
|
|
125
|
-
...$,
|
|
126
|
-
id: e,
|
|
127
|
-
className: K(x, { selected: o }),
|
|
128
|
-
ref: w,
|
|
129
|
-
children: [
|
|
130
|
-
n && n,
|
|
131
|
-
/* @__PURE__ */ v("span", { className: "label", children: t }),
|
|
132
|
-
f && /* @__PURE__ */ v(
|
|
133
|
-
X,
|
|
134
|
-
{
|
|
135
|
-
icon: "restart_alt",
|
|
136
|
-
variant: "text",
|
|
137
|
-
className: "reset",
|
|
138
|
-
onClick: f,
|
|
139
|
-
"data-tooltip": "Reset to Default",
|
|
140
|
-
"data-shortcut": qe("0", [re.Shift, re.Ctrl])
|
|
141
|
-
}
|
|
142
|
-
),
|
|
143
|
-
d && u && !o && /* @__PURE__ */ v(
|
|
144
|
-
X,
|
|
145
|
-
{
|
|
146
|
-
icon: "save",
|
|
147
|
-
variant: "text",
|
|
148
|
-
className: K("save", { active: V === "save" }),
|
|
149
|
-
onClick: (a) => c(a, V !== "save"),
|
|
150
|
-
"data-tooltip": `Save ${l} settings from current ${l}`
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
|
-
d && g && /* @__PURE__ */ v(
|
|
154
|
-
X,
|
|
155
|
-
{
|
|
156
|
-
variant: "text",
|
|
157
|
-
icon: "more_horiz",
|
|
158
|
-
className: K("more", { active: V === "edit" }),
|
|
159
|
-
onClick: (a) => g(a, e),
|
|
160
|
-
"data-tooltip": `Edit ${l}`
|
|
161
|
-
}
|
|
162
|
-
),
|
|
163
|
-
s && s
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
), Xe = M.div`
|
|
169
|
-
overflow: auto;
|
|
170
|
-
max-height: 40vh;
|
|
171
|
-
`, Ye = M.ul`
|
|
172
|
-
/* reset defaults */
|
|
173
|
-
margin: 0;
|
|
174
|
-
padding: 0;
|
|
175
|
-
list-style: none;
|
|
176
|
-
|
|
177
|
-
display: flex;
|
|
178
|
-
flex-direction: column;
|
|
179
|
-
gap: var(--base-gap-small);
|
|
180
|
-
margin-bottom: var(--padding-s);
|
|
181
|
-
`, Ze = M.li`
|
|
182
|
-
height: 1px;
|
|
183
|
-
background-color: var(--md-sys-color-outline-variant);
|
|
184
|
-
margin: 4px 0;
|
|
185
|
-
`;
|
|
186
|
-
M.li`
|
|
187
|
-
${le.labelSmall}
|
|
188
|
-
color: var(--md-sys-color-outline);
|
|
189
|
-
`;
|
|
190
|
-
const je = M.li`
|
|
191
|
-
${le.labelSmall}
|
|
192
|
-
color: var(--md-sys-color-outline);
|
|
193
|
-
user-select: none;
|
|
194
|
-
border-radius: var(--border-radius-m);
|
|
195
|
-
height: 28px;
|
|
196
|
-
padding: 0 8px;
|
|
197
|
-
|
|
198
|
-
display: flex;
|
|
199
|
-
align-items: center;
|
|
200
|
-
gap: var(--base-gap-small);
|
|
201
|
-
|
|
202
|
-
cursor: pointer;
|
|
203
|
-
|
|
204
|
-
&:hover {
|
|
205
|
-
background-color: var(--md-sys-color-surface-container-high-hover);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.spacer {
|
|
209
|
-
flex: 1;
|
|
210
|
-
}
|
|
211
|
-
.icon {
|
|
212
|
-
font-size: 18px;
|
|
213
|
-
color: var(--md-sys-color-outline);
|
|
214
|
-
display: none;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/* if collapsed show icon at 90degrees */
|
|
218
|
-
&.collapsed .icon {
|
|
219
|
-
display: inline-flex;
|
|
220
|
-
transform: rotate(-90deg);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
&:hover .icon {
|
|
224
|
-
display: inline-flex;
|
|
225
|
-
}
|
|
226
|
-
`, Ne = Z(
|
|
227
|
-
({ title: e, collapsed: t, className: n, ...s }, o) => /* @__PURE__ */ ae(
|
|
228
|
-
je,
|
|
229
|
-
{
|
|
230
|
-
...s,
|
|
231
|
-
className: K("views-section-header", { collapsed: t }, n),
|
|
232
|
-
ref: o,
|
|
233
|
-
children: [
|
|
234
|
-
/* @__PURE__ */ v("span", { children: e }),
|
|
235
|
-
/* @__PURE__ */ v("span", { className: "spacer" }),
|
|
236
|
-
/* @__PURE__ */ v(de, { className: "icon", icon: "expand_more" })
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
)
|
|
240
|
-
), Te = "_divider_", et = (e) => typeof e == "object" && e !== null && "type" in e && e.type === "section", Bt = Z(
|
|
241
|
-
({ items: e, selected: t, ...n }, s) => /* @__PURE__ */ v(Xe, { children: /* @__PURE__ */ v(Ye, { ...n, ref: s, children: e.map((o, d) => o === "_divider_" ? /* @__PURE__ */ v(Ze, {}, d) : et(o) ? /* @__PURE__ */ v(
|
|
242
|
-
Ne,
|
|
243
|
-
{
|
|
244
|
-
id: o.id,
|
|
245
|
-
title: o.title,
|
|
246
|
-
collapsed: o.collapsed,
|
|
247
|
-
onClick: o.onToggle
|
|
248
|
-
},
|
|
249
|
-
o.id
|
|
250
|
-
) : /* @__PURE__ */ v(
|
|
251
|
-
Je,
|
|
252
|
-
{
|
|
253
|
-
tabIndex: 0,
|
|
254
|
-
isSelected: o.id === t,
|
|
255
|
-
autoFocus: d === 0,
|
|
256
|
-
...o
|
|
257
|
-
},
|
|
258
|
-
(o.id || "") + d.toString()
|
|
259
|
-
)) }) })
|
|
260
|
-
), tt = (e) => {
|
|
261
|
-
const { viewsList: t, onEdit: n, onSelect: s, onSave: o } = e, d = (i, f = {}) => ({
|
|
262
|
-
id: i.id,
|
|
263
|
-
label: i.label,
|
|
264
|
-
isSelected: !1,
|
|
265
|
-
highlighted: i.highlighted,
|
|
266
|
-
onClick: () => s(i.id),
|
|
267
|
-
...f
|
|
268
|
-
}), u = t.filter((i) => i.visibility === "private" && i.isOwner && !i.working).map(
|
|
269
|
-
(i) => d(i, {
|
|
270
|
-
isEditable: !0,
|
|
271
|
-
isSaveable: !0,
|
|
272
|
-
onEdit: () => n(i.id),
|
|
273
|
-
onSave: () => o(i.id)
|
|
274
|
-
})
|
|
275
|
-
), V = t.filter((i) => i.visibility === "public" && !i.working).map(
|
|
276
|
-
(i) => d(i, {
|
|
277
|
-
isEditable: i.isOwner,
|
|
278
|
-
isSaveable: i.isOwner,
|
|
279
|
-
...i.isOwner && {
|
|
280
|
-
onEdit: () => n(i.id),
|
|
281
|
-
onSave: () => o(i.id)
|
|
282
|
-
}
|
|
283
|
-
})
|
|
284
|
-
), g = t.filter((i) => i.visibility === "private" && !i.isOwner && !i.working).map(
|
|
285
|
-
(i) => d(i, {
|
|
286
|
-
isEditable: !1,
|
|
287
|
-
isSaveable: !1
|
|
288
|
-
})
|
|
289
|
-
);
|
|
290
|
-
return {
|
|
291
|
-
myViews: u,
|
|
292
|
-
sharedViews: V,
|
|
293
|
-
allPrivateViews: g
|
|
294
|
-
};
|
|
295
|
-
}, st = ({
|
|
296
|
-
viewsList: e,
|
|
297
|
-
workingView: t,
|
|
298
|
-
viewType: n,
|
|
299
|
-
viewAlias: s,
|
|
300
|
-
projectName: o,
|
|
301
|
-
currentUser: d,
|
|
302
|
-
useWorkingView: u,
|
|
303
|
-
editingViewId: V,
|
|
304
|
-
collapsed: g,
|
|
305
|
-
setCollapsed: i,
|
|
306
|
-
onSelect: f,
|
|
307
|
-
onEdit: x,
|
|
308
|
-
onSave: $,
|
|
309
|
-
onResetWorkingView: w,
|
|
310
|
-
selectedId: l
|
|
311
|
-
}) => {
|
|
312
|
-
const { powerLicense: c } = ue(), [a] = j(), h = F(
|
|
313
|
-
() => e.map((r) => ({
|
|
314
|
-
...r,
|
|
315
|
-
isOwner: r.owner === d?.name,
|
|
316
|
-
highlighted: V === r.id ? "save" : void 0
|
|
317
|
-
})),
|
|
318
|
-
[e, d, V]
|
|
319
|
-
), y = {
|
|
320
|
-
id: ge,
|
|
321
|
-
label: u ? `Personal ${s.toLowerCase()}` : `Working ${s.toLowerCase()}`,
|
|
322
|
-
startContent: u && /* @__PURE__ */ v(de, { icon: "person" }),
|
|
323
|
-
isEditable: !1
|
|
324
|
-
}, D = b(async () => {
|
|
325
|
-
let r = t?.id;
|
|
326
|
-
if (!t)
|
|
327
|
-
try {
|
|
328
|
-
console.warn(`No working ${s.toLowerCase()} found, creating a new one`);
|
|
329
|
-
const C = we();
|
|
330
|
-
await a({
|
|
331
|
-
payload: C,
|
|
332
|
-
viewType: n,
|
|
333
|
-
projectName: o
|
|
334
|
-
}).unwrap(), r = C.id;
|
|
335
|
-
} catch (C) {
|
|
336
|
-
m.error(`Failed to create working ${s}: ${C}`);
|
|
337
|
-
}
|
|
338
|
-
f(r);
|
|
339
|
-
}, [t, n, a, o, f]), _ = async (r) => {
|
|
340
|
-
try {
|
|
341
|
-
await $(r), f(r);
|
|
342
|
-
} catch (C) {
|
|
343
|
-
m.error(C);
|
|
344
|
-
}
|
|
345
|
-
}, [W, { isLoading: R }] = Ue({
|
|
346
|
-
addon: "powerpack",
|
|
347
|
-
remote: "views",
|
|
348
|
-
module: "getCustomViews",
|
|
349
|
-
fallback: tt,
|
|
350
|
-
// minVersion: minVersion,
|
|
351
|
-
skip: !n || !c
|
|
352
|
-
}), { myViews: S, sharedViews: I, allPrivateViews: k } = W({
|
|
353
|
-
viewsList: h,
|
|
354
|
-
onEdit: x,
|
|
355
|
-
onSelect: f,
|
|
356
|
-
onSave: _
|
|
357
|
-
}), E = b(
|
|
358
|
-
(r) => {
|
|
359
|
-
i({ ...g, [r]: !g[r] });
|
|
360
|
-
},
|
|
361
|
-
[g, i]
|
|
362
|
-
), O = F(() => [
|
|
363
|
-
{ id: "myViews", title: `My ${s.toLowerCase()}s`, items: S },
|
|
364
|
-
{
|
|
365
|
-
id: "sharedViews",
|
|
366
|
-
title: `Shared ${s.toLowerCase()}s`,
|
|
367
|
-
items: I
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
id: "allPrivateViews",
|
|
371
|
-
title: `All private ${s.toLowerCase()}s`,
|
|
372
|
-
items: k
|
|
373
|
-
}
|
|
374
|
-
], [S, I, k]), L = F(() => ({
|
|
375
|
-
...y,
|
|
376
|
-
onClick: D,
|
|
377
|
-
// expose reset button when handler is provided
|
|
378
|
-
isEditable: !!w,
|
|
379
|
-
onResetView: w
|
|
380
|
-
}), [D, w]);
|
|
381
|
-
return F(() => {
|
|
382
|
-
const r = [L], C = O.filter((B) => c && (B.items?.length || 0) > 0);
|
|
383
|
-
return C.length > 0 && r.push(Te), C.forEach((B) => {
|
|
384
|
-
const G = !!g[B.id];
|
|
385
|
-
if (r.push({
|
|
386
|
-
type: "section",
|
|
387
|
-
id: B.id,
|
|
388
|
-
title: B.title,
|
|
389
|
-
collapsed: G,
|
|
390
|
-
onToggle: () => E(B.id)
|
|
391
|
-
}), !G)
|
|
392
|
-
r.push(...B.items);
|
|
393
|
-
else if (l) {
|
|
394
|
-
const Q = B.items.find((z) => z.id === l);
|
|
395
|
-
Q && r.push(Q);
|
|
396
|
-
}
|
|
397
|
-
}), r;
|
|
398
|
-
}, [L, O, g, E, l, c]);
|
|
399
|
-
}, it = ({ viewType: e, projectName: t }) => {
|
|
400
|
-
const { currentData: n, isLoading: s } = Pe(
|
|
401
|
-
{ viewType: e, projectName: t },
|
|
402
|
-
{ skip: !e }
|
|
403
|
-
), [o] = N(), d = De({}), u = d.current[e];
|
|
404
|
-
return [n, async (g) => {
|
|
405
|
-
if (!e) throw "No view type provided for setting default view";
|
|
406
|
-
n?.id && n.id !== g && (d.current[e] = n.id);
|
|
407
|
-
try {
|
|
408
|
-
await o({
|
|
409
|
-
setDefaultViewRequestModel: {
|
|
410
|
-
viewId: g
|
|
411
|
-
},
|
|
412
|
-
viewType: e,
|
|
413
|
-
projectName: t
|
|
414
|
-
}).unwrap();
|
|
415
|
-
} catch (i) {
|
|
416
|
-
m.warn(`Failed to set default view: ${i}`);
|
|
417
|
-
}
|
|
418
|
-
}, u, s];
|
|
419
|
-
}, ot = ({
|
|
420
|
-
viewType: e,
|
|
421
|
-
projectName: t,
|
|
422
|
-
viewsList: n,
|
|
423
|
-
onCreate: s,
|
|
424
|
-
onDelete: o,
|
|
425
|
-
onUpdate: d
|
|
426
|
-
}) => {
|
|
427
|
-
const u = ze(), [V] = j(), [g] = ne(), [i] = ce(), [f] = N(), x = b(
|
|
428
|
-
async (c, a) => {
|
|
429
|
-
if (!e)
|
|
430
|
-
throw new Error("viewType are required for creating a view");
|
|
431
|
-
try {
|
|
432
|
-
await V({
|
|
433
|
-
viewType: e,
|
|
434
|
-
projectName: a ? void 0 : t,
|
|
435
|
-
payload: c
|
|
436
|
-
}).unwrap(), s && s(c);
|
|
437
|
-
} catch (h) {
|
|
438
|
-
throw h;
|
|
439
|
-
}
|
|
440
|
-
},
|
|
441
|
-
[V, e, t, s]
|
|
442
|
-
), $ = b(
|
|
443
|
-
async (c, a, h) => {
|
|
444
|
-
if (!e)
|
|
445
|
-
throw new Error("viewType are required for updating a view");
|
|
446
|
-
try {
|
|
447
|
-
await i({
|
|
448
|
-
viewId: c,
|
|
449
|
-
viewType: e,
|
|
450
|
-
projectName: h ? void 0 : t,
|
|
451
|
-
payload: a
|
|
452
|
-
}).unwrap(), d && d({ ...a, id: c });
|
|
453
|
-
} catch (y) {
|
|
454
|
-
throw y;
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
[i, e, t, d]
|
|
458
|
-
), w = b(
|
|
459
|
-
async (c, a) => {
|
|
460
|
-
if (!e)
|
|
461
|
-
throw new Error("viewType are required for deleting a view");
|
|
462
|
-
try {
|
|
463
|
-
await g({
|
|
464
|
-
viewType: e,
|
|
465
|
-
projectName: a ? void 0 : t,
|
|
466
|
-
viewId: c
|
|
467
|
-
}).unwrap(), o && o(c);
|
|
468
|
-
} catch (h) {
|
|
469
|
-
throw h;
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
[g, e, t, o]
|
|
473
|
-
), l = b(
|
|
474
|
-
async (c) => {
|
|
475
|
-
const { existingWorkingViewId: a, selectedViewId: h, setSelectedView: y, setSettingsChanged: D, notify: _ } = c || {};
|
|
476
|
-
if (!e)
|
|
477
|
-
throw new Error("viewType are required for resetting a view");
|
|
478
|
-
try {
|
|
479
|
-
u(
|
|
480
|
-
P.util.invalidateTags([
|
|
481
|
-
{ type: "Views", id: `base-${e}-${t}` },
|
|
482
|
-
{ type: "Views", id: `base-${e}` }
|
|
483
|
-
])
|
|
484
|
-
);
|
|
485
|
-
const S = (await u(
|
|
486
|
-
P.endpoints.getBaseView.initiate(
|
|
487
|
-
{ viewType: e, projectName: t },
|
|
488
|
-
{ subscribe: !1, forceRefetch: !0 }
|
|
489
|
-
)
|
|
490
|
-
)).data;
|
|
491
|
-
let I = {}, k = "default";
|
|
492
|
-
if (S && S.settings && Object.keys(S.settings).length > 0)
|
|
493
|
-
I = S.settings, k = "project";
|
|
494
|
-
else {
|
|
495
|
-
const r = (await u(
|
|
496
|
-
P.endpoints.getBaseView.initiate(
|
|
497
|
-
{ viewType: e },
|
|
498
|
-
{ subscribe: !1, forceRefetch: !0 }
|
|
499
|
-
)
|
|
500
|
-
)).data;
|
|
501
|
-
r && r.settings && Object.keys(r.settings).length > 0 && (I = r.settings, k = "studio");
|
|
502
|
-
}
|
|
503
|
-
const E = a ?? we().id;
|
|
504
|
-
if (a ? await i({
|
|
505
|
-
viewId: a,
|
|
506
|
-
viewType: e,
|
|
507
|
-
projectName: t,
|
|
508
|
-
payload: { settings: I }
|
|
509
|
-
}).unwrap() : await V({
|
|
510
|
-
viewType: e,
|
|
511
|
-
projectName: t,
|
|
512
|
-
payload: {
|
|
513
|
-
id: E,
|
|
514
|
-
label: "Working",
|
|
515
|
-
working: !0,
|
|
516
|
-
settings: I
|
|
517
|
-
}
|
|
518
|
-
}).unwrap(), await f({
|
|
519
|
-
viewType: e,
|
|
520
|
-
projectName: t,
|
|
521
|
-
setDefaultViewRequestModel: { viewId: E }
|
|
522
|
-
}).unwrap(), y && y(E), D && D(!1), _) {
|
|
523
|
-
const L = k === "project" ? "View reset to project default view" : k === "studio" ? "View reset to studio default view" : "View reset to default settings";
|
|
524
|
-
m.success(L);
|
|
525
|
-
}
|
|
526
|
-
return E;
|
|
527
|
-
} catch (W) {
|
|
528
|
-
throw _ && m.error("Failed to reset view to default"), W;
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
[V, i, f, e, t, u]
|
|
532
|
-
);
|
|
533
|
-
return {
|
|
534
|
-
onCreateView: x,
|
|
535
|
-
onUpdateView: $,
|
|
536
|
-
onDeleteView: w,
|
|
537
|
-
onResetWorkingView: l
|
|
538
|
-
};
|
|
539
|
-
}, rt = ({
|
|
540
|
-
viewType: e,
|
|
541
|
-
projectName: t,
|
|
542
|
-
viewSettings: n,
|
|
543
|
-
workingView: s,
|
|
544
|
-
dispatch: o
|
|
545
|
-
}) => {
|
|
546
|
-
const [d] = j(), [u] = ce(), [V] = ne(), [g] = N(), i = b(
|
|
547
|
-
async (w) => {
|
|
548
|
-
try {
|
|
549
|
-
const a = await d({
|
|
550
|
-
payload: {
|
|
551
|
-
label: Ve,
|
|
552
|
-
working: !1,
|
|
553
|
-
settings: n || {}
|
|
554
|
-
},
|
|
555
|
-
viewType: e,
|
|
556
|
-
projectName: w ? void 0 : t
|
|
557
|
-
}).unwrap();
|
|
558
|
-
o(
|
|
559
|
-
P.util.invalidateTags([
|
|
560
|
-
{ type: "view", id: a.id },
|
|
561
|
-
J(e, w ? void 0 : t)
|
|
562
|
-
])
|
|
563
|
-
);
|
|
564
|
-
const h = w ? "Studio" : "Project";
|
|
565
|
-
m.success(`${h} default view created successfully`);
|
|
566
|
-
} catch (l) {
|
|
567
|
-
const c = w ? "studio" : "project";
|
|
568
|
-
m.error(`Failed to create ${c} base view: ${l?.message || l}`);
|
|
569
|
-
}
|
|
570
|
-
},
|
|
571
|
-
[d, e, t, n, o]
|
|
572
|
-
), f = b(
|
|
573
|
-
async (w, l) => {
|
|
574
|
-
try {
|
|
575
|
-
await u({
|
|
576
|
-
viewId: w,
|
|
577
|
-
viewType: e,
|
|
578
|
-
projectName: l ? void 0 : t,
|
|
579
|
-
payload: { settings: n || {} }
|
|
580
|
-
}).unwrap(), o(
|
|
581
|
-
P.util.invalidateTags([
|
|
582
|
-
{ type: "view", id: w },
|
|
583
|
-
J(e, l ? void 0 : t)
|
|
584
|
-
])
|
|
585
|
-
);
|
|
586
|
-
const a = l ? "Studio" : "Project";
|
|
587
|
-
m.success(`${a} default view updated successfully`);
|
|
588
|
-
} catch (c) {
|
|
589
|
-
const a = l ? "studio" : "project";
|
|
590
|
-
m.error(`Failed to update ${a} base view: ${c?.message || c}`);
|
|
591
|
-
}
|
|
592
|
-
},
|
|
593
|
-
[u, e, t, n, o]
|
|
594
|
-
), x = b(
|
|
595
|
-
async (w, l) => {
|
|
596
|
-
try {
|
|
597
|
-
await V({
|
|
598
|
-
viewId: w,
|
|
599
|
-
viewType: e,
|
|
600
|
-
projectName: l ? void 0 : t
|
|
601
|
-
}).unwrap(), o(
|
|
602
|
-
P.util.invalidateTags([
|
|
603
|
-
{ type: "view", id: w },
|
|
604
|
-
J(e, l ? void 0 : t)
|
|
605
|
-
])
|
|
606
|
-
);
|
|
607
|
-
const c = l ? "Studio" : "Project";
|
|
608
|
-
m.success(`${c} default view removed successfully`);
|
|
609
|
-
} catch (c) {
|
|
610
|
-
const a = l ? "studio" : "project";
|
|
611
|
-
m.error(`Failed to remove ${a} base view: ${c?.message || c}`);
|
|
612
|
-
}
|
|
613
|
-
},
|
|
614
|
-
[V, e, t, o]
|
|
615
|
-
), $ = b(
|
|
616
|
-
async (w) => {
|
|
617
|
-
try {
|
|
618
|
-
if (!s?.id)
|
|
619
|
-
throw new Error("No working view available to update");
|
|
620
|
-
const a = (await o(
|
|
621
|
-
P.endpoints.getBaseView.initiate(
|
|
622
|
-
{
|
|
623
|
-
viewType: e,
|
|
624
|
-
projectName: w ? void 0 : t
|
|
625
|
-
},
|
|
626
|
-
{ subscribe: !1, forceRefetch: !0 }
|
|
627
|
-
)
|
|
628
|
-
)).data;
|
|
629
|
-
if (!a || !a.settings)
|
|
630
|
-
throw new Error("Base view not found or has no settings");
|
|
631
|
-
await u({
|
|
632
|
-
viewId: s.id,
|
|
633
|
-
viewType: e,
|
|
634
|
-
projectName: t,
|
|
635
|
-
payload: { settings: a.settings }
|
|
636
|
-
}).unwrap(), await g({
|
|
637
|
-
viewType: e,
|
|
638
|
-
projectName: t,
|
|
639
|
-
setDefaultViewRequestModel: { viewId: s.id }
|
|
640
|
-
}).unwrap();
|
|
641
|
-
const h = w ? "Studio" : "Project";
|
|
642
|
-
m.success(`Loaded ${h} default view to working view`);
|
|
643
|
-
} catch (l) {
|
|
644
|
-
const c = w ? "studio" : "project";
|
|
645
|
-
m.error(`Failed to load ${c} base view: ${l?.message || l}`);
|
|
646
|
-
}
|
|
647
|
-
},
|
|
648
|
-
[s, u, g, e, t, o]
|
|
649
|
-
);
|
|
650
|
-
return {
|
|
651
|
-
onCreateBaseView: i,
|
|
652
|
-
onUpdateBaseView: f,
|
|
653
|
-
onDeleteBaseView: x,
|
|
654
|
-
onLoadBaseView: $
|
|
655
|
-
};
|
|
656
|
-
}, fe = (e, t) => e ? t.find((s) => s.id === e)?.scope === "studio" : !0, at = ({
|
|
657
|
-
viewType: e,
|
|
658
|
-
projectName: t,
|
|
659
|
-
viewsList: n,
|
|
660
|
-
sourceSettings: s,
|
|
661
|
-
onUpdateView: o
|
|
662
|
-
}) => ({ onSaveViewFromCurrent: b(
|
|
663
|
-
async (u) => {
|
|
664
|
-
if (!e)
|
|
665
|
-
throw "viewType are required for saving a view from another view";
|
|
666
|
-
if (!s)
|
|
667
|
-
throw "sourceView is required for saving a view from another view";
|
|
668
|
-
try {
|
|
669
|
-
await o(
|
|
670
|
-
u,
|
|
671
|
-
{
|
|
672
|
-
settings: s
|
|
673
|
-
},
|
|
674
|
-
fe(u, n)
|
|
675
|
-
), m.success("View settings saved");
|
|
676
|
-
} catch (V) {
|
|
677
|
-
const g = typeof V == "string" ? "Failed to save view settings: " + V : "Failed to save view settings";
|
|
678
|
-
throw console.error(g), g;
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
[e, t, s]
|
|
682
|
-
) }), nt = ({
|
|
683
|
-
viewType: e
|
|
684
|
-
}) => {
|
|
685
|
-
const [t, n] = Y({}), s = b(
|
|
686
|
-
(d) => {
|
|
687
|
-
e && n((u) => ({ ...u, [e]: d }));
|
|
688
|
-
},
|
|
689
|
-
[e, n]
|
|
690
|
-
);
|
|
691
|
-
return [e ? t[e] : !1, s];
|
|
692
|
-
}, he = Ie(null), ct = "view", $t = ({
|
|
693
|
-
children: e,
|
|
694
|
-
viewType: t,
|
|
695
|
-
viewAlias: n = ct,
|
|
696
|
-
projectName: s,
|
|
697
|
-
dispatch: o,
|
|
698
|
-
debug: d
|
|
699
|
-
}) => {
|
|
700
|
-
let { powerLicense: u } = ue();
|
|
701
|
-
d?.powerLicense !== void 0 && (console.warn("Using debug power license:", d.powerLicense), u = d.powerLicense);
|
|
702
|
-
const { user: V } = Qe(), [g, i] = Y(!1), [f, x] = Y(null), $ = "viewsMenuCollapsed", [w, l] = Ke(
|
|
703
|
-
$,
|
|
704
|
-
{}
|
|
705
|
-
), c = (p) => {
|
|
706
|
-
const U = p.visibility === "private" ? "myViews" : "sharedViews";
|
|
707
|
-
if (w[U]) {
|
|
708
|
-
const ie = { ...w };
|
|
709
|
-
ie[U] = !1, l(ie);
|
|
710
|
-
}
|
|
711
|
-
}, { data: a } = Me(
|
|
712
|
-
{ projectName: s },
|
|
713
|
-
{ skip: !u || !f }
|
|
714
|
-
), [h, y, D, _] = it({
|
|
715
|
-
viewType: t,
|
|
716
|
-
projectName: s
|
|
717
|
-
}), [W, R] = nt({
|
|
718
|
-
viewType: t
|
|
719
|
-
}), { currentData: S = [], isLoading: I } = _e(
|
|
720
|
-
{ projectName: s, viewType: t },
|
|
721
|
-
{ skip: !t }
|
|
722
|
-
), k = F(
|
|
723
|
-
() => S.filter(
|
|
724
|
-
(p) => p.label !== Ve && !(s && p.working && p.scope === "studio")
|
|
725
|
-
),
|
|
726
|
-
[S]
|
|
727
|
-
), { onCreateView: E, onDeleteView: O, onUpdateView: L, onResetWorkingView: q } = ot({
|
|
728
|
-
viewType: t,
|
|
729
|
-
projectName: s,
|
|
730
|
-
viewsList: k,
|
|
731
|
-
onCreate: c
|
|
732
|
-
}), {
|
|
733
|
-
currentData: r,
|
|
734
|
-
isLoading: C,
|
|
735
|
-
isError: B
|
|
736
|
-
} = We(
|
|
737
|
-
{ projectName: s, viewType: t },
|
|
738
|
-
{ skip: !t }
|
|
739
|
-
), { currentData: G, isLoading: Q } = oe(
|
|
740
|
-
{ projectName: s, viewType: t },
|
|
741
|
-
{ skip: !t }
|
|
742
|
-
), { currentData: z, isLoading: pe } = oe(
|
|
743
|
-
{ projectName: void 0, viewType: t },
|
|
744
|
-
{ skip: !t }
|
|
745
|
-
), me = I || _ || C || Q || pe, T = r?.settings, H = h?.id === ge ? T : h?.settings, ee = h?.id === r?.id, te = W && ee && D && D !== r?.id ? D : void 0, { currentData: A, isFetching: ve } = Re(
|
|
746
|
-
{
|
|
747
|
-
viewId: f,
|
|
748
|
-
projectName: fe(f, k) ? void 0 : s,
|
|
749
|
-
viewType: t
|
|
750
|
-
},
|
|
751
|
-
{ skip: typeof f != "string" || !u }
|
|
752
|
-
), be = F(
|
|
753
|
-
() => f === A?.id ? A : void 0,
|
|
754
|
-
[f, A]
|
|
755
|
-
), { onSaveViewFromCurrent: ke } = at({
|
|
756
|
-
viewType: t,
|
|
757
|
-
projectName: s,
|
|
758
|
-
viewsList: k,
|
|
759
|
-
sourceSettings: H,
|
|
760
|
-
onUpdateView: L
|
|
761
|
-
}), { onCreateBaseView: ye, onUpdateBaseView: Ce, onDeleteBaseView: xe, onLoadBaseView: Se } = rt({
|
|
762
|
-
viewType: t,
|
|
763
|
-
projectName: s,
|
|
764
|
-
viewSettings: H,
|
|
765
|
-
workingView: r,
|
|
766
|
-
dispatch: o
|
|
767
|
-
}), Le = b(
|
|
768
|
-
async (p, { selectView: U } = {}) => {
|
|
769
|
-
if (!r?.id) {
|
|
770
|
-
console.error("No working view to update");
|
|
771
|
-
return;
|
|
772
|
-
}
|
|
773
|
-
await L(r.id, p, !s), U && y(r.id);
|
|
774
|
-
},
|
|
775
|
-
[L, r]
|
|
776
|
-
), se = b(async () => {
|
|
777
|
-
try {
|
|
778
|
-
await q({
|
|
779
|
-
existingWorkingViewId: r?.id,
|
|
780
|
-
selectedViewId: h?.id,
|
|
781
|
-
setSelectedView: y,
|
|
782
|
-
setSettingsChanged: R,
|
|
783
|
-
notify: !0
|
|
784
|
-
});
|
|
785
|
-
} catch (p) {
|
|
786
|
-
console.error("Failed to reset view:", p);
|
|
787
|
-
}
|
|
788
|
-
}, [r, q, h, y, R]), Be = st({
|
|
789
|
-
viewsList: k,
|
|
790
|
-
workingView: r,
|
|
791
|
-
viewType: t,
|
|
792
|
-
viewAlias: n,
|
|
793
|
-
projectName: s,
|
|
794
|
-
currentUser: V,
|
|
795
|
-
useWorkingView: !u,
|
|
796
|
-
editingViewId: te,
|
|
797
|
-
selectedId: h?.id,
|
|
798
|
-
collapsed: w,
|
|
799
|
-
setCollapsed: l,
|
|
800
|
-
onResetWorkingView: se,
|
|
801
|
-
onSelect: (p) => {
|
|
802
|
-
y(p), R(!1), i(!1);
|
|
803
|
-
},
|
|
804
|
-
onEdit: (p) => x(p),
|
|
805
|
-
onSave: async (p) => ke(p)
|
|
806
|
-
}), $e = {
|
|
807
|
-
viewType: t,
|
|
808
|
-
viewAlias: n,
|
|
809
|
-
projectName: s,
|
|
810
|
-
isMenuOpen: g,
|
|
811
|
-
editingView: f,
|
|
812
|
-
currentUser: V,
|
|
813
|
-
selectedView: h,
|
|
814
|
-
viewSettings: H,
|
|
815
|
-
editingViewData: be,
|
|
816
|
-
isLoadingEditingViewData: ve,
|
|
817
|
-
viewsList: k,
|
|
818
|
-
// Working view
|
|
819
|
-
workingSettings: T,
|
|
820
|
-
workingView: r,
|
|
821
|
-
isViewWorking: ee,
|
|
822
|
-
onUpdateWorkingView: Le,
|
|
823
|
-
// base views
|
|
824
|
-
projectBaseView: G,
|
|
825
|
-
studioBaseView: z,
|
|
826
|
-
// base view mutations
|
|
827
|
-
onCreateBaseView: ye,
|
|
828
|
-
onUpdateBaseView: Ce,
|
|
829
|
-
onDeleteBaseView: xe,
|
|
830
|
-
onLoadBaseView: Se,
|
|
831
|
-
editingViewId: te,
|
|
832
|
-
viewMenuItems: Be,
|
|
833
|
-
isLoadingViews: me,
|
|
834
|
-
isErrorWorkingView: B,
|
|
835
|
-
// data
|
|
836
|
-
shareOptions: a,
|
|
837
|
-
setIsMenuOpen: i,
|
|
838
|
-
setEditingView: x,
|
|
839
|
-
setSelectedView: y,
|
|
840
|
-
onSettingsChanged: R,
|
|
841
|
-
// mutations
|
|
842
|
-
onCreateView: E,
|
|
843
|
-
onUpdateView: L,
|
|
844
|
-
onDeleteView: O,
|
|
845
|
-
// shared actions
|
|
846
|
-
resetWorkingView: se,
|
|
847
|
-
// api
|
|
848
|
-
api: P,
|
|
849
|
-
dispatch: o
|
|
850
|
-
};
|
|
851
|
-
return /* @__PURE__ */ v(he.Provider, { value: $e, children: e });
|
|
852
|
-
}, lt = () => {
|
|
853
|
-
const e = Ee(he);
|
|
854
|
-
if (!e)
|
|
855
|
-
throw new Error("useViewsContext must be used within a ViewsProvider");
|
|
856
|
-
return e;
|
|
857
|
-
};
|
|
858
|
-
export {
|
|
859
|
-
Ve as B,
|
|
860
|
-
Lt as N,
|
|
861
|
-
Ne as S,
|
|
862
|
-
Bt as V,
|
|
863
|
-
ge as W,
|
|
864
|
-
Je as a,
|
|
865
|
-
Te as b,
|
|
866
|
-
$t as c,
|
|
867
|
-
He as d,
|
|
868
|
-
tt as e,
|
|
869
|
-
rt as f,
|
|
870
|
-
we as g,
|
|
871
|
-
st as h,
|
|
872
|
-
fe as i,
|
|
873
|
-
at as j,
|
|
874
|
-
it as k,
|
|
875
|
-
ot as l,
|
|
876
|
-
lt as u,
|
|
877
|
-
St as v
|
|
878
|
-
};
|