@ynput/ayon-frontend-shared 0.6.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 +292 -298
- package/dist/Feed.es.js +179 -50
- package/dist/ListTable.es.js +32 -35
- package/dist/NewEntity.es.js +1256 -11
- package/dist/ProjectTreeTable.es.js +4451 -2965
- package/dist/SimpleTable.es.js +8 -7
- package/dist/Slicer.es.js +451 -147
- package/dist/Views.es.js +918 -310
- package/dist/chunks/Actions.es.js +9 -4
- 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/EmptyPlaceholder.es.js +4 -4
- package/dist/chunks/EntityPath.es.js +58 -53
- package/dist/chunks/EntityPickerDialog.es.js +24 -20
- package/dist/chunks/EntityTooltip.es.js +20 -13
- package/dist/chunks/EntityUpdatesContext.es.js +38 -96
- package/dist/chunks/Feed.es.js +1495 -1439
- package/dist/chunks/FilterErrorActions.es.js +25 -229
- package/dist/chunks/Menu.es.js +21 -17
- package/dist/chunks/MenuContext.es.js +14 -65
- package/dist/chunks/MenuItem.es.js +34 -24
- package/dist/chunks/MetaWidget.es.js +2835 -4301
- package/dist/chunks/NewEntityContextInstance.es.js +11 -0
- package/dist/chunks/PlayableIcon.es.js +1532 -1594
- package/dist/chunks/ProjectContext.es.js +102 -66
- package/dist/chunks/RepresentationsList.es.js +1 -1
- package/dist/chunks/ReviewablesSelector.es.js +457 -458
- package/dist/chunks/SimpleForm.es.js +9 -9
- package/dist/chunks/SimpleTable.es.js +15 -13
- package/dist/chunks/Slicer.es.js +163 -154
- package/dist/chunks/TableSettingsFallback.es.js +25 -13
- package/dist/chunks/ThumbnailSimple.es.js +150 -261
- package/dist/chunks/VersionUploadContextInstance.es.js +12 -0
- package/dist/chunks/VideoPlayer.es.js +24 -28
- package/dist/chunks/Watchers.es.js +384 -389
- package/dist/chunks/entityDefinitions.es.js +2 -350
- package/dist/chunks/extractVersionFromFilename.es.js +28 -0
- package/dist/chunks/getBundleMode.es.js +61 -16
- package/dist/chunks/getUris.es.js +737 -712
- package/dist/chunks/searchTerms.es.js +57 -56
- package/dist/chunks/useAttributeEnums.es.js +4 -4
- package/dist/chunks/useCreateContextMenu.es.js +66 -90
- 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 +67 -50
- package/dist/components.es.js +1425 -999
- package/dist/context.es.js +791 -80
- package/dist/hooks.es.js +115 -120
- package/dist/index.es.js +19 -23
- package/dist/types/Actions.d.ts +7 -7
- package/dist/types/ContextMenu.d.ts +11 -8
- package/dist/types/DetailsPanel.d.ts +102 -9
- package/dist/types/EntityPickerDialog.d.ts +7 -7
- package/dist/types/Feed.d.ts +11 -8
- package/dist/types/ListTable.d.ts +7 -7
- package/dist/types/NewEntity.d.ts +16 -10
- package/dist/types/ProjectTreeTable.d.ts +22 -115
- package/dist/types/RepresentationsList.d.ts +7 -7
- package/dist/types/SimpleTable.d.ts +11 -8
- package/dist/types/Slicer.d.ts +10 -7
- package/dist/types/Views.d.ts +10 -7
- package/dist/types/api.d.ts +132 -120
- package/dist/types/components.d.ts +13 -8
- package/dist/types/context.d.ts +56 -16
- package/dist/types/hooks.d.ts +7 -7
- package/dist/types/index.d.ts +7 -7
- package/dist/types/util.d.ts +12 -7
- package/dist/util.es.js +72 -71
- package/package.json +1 -1
- package/dist/chunks/DeleteEntitiesContext.es.js +0 -748
- package/dist/chunks/DetailsPanelContext.es.js +0 -155
- 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/uriUtils.es.js +0 -48
- package/dist/chunks/useColumnDragRestriction.es.js +0 -158
- package/dist/chunks/useLocalStorage.es.js +0 -355
- package/dist/chunks/useSessionStorage.es.js +0 -61
- /package/dist/{useCreateContextMenu.css → ContextMenuContextInstance.css} +0 -0
package/dist/NewEntity.es.js
CHANGED
|
@@ -1,13 +1,1258 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as t, jsxs as f, Fragment as ue } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z, forwardRef as Ue, useRef as ce, useEffect as Le, useLayoutEffect as Ve, useContext as Pe, useMemo as ge } from "react";
|
|
3
|
+
import { isEmpty as Ce } from "lodash";
|
|
4
|
+
import "primereact/confirmdialog";
|
|
5
|
+
import { toast as me } from "react-toastify";
|
|
6
|
+
import { g as Je, R as Me } from "./chunks/realtimeUpdatesUtils.es.js";
|
|
7
|
+
import { p as be, c as Xe, a as Ze } from "./chunks/parseHtmlToPlainTextWithLinks.es.js";
|
|
8
|
+
import { bi as Ge } from "./chunks/searchTerms.es.js";
|
|
9
|
+
import { dl as Qe } from "./chunks/getUris.es.js";
|
|
10
|
+
import "@module-federation/enhanced/runtime";
|
|
11
|
+
import { x as Te, y as ze, M as Ye } from "./chunks/DeleteEntitiesContextInstance.es.js";
|
|
12
|
+
import "semver";
|
|
13
|
+
import { Dropdown as De, Icon as Q, InputText as he, Button as fe, InputSwitch as Ne, InputNumber as je, Spacer as Be, theme as qe, Dialog as et, ShortcutTag as tt, Toolbar as nt, SaveButton as at } from "@ynput/ayon-react-components";
|
|
14
|
+
import "./chunks/ContextMenuContextInstance.es.js";
|
|
15
|
+
import Ae from "clsx";
|
|
16
|
+
import "uuid";
|
|
17
|
+
import "react-dom";
|
|
18
|
+
import "react-redux";
|
|
19
|
+
import { f as rt, d as ot, C as st, g as lt, h as it, p as ct } from "./chunks/MetaWidget.es.js";
|
|
20
|
+
import { N as dt, u as pt } from "./chunks/NewEntityContextInstance.es.js";
|
|
21
|
+
import E from "styled-components";
|
|
22
|
+
import { a as ft, K as ut } from "./chunks/platform.es.js";
|
|
23
|
+
import "./chunks/PlayableIcon.es.js";
|
|
24
|
+
import "date-fns";
|
|
25
|
+
import "lexical";
|
|
26
|
+
import "@lexical/markdown";
|
|
27
|
+
import "@lexical/react/LexicalBlockWithAlignableContents";
|
|
28
|
+
import "@lexical/react/LexicalDecoratorBlockNode";
|
|
29
|
+
import "match-sorter";
|
|
30
|
+
import "@lexical/code";
|
|
31
|
+
import "@lexical/list";
|
|
32
|
+
import "@lexical/rich-text";
|
|
33
|
+
import "@lexical/selection";
|
|
34
|
+
import "@lexical/utils";
|
|
35
|
+
import "react-router-dom";
|
|
36
|
+
import { u as mt } from "./chunks/useHierarchySelection.es.js";
|
|
37
|
+
import { n as te } from "./chunks/entityDefinitions.es.js";
|
|
38
|
+
import "@tanstack/react-table";
|
|
39
|
+
const Ee = (c, m, u) => {
|
|
40
|
+
const d = c.match(/\d+$/), v = m.match(/\d+$/), h = d ? parseInt(d[0], 10) : NaN, O = (v ? parseInt(v[0], 10) : NaN) - h;
|
|
41
|
+
if (isNaN(O)) return [];
|
|
42
|
+
const r = [];
|
|
43
|
+
for (let D = 0; D < u; D++) {
|
|
44
|
+
const y = h + D * O, F = c.match(/\d+$/);
|
|
45
|
+
if (!F) return [];
|
|
46
|
+
const A = String(y).padStart(F[0].length, "0"), _ = c.replace(/\d+$/, A);
|
|
47
|
+
r.push(_);
|
|
48
|
+
}
|
|
49
|
+
return r;
|
|
50
|
+
}, ht = (c, m, u) => {
|
|
51
|
+
if (!c || !m) return "";
|
|
52
|
+
const d = (c === "folder" ? u?.folderTypes : u?.taskTypes)?.find(
|
|
53
|
+
(v) => v.name === m
|
|
54
|
+
);
|
|
55
|
+
return d ? d.name : "";
|
|
56
|
+
}, xn = ({ children: c }) => {
|
|
57
|
+
const { projectName: m, ...u } = Te(), { attribFields: d } = rt(), { findNonInheritedValues: v, getFolderById: h } = ze(), { attrib: n = {}, statuses: O } = u || {}, { anatomy: r } = Te(), { entity_naming: D = { capitalization: "lower", separator: "_" } } = r, { rowSelection: y, sliceType: F } = ot(), A = O?.filter((a) => a.scope?.includes("task"))?.[0]?.name || O?.[0]?.name || "none", _ = O?.filter((a) => a.scope?.includes("folder"))?.[0]?.name || O?.[0]?.name || "none", [q, o] = z(null), [R, J] = z(null), K = { label: "", subType: "", name: "" }, [x, ne] = z(K), [W, V] = z({
|
|
58
|
+
active: !1,
|
|
59
|
+
increment: "",
|
|
60
|
+
length: 10,
|
|
61
|
+
prefix: !1,
|
|
62
|
+
prefixDepth: 0
|
|
63
|
+
}), X = (a, p, g, S) => {
|
|
64
|
+
const s = {};
|
|
65
|
+
if (F !== "hierarchy" && !Ce(y) && a === "task") {
|
|
66
|
+
const b = Object.keys(y).filter(
|
|
67
|
+
(l) => !["hasValue", "noValue"].includes(l)
|
|
68
|
+
);
|
|
69
|
+
switch (F) {
|
|
70
|
+
case "assignees":
|
|
71
|
+
s.assignees = b;
|
|
72
|
+
break;
|
|
73
|
+
case "status":
|
|
74
|
+
s.status = b[0];
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
type: "create",
|
|
80
|
+
entityType: a,
|
|
81
|
+
data: {
|
|
82
|
+
[`${a}Type`]: p,
|
|
83
|
+
id: Je(),
|
|
84
|
+
label: g.label || g.name,
|
|
85
|
+
name: g.name,
|
|
86
|
+
...S && { [a === "folder" ? "parentId" : "folderId"]: S },
|
|
87
|
+
...s
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}, ae = (a, p, g, S, s) => {
|
|
91
|
+
if (S.length === 0 && a === "folder")
|
|
92
|
+
return g.map((l) => X(a, p, { name: l }));
|
|
93
|
+
const b = [];
|
|
94
|
+
for (const l of S)
|
|
95
|
+
for (const C of g) {
|
|
96
|
+
const $ = s ? (l.label || l.name) + C : C;
|
|
97
|
+
b.push(X(a, p, { name: $ }, l.id));
|
|
98
|
+
}
|
|
99
|
+
return b;
|
|
100
|
+
}, de = (a, p, g, S, s) => S.length === 0 && a === "folder" ? [X(a, p, { name: s, label: g })] : S.map(
|
|
101
|
+
(b) => X(a, p, { name: s, label: g }, b)
|
|
102
|
+
), H = (a, p = {}) => {
|
|
103
|
+
const g = /* @__PURE__ */ new Set();
|
|
104
|
+
for (const T of a)
|
|
105
|
+
if (T.entityType === "folder")
|
|
106
|
+
T.data?.parentId && g.add(T.data.parentId);
|
|
107
|
+
else if (T.entityType === "task") {
|
|
108
|
+
if (!T.data?.folderId) {
|
|
109
|
+
console.warn("Task operation without folderId:", T);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
g.add(T.data.folderId);
|
|
113
|
+
}
|
|
114
|
+
const S = /* @__PURE__ */ new Map();
|
|
115
|
+
for (const T of g) {
|
|
116
|
+
if (!T) continue;
|
|
117
|
+
const k = v(
|
|
118
|
+
T,
|
|
119
|
+
d.map((P) => P.name)
|
|
120
|
+
);
|
|
121
|
+
S.set(T, k);
|
|
122
|
+
}
|
|
123
|
+
const s = a.filter((T) => T.entityType === "folder"), b = a.filter((T) => T.entityType === "task"), l = (T, k) => {
|
|
124
|
+
let P = [];
|
|
125
|
+
for (const i of T) {
|
|
126
|
+
const Z = k === "folder" ? i.data.parentId : i.data.folderId, j = S.get(Z) || n, M = Object.keys(j).reduce((N, U) => {
|
|
127
|
+
const oe = d.find((pe) => pe.name === U);
|
|
128
|
+
if (!oe) return N;
|
|
129
|
+
const ye = oe.scope?.includes(k), se = !!oe.data.inherit;
|
|
130
|
+
return ye ? N[U] = j[U] : se && j[U] && (N[U] = {
|
|
131
|
+
...j[U],
|
|
132
|
+
inherited: !0,
|
|
133
|
+
inheritedFrom: Z
|
|
134
|
+
}), N;
|
|
135
|
+
}, {});
|
|
136
|
+
if (k === "folder") {
|
|
137
|
+
let N = i.data.parentId && p[i.data.parentId];
|
|
138
|
+
N = N ? N + "/" + i.data.name : "";
|
|
139
|
+
const U = {
|
|
140
|
+
type: "create",
|
|
141
|
+
entityType: "folder",
|
|
142
|
+
entityId: i.data.id,
|
|
143
|
+
data: {
|
|
144
|
+
...i.data,
|
|
145
|
+
entityId: i.data.id,
|
|
146
|
+
entityType: "folder",
|
|
147
|
+
projectName: m,
|
|
148
|
+
folderType: i.data.folderType,
|
|
149
|
+
parents: [],
|
|
150
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
151
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
152
|
+
status: _,
|
|
153
|
+
ownAttrib: [],
|
|
154
|
+
path: N,
|
|
155
|
+
tags: [],
|
|
156
|
+
attrib: M,
|
|
157
|
+
links: []
|
|
158
|
+
// Add empty links object
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
P.push(U);
|
|
162
|
+
} else {
|
|
163
|
+
const N = {
|
|
164
|
+
type: "create",
|
|
165
|
+
entityType: "task",
|
|
166
|
+
entityId: i.data.id,
|
|
167
|
+
data: {
|
|
168
|
+
...i.data,
|
|
169
|
+
entityId: i.data.id,
|
|
170
|
+
entityType: "task",
|
|
171
|
+
label: i.data.label || i.data.name,
|
|
172
|
+
taskType: i.data.taskType || "",
|
|
173
|
+
folderId: i.data.folderId || "",
|
|
174
|
+
active: !0,
|
|
175
|
+
assignees: i.data.assignees || [],
|
|
176
|
+
projectName: m,
|
|
177
|
+
status: i.data.status || A,
|
|
178
|
+
folder: {
|
|
179
|
+
path: i.data.folderId ? p[i.data.folderId] : "",
|
|
180
|
+
folderType: ""
|
|
181
|
+
},
|
|
182
|
+
tags: [],
|
|
183
|
+
ownAttrib: [],
|
|
184
|
+
path: "",
|
|
185
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
186
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
187
|
+
thumbnailHash: "",
|
|
188
|
+
subtasks: [],
|
|
189
|
+
attrib: M,
|
|
190
|
+
hasReviewables: !1,
|
|
191
|
+
// Add required field
|
|
192
|
+
links: [],
|
|
193
|
+
// Add empty links object
|
|
194
|
+
allAttrib: JSON.stringify(M),
|
|
195
|
+
parents: []
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
P.push(N);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return P;
|
|
202
|
+
}, C = l(
|
|
203
|
+
s,
|
|
204
|
+
"folder"
|
|
205
|
+
), $ = l(
|
|
206
|
+
b,
|
|
207
|
+
"task"
|
|
208
|
+
);
|
|
209
|
+
return [...C, ...$];
|
|
210
|
+
}, [Y] = Qe(), ee = async (a) => {
|
|
211
|
+
if (!q || !x.label || !x.name)
|
|
212
|
+
throw me.error("Please provide a valid name and select an entity type"), new Error("Invalid entity type or label");
|
|
213
|
+
if (q === "task" && a.length === 0)
|
|
214
|
+
throw me.error("Cannot create a task without selecting a folder"), new Error("No folder selected for task creation");
|
|
215
|
+
let p;
|
|
216
|
+
if (W.active) {
|
|
217
|
+
const s = [];
|
|
218
|
+
for (const l of a) {
|
|
219
|
+
const C = h(l);
|
|
220
|
+
C && s.push({
|
|
221
|
+
id: C.id,
|
|
222
|
+
name: C.name,
|
|
223
|
+
label: C.label || C.name
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
const b = Ee(x.label, W.increment, W.length);
|
|
227
|
+
p = ae(
|
|
228
|
+
q,
|
|
229
|
+
x.subType,
|
|
230
|
+
b,
|
|
231
|
+
s,
|
|
232
|
+
W.prefix
|
|
233
|
+
);
|
|
234
|
+
} else
|
|
235
|
+
p = de(
|
|
236
|
+
q,
|
|
237
|
+
x.subType,
|
|
238
|
+
x.label,
|
|
239
|
+
a,
|
|
240
|
+
x.name
|
|
241
|
+
);
|
|
242
|
+
const g = {};
|
|
243
|
+
for (const s of a) {
|
|
244
|
+
const b = h(s);
|
|
245
|
+
b && (g[b.id] = b.path);
|
|
246
|
+
}
|
|
247
|
+
const S = H(p, g);
|
|
248
|
+
try {
|
|
249
|
+
const s = await Y({
|
|
250
|
+
operationsRequestModel: { operations: p },
|
|
251
|
+
projectName: m,
|
|
252
|
+
patchOperations: S
|
|
253
|
+
}).unwrap();
|
|
254
|
+
if (s?.success && s.operations)
|
|
255
|
+
return s.operations;
|
|
256
|
+
throw {
|
|
257
|
+
error: (
|
|
258
|
+
// @ts-expect-error - res.operations may not be typed
|
|
259
|
+
s?.operations?.[0]?.error || "An error occurred while creating the entity. Please try again."
|
|
260
|
+
)
|
|
261
|
+
};
|
|
262
|
+
} catch (s) {
|
|
263
|
+
console.log(s);
|
|
264
|
+
const b = Ge(s);
|
|
265
|
+
throw me.error(b), new Error(b);
|
|
266
|
+
}
|
|
267
|
+
}, B = (a, p) => {
|
|
268
|
+
o(a), J(p?.parentFolderIds ?? null);
|
|
269
|
+
const s = ((a === "folder" ? u?.folderTypes : u?.taskTypes) || [])[0].name || "", b = ht(a, s, u), l = {
|
|
270
|
+
subType: s,
|
|
271
|
+
label: b,
|
|
272
|
+
name: be(b, D)
|
|
273
|
+
};
|
|
274
|
+
p?.isSequence && V((C) => ({
|
|
275
|
+
...C,
|
|
276
|
+
active: !0
|
|
277
|
+
})), ne(l);
|
|
278
|
+
};
|
|
279
|
+
return /* @__PURE__ */ t(
|
|
280
|
+
dt.Provider,
|
|
281
|
+
{
|
|
282
|
+
value: {
|
|
283
|
+
config: D,
|
|
284
|
+
entityType: q,
|
|
285
|
+
setEntityType: o,
|
|
286
|
+
entityForm: x,
|
|
287
|
+
setEntityForm: ne,
|
|
288
|
+
sequenceForm: W,
|
|
289
|
+
setSequenceForm: V,
|
|
290
|
+
onCreateNew: ee,
|
|
291
|
+
onOpenNew: B,
|
|
292
|
+
parentFolderIds: R
|
|
293
|
+
},
|
|
294
|
+
children: c
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
}, xe = Ue(
|
|
298
|
+
({
|
|
299
|
+
value: c,
|
|
300
|
+
options: m,
|
|
301
|
+
onChange: u,
|
|
302
|
+
style: d,
|
|
303
|
+
mainStyle: v,
|
|
304
|
+
disabled: h,
|
|
305
|
+
placeholder: n,
|
|
306
|
+
isChanged: O,
|
|
307
|
+
align: r,
|
|
308
|
+
type: D,
|
|
309
|
+
...y
|
|
310
|
+
}, F) => /* @__PURE__ */ t(
|
|
311
|
+
De,
|
|
312
|
+
{
|
|
313
|
+
options: m,
|
|
314
|
+
dataKey: "name",
|
|
315
|
+
value: c,
|
|
316
|
+
valueStyle: d,
|
|
317
|
+
onChange: (A) => u(A[0]),
|
|
318
|
+
disabled: h,
|
|
319
|
+
isChanged: O,
|
|
320
|
+
placeholder: n,
|
|
321
|
+
widthExpand: !0,
|
|
322
|
+
search: !0,
|
|
323
|
+
searchFields: ["name"],
|
|
324
|
+
emptyMessage: "None Set",
|
|
325
|
+
style: v,
|
|
326
|
+
align: r,
|
|
327
|
+
ref: F,
|
|
328
|
+
...y
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
);
|
|
332
|
+
xe.displayName = "TypeEditor";
|
|
333
|
+
const yt = E.div`
|
|
334
|
+
position: relative;
|
|
335
|
+
display: flex;
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
gap: var(--base-gap-small);
|
|
338
|
+
width: 100%;
|
|
339
|
+
align-items: flex-end;
|
|
340
|
+
|
|
341
|
+
.seq {
|
|
342
|
+
/* flex: 1; */
|
|
343
|
+
flex-grow: 1;
|
|
344
|
+
width: 100%;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
&.task {
|
|
348
|
+
width: 100%;
|
|
349
|
+
}
|
|
350
|
+
`, $e = E.div`
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-direction: column;
|
|
353
|
+
/* panel */
|
|
354
|
+
background-color: var(--md-sys-color-surface-container-high);
|
|
355
|
+
padding: 7px 4px;
|
|
356
|
+
border-radius: var(--border-radius);
|
|
357
|
+
border: 1px solid transparent;
|
|
358
|
+
z-index: 10;
|
|
359
|
+
width: 100%;
|
|
360
|
+
|
|
361
|
+
transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
|
362
|
+
|
|
363
|
+
&.is-new {
|
|
364
|
+
/* highlight new items */
|
|
365
|
+
background-color: var(--md-sys-color-secondary-container);
|
|
366
|
+
border-color: var(--md-sys-color-primary);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
&.no-nesting {
|
|
370
|
+
background-color: unset;
|
|
371
|
+
border: none;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.icon {
|
|
375
|
+
font-size: 20px;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.form > .icon {
|
|
379
|
+
padding: 5px 0;
|
|
380
|
+
}
|
|
381
|
+
`, gt = E($e)`
|
|
382
|
+
& > div {
|
|
383
|
+
align-items: center;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
border-radius: var(--border-radius-l);
|
|
387
|
+
padding-bottom: 4px;
|
|
388
|
+
padding: 2px 4px;
|
|
389
|
+
`, Se = E.div`
|
|
390
|
+
display: flex;
|
|
391
|
+
flex-direction: row;
|
|
392
|
+
align-items: flex-end;
|
|
393
|
+
gap: var(--base-gap-small);
|
|
394
|
+
width: 100%;
|
|
395
|
+
.delete {
|
|
396
|
+
margin-left: auto;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
strong {
|
|
400
|
+
font-weight: 700;
|
|
401
|
+
}
|
|
402
|
+
`, re = E.div`
|
|
403
|
+
display: flex;
|
|
404
|
+
flex-direction: column;
|
|
405
|
+
width: min-content;
|
|
406
|
+
|
|
407
|
+
/* input type number */
|
|
408
|
+
#length {
|
|
409
|
+
width: 90px;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
#prefix {
|
|
413
|
+
width: 53px;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
label {
|
|
417
|
+
width: 100%;
|
|
418
|
+
text-overflow: ellipsis;
|
|
419
|
+
white-space: nowrap;
|
|
420
|
+
}
|
|
421
|
+
`, bt = E.div`
|
|
422
|
+
display: flex;
|
|
423
|
+
flex-direction: column;
|
|
424
|
+
gap: var(--base-gap-small);
|
|
425
|
+
justify-content: flex-end;
|
|
426
|
+
|
|
427
|
+
/* has no children then display none */
|
|
428
|
+
&:empty {
|
|
429
|
+
display: none;
|
|
430
|
+
}
|
|
431
|
+
width: 100%;
|
|
432
|
+
`, xt = E.div`
|
|
433
|
+
display: flex;
|
|
434
|
+
flex-direction: row;
|
|
435
|
+
align-items: center;
|
|
436
|
+
gap: var(--base-gap-small);
|
|
437
|
+
width: 100%;
|
|
438
|
+
`, wt = E.div`
|
|
439
|
+
display: flex;
|
|
440
|
+
flex-direction: column;
|
|
441
|
+
gap: var(--base-gap-small);
|
|
442
|
+
z-index: 10;
|
|
443
|
+
`, vt = E.span``, kt = E.span`
|
|
444
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
445
|
+
padding: 5px 8px;
|
|
446
|
+
border-radius: var(--border-radius);
|
|
447
|
+
position: relative;
|
|
448
|
+
top: -1px;
|
|
449
|
+
right: -3px;
|
|
450
|
+
|
|
451
|
+
color: var(--md-sys-color-outline);
|
|
452
|
+
min-height: 30px;
|
|
453
|
+
`;
|
|
454
|
+
function It(c, m, u = "") {
|
|
455
|
+
if (c.length <= m)
|
|
456
|
+
return c.map((d) => u + d).join(", ");
|
|
457
|
+
{
|
|
458
|
+
const d = c.slice(0, Math.ceil(m / 2)).map((h) => u + h), v = c.slice(-1).map((h) => u + h);
|
|
459
|
+
return `${d.join(", ")} ... ${v.join(", ")}`;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function Re(c) {
|
|
463
|
+
return c === "Shot" ? {
|
|
464
|
+
base: "0010",
|
|
465
|
+
increment: "0020",
|
|
466
|
+
length: 10,
|
|
467
|
+
difference: 10
|
|
468
|
+
} : {
|
|
469
|
+
base: "001",
|
|
470
|
+
increment: "002",
|
|
471
|
+
length: 10,
|
|
472
|
+
difference: 1
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
const St = ({
|
|
476
|
+
onChange: c,
|
|
477
|
+
parentId: m = null,
|
|
478
|
+
children: u,
|
|
479
|
+
depth: d,
|
|
480
|
+
onNew: v,
|
|
481
|
+
index: h,
|
|
482
|
+
nesting: n = !0,
|
|
483
|
+
isRoot: O,
|
|
484
|
+
parentLabel: r,
|
|
485
|
+
prefixDisabled: D,
|
|
486
|
+
typeSelectRef: y,
|
|
487
|
+
onLastInputKeydown: F,
|
|
488
|
+
folders: A,
|
|
489
|
+
..._
|
|
490
|
+
}) => {
|
|
491
|
+
const { base: q, increment: o, length: R, type: J, id: K, prefix: x, prefixDepth: ne, parentBases: W } = _, V = _.entityType, X = !n && O || D;
|
|
492
|
+
let ae = [];
|
|
493
|
+
q && o && R && (ae = Ee(q, o, R));
|
|
494
|
+
const [de, H] = z(ae), Y = ce(null), ee = ce(null), B = (l) => {
|
|
495
|
+
l?.preventDefault && l?.preventDefault();
|
|
496
|
+
let { value: C, id: $ } = l.target;
|
|
497
|
+
$ === "prefixDepth" && (C = parseInt(String(C), 10));
|
|
498
|
+
const T = { [$]: C }, k = { ..._, ...T };
|
|
499
|
+
if ($ === "type") {
|
|
500
|
+
let P = !1;
|
|
501
|
+
const i = A.find((M) => M.name === C);
|
|
502
|
+
for (const M of A) {
|
|
503
|
+
if (k.base === "") {
|
|
504
|
+
P = !0;
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
for (const N in M)
|
|
508
|
+
if (typeof M[N] == "string" && k.base?.toLowerCase().includes(M[N].toLowerCase())) {
|
|
509
|
+
P = !0;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (!P || !i) return;
|
|
514
|
+
const Z = V === "folder" && i.shortName || i.name, j = Re(String(C));
|
|
515
|
+
k.base = Z + j.base, k.increment = Z + j.increment, k.length = j.length;
|
|
516
|
+
}
|
|
517
|
+
if ($ === "base") {
|
|
518
|
+
const P = Re(k.type), i = String(C), Z = i.replace(/[^a-zA-Z]/g, ""), j = i.replace(/[^0-9]/g, ""), M = parseInt(j, 10), N = j.length, U = Z + (M + P.difference).toString().padStart(N, "0");
|
|
519
|
+
k.increment = U.replace("NaN", "");
|
|
520
|
+
}
|
|
521
|
+
if (c(
|
|
522
|
+
k,
|
|
523
|
+
typeof K == "string" ? K : void 0,
|
|
524
|
+
V
|
|
525
|
+
), k.base && k.increment && k.length) {
|
|
526
|
+
const P = Ee(k.base, k.increment, k.length);
|
|
527
|
+
H(P);
|
|
528
|
+
}
|
|
529
|
+
$ === "type" && setTimeout(X ? () => {
|
|
530
|
+
Y.current?.focus(), Y.current?.select();
|
|
531
|
+
} : () => {
|
|
532
|
+
ee.current?.focus();
|
|
533
|
+
}, 50);
|
|
534
|
+
}, [a, p] = z(!0);
|
|
535
|
+
Le(
|
|
536
|
+
() => {
|
|
537
|
+
const l = setTimeout(() => {
|
|
538
|
+
p(!1);
|
|
539
|
+
}, 1e3);
|
|
540
|
+
return () => clearTimeout(l);
|
|
541
|
+
},
|
|
542
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
543
|
+
[]
|
|
544
|
+
);
|
|
545
|
+
const g = It(de, 5, x ? r : void 0), S = ce(null), [s, b] = z(0);
|
|
546
|
+
return Ve(() => {
|
|
547
|
+
S.current && b(S.current.offsetWidth);
|
|
548
|
+
}, [S.current, x]), V === "task" ? /* @__PURE__ */ t(
|
|
549
|
+
gt,
|
|
550
|
+
{
|
|
551
|
+
className: Ae("task", { "is-new": a, nesting: n, "no-nesting": !n }),
|
|
552
|
+
style: { zIndex: 100 - (d ?? 0) - (h ?? 0) },
|
|
553
|
+
children: /* @__PURE__ */ f(Se, { className: "form", children: [
|
|
554
|
+
/* @__PURE__ */ t(Q, { icon: "task_alt" }),
|
|
555
|
+
/* @__PURE__ */ t("strong", { children: "Task" }),
|
|
556
|
+
/* @__PURE__ */ t("label", { children: "Type" }),
|
|
557
|
+
/* @__PURE__ */ t(
|
|
558
|
+
xe,
|
|
559
|
+
{
|
|
560
|
+
value: [J],
|
|
561
|
+
onChange: (l) => B({ target: { value: l, id: "type" } }),
|
|
562
|
+
options: A,
|
|
563
|
+
style: { width: 160 },
|
|
564
|
+
align: "right"
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
/* @__PURE__ */ t("label", { children: "label" }),
|
|
568
|
+
/* @__PURE__ */ t(
|
|
569
|
+
he,
|
|
570
|
+
{
|
|
571
|
+
value: q,
|
|
572
|
+
id: "base",
|
|
573
|
+
onChange: B,
|
|
574
|
+
placeholder: "compositing...",
|
|
575
|
+
autoComplete: "off"
|
|
576
|
+
}
|
|
577
|
+
),
|
|
578
|
+
/* @__PURE__ */ t(
|
|
579
|
+
fe,
|
|
580
|
+
{
|
|
581
|
+
icon: "close",
|
|
582
|
+
variant: "text",
|
|
583
|
+
onClick: () => c({ id: K, delete: !0 }, m),
|
|
584
|
+
className: "delete"
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
] })
|
|
588
|
+
}
|
|
589
|
+
) : /* @__PURE__ */ f(yt, { className: "folder", children: [
|
|
590
|
+
/* @__PURE__ */ f(xt, { className: "seq", style: { zIndex: 100 - (d ?? 0) - (h ?? 0) }, children: [
|
|
591
|
+
n && /* @__PURE__ */ f(wt, { className: "buttons", children: [
|
|
592
|
+
/* @__PURE__ */ f(Se, { children: [
|
|
593
|
+
d === 0 && /* @__PURE__ */ t(
|
|
594
|
+
fe,
|
|
595
|
+
{
|
|
596
|
+
icon: "south",
|
|
597
|
+
onClick: () => v?.(null),
|
|
598
|
+
label: "Root",
|
|
599
|
+
title: "add root folder"
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
/* @__PURE__ */ t(
|
|
603
|
+
fe,
|
|
604
|
+
{
|
|
605
|
+
icon: te.folder.icon,
|
|
606
|
+
onClick: () => K && v?.(K, "folder"),
|
|
607
|
+
label: d === 0 ? te.folder.label : void 0,
|
|
608
|
+
title: "add nested folder"
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
] }),
|
|
612
|
+
/* @__PURE__ */ t(
|
|
613
|
+
fe,
|
|
614
|
+
{
|
|
615
|
+
icon: te.task.icon,
|
|
616
|
+
onClick: () => K && v?.(K, "task"),
|
|
617
|
+
label: d === 0 ? te.task.label : void 0,
|
|
618
|
+
title: "add nested task",
|
|
619
|
+
style: { width: "max-content", marginLeft: "auto" }
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
] }),
|
|
623
|
+
/* @__PURE__ */ f(
|
|
624
|
+
$e,
|
|
625
|
+
{
|
|
626
|
+
className: Ae({ "is-new": a, "no-nesting": !n }),
|
|
627
|
+
ref: S,
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ f(Se, { className: "form folder", children: [
|
|
630
|
+
/* @__PURE__ */ f(re, { children: [
|
|
631
|
+
/* @__PURE__ */ t("label", { children: "Type" }),
|
|
632
|
+
/* @__PURE__ */ t(
|
|
633
|
+
xe,
|
|
634
|
+
{
|
|
635
|
+
value: [J],
|
|
636
|
+
onChange: (l) => B({ target: { value: l, id: "type" } }),
|
|
637
|
+
options: A,
|
|
638
|
+
style: { width: 160 },
|
|
639
|
+
align: "right",
|
|
640
|
+
ref: y
|
|
641
|
+
}
|
|
642
|
+
)
|
|
643
|
+
] }),
|
|
644
|
+
/* @__PURE__ */ t(Q, { icon: "trending_flat" }),
|
|
645
|
+
(d !== 0 || !n) && /* @__PURE__ */ f(ue, { children: [
|
|
646
|
+
/* @__PURE__ */ f(ue, { children: [
|
|
647
|
+
/* @__PURE__ */ f(re, { children: [
|
|
648
|
+
/* @__PURE__ */ t("label", { children: "Prefix" }),
|
|
649
|
+
/* @__PURE__ */ t(
|
|
650
|
+
Ne,
|
|
651
|
+
{
|
|
652
|
+
checked: x,
|
|
653
|
+
id: "prefix",
|
|
654
|
+
onChange: () => B({ target: { value: !x, id: "prefix" } }),
|
|
655
|
+
disabled: X,
|
|
656
|
+
ref: ee,
|
|
657
|
+
switchStyle: { margin: "4px 0" }
|
|
658
|
+
}
|
|
659
|
+
)
|
|
660
|
+
] }),
|
|
661
|
+
/* @__PURE__ */ t(Q, { icon: "trending_flat" })
|
|
662
|
+
] }),
|
|
663
|
+
n && x && /* @__PURE__ */ f(re, { children: [
|
|
664
|
+
/* @__PURE__ */ t("label", { children: "Depth" }),
|
|
665
|
+
/* @__PURE__ */ t(
|
|
666
|
+
je,
|
|
667
|
+
{
|
|
668
|
+
value: ne,
|
|
669
|
+
id: "prefixDepth",
|
|
670
|
+
onChange: B,
|
|
671
|
+
max: W?.length,
|
|
672
|
+
min: 0
|
|
673
|
+
}
|
|
674
|
+
)
|
|
675
|
+
] })
|
|
676
|
+
] }),
|
|
677
|
+
W && n && /* @__PURE__ */ t(re, { style: { display: x ? "flex" : "none" }, children: /* @__PURE__ */ t(kt, { children: W.join("") }) }),
|
|
678
|
+
/* @__PURE__ */ f(re, { className: "seq", children: [
|
|
679
|
+
/* @__PURE__ */ t("label", { children: "First Name" }),
|
|
680
|
+
/* @__PURE__ */ t(
|
|
681
|
+
he,
|
|
682
|
+
{
|
|
683
|
+
value: q,
|
|
684
|
+
id: "base",
|
|
685
|
+
ref: Y,
|
|
686
|
+
onChange: B,
|
|
687
|
+
placeholder: "ep101...",
|
|
688
|
+
autoComplete: "off"
|
|
689
|
+
}
|
|
690
|
+
)
|
|
691
|
+
] }),
|
|
692
|
+
/* @__PURE__ */ t(Q, { icon: "trending_flat" }),
|
|
693
|
+
/* @__PURE__ */ f(re, { className: "seq", children: [
|
|
694
|
+
/* @__PURE__ */ t("label", { children: "Second Name" }),
|
|
695
|
+
/* @__PURE__ */ t(
|
|
696
|
+
he,
|
|
697
|
+
{
|
|
698
|
+
value: o,
|
|
699
|
+
id: "increment",
|
|
700
|
+
onChange: B,
|
|
701
|
+
placeholder: "ep102...",
|
|
702
|
+
autoComplete: "off"
|
|
703
|
+
}
|
|
704
|
+
)
|
|
705
|
+
] }),
|
|
706
|
+
/* @__PURE__ */ t(Q, { icon: "trending_flat" }),
|
|
707
|
+
/* @__PURE__ */ f(re, { children: [
|
|
708
|
+
/* @__PURE__ */ t("label", { children: "Count" }),
|
|
709
|
+
/* @__PURE__ */ t(
|
|
710
|
+
je,
|
|
711
|
+
{
|
|
712
|
+
value: R,
|
|
713
|
+
id: "length",
|
|
714
|
+
onChange: B,
|
|
715
|
+
placeholder: "15...",
|
|
716
|
+
min: 2,
|
|
717
|
+
onFocus: (l) => l.target.select(),
|
|
718
|
+
onKeyDown: F
|
|
719
|
+
}
|
|
720
|
+
)
|
|
721
|
+
] }),
|
|
722
|
+
/* @__PURE__ */ t(Be, {}),
|
|
723
|
+
n && /* @__PURE__ */ t(
|
|
724
|
+
fe,
|
|
725
|
+
{
|
|
726
|
+
icon: "close",
|
|
727
|
+
variant: "text",
|
|
728
|
+
onClick: () => c({ id: K, delete: !0 }),
|
|
729
|
+
disabled: d === 0 && h === 0
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
] }),
|
|
733
|
+
!n && /* @__PURE__ */ f(vt, { children: [
|
|
734
|
+
"Example: ",
|
|
735
|
+
g
|
|
736
|
+
] })
|
|
737
|
+
]
|
|
738
|
+
}
|
|
739
|
+
)
|
|
740
|
+
] }),
|
|
741
|
+
n && /* @__PURE__ */ t(
|
|
742
|
+
bt,
|
|
743
|
+
{
|
|
744
|
+
className: "children",
|
|
745
|
+
style: { width: s, zIndex: 99 - (d ?? 0) - (h ?? 0) },
|
|
746
|
+
children: u
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
] });
|
|
750
|
+
}, Ct = ({
|
|
751
|
+
options: c,
|
|
752
|
+
onOpenNew: m,
|
|
753
|
+
enabled: u = !0
|
|
754
|
+
}) => {
|
|
755
|
+
const { menuOpen: d } = Pe(Ye) || { menuOpen: !1 }, { editingCellId: v } = Pe(st) || { editingCellId: null };
|
|
756
|
+
Le(() => {
|
|
757
|
+
if (!u) return;
|
|
758
|
+
const h = (n) => {
|
|
759
|
+
if (d || n.target instanceof HTMLElement && (n.target.tagName === "INPUT" || n.target.tagName === "TEXTAREA" || n.target.isContentEditable || n.target.getAttribute("role") === "textbox") || v || n.ctrlKey || n.metaKey || n.altKey)
|
|
760
|
+
return;
|
|
761
|
+
const O = n.key.toUpperCase(), r = c.find((D) => D.shortcut === O);
|
|
762
|
+
r && !r.disabled && (n.preventDefault(), m(r.type, { isSequence: r.isSequence }));
|
|
763
|
+
};
|
|
764
|
+
return window.addEventListener("keydown", h), () => {
|
|
765
|
+
window.removeEventListener("keydown", h);
|
|
766
|
+
};
|
|
767
|
+
}, [u, c, m, v, d]);
|
|
768
|
+
}, we = E.label`
|
|
769
|
+
font-size: ${qe.labelMedium};
|
|
770
|
+
color: var(--md-sys-color-outline);
|
|
771
|
+
`, Oe = E.div`
|
|
772
|
+
display: flex;
|
|
773
|
+
flex-direction: column;
|
|
774
|
+
align-items: flex-start;
|
|
775
|
+
gap: var(--base-gap-small);
|
|
776
|
+
|
|
777
|
+
label {
|
|
778
|
+
white-space: nowrap;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
[icon='info'] {
|
|
782
|
+
cursor: help;
|
|
783
|
+
font-size: 16px;
|
|
784
|
+
color: var(--md-sys-color-outline);
|
|
785
|
+
}
|
|
786
|
+
`, Tt = E.div`
|
|
787
|
+
display: flex;
|
|
788
|
+
align-items: center;
|
|
789
|
+
margin-top: 6px;
|
|
790
|
+
gap: var(--base-gap-small);
|
|
791
|
+
width: 100%;
|
|
792
|
+
word-break: break-all;
|
|
793
|
+
`, Nt = E.span`
|
|
794
|
+
position: relative;
|
|
795
|
+
padding: 2px 6px;
|
|
796
|
+
font-size: ${qe.bodySmall};
|
|
797
|
+
display: inline-flex;
|
|
798
|
+
min-height: 20px;
|
|
799
|
+
gap: var(--base-gap-small);
|
|
800
|
+
cursor: pointer;
|
|
801
|
+
|
|
802
|
+
.icon {
|
|
803
|
+
display: none;
|
|
804
|
+
font-size: 14px;
|
|
805
|
+
}
|
|
806
|
+
&:hover {
|
|
807
|
+
background-color: var(--md-sys-color-surface-container-low);
|
|
808
|
+
border-radius: var(--border-radius-m);
|
|
809
|
+
.icon {
|
|
810
|
+
display: flex;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
`, Et = E(he)`
|
|
814
|
+
font-size: ${qe.bodySmall};
|
|
815
|
+
width: 100px;
|
|
816
|
+
max-width: 160px;
|
|
817
|
+
min-height: 0;
|
|
818
|
+
height: 20px;
|
|
819
|
+
border: 0;
|
|
820
|
+
padding: 1px 6px;
|
|
821
|
+
|
|
822
|
+
input {
|
|
823
|
+
color: var(--md-sys-color-outline);
|
|
824
|
+
outline: none;
|
|
825
|
+
|
|
826
|
+
&:focus {
|
|
827
|
+
background: var(--md-sys-color-surface-container-low);
|
|
828
|
+
border: none;
|
|
829
|
+
outline: 1px solid var(--md-sys-color-primary);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
`, Ot = ({
|
|
833
|
+
handleChange: c,
|
|
834
|
+
entityForm: m,
|
|
835
|
+
setNameFocused: u,
|
|
836
|
+
handleKeyDown: d,
|
|
837
|
+
labelRef: v,
|
|
838
|
+
nameInfo: h = ""
|
|
839
|
+
}) => {
|
|
840
|
+
const [n, O] = z(!1), [r, D] = z(void 0), y = ce(null), F = () => {
|
|
841
|
+
O(!0), u(!0), D(m.name), setTimeout(() => {
|
|
842
|
+
y.current && (y.current.focus(), y.current.select());
|
|
843
|
+
}, 0);
|
|
844
|
+
}, A = (o) => {
|
|
845
|
+
const R = o.relatedTarget;
|
|
846
|
+
(!R || !y.current?.contains(R)) && (O(!1), u(!1), D(void 0));
|
|
847
|
+
}, _ = (o) => {
|
|
848
|
+
if (o.key === "ArrowDown" && !o.altKey || o.key === "Tab") {
|
|
849
|
+
o.preventDefault(), F();
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
d(o, !0);
|
|
853
|
+
}, q = (o) => {
|
|
854
|
+
if (o.key === "Enter" || o.key === "Escape" || o.key === "ArrowUp" && !o.altKey) {
|
|
855
|
+
if (o.stopPropagation(), o.key === "Enter" && !n)
|
|
856
|
+
return F();
|
|
857
|
+
o.key === "Escape" && r !== void 0 && c(r, "name"), O(!1), u(!1), D(void 0), setTimeout(() => {
|
|
858
|
+
v.current?.focus();
|
|
859
|
+
const R = m.label.length || 0;
|
|
860
|
+
v.current?.setSelectionRange(R, R);
|
|
861
|
+
}, 0);
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
return /* @__PURE__ */ f(Oe, { style: { flex: 1 }, children: [
|
|
866
|
+
/* @__PURE__ */ t(we, { children: "Label" }),
|
|
867
|
+
/* @__PURE__ */ t(
|
|
868
|
+
he,
|
|
869
|
+
{
|
|
870
|
+
value: m.label,
|
|
871
|
+
onChange: (o) => c(o.target.value, "label"),
|
|
872
|
+
ref: v,
|
|
873
|
+
onFocus: () => u(!0),
|
|
874
|
+
onKeyDown: _,
|
|
875
|
+
style: { flex: 1, width: "100%" }
|
|
876
|
+
}
|
|
877
|
+
),
|
|
878
|
+
/* @__PURE__ */ f(Tt, { onKeyDown: q, children: [
|
|
879
|
+
/* @__PURE__ */ t(we, { children: "Name" }),
|
|
880
|
+
h && /* @__PURE__ */ t(Q, { icon: "info", "data-tooltip": h, "data-tooltip-delay": 0 }),
|
|
881
|
+
n ? /* @__PURE__ */ t(
|
|
882
|
+
Et,
|
|
883
|
+
{
|
|
884
|
+
ref: y,
|
|
885
|
+
value: m.name,
|
|
886
|
+
onChange: (o) => c(o.target.value, "name"),
|
|
887
|
+
onBlur: A,
|
|
888
|
+
style: { flex: 1 }
|
|
889
|
+
}
|
|
890
|
+
) : /* @__PURE__ */ f(Nt, { onClick: F, tabIndex: 0, children: [
|
|
891
|
+
m.name,
|
|
892
|
+
" ",
|
|
893
|
+
/* @__PURE__ */ t(Q, { icon: "edit" })
|
|
894
|
+
] })
|
|
895
|
+
] })
|
|
896
|
+
] });
|
|
897
|
+
}, Dt = E(et)`
|
|
898
|
+
.body {
|
|
899
|
+
overflow: visible;
|
|
900
|
+
}
|
|
901
|
+
`, qt = E.div`
|
|
902
|
+
display: flex;
|
|
903
|
+
align-items: flex-start;
|
|
904
|
+
gap: var(--base-gap-large);
|
|
905
|
+
form {
|
|
906
|
+
input:first-child {
|
|
907
|
+
margin-right: 8px;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
`, Ft = E(De)`
|
|
911
|
+
overflow: visible;
|
|
912
|
+
min-width: fit-content;
|
|
913
|
+
.button {
|
|
914
|
+
display: flex;
|
|
915
|
+
align-items: center;
|
|
916
|
+
gap: var(--base-gap-small);
|
|
917
|
+
padding: 0 8px;
|
|
918
|
+
background-color: var(--md-sys-color-primary);
|
|
919
|
+
&,
|
|
920
|
+
.icon {
|
|
921
|
+
color: var(--md-sys-color-on-primary);
|
|
922
|
+
}
|
|
923
|
+
min-width: 100px;
|
|
924
|
+
justify-content: center;
|
|
925
|
+
|
|
926
|
+
&:hover {
|
|
927
|
+
background-color: var(--md-sys-color-primary-hover);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
`, Ke = E.span`
|
|
931
|
+
display: flex;
|
|
932
|
+
align-items: center;
|
|
933
|
+
min-height: 32px;
|
|
934
|
+
color: var(--md-sys-color-outline);
|
|
935
|
+
`, Pt = E.span`
|
|
936
|
+
display: flex;
|
|
937
|
+
align-items: center;
|
|
938
|
+
gap: var(--base-gap-small);
|
|
939
|
+
padding: 0 8px;
|
|
940
|
+
height: 32px;
|
|
941
|
+
width: 100%;
|
|
942
|
+
|
|
943
|
+
.label {
|
|
944
|
+
flex: 1;
|
|
945
|
+
margin-right: 24px;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
&.disabled {
|
|
949
|
+
opacity: 0.5;
|
|
950
|
+
}
|
|
951
|
+
`, wn = ({
|
|
952
|
+
disabled: c,
|
|
953
|
+
onNewEntities: m,
|
|
954
|
+
showButton: u = !0,
|
|
955
|
+
showDialog: d = !0,
|
|
956
|
+
enableShortcuts: v = !0
|
|
957
|
+
}) => {
|
|
958
|
+
const { ...h } = Te(), {
|
|
959
|
+
entityType: n,
|
|
960
|
+
setEntityType: O,
|
|
961
|
+
entityForm: r,
|
|
962
|
+
setEntityForm: D,
|
|
963
|
+
sequenceForm: y,
|
|
964
|
+
setSequenceForm: F,
|
|
965
|
+
onCreateNew: A,
|
|
966
|
+
onOpenNew: _,
|
|
967
|
+
config: q,
|
|
968
|
+
parentFolderIds: o
|
|
969
|
+
} = pt(), [R, J] = z(!1), { selectedCells: K } = lt() || {}, x = mt(), { getFolderById: ne } = ze(), W = it(), V = W?.getEntityById, X = W?.showHierarchy ?? !0, ae = ge(() => {
|
|
970
|
+
if (o !== null) return o;
|
|
971
|
+
const e = K ? Array.from(K).map((I) => ct(I)) : [], w = Array.from(
|
|
972
|
+
new Set(
|
|
973
|
+
e.filter((I) => I && I.colId !== Me).map((I) => I?.rowId).filter(Boolean)
|
|
974
|
+
)
|
|
975
|
+
), L = Array.from(
|
|
976
|
+
new Set(
|
|
977
|
+
e.filter((I) => I?.colId === Me).map((I) => I?.rowId).filter(Boolean)
|
|
978
|
+
)
|
|
979
|
+
), le = w.length > 0 ? w : L;
|
|
980
|
+
if (le.length > 0) {
|
|
981
|
+
const I = le.map((G) => V?.(G)), ie = I.filter(
|
|
982
|
+
(G) => G?.entityType === "folder"
|
|
983
|
+
), Ie = I.filter(
|
|
984
|
+
(G) => G?.entityType === "task"
|
|
985
|
+
), Fe = Array.from(
|
|
986
|
+
/* @__PURE__ */ new Set([
|
|
987
|
+
...ie.map((G) => G.id),
|
|
988
|
+
...Ie.map((G) => G.folderId)
|
|
989
|
+
])
|
|
990
|
+
);
|
|
991
|
+
if (Fe.length) return Fe;
|
|
992
|
+
}
|
|
993
|
+
return x ? Object.keys(x).filter((I) => x[I]) : [];
|
|
994
|
+
}, [o, K, x, V]), de = ge(() => o !== null ? o : x ? Object.keys(x).filter((e) => x[e]) : [], [o, x]), H = n === "folder" && !X ? de : ae, Y = ae.length > 0, ee = ge(
|
|
995
|
+
() => H.map((e) => {
|
|
996
|
+
const w = V?.(e) || ne(e);
|
|
997
|
+
return { value: e, label: w?.label || w?.name || e };
|
|
998
|
+
}),
|
|
999
|
+
[H, V, ne]
|
|
1000
|
+
), [B, a] = z(null);
|
|
1001
|
+
let p = B !== null ? B : H;
|
|
1002
|
+
p = p.filter((e) => H.includes(e)), p.length === 0 && H.length > 0 && (p = H);
|
|
1003
|
+
const g = p.map((e) => ee.find((w) => w.value === e)?.label || "").filter(Boolean), S = g[0] || "", s = Ce(H), [b, l] = z(!1), [C, $] = z(!1), T = { label: "", subType: "", name: "" }, k = () => {
|
|
1004
|
+
let e = "Add New ";
|
|
1005
|
+
return s && n === "folder" && (e += "Root "), e += n ? te[n].label : "", s || (g.length > 2 ? e += " - " + g.slice(0, 2).join(", ") + ` +${g.length - 2} more` : e += " - " + g.join(", ")), e;
|
|
1006
|
+
}, P = (n === "folder" ? h?.folderTypes : h?.taskTypes) || [], i = (e, w) => {
|
|
1007
|
+
if (!w) return;
|
|
1008
|
+
let L = { ...r };
|
|
1009
|
+
if (L[w] = e, e && w === "subType") {
|
|
1010
|
+
const le = P.find((ie) => ie.name === r.subType), I = P.find((ie) => ie.name === e);
|
|
1011
|
+
if (I && r.label === le?.name) {
|
|
1012
|
+
L.label = I.name;
|
|
1013
|
+
const Ie = be(r.label, q);
|
|
1014
|
+
r.name === Ie && (L.name = be(L.label, q));
|
|
1015
|
+
}
|
|
1016
|
+
setTimeout(() => {
|
|
1017
|
+
M.current?.focus();
|
|
1018
|
+
}, 100);
|
|
1019
|
+
} else w === "label" ? (L.label = e, C || (L.name = be(e, q))) : w === "name" && ($(!0), L.name = e);
|
|
1020
|
+
D(L);
|
|
1021
|
+
}, Z = (e) => {
|
|
1022
|
+
D({ ...r, label: e.base, subType: e.type }), F({
|
|
1023
|
+
...y,
|
|
1024
|
+
increment: e.increment,
|
|
1025
|
+
length: e.length,
|
|
1026
|
+
prefix: e.prefix,
|
|
1027
|
+
prefixDepth: e.prefixDepth
|
|
1028
|
+
});
|
|
1029
|
+
}, j = ce(null), M = ce(null), N = () => {
|
|
1030
|
+
O(null), D(T), F((e) => ({ ...e, active: !1 })), $(!1), a(null);
|
|
1031
|
+
}, U = () => setTimeout(() => j.current?.open(), 180), [oe, ye] = z(!1), se = async (e) => {
|
|
1032
|
+
const w = Xe(r.label);
|
|
1033
|
+
if (!w.valid) {
|
|
1034
|
+
me.error(w.error || "Invalid label");
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
const { valid: L, error: le } = Ze(r.name);
|
|
1038
|
+
if (!L) {
|
|
1039
|
+
me.error(le || "Invalid name");
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
ye(!0);
|
|
1043
|
+
try {
|
|
1044
|
+
const I = await A(p);
|
|
1045
|
+
console.log(I), m?.(I, e), e ? (M.current && (M.current.focus(), M.current.select()), $(!1)) : N();
|
|
1046
|
+
} catch {
|
|
1047
|
+
} finally {
|
|
1048
|
+
ye(!1);
|
|
1049
|
+
}
|
|
1050
|
+
}, pe = (e, w) => {
|
|
1051
|
+
e?.stopPropagation(), e.key === "Enter" ? w && !e.shiftKey || e.ctrlKey || e.metaKey ? (se(!1), J(!1)) : e.shiftKey && (se(!0), J(!0)) : e.key === "Escape" && N();
|
|
1052
|
+
}, _e = () => {
|
|
1053
|
+
b && (l(!1), setTimeout(() => {
|
|
1054
|
+
j.current?.open();
|
|
1055
|
+
}, 100));
|
|
1056
|
+
}, ve = ge(
|
|
1057
|
+
() => [
|
|
1058
|
+
{
|
|
1059
|
+
...te.folder,
|
|
1060
|
+
value: "folder",
|
|
1061
|
+
type: "folder",
|
|
1062
|
+
shortcut: "N"
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
label: "Folder sequence",
|
|
1066
|
+
value: "sequence",
|
|
1067
|
+
type: "folder",
|
|
1068
|
+
icon: "topic",
|
|
1069
|
+
shortcut: "M",
|
|
1070
|
+
isSequence: !0
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
...te.task,
|
|
1074
|
+
value: "task",
|
|
1075
|
+
type: "task",
|
|
1076
|
+
shortcut: "T",
|
|
1077
|
+
disabled: !Y,
|
|
1078
|
+
disabledMessage: "Select a folder to create a task in"
|
|
1079
|
+
}
|
|
1080
|
+
],
|
|
1081
|
+
[Y]
|
|
1082
|
+
);
|
|
1083
|
+
Ct({ options: ve, onOpenNew: _, enabled: v });
|
|
1084
|
+
const We = (e) => {
|
|
1085
|
+
const w = ve.find((L) => L.value === e);
|
|
1086
|
+
w && !w.disabled && _(w.type, { isSequence: w.isSequence });
|
|
1087
|
+
}, ke = n === "task" && Ce(p), He = !r.label || !r.subType || ke;
|
|
1088
|
+
return /* @__PURE__ */ f(ue, { children: [
|
|
1089
|
+
u && /* @__PURE__ */ t(
|
|
1090
|
+
Ft,
|
|
1091
|
+
{
|
|
1092
|
+
options: ve,
|
|
1093
|
+
value: [],
|
|
1094
|
+
onChange: (e) => We(e[0]),
|
|
1095
|
+
valueTemplate: () => /* @__PURE__ */ f(ue, { children: [
|
|
1096
|
+
/* @__PURE__ */ t(Q, { icon: "add" }),
|
|
1097
|
+
/* @__PURE__ */ t("span", { children: "Create" })
|
|
1098
|
+
] }),
|
|
1099
|
+
itemTemplate: (e) => /* @__PURE__ */ f(
|
|
1100
|
+
Pt,
|
|
1101
|
+
{
|
|
1102
|
+
className: e.disabled ? "disabled" : void 0,
|
|
1103
|
+
"data-tooltip": e.disabled ? e.disabledMessage : void 0,
|
|
1104
|
+
children: [
|
|
1105
|
+
/* @__PURE__ */ t(Q, { icon: e.icon }),
|
|
1106
|
+
/* @__PURE__ */ t("span", { className: "label", children: e.label }),
|
|
1107
|
+
/* @__PURE__ */ t(tt, { children: e.shortcut })
|
|
1108
|
+
]
|
|
1109
|
+
}
|
|
1110
|
+
),
|
|
1111
|
+
itemStyle: {
|
|
1112
|
+
paddingRight: 16
|
|
1113
|
+
},
|
|
1114
|
+
disabled: c,
|
|
1115
|
+
"data-tooltip": "Create new entity"
|
|
1116
|
+
}
|
|
1117
|
+
),
|
|
1118
|
+
d && n && /* @__PURE__ */ t(
|
|
1119
|
+
Dt,
|
|
1120
|
+
{
|
|
1121
|
+
header: k(),
|
|
1122
|
+
isOpen: !0,
|
|
1123
|
+
onClose: N,
|
|
1124
|
+
onShow: U,
|
|
1125
|
+
size: y.active ? "lg" : "md",
|
|
1126
|
+
style: { maxWidth: y.active ? "unset" : 430 },
|
|
1127
|
+
enableBackdropClose: !1,
|
|
1128
|
+
footer: /* @__PURE__ */ f(nt, { onFocus: () => l(!1), style: { width: "100%" }, children: [
|
|
1129
|
+
n === "folder" && /* @__PURE__ */ f(ue, { children: [
|
|
1130
|
+
/* @__PURE__ */ t("span", { children: "Sequence" }),
|
|
1131
|
+
/* @__PURE__ */ t(
|
|
1132
|
+
Ne,
|
|
1133
|
+
{
|
|
1134
|
+
checked: y.active,
|
|
1135
|
+
onChange: (e) => F({
|
|
1136
|
+
...y,
|
|
1137
|
+
active: e.target.checked
|
|
1138
|
+
})
|
|
1139
|
+
}
|
|
1140
|
+
)
|
|
1141
|
+
] }),
|
|
1142
|
+
/* @__PURE__ */ t(Be, {}),
|
|
1143
|
+
/* @__PURE__ */ t("span", { children: "Create more" }),
|
|
1144
|
+
/* @__PURE__ */ t(
|
|
1145
|
+
Ne,
|
|
1146
|
+
{
|
|
1147
|
+
checked: R,
|
|
1148
|
+
onChange: (e) => J(e.target.checked)
|
|
1149
|
+
}
|
|
1150
|
+
),
|
|
1151
|
+
/* @__PURE__ */ t(
|
|
1152
|
+
at,
|
|
1153
|
+
{
|
|
1154
|
+
label: te[n].createLabel,
|
|
1155
|
+
onClick: () => se(R),
|
|
1156
|
+
active: !He || oe,
|
|
1157
|
+
disabled: !r.name || !r.label || ke,
|
|
1158
|
+
"data-tooltip": ke ? "Select a parent folder" : void 0,
|
|
1159
|
+
"data-shortcut": ft("Enter", [ut.Ctrl]),
|
|
1160
|
+
saving: oe
|
|
1161
|
+
}
|
|
1162
|
+
)
|
|
1163
|
+
] }),
|
|
1164
|
+
onKeyDown: (e) => pe(e),
|
|
1165
|
+
onClick: (e) => {
|
|
1166
|
+
e.target.tagName !== "INPUT" && l(!1);
|
|
1167
|
+
},
|
|
1168
|
+
children: /* @__PURE__ */ f(
|
|
1169
|
+
"div",
|
|
1170
|
+
{
|
|
1171
|
+
style: {
|
|
1172
|
+
display: "flex",
|
|
1173
|
+
flexDirection: "column",
|
|
1174
|
+
gap: "var(--base-gap-large)"
|
|
1175
|
+
},
|
|
1176
|
+
children: [
|
|
1177
|
+
/* @__PURE__ */ f(Oe, { children: [
|
|
1178
|
+
/* @__PURE__ */ t(we, { children: "Parent folder" }),
|
|
1179
|
+
H.length > 0 ? /* @__PURE__ */ t(
|
|
1180
|
+
De,
|
|
1181
|
+
{
|
|
1182
|
+
value: p,
|
|
1183
|
+
options: ee,
|
|
1184
|
+
onChange: (e) => a(e),
|
|
1185
|
+
disabled: ee.length <= 1,
|
|
1186
|
+
multiSelect: !0,
|
|
1187
|
+
style: { width: "100%", minHeight: 32 }
|
|
1188
|
+
}
|
|
1189
|
+
) : n === "task" ? /* @__PURE__ */ t(Ke, { children: "Select a folder to create a task in" }) : /* @__PURE__ */ t(Ke, { children: "Creating in the project root" })
|
|
1190
|
+
] }),
|
|
1191
|
+
y.active ? (
|
|
1192
|
+
// @ts-ignore
|
|
1193
|
+
/* @__PURE__ */ t(
|
|
1194
|
+
St,
|
|
1195
|
+
{
|
|
1196
|
+
base: r.label,
|
|
1197
|
+
type: r.subType,
|
|
1198
|
+
increment: y.increment,
|
|
1199
|
+
length: y.length,
|
|
1200
|
+
prefix: y.prefix,
|
|
1201
|
+
prefixDepth: y.prefixDepth,
|
|
1202
|
+
parentLabel: S,
|
|
1203
|
+
entityType: "folder",
|
|
1204
|
+
nesting: !1,
|
|
1205
|
+
onChange: Z,
|
|
1206
|
+
isRoot: s,
|
|
1207
|
+
typeSelectRef: j,
|
|
1208
|
+
onLastInputKeydown: (e) => pe(e, !0),
|
|
1209
|
+
folders: h?.folderTypes || []
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1212
|
+
) : /* @__PURE__ */ f(qt, { children: [
|
|
1213
|
+
/* @__PURE__ */ f(Oe, { children: [
|
|
1214
|
+
/* @__PURE__ */ t(we, { children: "Type" }),
|
|
1215
|
+
/* @__PURE__ */ t(
|
|
1216
|
+
xe,
|
|
1217
|
+
{
|
|
1218
|
+
value: [r.subType],
|
|
1219
|
+
onChange: (e) => i(e, "subType"),
|
|
1220
|
+
options: P,
|
|
1221
|
+
style: { width: 160 },
|
|
1222
|
+
ref: j,
|
|
1223
|
+
onFocus: _e,
|
|
1224
|
+
onClick: () => l(!1)
|
|
1225
|
+
}
|
|
1226
|
+
)
|
|
1227
|
+
] }),
|
|
1228
|
+
/* @__PURE__ */ t(
|
|
1229
|
+
Ot,
|
|
1230
|
+
{
|
|
1231
|
+
handleChange: i,
|
|
1232
|
+
entityForm: r,
|
|
1233
|
+
labelRef: M,
|
|
1234
|
+
setNameFocused: l,
|
|
1235
|
+
handleKeyDown: pe,
|
|
1236
|
+
nameInfo: `Names are auto generated from the label using the Entity Naming setting on the project anatomy. Capitalization: ${q.capitalization}. Separator: "${q.separator}"`
|
|
1237
|
+
}
|
|
1238
|
+
)
|
|
1239
|
+
] })
|
|
1240
|
+
]
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1243
|
+
}
|
|
1244
|
+
)
|
|
1245
|
+
] });
|
|
1246
|
+
};
|
|
3
1247
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1248
|
+
we as InputLabel,
|
|
1249
|
+
Oe as InputsContainer,
|
|
1250
|
+
Tt as NameRow,
|
|
1251
|
+
wn as NewEntity,
|
|
1252
|
+
dt as NewEntityContext,
|
|
1253
|
+
Ot as NewEntityForm,
|
|
1254
|
+
xn as NewEntityProvider,
|
|
1255
|
+
ht as generateLabel,
|
|
1256
|
+
te as newEntityDefinitions,
|
|
1257
|
+
pt as useNewEntityContext
|
|
13
1258
|
};
|