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