@cgi-learning-hub/ui 1.4.0-dev.1742031677 → 1.4.0-dev.1742033565
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/{CustomTreeItem-GHUeoYTN.cjs → CustomTreeItem-dmAy1wfu.cjs} +3 -3
- package/dist/{CustomTreeItem-CyfVhVMC.js → CustomTreeItem-kFMLEWpp.js} +88 -87
- package/dist/components/TreeView/TreeView.cjs.js +7 -7
- package/dist/components/TreeView/TreeView.es.js +291 -292
- package/dist/components/TreeView/components/CustomTreeItem.cjs.js +1 -1
- package/dist/components/TreeView/components/CustomTreeItem.es.js +3 -3
- package/dist/components/TreeView/style.cjs.js +1 -1
- package/dist/components/TreeView/style.d.ts +1 -0
- package/dist/components/TreeView/style.es.js +7 -6
- package/dist/components/stories/TreeView.stories.cjs.js +30 -2
- package/dist/components/stories/TreeView.stories.d.ts +1 -0
- package/dist/components/stories/TreeView.stories.es.js +309 -147
- package/package.json +1 -1
|
@@ -2,66 +2,66 @@ import { jsx as S, jsxs as je } from "react/jsx-runtime";
|
|
|
2
2
|
import { B as yt } from "../../Box-GMNejc_m.js";
|
|
3
3
|
import * as E from "react";
|
|
4
4
|
import { useState as Ct, useMemo as wt, useEffect as Rt } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import { treeContainerStyle as
|
|
7
|
-
import {
|
|
5
|
+
import { c as St, T as Pt, g as _e, a as $e, b as Ne, d as se, f as vt, e as kt, h as Mt, i as he, j as ge, k as Dt, l as oe, u as H, m as Ke, n as Ot, o as Vt, p as Ue, q as At, r as Ft, s as Lt, t as jt, v as O, C as _t } from "../../CustomTreeItem-kFMLEWpp.js";
|
|
6
|
+
import { treeContainerStyle as $t, DEFAULT_CHILDREN_INDENT as Nt } from "./style.es.js";
|
|
7
|
+
import { buildItemDataMap as Kt, findItemPath as Ut, getItemId as Bt } from "./utils.es.js";
|
|
8
8
|
import { _ as C } from "../../ButtonBase-CU1npQuI.js";
|
|
9
|
-
import { H as
|
|
9
|
+
import { H as zt, G as qt, I as Be, P as a, n as ne } from "../../generateUtilityClasses-EXBFO7eY.js";
|
|
10
10
|
import { a as A } from "../../TransitionGroupContext-DbLioz_6.js";
|
|
11
11
|
import { u as U } from "../../useEventCallback-BAQJJ3ye.js";
|
|
12
|
-
import { o as
|
|
13
|
-
import { u as
|
|
14
|
-
import { C as
|
|
12
|
+
import { o as Ht } from "../../ownerDocument-CUrv0DIK.js";
|
|
13
|
+
import { u as Xt } from "../../index-D_xl88AE.js";
|
|
14
|
+
import { C as Wt } from "../../Checkbox-CtRSDqOe.js";
|
|
15
15
|
import { w as xe } from "../../warning-C8W811fV.js";
|
|
16
16
|
import { u as Ee } from "../../useForkRef-C_4o__cU.js";
|
|
17
17
|
import { u as N } from "../../useSlotProps-U2Iu6E0j.js";
|
|
18
|
-
import { r as
|
|
18
|
+
import { r as $, e as Fe } from "../../resolveComponentProps-CIdMNno4.js";
|
|
19
19
|
import { s as ie, c as ze, f as qe } from "../../DefaultPropsProvider-CQixa6JQ.js";
|
|
20
|
-
import { C as
|
|
21
|
-
import { u as
|
|
22
|
-
import { e as
|
|
23
|
-
function
|
|
24
|
-
return
|
|
20
|
+
import { C as Gt } from "../../Collapse-wS8A5zc5.js";
|
|
21
|
+
import { u as Jt } from "../../unsupportedProp-BuVD30Gh.js";
|
|
22
|
+
import { e as Yt } from "../../elementTypeAcceptingRef-B04tk6ag.js";
|
|
23
|
+
function Qt(e) {
|
|
24
|
+
return zt("MuiRichTreeView", e);
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
const
|
|
26
|
+
qt("MuiRichTreeView", ["root"]);
|
|
27
|
+
const Zt = (e, t) => {
|
|
28
28
|
const n = E.useRef({}), [r, l] = E.useState(() => {
|
|
29
29
|
const g = {};
|
|
30
30
|
return e.forEach((p) => {
|
|
31
|
-
p.models && Object.entries(p.models).forEach(([m,
|
|
31
|
+
p.models && Object.entries(p.models).forEach(([m, d]) => {
|
|
32
32
|
n.current[m] = {
|
|
33
33
|
isControlled: t[m] !== void 0,
|
|
34
|
-
getDefaultValue:
|
|
35
|
-
}, g[m] =
|
|
34
|
+
getDefaultValue: d.getDefaultValue
|
|
35
|
+
}, g[m] = d.getDefaultValue(t);
|
|
36
36
|
});
|
|
37
37
|
}), g;
|
|
38
38
|
}), h = Object.fromEntries(Object.entries(n.current).map(([g, p]) => {
|
|
39
39
|
const m = t[g] ?? r[g];
|
|
40
40
|
return [g, {
|
|
41
41
|
value: m,
|
|
42
|
-
setControlledValue: (
|
|
42
|
+
setControlledValue: (d) => {
|
|
43
43
|
p.isControlled || l((o) => C({}, o, {
|
|
44
|
-
[g]:
|
|
44
|
+
[g]: d
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
47
|
}];
|
|
48
48
|
}));
|
|
49
49
|
return process.env.NODE_ENV !== "production" && Object.entries(n.current).forEach(([g, p]) => {
|
|
50
|
-
const m = t[g],
|
|
50
|
+
const m = t[g], d = p.getDefaultValue(t);
|
|
51
51
|
E.useEffect(() => {
|
|
52
52
|
p.isControlled !== (m !== void 0) && console.error([`MUI X: A component is changing the ${p.isControlled ? "" : "un"}controlled ${g} state of TreeView to be ${p.isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${g} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
|
|
53
53
|
`));
|
|
54
54
|
}, [m]);
|
|
55
55
|
const {
|
|
56
56
|
current: o
|
|
57
|
-
} = E.useRef(
|
|
57
|
+
} = E.useRef(d);
|
|
58
58
|
E.useEffect(() => {
|
|
59
|
-
!p.isControlled && o !==
|
|
59
|
+
!p.isControlled && o !== d && console.error([`MUI X: A component is changing the default ${g} state of an uncontrolled TreeView after being initialized. To suppress this warning opt to use a controlled TreeView.`].join(`
|
|
60
60
|
`));
|
|
61
|
-
}, [JSON.stringify(
|
|
61
|
+
}, [JSON.stringify(d)]);
|
|
62
62
|
}), h;
|
|
63
63
|
};
|
|
64
|
-
class
|
|
64
|
+
class en {
|
|
65
65
|
constructor() {
|
|
66
66
|
this.maxListeners = 20, this.warnOnce = !1, this.events = {};
|
|
67
67
|
}
|
|
@@ -103,10 +103,10 @@ class Zt {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
const [e] = E.useState(() => new
|
|
106
|
+
const tn = (e) => e.isPropagationStopped !== void 0, He = () => {
|
|
107
|
+
const [e] = E.useState(() => new en()), t = E.useCallback((...r) => {
|
|
108
108
|
const [l, h, g = {}] = r;
|
|
109
|
-
g.defaultMuiPrevented = !1, !(
|
|
109
|
+
g.defaultMuiPrevented = !1, !(tn(g) && g.isPropagationStopped()) && e.emit(l, h, g);
|
|
110
110
|
}, [e]), n = E.useCallback((r, l) => (e.on(r, l), () => {
|
|
111
111
|
e.removeListener(r, l);
|
|
112
112
|
}), [e]);
|
|
@@ -137,7 +137,7 @@ const Te = ({
|
|
|
137
137
|
E.useEffect(() => {
|
|
138
138
|
n((l) => l.id.treeId === e.id && l.id.treeId !== void 0 ? l : C({}, l, {
|
|
139
139
|
id: C({}, l.id, {
|
|
140
|
-
treeId: e.id ??
|
|
140
|
+
treeId: e.id ?? St()
|
|
141
141
|
})
|
|
142
142
|
}));
|
|
143
143
|
}, [n, e.id]);
|
|
@@ -161,7 +161,7 @@ Te.getInitialState = ({
|
|
|
161
161
|
treeId: e ?? void 0
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
const
|
|
164
|
+
const nn = [He, Xe, Te], on = ["slots", "slotProps", "apiRef", "experimentalFeatures"], rn = (e) => {
|
|
165
165
|
let {
|
|
166
166
|
props: {
|
|
167
167
|
slots: t,
|
|
@@ -170,36 +170,36 @@ const tn = [He, Xe, Te], nn = ["slots", "slotProps", "apiRef", "experimentalFeat
|
|
|
170
170
|
experimentalFeatures: l
|
|
171
171
|
},
|
|
172
172
|
plugins: h
|
|
173
|
-
} = e, g = A(e.props,
|
|
173
|
+
} = e, g = A(e.props, on);
|
|
174
174
|
const p = {};
|
|
175
|
-
h.forEach((
|
|
176
|
-
Object.assign(p,
|
|
175
|
+
h.forEach((f) => {
|
|
176
|
+
Object.assign(p, f.params);
|
|
177
177
|
});
|
|
178
|
-
const m = {},
|
|
179
|
-
Object.keys(g).forEach((
|
|
180
|
-
const b = g[
|
|
181
|
-
p[
|
|
178
|
+
const m = {}, d = {};
|
|
179
|
+
Object.keys(g).forEach((f) => {
|
|
180
|
+
const b = g[f];
|
|
181
|
+
p[f] ? m[f] = b : d[f] = b;
|
|
182
182
|
});
|
|
183
|
-
const o = l ?? {}, s = h.reduce((
|
|
184
|
-
params:
|
|
183
|
+
const o = l ?? {}, s = h.reduce((f, b) => b.getDefaultizedParams ? b.getDefaultizedParams({
|
|
184
|
+
params: f,
|
|
185
185
|
experimentalFeatures: o
|
|
186
|
-
}) :
|
|
186
|
+
}) : f, m);
|
|
187
187
|
return {
|
|
188
188
|
apiRef: r,
|
|
189
|
-
forwardedProps:
|
|
189
|
+
forwardedProps: d,
|
|
190
190
|
pluginParams: s,
|
|
191
191
|
slots: t ?? {},
|
|
192
192
|
slotProps: n ?? {},
|
|
193
193
|
experimentalFeatures: o
|
|
194
194
|
};
|
|
195
|
-
},
|
|
195
|
+
}, sn = ({
|
|
196
196
|
plugins: e,
|
|
197
197
|
instance: t,
|
|
198
198
|
publicAPI: n,
|
|
199
199
|
rootRef: r
|
|
200
200
|
}) => ({
|
|
201
201
|
runItemPlugins: (p) => {
|
|
202
|
-
let m = null,
|
|
202
|
+
let m = null, d = null;
|
|
203
203
|
const o = [], s = {};
|
|
204
204
|
e.forEach((x) => {
|
|
205
205
|
if (!x.itemPlugin)
|
|
@@ -207,21 +207,21 @@ const tn = [He, Xe, Te], nn = ["slots", "slotProps", "apiRef", "experimentalFeat
|
|
|
207
207
|
const c = x.itemPlugin({
|
|
208
208
|
props: p,
|
|
209
209
|
rootRef: m,
|
|
210
|
-
contentRef:
|
|
210
|
+
contentRef: d
|
|
211
211
|
});
|
|
212
|
-
c != null && c.rootRef && (m = c.rootRef), c != null && c.contentRef && (
|
|
212
|
+
c != null && c.rootRef && (m = c.rootRef), c != null && c.contentRef && (d = c.contentRef), c != null && c.propsEnhancers && (o.push(c.propsEnhancers), Object.keys(c.propsEnhancers).forEach((i) => {
|
|
213
213
|
s[i] = !0;
|
|
214
214
|
}));
|
|
215
215
|
});
|
|
216
|
-
const
|
|
216
|
+
const f = (x) => (c) => {
|
|
217
217
|
const i = {};
|
|
218
|
-
return o.forEach((
|
|
219
|
-
const I =
|
|
218
|
+
return o.forEach((u) => {
|
|
219
|
+
const I = u[x];
|
|
220
220
|
I != null && Object.assign(i, I(c));
|
|
221
221
|
}), i;
|
|
222
|
-
}, b = Object.fromEntries(Object.keys(s).map((x) => [x,
|
|
222
|
+
}, b = Object.fromEntries(Object.keys(s).map((x) => [x, f(x)]));
|
|
223
223
|
return {
|
|
224
|
-
contentRef:
|
|
224
|
+
contentRef: d,
|
|
225
225
|
rootRef: m,
|
|
226
226
|
propsEnhancers: b
|
|
227
227
|
};
|
|
@@ -230,23 +230,23 @@ const tn = [He, Xe, Te], nn = ["slots", "slotProps", "apiRef", "experimentalFeat
|
|
|
230
230
|
itemId: p,
|
|
231
231
|
children: m
|
|
232
232
|
}) => {
|
|
233
|
-
let
|
|
233
|
+
let d = m;
|
|
234
234
|
for (let o = e.length - 1; o >= 0; o -= 1) {
|
|
235
235
|
const s = e[o];
|
|
236
|
-
s.wrapItem && (
|
|
236
|
+
s.wrapItem && (d = s.wrapItem({
|
|
237
237
|
itemId: p,
|
|
238
|
-
children:
|
|
238
|
+
children: d,
|
|
239
239
|
instance: t
|
|
240
240
|
}));
|
|
241
241
|
}
|
|
242
|
-
return
|
|
242
|
+
return d;
|
|
243
243
|
},
|
|
244
244
|
wrapRoot: ({
|
|
245
245
|
children: p
|
|
246
246
|
}) => {
|
|
247
247
|
let m = p;
|
|
248
|
-
for (let
|
|
249
|
-
const o = e[
|
|
248
|
+
for (let d = e.length - 1; d >= 0; d -= 1) {
|
|
249
|
+
const o = e[d];
|
|
250
250
|
o.wrapRoot && (m = o.wrapRoot({
|
|
251
251
|
children: m,
|
|
252
252
|
instance: t
|
|
@@ -258,49 +258,49 @@ const tn = [He, Xe, Te], nn = ["slots", "slotProps", "apiRef", "experimentalFeat
|
|
|
258
258
|
rootRef: r,
|
|
259
259
|
publicAPI: n
|
|
260
260
|
});
|
|
261
|
-
function
|
|
261
|
+
function ln(e) {
|
|
262
262
|
const t = E.useRef({});
|
|
263
263
|
return e ? (e.current == null && (e.current = {}), e.current) : t.current;
|
|
264
264
|
}
|
|
265
|
-
const
|
|
265
|
+
const an = ({
|
|
266
266
|
plugins: e,
|
|
267
267
|
rootRef: t,
|
|
268
268
|
props: n
|
|
269
269
|
}) => {
|
|
270
|
-
const r = [...
|
|
270
|
+
const r = [...nn, ...e], {
|
|
271
271
|
pluginParams: l,
|
|
272
272
|
forwardedProps: h,
|
|
273
273
|
apiRef: g,
|
|
274
274
|
experimentalFeatures: p,
|
|
275
275
|
slots: m,
|
|
276
|
-
slotProps:
|
|
277
|
-
} =
|
|
276
|
+
slotProps: d
|
|
277
|
+
} = rn({
|
|
278
278
|
plugins: r,
|
|
279
279
|
props: n
|
|
280
|
-
}), o =
|
|
280
|
+
}), o = Zt(r, l), f = E.useRef({}).current, b = ln(g), x = E.useRef(null), c = Ee(x, t), i = sn({
|
|
281
281
|
plugins: r,
|
|
282
|
-
instance:
|
|
282
|
+
instance: f,
|
|
283
283
|
publicAPI: b,
|
|
284
284
|
rootRef: x
|
|
285
|
-
}), [
|
|
285
|
+
}), [u, I] = E.useState(() => {
|
|
286
286
|
const R = {};
|
|
287
287
|
return r.forEach((v) => {
|
|
288
288
|
v.getInitialState && Object.assign(R, v.getInitialState(l));
|
|
289
289
|
}), R;
|
|
290
290
|
}), T = [], P = (R) => {
|
|
291
291
|
const v = R({
|
|
292
|
-
instance:
|
|
292
|
+
instance: f,
|
|
293
293
|
params: l,
|
|
294
294
|
slots: m,
|
|
295
|
-
slotProps:
|
|
295
|
+
slotProps: d,
|
|
296
296
|
experimentalFeatures: p,
|
|
297
|
-
state:
|
|
297
|
+
state: u,
|
|
298
298
|
setState: I,
|
|
299
299
|
rootRef: x,
|
|
300
300
|
models: o,
|
|
301
301
|
plugins: r
|
|
302
302
|
});
|
|
303
|
-
v.getRootProps && T.push(v.getRootProps), v.publicAPI && Object.assign(b, v.publicAPI), v.instance && Object.assign(
|
|
303
|
+
v.getRootProps && T.push(v.getRootProps), v.publicAPI && Object.assign(b, v.publicAPI), v.instance && Object.assign(f, v.instance), v.contextValue && Object.assign(i, v.contextValue);
|
|
304
304
|
};
|
|
305
305
|
return r.forEach(P), {
|
|
306
306
|
getRootProps: (R = {}) => {
|
|
@@ -315,15 +315,15 @@ const ln = ({
|
|
|
315
315
|
},
|
|
316
316
|
rootRef: c,
|
|
317
317
|
contextValue: i,
|
|
318
|
-
instance:
|
|
318
|
+
instance: f
|
|
319
319
|
};
|
|
320
320
|
};
|
|
321
|
-
function
|
|
321
|
+
function cn(e) {
|
|
322
322
|
const {
|
|
323
323
|
value: t,
|
|
324
324
|
children: n
|
|
325
325
|
} = e;
|
|
326
|
-
return /* @__PURE__ */ S(
|
|
326
|
+
return /* @__PURE__ */ S(Pt.Provider, {
|
|
327
327
|
value: t,
|
|
328
328
|
children: t.wrapRoot({
|
|
329
329
|
children: n,
|
|
@@ -331,14 +331,14 @@ function an(e) {
|
|
|
331
331
|
})
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const un = (e, t, n) => {
|
|
335
335
|
e.$$publishEvent(t, n);
|
|
336
|
-
}, K = "__TREE_VIEW_ROOT_PARENT_ID__",
|
|
336
|
+
}, K = "__TREE_VIEW_ROOT_PARENT_ID__", dn = (e) => {
|
|
337
337
|
const t = {};
|
|
338
338
|
return e.forEach((n, r) => {
|
|
339
339
|
t[n] = r;
|
|
340
340
|
}), t;
|
|
341
|
-
},
|
|
341
|
+
}, fn = ["children"], We = ({
|
|
342
342
|
items: e,
|
|
343
343
|
isItemDisabled: t,
|
|
344
344
|
getItemLabel: n,
|
|
@@ -346,35 +346,35 @@ const cn = (e, t, n) => {
|
|
|
346
346
|
}) => {
|
|
347
347
|
const l = {}, h = {}, g = {
|
|
348
348
|
[K]: []
|
|
349
|
-
}, p = (
|
|
349
|
+
}, p = (d, o, s) => {
|
|
350
350
|
var c, i;
|
|
351
|
-
const
|
|
352
|
-
if (
|
|
353
|
-
throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", "An item was provided without id in the `items` prop:", JSON.stringify(
|
|
351
|
+
const f = r ? r(d) : d.id;
|
|
352
|
+
if (f == null)
|
|
353
|
+
throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", "An item was provided without id in the `items` prop:", JSON.stringify(d)].join(`
|
|
354
354
|
`));
|
|
355
|
-
if (l[
|
|
356
|
-
throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", `Two items were provided with the same id in the \`items\` prop: "${
|
|
355
|
+
if (l[f] != null)
|
|
356
|
+
throw new Error(["MUI X: The Tree View component requires all items to have a unique `id` property.", "Alternatively, you can use the `getItemId` prop to specify a custom id for each item.", `Two items were provided with the same id in the \`items\` prop: "${f}"`].join(`
|
|
357
357
|
`));
|
|
358
|
-
const b = n ? n(
|
|
358
|
+
const b = n ? n(d) : d.label;
|
|
359
359
|
if (b == null)
|
|
360
|
-
throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.", "Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.", "An item was provided without label in the `items` prop:", JSON.stringify(
|
|
360
|
+
throw new Error(["MUI X: The Tree View component requires all items to have a `label` property.", "Alternatively, you can use the `getItemLabel` prop to specify a custom label for each item.", "An item was provided without label in the `items` prop:", JSON.stringify(d)].join(`
|
|
361
361
|
`));
|
|
362
|
-
l[
|
|
363
|
-
id:
|
|
362
|
+
l[f] = {
|
|
363
|
+
id: f,
|
|
364
364
|
label: b,
|
|
365
365
|
parentId: s,
|
|
366
366
|
idAttribute: void 0,
|
|
367
|
-
expandable: !!((c =
|
|
368
|
-
disabled: t ? t(
|
|
367
|
+
expandable: !!((c = d.children) != null && c.length),
|
|
368
|
+
disabled: t ? t(d) : !1,
|
|
369
369
|
depth: o
|
|
370
|
-
}, h[
|
|
370
|
+
}, h[f] = d;
|
|
371
371
|
const x = s ?? K;
|
|
372
|
-
g[x] || (g[x] = []), g[x].push(
|
|
372
|
+
g[x] || (g[x] = []), g[x].push(f), (i = d.children) == null || i.forEach((u) => p(u, o + 1, f));
|
|
373
373
|
};
|
|
374
|
-
e.forEach((
|
|
374
|
+
e.forEach((d) => p(d, 0, null));
|
|
375
375
|
const m = {};
|
|
376
|
-
return Object.keys(g).forEach((
|
|
377
|
-
m[
|
|
376
|
+
return Object.keys(g).forEach((d) => {
|
|
377
|
+
m[d] = dn(g[d]);
|
|
378
378
|
}), {
|
|
379
379
|
itemMetaMap: l,
|
|
380
380
|
itemMap: h,
|
|
@@ -388,16 +388,16 @@ const cn = (e, t, n) => {
|
|
|
388
388
|
setState: r,
|
|
389
389
|
experimentalFeatures: l
|
|
390
390
|
}) => {
|
|
391
|
-
const h = E.useCallback((
|
|
392
|
-
const
|
|
393
|
-
const T = n.items.itemMap[I], P = A(T,
|
|
394
|
-
return y && (P.children = y.map(
|
|
391
|
+
const h = E.useCallback((u) => n.items.itemMetaMap[u], [n.items.itemMetaMap]), g = E.useCallback((u) => n.items.itemMap[u], [n.items.itemMap]), p = E.useCallback(() => {
|
|
392
|
+
const u = (I) => {
|
|
393
|
+
const T = n.items.itemMap[I], P = A(T, fn), y = n.items.itemOrderedChildrenIds[I];
|
|
394
|
+
return y && (P.children = y.map(u)), P;
|
|
395
395
|
};
|
|
396
|
-
return n.items.itemOrderedChildrenIds[K].map(
|
|
397
|
-
}, [n.items.itemMap, n.items.itemOrderedChildrenIds]), m = E.useCallback((
|
|
398
|
-
if (
|
|
396
|
+
return n.items.itemOrderedChildrenIds[K].map(u);
|
|
397
|
+
}, [n.items.itemMap, n.items.itemOrderedChildrenIds]), m = E.useCallback((u) => {
|
|
398
|
+
if (u == null)
|
|
399
399
|
return !1;
|
|
400
|
-
let I = e.getItemMeta(
|
|
400
|
+
let I = e.getItemMeta(u);
|
|
401
401
|
if (!I)
|
|
402
402
|
return !1;
|
|
403
403
|
if (I.disabled)
|
|
@@ -406,32 +406,32 @@ const cn = (e, t, n) => {
|
|
|
406
406
|
if (I = e.getItemMeta(I.parentId), I.disabled)
|
|
407
407
|
return !0;
|
|
408
408
|
return !1;
|
|
409
|
-
}, [e]),
|
|
410
|
-
const I = e.getItemMeta(
|
|
411
|
-
return n.items.itemChildrenIndexes[I][
|
|
412
|
-
}, [e, n.items.itemChildrenIndexes]), o = E.useCallback((
|
|
413
|
-
const I = e.getItemMeta(
|
|
414
|
-
return I == null ? null : document.getElementById(
|
|
409
|
+
}, [e]), d = E.useCallback((u) => {
|
|
410
|
+
const I = e.getItemMeta(u).parentId ?? K;
|
|
411
|
+
return n.items.itemChildrenIndexes[I][u];
|
|
412
|
+
}, [e, n.items.itemChildrenIndexes]), o = E.useCallback((u) => n.items.itemOrderedChildrenIds[u ?? K] ?? [], [n.items.itemOrderedChildrenIds]), s = (u) => {
|
|
413
|
+
const I = e.getItemMeta(u);
|
|
414
|
+
return I == null ? null : document.getElementById(_e({
|
|
415
415
|
treeId: n.id.treeId,
|
|
416
|
-
itemId:
|
|
416
|
+
itemId: u,
|
|
417
417
|
id: I.idAttribute
|
|
418
418
|
}));
|
|
419
|
-
},
|
|
419
|
+
}, f = (u) => t.disabledItemsFocusable ? !0 : !e.isItemDisabled(u), b = E.useRef(!1), x = E.useCallback(() => {
|
|
420
420
|
b.current = !0;
|
|
421
421
|
}, []), c = E.useCallback(() => b.current, []);
|
|
422
422
|
return E.useEffect(() => {
|
|
423
|
-
e.areItemUpdatesPrevented() || r((
|
|
423
|
+
e.areItemUpdatesPrevented() || r((u) => {
|
|
424
424
|
const I = We({
|
|
425
425
|
items: t.items,
|
|
426
426
|
isItemDisabled: t.isItemDisabled,
|
|
427
427
|
getItemId: t.getItemId,
|
|
428
428
|
getItemLabel: t.getItemLabel
|
|
429
429
|
});
|
|
430
|
-
return Object.values(
|
|
431
|
-
I.itemMetaMap[T.id] ||
|
|
430
|
+
return Object.values(u.items.itemMetaMap).forEach((T) => {
|
|
431
|
+
I.itemMetaMap[T.id] || un(e, "removeItem", {
|
|
432
432
|
id: T.id
|
|
433
433
|
});
|
|
434
|
-
}), C({},
|
|
434
|
+
}), C({}, u, {
|
|
435
435
|
items: I
|
|
436
436
|
});
|
|
437
437
|
});
|
|
@@ -452,23 +452,23 @@ const cn = (e, t, n) => {
|
|
|
452
452
|
getItem: g,
|
|
453
453
|
getItemTree: p,
|
|
454
454
|
getItemsToRender: () => {
|
|
455
|
-
const
|
|
455
|
+
const u = (I) => {
|
|
456
456
|
var P;
|
|
457
457
|
const T = n.items.itemMetaMap[I];
|
|
458
458
|
return {
|
|
459
459
|
label: T.label,
|
|
460
460
|
itemId: T.id,
|
|
461
461
|
id: T.idAttribute,
|
|
462
|
-
children: (P = n.items.itemOrderedChildrenIds[I]) == null ? void 0 : P.map(
|
|
462
|
+
children: (P = n.items.itemOrderedChildrenIds[I]) == null ? void 0 : P.map(u)
|
|
463
463
|
};
|
|
464
464
|
};
|
|
465
|
-
return n.items.itemOrderedChildrenIds[K].map(
|
|
465
|
+
return n.items.itemOrderedChildrenIds[K].map(u);
|
|
466
466
|
},
|
|
467
|
-
getItemIndex:
|
|
467
|
+
getItemIndex: d,
|
|
468
468
|
getItemDOMElement: s,
|
|
469
469
|
getItemOrderedChildrenIds: o,
|
|
470
470
|
isItemDisabled: m,
|
|
471
|
-
isItemNavigable:
|
|
471
|
+
isItemNavigable: f,
|
|
472
472
|
preventItemUpdates: x,
|
|
473
473
|
areItemUpdatesPrevented: c
|
|
474
474
|
},
|
|
@@ -498,7 +498,7 @@ X.getDefaultizedParams = ({
|
|
|
498
498
|
X.wrapRoot = ({
|
|
499
499
|
children: e,
|
|
500
500
|
instance: t
|
|
501
|
-
}) => /* @__PURE__ */ S(
|
|
501
|
+
}) => /* @__PURE__ */ S($e.Provider, {
|
|
502
502
|
value: (n) => {
|
|
503
503
|
var r;
|
|
504
504
|
return ((r = t.getItemMeta(n)) == null ? void 0 : r.depth) ?? 0;
|
|
@@ -521,27 +521,27 @@ const le = ({
|
|
|
521
521
|
}) => {
|
|
522
522
|
const r = E.useMemo(() => {
|
|
523
523
|
const s = /* @__PURE__ */ new Map();
|
|
524
|
-
return n.expandedItems.value.forEach((
|
|
525
|
-
s.set(
|
|
524
|
+
return n.expandedItems.value.forEach((f) => {
|
|
525
|
+
s.set(f, !0);
|
|
526
526
|
}), s;
|
|
527
|
-
}, [n.expandedItems.value]), l = (s,
|
|
527
|
+
}, [n.expandedItems.value]), l = (s, f) => {
|
|
528
528
|
var b;
|
|
529
|
-
(b = t.onExpandedItemsChange) == null || b.call(t, s,
|
|
529
|
+
(b = t.onExpandedItemsChange) == null || b.call(t, s, f), n.expandedItems.setControlledValue(f);
|
|
530
530
|
}, h = E.useCallback((s) => r.has(s), [r]), g = E.useCallback((s) => {
|
|
531
|
-
var
|
|
532
|
-
return !!((
|
|
533
|
-
}, [e]), p = U((s,
|
|
534
|
-
const b = e.isItemExpanded(
|
|
535
|
-
e.setItemExpansion(s,
|
|
536
|
-
}), m = U((s,
|
|
537
|
-
if (e.isItemExpanded(
|
|
531
|
+
var f;
|
|
532
|
+
return !!((f = e.getItemMeta(s)) != null && f.expandable);
|
|
533
|
+
}, [e]), p = U((s, f) => {
|
|
534
|
+
const b = e.isItemExpanded(f);
|
|
535
|
+
e.setItemExpansion(s, f, !b);
|
|
536
|
+
}), m = U((s, f, b) => {
|
|
537
|
+
if (e.isItemExpanded(f) === b)
|
|
538
538
|
return;
|
|
539
539
|
let c;
|
|
540
|
-
b ? c = [
|
|
541
|
-
}),
|
|
542
|
-
const b = e.getItemMeta(
|
|
543
|
-
c.length > 0 && (t.onItemExpansionToggle && c.forEach((
|
|
544
|
-
t.onItemExpansionToggle(s,
|
|
540
|
+
b ? c = [f].concat(n.expandedItems.value) : c = n.expandedItems.value.filter((i) => i !== f), t.onItemExpansionToggle && t.onItemExpansionToggle(s, f, b), l(s, c);
|
|
541
|
+
}), d = (s, f) => {
|
|
542
|
+
const b = e.getItemMeta(f), c = e.getItemOrderedChildrenIds(b.parentId).filter((u) => e.isItemExpandable(u) && !e.isItemExpanded(u)), i = n.expandedItems.value.concat(c);
|
|
543
|
+
c.length > 0 && (t.onItemExpansionToggle && c.forEach((u) => {
|
|
544
|
+
t.onItemExpansionToggle(s, u, !0);
|
|
545
545
|
}), l(s, i));
|
|
546
546
|
}, o = E.useMemo(() => t.expansionTrigger ? t.expansionTrigger : e.isTreeViewEditable ? "iconContainer" : "content", [t.expansionTrigger, e.isTreeViewEditable]);
|
|
547
547
|
return {
|
|
@@ -553,7 +553,7 @@ const le = ({
|
|
|
553
553
|
isItemExpandable: g,
|
|
554
554
|
setItemExpansion: m,
|
|
555
555
|
toggleItemExpansion: p,
|
|
556
|
-
expandAllSiblings:
|
|
556
|
+
expandAllSiblings: d
|
|
557
557
|
},
|
|
558
558
|
contextValue: {
|
|
559
559
|
expansion: {
|
|
@@ -567,11 +567,11 @@ le.models = {
|
|
|
567
567
|
getDefaultValue: (e) => e.defaultExpandedItems
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
|
-
const
|
|
570
|
+
const pn = [];
|
|
571
571
|
le.getDefaultizedParams = ({
|
|
572
572
|
params: e
|
|
573
573
|
}) => C({}, e, {
|
|
574
|
-
defaultExpandedItems: e.defaultExpandedItems ??
|
|
574
|
+
defaultExpandedItems: e.defaultExpandedItems ?? pn
|
|
575
575
|
});
|
|
576
576
|
le.params = {
|
|
577
577
|
expandedItems: !0,
|
|
@@ -598,8 +598,8 @@ const re = (e) => Array.isArray(e) ? e : e != null ? [e] : [], be = (e) => {
|
|
|
598
598
|
}, [n.selectedItems.value]), g = (c, i) => {
|
|
599
599
|
if (t.onItemSelectionToggle)
|
|
600
600
|
if (t.multiSelect) {
|
|
601
|
-
const
|
|
602
|
-
|
|
601
|
+
const u = i.filter((T) => !e.isItemSelected(T)), I = n.selectedItems.value.filter((T) => !i.includes(T));
|
|
602
|
+
u.forEach((T) => {
|
|
603
603
|
t.onItemSelectionToggle(c, T, !0);
|
|
604
604
|
}), I.forEach((T) => {
|
|
605
605
|
t.onItemSelectionToggle(c, T, !1);
|
|
@@ -609,24 +609,24 @@ const re = (e) => Array.isArray(e) ? e : e != null ? [e] : [], be = (e) => {
|
|
|
609
609
|
}, p = (c) => h.has(c), m = ({
|
|
610
610
|
event: c,
|
|
611
611
|
itemId: i,
|
|
612
|
-
keepExistingSelection:
|
|
612
|
+
keepExistingSelection: u = !1,
|
|
613
613
|
shouldBeSelected: I
|
|
614
614
|
}) => {
|
|
615
615
|
if (t.disableSelection)
|
|
616
616
|
return;
|
|
617
617
|
let T;
|
|
618
|
-
if (
|
|
618
|
+
if (u) {
|
|
619
619
|
const P = re(n.selectedItems.value), y = e.isItemSelected(i);
|
|
620
620
|
y && (I === !1 || I == null) ? T = P.filter((R) => R !== i) : !y && (I === !0 || I == null) ? T = [i].concat(P) : T = P;
|
|
621
621
|
} else
|
|
622
622
|
I === !1 || I == null && e.isItemSelected(i) ? T = t.multiSelect ? [] : null : T = t.multiSelect ? [i] : i;
|
|
623
623
|
g(c, T), r.current = i, l.current = {};
|
|
624
|
-
},
|
|
624
|
+
}, d = (c, [i, u]) => {
|
|
625
625
|
if (t.disableSelection || !t.multiSelect)
|
|
626
626
|
return;
|
|
627
627
|
let I = re(n.selectedItems.value).slice();
|
|
628
628
|
Object.keys(l.current).length > 0 && (I = I.filter((R) => !l.current[R]));
|
|
629
|
-
const T = be(I), P =
|
|
629
|
+
const T = be(I), P = Mt(e, i, u), y = P.filter((R) => !T[R]);
|
|
630
630
|
I = I.concat(y), g(c, I), l.current = be(P);
|
|
631
631
|
};
|
|
632
632
|
return {
|
|
@@ -642,29 +642,29 @@ const re = (e) => Array.isArray(e) ? e : e != null ? [e] : [], be = (e) => {
|
|
|
642
642
|
selectAllNavigableItems: (c) => {
|
|
643
643
|
if (t.disableSelection || !t.multiSelect)
|
|
644
644
|
return;
|
|
645
|
-
const i =
|
|
645
|
+
const i = kt(e);
|
|
646
646
|
g(c, i), l.current = be(i);
|
|
647
647
|
},
|
|
648
648
|
expandSelectionRange: (c, i) => {
|
|
649
649
|
if (r.current != null) {
|
|
650
|
-
const [
|
|
651
|
-
|
|
650
|
+
const [u, I] = vt(e, i, r.current);
|
|
651
|
+
d(c, [u, I]);
|
|
652
652
|
}
|
|
653
653
|
},
|
|
654
654
|
selectRangeFromStartToItem: (c, i) => {
|
|
655
|
-
|
|
655
|
+
d(c, [se(e), i]);
|
|
656
656
|
},
|
|
657
657
|
selectRangeFromItemToEnd: (c, i) => {
|
|
658
|
-
|
|
658
|
+
d(c, [i, Ne(e)]);
|
|
659
659
|
},
|
|
660
|
-
selectItemFromArrowNavigation: (c, i,
|
|
660
|
+
selectItemFromArrowNavigation: (c, i, u) => {
|
|
661
661
|
if (t.disableSelection || !t.multiSelect)
|
|
662
662
|
return;
|
|
663
663
|
let I = re(n.selectedItems.value).slice();
|
|
664
|
-
Object.keys(l.current).length === 0 ? (I.push(
|
|
664
|
+
Object.keys(l.current).length === 0 ? (I.push(u), l.current = {
|
|
665
665
|
[i]: !0,
|
|
666
|
-
[
|
|
667
|
-
}) : (l.current[i] || (l.current = {}), l.current[
|
|
666
|
+
[u]: !0
|
|
667
|
+
}) : (l.current[i] || (l.current = {}), l.current[u] ? (I = I.filter((T) => T !== i), delete l.current[i]) : (I.push(u), l.current[u] = !0)), g(c, I);
|
|
668
668
|
}
|
|
669
669
|
},
|
|
670
670
|
contextValue: {
|
|
@@ -681,14 +681,14 @@ ae.models = {
|
|
|
681
681
|
getDefaultValue: (e) => e.defaultSelectedItems
|
|
682
682
|
}
|
|
683
683
|
};
|
|
684
|
-
const
|
|
684
|
+
const mn = [];
|
|
685
685
|
ae.getDefaultizedParams = ({
|
|
686
686
|
params: e
|
|
687
687
|
}) => C({}, e, {
|
|
688
688
|
disableSelection: e.disableSelection ?? !1,
|
|
689
689
|
multiSelect: e.multiSelect ?? !1,
|
|
690
690
|
checkboxSelection: e.checkboxSelection ?? !1,
|
|
691
|
-
defaultSelectedItems: e.defaultSelectedItems ?? (e.multiSelect ?
|
|
691
|
+
defaultSelectedItems: e.defaultSelectedItems ?? (e.multiSelect ? mn : null)
|
|
692
692
|
});
|
|
693
693
|
ae.params = {
|
|
694
694
|
disableSelection: !0,
|
|
@@ -700,7 +700,7 @@ ae.params = {
|
|
|
700
700
|
onItemSelectionToggle: !0
|
|
701
701
|
};
|
|
702
702
|
const Le = 1e3;
|
|
703
|
-
class
|
|
703
|
+
class In {
|
|
704
704
|
constructor(t = Le) {
|
|
705
705
|
this.timeouts = /* @__PURE__ */ new Map(), this.cleanupTimeout = Le, this.cleanupTimeout = t;
|
|
706
706
|
}
|
|
@@ -723,7 +723,7 @@ class mn {
|
|
|
723
723
|
}), this.timeouts = void 0);
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
class
|
|
726
|
+
class gn {
|
|
727
727
|
constructor() {
|
|
728
728
|
this.registry = new FinalizationRegistry((t) => {
|
|
729
729
|
typeof t == "function" && t();
|
|
@@ -739,53 +739,53 @@ class In {
|
|
|
739
739
|
reset() {
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
|
-
class
|
|
742
|
+
class bn {
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function hn(e) {
|
|
745
745
|
let t = 0;
|
|
746
746
|
return function(r, l, h) {
|
|
747
|
-
e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new
|
|
748
|
-
const [g] = E.useState(new
|
|
747
|
+
e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new gn() : new In());
|
|
748
|
+
const [g] = E.useState(new bn()), p = E.useRef(null), m = E.useRef(void 0);
|
|
749
749
|
m.current = h;
|
|
750
|
-
const
|
|
750
|
+
const d = E.useRef(null);
|
|
751
751
|
if (!p.current && m.current) {
|
|
752
|
-
const o = (s,
|
|
752
|
+
const o = (s, f) => {
|
|
753
753
|
var b;
|
|
754
|
-
|
|
754
|
+
f.defaultMuiPrevented || (b = m.current) == null || b.call(m, s, f);
|
|
755
755
|
};
|
|
756
|
-
p.current = r.$$subscribeEvent(l, o), t += 1,
|
|
756
|
+
p.current = r.$$subscribeEvent(l, o), t += 1, d.current = {
|
|
757
757
|
cleanupToken: t
|
|
758
758
|
}, e.registry.register(
|
|
759
759
|
g,
|
|
760
760
|
// The callback below will be called once this reference stops being retained
|
|
761
761
|
() => {
|
|
762
762
|
var s;
|
|
763
|
-
(s = p.current) == null || s.call(p), p.current = null,
|
|
763
|
+
(s = p.current) == null || s.call(p), p.current = null, d.current = null;
|
|
764
764
|
},
|
|
765
|
-
|
|
765
|
+
d.current
|
|
766
766
|
);
|
|
767
|
-
} else !m.current && p.current && (p.current(), p.current = null,
|
|
767
|
+
} else !m.current && p.current && (p.current(), p.current = null, d.current && (e.registry.unregister(d.current), d.current = null));
|
|
768
768
|
E.useEffect(() => {
|
|
769
769
|
if (!p.current && m.current) {
|
|
770
|
-
const o = (s,
|
|
770
|
+
const o = (s, f) => {
|
|
771
771
|
var b;
|
|
772
|
-
|
|
772
|
+
f.defaultMuiPrevented || (b = m.current) == null || b.call(m, s, f);
|
|
773
773
|
};
|
|
774
774
|
p.current = r.$$subscribeEvent(l, o);
|
|
775
775
|
}
|
|
776
|
-
return
|
|
776
|
+
return d.current && e.registry && (e.registry.unregister(d.current), d.current = null), () => {
|
|
777
777
|
var o;
|
|
778
778
|
(o = p.current) == null || o.call(p), p.current = null;
|
|
779
779
|
};
|
|
780
780
|
}, [r, l]);
|
|
781
781
|
};
|
|
782
782
|
}
|
|
783
|
-
const
|
|
783
|
+
const xn = {
|
|
784
784
|
registry: null
|
|
785
|
-
},
|
|
785
|
+
}, En = hn(xn), Ge = (e = document) => {
|
|
786
786
|
const t = e.activeElement;
|
|
787
787
|
return t ? t.shadowRoot ? Ge(t.shadowRoot) : t : null;
|
|
788
|
-
},
|
|
788
|
+
}, Tn = (e, t) => {
|
|
789
789
|
let n = re(t).find((r) => {
|
|
790
790
|
if (!e.isItemNavigable(r))
|
|
791
791
|
return !1;
|
|
@@ -801,48 +801,48 @@ const hn = {
|
|
|
801
801
|
models: l,
|
|
802
802
|
rootRef: h
|
|
803
803
|
}) => {
|
|
804
|
-
const g =
|
|
805
|
-
const
|
|
806
|
-
n.focusedItemId !==
|
|
807
|
-
focusedItemId:
|
|
804
|
+
const g = Tn(e, l.selectedItems.value), p = U((i) => {
|
|
805
|
+
const u = typeof i == "function" ? i(n.focusedItemId) : i;
|
|
806
|
+
n.focusedItemId !== u && r((I) => C({}, I, {
|
|
807
|
+
focusedItemId: u
|
|
808
808
|
}));
|
|
809
|
-
}), m = E.useCallback(() => !!h.current && h.current.contains(Ge(
|
|
810
|
-
const
|
|
811
|
-
return
|
|
812
|
-
}, s = (i,
|
|
813
|
-
const I = e.getItemDOMElement(
|
|
814
|
-
I && I.focus(), p(
|
|
815
|
-
},
|
|
816
|
-
o(
|
|
809
|
+
}), m = E.useCallback(() => !!h.current && h.current.contains(Ge(Ht(h.current))), [h]), d = E.useCallback((i) => n.focusedItemId === i && m(), [n.focusedItemId, m]), o = (i) => {
|
|
810
|
+
const u = e.getItemMeta(i);
|
|
811
|
+
return u && (u.parentId == null || e.isItemExpanded(u.parentId));
|
|
812
|
+
}, s = (i, u) => {
|
|
813
|
+
const I = e.getItemDOMElement(u);
|
|
814
|
+
I && I.focus(), p(u), t.onItemFocus && t.onItemFocus(i, u);
|
|
815
|
+
}, f = U((i, u) => {
|
|
816
|
+
o(u) && s(i, u);
|
|
817
817
|
}), b = U(() => {
|
|
818
818
|
if (n.focusedItemId == null)
|
|
819
819
|
return;
|
|
820
820
|
if (e.getItemMeta(n.focusedItemId)) {
|
|
821
|
-
const
|
|
822
|
-
|
|
821
|
+
const u = e.getItemDOMElement(n.focusedItemId);
|
|
822
|
+
u && u.blur();
|
|
823
823
|
}
|
|
824
824
|
p(null);
|
|
825
825
|
}), x = (i) => i === g;
|
|
826
|
-
|
|
826
|
+
En(e, "removeItem", ({
|
|
827
827
|
id: i
|
|
828
828
|
}) => {
|
|
829
829
|
n.focusedItemId === i && s(null, g);
|
|
830
830
|
});
|
|
831
|
-
const c = (i) => (
|
|
831
|
+
const c = (i) => (u) => {
|
|
832
832
|
var I;
|
|
833
|
-
(I = i.onFocus) == null || I.call(i,
|
|
833
|
+
(I = i.onFocus) == null || I.call(i, u), !u.defaultMuiPrevented && u.target === u.currentTarget && s(u, g);
|
|
834
834
|
};
|
|
835
835
|
return {
|
|
836
836
|
getRootProps: (i) => ({
|
|
837
837
|
onFocus: c(i)
|
|
838
838
|
}),
|
|
839
839
|
publicAPI: {
|
|
840
|
-
focusItem:
|
|
840
|
+
focusItem: f
|
|
841
841
|
},
|
|
842
842
|
instance: {
|
|
843
|
-
isItemFocused:
|
|
843
|
+
isItemFocused: d,
|
|
844
844
|
canItemBeTabbed: x,
|
|
845
|
-
focusItem:
|
|
845
|
+
focusItem: f,
|
|
846
846
|
removeFocusedItem: b
|
|
847
847
|
}
|
|
848
848
|
};
|
|
@@ -853,7 +853,7 @@ ye.getInitialState = () => ({
|
|
|
853
853
|
ye.params = {
|
|
854
854
|
onItemFocus: !0
|
|
855
855
|
};
|
|
856
|
-
function
|
|
856
|
+
function yn(e) {
|
|
857
857
|
return !!e && e.length === 1 && !!e.match(/\S/);
|
|
858
858
|
}
|
|
859
859
|
const Je = ({
|
|
@@ -861,26 +861,26 @@ const Je = ({
|
|
|
861
861
|
params: t,
|
|
862
862
|
state: n
|
|
863
863
|
}) => {
|
|
864
|
-
const r =
|
|
864
|
+
const r = Xt(), l = E.useRef({}), h = U((o) => {
|
|
865
865
|
l.current = o(l.current);
|
|
866
866
|
});
|
|
867
867
|
E.useEffect(() => {
|
|
868
868
|
if (e.areItemUpdatesPrevented())
|
|
869
869
|
return;
|
|
870
|
-
const o = {}, s = (
|
|
871
|
-
o[
|
|
870
|
+
const o = {}, s = (f) => {
|
|
871
|
+
o[f.id] = f.label.substring(0, 1).toLowerCase();
|
|
872
872
|
};
|
|
873
873
|
Object.values(n.items.itemMetaMap).forEach(s), l.current = o;
|
|
874
874
|
}, [n.items.itemMetaMap, t.getItemId, e]);
|
|
875
875
|
const g = (o, s) => {
|
|
876
|
-
const
|
|
877
|
-
const I = ge(e,
|
|
876
|
+
const f = s.toLowerCase(), b = (u) => {
|
|
877
|
+
const I = ge(e, u);
|
|
878
878
|
return I === null ? se(e) : I;
|
|
879
879
|
};
|
|
880
880
|
let x = null, c = b(o);
|
|
881
881
|
const i = {};
|
|
882
882
|
for (; x == null && !i[c]; )
|
|
883
|
-
l.current[c] ===
|
|
883
|
+
l.current[c] === f ? x = c : (i[c] = !0, c = b(c));
|
|
884
884
|
return x;
|
|
885
885
|
}, p = (o) => !t.disableSelection && !e.isItemDisabled(o), m = (o) => !e.isItemDisabled(o) && e.isItemExpandable(o);
|
|
886
886
|
return {
|
|
@@ -889,7 +889,7 @@ const Je = ({
|
|
|
889
889
|
handleItemKeyDown: (o, s) => {
|
|
890
890
|
if (o.defaultMuiPrevented || o.altKey || he(o.target, o.currentTarget))
|
|
891
891
|
return;
|
|
892
|
-
const
|
|
892
|
+
const f = o.ctrlKey || o.metaKey, b = o.key;
|
|
893
893
|
switch (!0) {
|
|
894
894
|
// Select the item when pressing "Space"
|
|
895
895
|
case (b === " " && p(s)): {
|
|
@@ -922,14 +922,14 @@ const Je = ({
|
|
|
922
922
|
}
|
|
923
923
|
// Focuses the previous focusable item
|
|
924
924
|
case b === "ArrowUp": {
|
|
925
|
-
const x =
|
|
925
|
+
const x = Dt(e, s);
|
|
926
926
|
x && (o.preventDefault(), e.focusItem(o, x), t.multiSelect && o.shiftKey && p(x) && e.selectItemFromArrowNavigation(o, s, x));
|
|
927
927
|
break;
|
|
928
928
|
}
|
|
929
929
|
// If the focused item is expanded, we move the focus to its first child
|
|
930
930
|
// If the focused item is collapsed and has children, we expand it
|
|
931
931
|
case (b === "ArrowRight" && !r || b === "ArrowLeft" && r): {
|
|
932
|
-
if (
|
|
932
|
+
if (f)
|
|
933
933
|
return;
|
|
934
934
|
if (e.isItemExpanded(s)) {
|
|
935
935
|
const x = ge(e, s);
|
|
@@ -940,7 +940,7 @@ const Je = ({
|
|
|
940
940
|
// If the focused item is expanded, we collapse it
|
|
941
941
|
// If the focused item is collapsed and has a parent, we move the focus to this parent
|
|
942
942
|
case (b === "ArrowLeft" && !r || b === "ArrowRight" && r): {
|
|
943
|
-
if (
|
|
943
|
+
if (f)
|
|
944
944
|
return;
|
|
945
945
|
if (m(s) && e.isItemExpanded(s))
|
|
946
946
|
e.toggleItemExpansion(o, s), o.preventDefault();
|
|
@@ -952,12 +952,12 @@ const Je = ({
|
|
|
952
952
|
}
|
|
953
953
|
// Focuses the first item in the tree
|
|
954
954
|
case b === "Home": {
|
|
955
|
-
p(s) && t.multiSelect &&
|
|
955
|
+
p(s) && t.multiSelect && f && o.shiftKey ? e.selectRangeFromStartToItem(o, s) : e.focusItem(o, se(e)), o.preventDefault();
|
|
956
956
|
break;
|
|
957
957
|
}
|
|
958
958
|
// Focuses the last item in the tree
|
|
959
959
|
case b === "End": {
|
|
960
|
-
p(s) && t.multiSelect &&
|
|
960
|
+
p(s) && t.multiSelect && f && o.shiftKey ? e.selectRangeFromItemToEnd(o, s) : e.focusItem(o, Ne(e)), o.preventDefault();
|
|
961
961
|
break;
|
|
962
962
|
}
|
|
963
963
|
// Expand all siblings that are at the same level as the focused item
|
|
@@ -967,13 +967,13 @@ const Je = ({
|
|
|
967
967
|
}
|
|
968
968
|
// Multi select behavior when pressing Ctrl + a
|
|
969
969
|
// Selects all the items
|
|
970
|
-
case (String.fromCharCode(o.keyCode) === "A" &&
|
|
970
|
+
case (String.fromCharCode(o.keyCode) === "A" && f && t.multiSelect && !t.disableSelection): {
|
|
971
971
|
e.selectAllNavigableItems(o), o.preventDefault();
|
|
972
972
|
break;
|
|
973
973
|
}
|
|
974
974
|
// Type-ahead
|
|
975
975
|
// TODO: Support typing multiple characters
|
|
976
|
-
case (!
|
|
976
|
+
case (!f && !o.shiftKey && yn(b)): {
|
|
977
977
|
const x = g(s, b);
|
|
978
978
|
x != null && (e.focusItem(o, x), o.preventDefault());
|
|
979
979
|
break;
|
|
@@ -1004,7 +1004,7 @@ const Ye = ({
|
|
|
1004
1004
|
}
|
|
1005
1005
|
});
|
|
1006
1006
|
Ye.params = {};
|
|
1007
|
-
const
|
|
1007
|
+
const Cn = [X, le, ae, ye, Je, Ye, H];
|
|
1008
1008
|
function Qe(e) {
|
|
1009
1009
|
const {
|
|
1010
1010
|
instance: t,
|
|
@@ -1019,14 +1019,14 @@ function Qe(e) {
|
|
|
1019
1019
|
expansion: {
|
|
1020
1020
|
expansionTrigger: g
|
|
1021
1021
|
}
|
|
1022
|
-
} = Ke(), p = t.isItemExpandable(e), m = t.isItemExpanded(e),
|
|
1022
|
+
} = Ke(), p = t.isItemExpandable(e), m = t.isItemExpanded(e), d = t.isItemFocused(e), o = t.isItemSelected(e), s = t.isItemDisabled(e), f = t != null && t.isItemBeingEdited ? t == null ? void 0 : t.isItemBeingEdited(e) : !1, b = t.isItemEditable ? t.isItemEditable(e) : !1, x = (y) => {
|
|
1023
1023
|
if (!s) {
|
|
1024
|
-
|
|
1024
|
+
d || t.focusItem(y, e);
|
|
1025
1025
|
const R = r && (y.shiftKey || y.ctrlKey || y.metaKey);
|
|
1026
1026
|
p && !(R && t.isItemExpanded(e)) && t.toggleItemExpansion(y, e);
|
|
1027
1027
|
}
|
|
1028
1028
|
}, c = (y) => {
|
|
1029
|
-
s || (
|
|
1029
|
+
s || (d || t.focusItem(y, e), r && (y.shiftKey || y.ctrlKey || y.metaKey) ? y.shiftKey ? t.expandSelectionRange(y, e) : t.selectItem({
|
|
1030
1030
|
event: y,
|
|
1031
1031
|
itemId: e,
|
|
1032
1032
|
keepExistingSelection: !0
|
|
@@ -1045,7 +1045,7 @@ function Qe(e) {
|
|
|
1045
1045
|
keepExistingSelection: r,
|
|
1046
1046
|
shouldBeSelected: y.target.checked
|
|
1047
1047
|
});
|
|
1048
|
-
},
|
|
1048
|
+
}, u = (y) => {
|
|
1049
1049
|
(y.shiftKey || y.ctrlKey || y.metaKey || s) && y.preventDefault();
|
|
1050
1050
|
}, I = () => {
|
|
1051
1051
|
oe(t, H) && t.isItemEditable(e) && (t.isItemBeingEdited(e) ? t.setEditedItemId(null) : t.setEditedItemId(e));
|
|
@@ -1054,16 +1054,16 @@ function Qe(e) {
|
|
|
1054
1054
|
disabled: s,
|
|
1055
1055
|
expanded: m,
|
|
1056
1056
|
selected: o,
|
|
1057
|
-
focused:
|
|
1057
|
+
focused: d,
|
|
1058
1058
|
editable: b,
|
|
1059
|
-
editing:
|
|
1059
|
+
editing: f,
|
|
1060
1060
|
disableSelection: h,
|
|
1061
1061
|
checkboxSelection: l,
|
|
1062
1062
|
handleExpansion: x,
|
|
1063
1063
|
handleSelection: c,
|
|
1064
1064
|
handleCheckboxSelection: i,
|
|
1065
1065
|
handleContentClick: n,
|
|
1066
|
-
preventSelection:
|
|
1066
|
+
preventSelection: u,
|
|
1067
1067
|
expansionTrigger: g,
|
|
1068
1068
|
toggleItemEditing: I,
|
|
1069
1069
|
handleSaveItemLabel: (y, R) => {
|
|
@@ -1074,7 +1074,7 @@ function Qe(e) {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
};
|
|
1076
1076
|
}
|
|
1077
|
-
const
|
|
1077
|
+
const wn = ["classes", "className", "displayIcon", "expansionIcon", "icon", "label", "itemId", "onClick", "onMouseDown", "dragAndDropOverlayProps", "labelInputProps"], Ce = /* @__PURE__ */ E.forwardRef(function(t, n) {
|
|
1078
1078
|
const {
|
|
1079
1079
|
classes: r,
|
|
1080
1080
|
className: l,
|
|
@@ -1082,15 +1082,15 @@ const Cn = ["classes", "className", "displayIcon", "expansionIcon", "icon", "lab
|
|
|
1082
1082
|
expansionIcon: g,
|
|
1083
1083
|
icon: p,
|
|
1084
1084
|
label: m,
|
|
1085
|
-
itemId:
|
|
1085
|
+
itemId: d,
|
|
1086
1086
|
onClick: o,
|
|
1087
1087
|
onMouseDown: s,
|
|
1088
|
-
dragAndDropOverlayProps:
|
|
1088
|
+
dragAndDropOverlayProps: f,
|
|
1089
1089
|
labelInputProps: b
|
|
1090
|
-
} = t, x = A(t,
|
|
1090
|
+
} = t, x = A(t, wn), {
|
|
1091
1091
|
disabled: c,
|
|
1092
1092
|
expanded: i,
|
|
1093
|
-
selected:
|
|
1093
|
+
selected: u,
|
|
1094
1094
|
focused: I,
|
|
1095
1095
|
editing: T,
|
|
1096
1096
|
editable: P,
|
|
@@ -1103,32 +1103,32 @@ const Cn = ["classes", "className", "displayIcon", "expansionIcon", "icon", "lab
|
|
|
1103
1103
|
preventSelection: L,
|
|
1104
1104
|
expansionTrigger: W,
|
|
1105
1105
|
toggleItemEditing: G
|
|
1106
|
-
} = Qe(
|
|
1106
|
+
} = Qe(d), j = p || g || h, J = E.useRef(null), ce = (M) => {
|
|
1107
1107
|
L(M), s && s(M);
|
|
1108
1108
|
}, ue = (M) => {
|
|
1109
1109
|
var Y;
|
|
1110
|
-
V == null || V(M,
|
|
1110
|
+
V == null || V(M, d), !((Y = J.current) != null && Y.contains(M.target)) && (W === "content" && v(M), R || F(M), o && o(M));
|
|
1111
1111
|
}, de = (M) => {
|
|
1112
1112
|
M.defaultMuiPrevented || G();
|
|
1113
1113
|
};
|
|
1114
1114
|
return (
|
|
1115
1115
|
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -- Key event is handled by the TreeView */
|
|
1116
1116
|
/* @__PURE__ */ je("div", C({}, x, {
|
|
1117
|
-
className: Be(r.root, l, i && r.expanded,
|
|
1117
|
+
className: Be(r.root, l, i && r.expanded, u && r.selected, I && r.focused, c && r.disabled, T && r.editing, P && r.editable),
|
|
1118
1118
|
onClick: ue,
|
|
1119
1119
|
onMouseDown: ce,
|
|
1120
1120
|
ref: n,
|
|
1121
1121
|
children: [/* @__PURE__ */ S("div", {
|
|
1122
1122
|
className: r.iconContainer,
|
|
1123
1123
|
children: j
|
|
1124
|
-
}), R && /* @__PURE__ */ S(
|
|
1124
|
+
}), R && /* @__PURE__ */ S(Wt, {
|
|
1125
1125
|
className: r.checkbox,
|
|
1126
|
-
checked:
|
|
1126
|
+
checked: u,
|
|
1127
1127
|
onChange: B,
|
|
1128
1128
|
disabled: c || y,
|
|
1129
1129
|
ref: J,
|
|
1130
1130
|
tabIndex: -1
|
|
1131
|
-
}), T ? /* @__PURE__ */ S(
|
|
1131
|
+
}), T ? /* @__PURE__ */ S(Ot, C({}, b, {
|
|
1132
1132
|
className: r.labelInput
|
|
1133
1133
|
})) : /* @__PURE__ */ S("div", C({
|
|
1134
1134
|
className: r.label
|
|
@@ -1136,7 +1136,7 @@ const Cn = ["classes", "className", "displayIcon", "expansionIcon", "icon", "lab
|
|
|
1136
1136
|
onDoubleClick: de
|
|
1137
1137
|
}, {
|
|
1138
1138
|
children: m
|
|
1139
|
-
})),
|
|
1139
|
+
})), f && /* @__PURE__ */ S(Vt, C({}, f))]
|
|
1140
1140
|
}))
|
|
1141
1141
|
);
|
|
1142
1142
|
});
|
|
@@ -1184,7 +1184,7 @@ process.env.NODE_ENV !== "production" && (Ce.propTypes = {
|
|
|
1184
1184
|
value: a.string
|
|
1185
1185
|
})
|
|
1186
1186
|
});
|
|
1187
|
-
const
|
|
1187
|
+
const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "ContentProps", "itemId", "id", "label", "onClick", "onMouseDown", "onFocus", "onBlur", "onKeyDown"], Sn = ["ownerState"], Pn = ["ownerState"], vn = ["ownerState"], kn = Ue(), Mn = (e) => {
|
|
1188
1188
|
const {
|
|
1189
1189
|
classes: t
|
|
1190
1190
|
} = e;
|
|
@@ -1202,8 +1202,8 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1202
1202
|
editing: ["editing"],
|
|
1203
1203
|
editable: ["editable"],
|
|
1204
1204
|
groupTransition: ["groupTransition"]
|
|
1205
|
-
},
|
|
1206
|
-
},
|
|
1205
|
+
}, jt, t);
|
|
1206
|
+
}, Dn = ie("li", {
|
|
1207
1207
|
name: "MuiTreeItem",
|
|
1208
1208
|
slot: "Root",
|
|
1209
1209
|
overridesResolver: (e, t) => t.root
|
|
@@ -1212,7 +1212,7 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1212
1212
|
margin: 0,
|
|
1213
1213
|
padding: 0,
|
|
1214
1214
|
outline: 0
|
|
1215
|
-
}),
|
|
1215
|
+
}), On = ie(Ce, {
|
|
1216
1216
|
name: "MuiTreeItem",
|
|
1217
1217
|
slot: "Content",
|
|
1218
1218
|
overridesResolver: (e, t) => [t.content, t.iconContainer && {
|
|
@@ -1290,7 +1290,7 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1290
1290
|
paddingLeft: `calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
|
|
1291
1291
|
}
|
|
1292
1292
|
}]
|
|
1293
|
-
})),
|
|
1293
|
+
})), Vn = ie(Gt, {
|
|
1294
1294
|
name: "MuiTreeItem",
|
|
1295
1295
|
slot: "GroupTransition",
|
|
1296
1296
|
overridesResolver: (e, t) => t.groupTransition,
|
|
@@ -1322,9 +1322,9 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1322
1322
|
expansion: {
|
|
1323
1323
|
expansionTrigger: m
|
|
1324
1324
|
},
|
|
1325
|
-
treeId:
|
|
1325
|
+
treeId: d,
|
|
1326
1326
|
instance: o
|
|
1327
|
-
} = Ke(), s = E.useContext(
|
|
1327
|
+
} = Ke(), s = E.useContext($e), f = kn({
|
|
1328
1328
|
props: t,
|
|
1329
1329
|
name: "MuiTreeItem"
|
|
1330
1330
|
}), {
|
|
@@ -1332,7 +1332,7 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1332
1332
|
className: x,
|
|
1333
1333
|
slots: c,
|
|
1334
1334
|
slotProps: i,
|
|
1335
|
-
ContentComponent:
|
|
1335
|
+
ContentComponent: u = Ce,
|
|
1336
1336
|
ContentProps: I,
|
|
1337
1337
|
itemId: T,
|
|
1338
1338
|
id: P,
|
|
@@ -1341,7 +1341,7 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1341
1341
|
onMouseDown: v,
|
|
1342
1342
|
onBlur: F,
|
|
1343
1343
|
onKeyDown: B
|
|
1344
|
-
} =
|
|
1344
|
+
} = f, V = A(f, Rn), {
|
|
1345
1345
|
expanded: L,
|
|
1346
1346
|
focused: W,
|
|
1347
1347
|
selected: G,
|
|
@@ -1351,24 +1351,24 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1351
1351
|
handleCancelItemLabelEditing: ue,
|
|
1352
1352
|
handleSaveItemLabel: de
|
|
1353
1353
|
} = Qe(T);
|
|
1354
|
-
process.env.NODE_ENV !== "production" && (
|
|
1354
|
+
process.env.NODE_ENV !== "production" && (f.ContentComponent && xe(["MUI X: The ContentComponent prop of the TreeItem component is deprecated and will be removed in the next major release.", "You can use the new TreeItem2 component or the new useTreeItem2 hook to customize the rendering of the content.", "For more detail, see https://mui.com/x/react-tree-view/tree-item-customization/."]), f.ContentProps && xe(["MUI X: The ContentProps prop of the TreeItem component is deprecated and will be removed in the next major release.", "You can use the new TreeItem2 component or the new useTreeItem2 hook to customize the rendering of the content.", "For more detail, see https://mui.com/x/react-tree-view/tree-item-customization/."]));
|
|
1355
1355
|
const {
|
|
1356
1356
|
contentRef: M,
|
|
1357
1357
|
rootRef: Y,
|
|
1358
1358
|
propsEnhancers: D
|
|
1359
|
-
} = l(
|
|
1360
|
-
expandIcon: (c == null ? void 0 : c.expandIcon) ?? r.slots.expandIcon ??
|
|
1361
|
-
collapseIcon: (c == null ? void 0 : c.collapseIcon) ?? r.slots.collapseIcon ??
|
|
1359
|
+
} = l(f), Q = E.useRef(null), we = E.useRef(null), nt = Ee(n, Y, Q), ot = Ee(I == null ? void 0 : I.ref, M, we), z = {
|
|
1360
|
+
expandIcon: (c == null ? void 0 : c.expandIcon) ?? r.slots.expandIcon ?? Ft,
|
|
1361
|
+
collapseIcon: (c == null ? void 0 : c.collapseIcon) ?? r.slots.collapseIcon ?? At,
|
|
1362
1362
|
endIcon: (c == null ? void 0 : c.endIcon) ?? r.slots.endIcon,
|
|
1363
1363
|
icon: c == null ? void 0 : c.icon,
|
|
1364
1364
|
groupTransition: c == null ? void 0 : c.groupTransition
|
|
1365
|
-
}, Re = (w) => Array.isArray(w) ? w.length > 0 && w.some(Re) : !!w, Z = Re(b), fe = C({},
|
|
1365
|
+
}, Re = (w) => Array.isArray(w) ? w.length > 0 && w.some(Re) : !!w, Z = Re(b), fe = C({}, f, {
|
|
1366
1366
|
expanded: L,
|
|
1367
1367
|
focused: W,
|
|
1368
1368
|
selected: G,
|
|
1369
1369
|
disabled: j,
|
|
1370
1370
|
indentationAtItemLevel: g
|
|
1371
|
-
}), k =
|
|
1371
|
+
}), k = Mn(fe), Se = z.groupTransition ?? void 0, rt = N({
|
|
1372
1372
|
elementType: Se,
|
|
1373
1373
|
ownerState: {},
|
|
1374
1374
|
externalSlotProps: i == null ? void 0 : i.groupTransition,
|
|
@@ -1386,36 +1386,36 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1386
1386
|
}, pe = L ? z.collapseIcon : z.expandIcon, it = N({
|
|
1387
1387
|
elementType: pe,
|
|
1388
1388
|
ownerState: {},
|
|
1389
|
-
externalSlotProps: (w) => L ? C({},
|
|
1389
|
+
externalSlotProps: (w) => L ? C({}, $(r.slotProps.collapseIcon, w), $(i == null ? void 0 : i.collapseIcon, w)) : C({}, $(r.slotProps.expandIcon, w), $(i == null ? void 0 : i.expandIcon, w)),
|
|
1390
1390
|
additionalProps: {
|
|
1391
1391
|
onClick: st
|
|
1392
1392
|
}
|
|
1393
|
-
}), lt = A(it,
|
|
1393
|
+
}), lt = A(it, Sn), at = Z && pe ? /* @__PURE__ */ S(pe, C({}, lt)) : null, me = Z ? void 0 : z.endIcon, ct = N({
|
|
1394
1394
|
elementType: me,
|
|
1395
1395
|
ownerState: {},
|
|
1396
|
-
externalSlotProps: (w) => Z ? {} : C({},
|
|
1397
|
-
}), ut = A(ct,
|
|
1396
|
+
externalSlotProps: (w) => Z ? {} : C({}, $(r.slotProps.endIcon, w), $(i == null ? void 0 : i.endIcon, w))
|
|
1397
|
+
}), ut = A(ct, Pn), dt = me ? /* @__PURE__ */ S(me, C({}, ut)) : null, Ie = z.icon, ft = N({
|
|
1398
1398
|
elementType: Ie,
|
|
1399
1399
|
ownerState: {},
|
|
1400
1400
|
externalSlotProps: i == null ? void 0 : i.icon
|
|
1401
|
-
}), pt = A(ft,
|
|
1401
|
+
}), pt = A(ft, vn), mt = Ie ? /* @__PURE__ */ S(Ie, C({}, pt)) : null;
|
|
1402
1402
|
let ee;
|
|
1403
1403
|
G ? ee = !0 : p || j ? ee = void 0 : ee = !1;
|
|
1404
1404
|
function It(w) {
|
|
1405
1405
|
!W && (!j || h) && w.currentTarget === w.target && o.focusItem(w, T);
|
|
1406
1406
|
}
|
|
1407
1407
|
function gt(w) {
|
|
1408
|
-
var
|
|
1408
|
+
var _, q, Ve, Ae;
|
|
1409
1409
|
F == null || F(w), !(J || // we can exit the editing state by clicking outside the input (within the Tree Item) or by pressing Enter or Escape -> we don't want to remove the focused item from the state in these cases
|
|
1410
1410
|
// we can also exit the editing state by clicking on the root itself -> want to remove the focused item from the state in this case
|
|
1411
|
-
w.relatedTarget && he(w.relatedTarget, Q.current) && (w.target && ((q = (
|
|
1411
|
+
w.relatedTarget && he(w.relatedTarget, Q.current) && (w.target && ((q = (_ = w.target) == null ? void 0 : _.dataset) == null ? void 0 : q.element) === "labelInput" && he(w.target, Q.current) || ((Ae = (Ve = w.relatedTarget) == null ? void 0 : Ve.dataset) == null ? void 0 : Ae.element) === "labelInput")) && o.removeFocusedItem();
|
|
1412
1412
|
}
|
|
1413
1413
|
const bt = (w) => {
|
|
1414
|
-
var
|
|
1415
|
-
B == null || B(w), ((q = (
|
|
1416
|
-
}, ht =
|
|
1414
|
+
var _, q;
|
|
1415
|
+
B == null || B(w), ((q = (_ = w.target) == null ? void 0 : _.dataset) == null ? void 0 : q.element) !== "labelInput" && o.handleItemKeyDown(w, T);
|
|
1416
|
+
}, ht = _e({
|
|
1417
1417
|
itemId: T,
|
|
1418
|
-
treeId:
|
|
1418
|
+
treeId: d,
|
|
1419
1419
|
id: P
|
|
1420
1420
|
}), xt = o.canItemBeTabbed(T) ? 0 : -1, te = {
|
|
1421
1421
|
rootRefObject: Q,
|
|
@@ -1433,9 +1433,9 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1433
1433
|
}))) ?? {}, ve = ((Oe = D.labelInput) == null ? void 0 : Oe.call(D, C({}, te, {
|
|
1434
1434
|
externalEventHandlers: {}
|
|
1435
1435
|
}))) ?? {};
|
|
1436
|
-
return /* @__PURE__ */ S(
|
|
1436
|
+
return /* @__PURE__ */ S(Lt, {
|
|
1437
1437
|
itemId: T,
|
|
1438
|
-
children: /* @__PURE__ */ je(
|
|
1438
|
+
children: /* @__PURE__ */ je(Dn, C({
|
|
1439
1439
|
className: Be(k.root, x),
|
|
1440
1440
|
role: "treeitem",
|
|
1441
1441
|
"aria-expanded": Z ? L : void 0,
|
|
@@ -1453,8 +1453,8 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1453
1453
|
"--TreeView-itemDepth": typeof s == "function" ? s(T) : s
|
|
1454
1454
|
}) : V.style
|
|
1455
1455
|
}, Et, {
|
|
1456
|
-
children: [/* @__PURE__ */ S(
|
|
1457
|
-
as:
|
|
1456
|
+
children: [/* @__PURE__ */ S(On, C({
|
|
1457
|
+
as: u,
|
|
1458
1458
|
classes: {
|
|
1459
1459
|
root: k.content,
|
|
1460
1460
|
expanded: k.expanded,
|
|
@@ -1482,7 +1482,7 @@ const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1482
1482
|
labelInputProps: ve
|
|
1483
1483
|
}, {
|
|
1484
1484
|
ref: ot
|
|
1485
|
-
})), b && /* @__PURE__ */ S(
|
|
1485
|
+
})), b && /* @__PURE__ */ S(Vn, C({
|
|
1486
1486
|
as: Se
|
|
1487
1487
|
}, rt, {
|
|
1488
1488
|
children: b
|
|
@@ -1509,7 +1509,7 @@ process.env.NODE_ENV !== "production" && (Ze.propTypes = {
|
|
|
1509
1509
|
* @deprecated Consider using the `<TreeItem2 />` component or the `useTreeItem2` hook instead. For more details, see https://mui.com/x/react-tree-view/tree-item-customization/.
|
|
1510
1510
|
* @default TreeItemContent
|
|
1511
1511
|
*/
|
|
1512
|
-
ContentComponent:
|
|
1512
|
+
ContentComponent: Yt,
|
|
1513
1513
|
/**
|
|
1514
1514
|
* Props applied to ContentComponent.
|
|
1515
1515
|
* @deprecated Consider using the `<TreeItem2 />` component or the `useTreeItem2` hook instead. For more details, see https://mui.com/x/react-tree-view/tree-item-customization/.
|
|
@@ -1532,7 +1532,7 @@ process.env.NODE_ENV !== "production" && (Ze.propTypes = {
|
|
|
1532
1532
|
* This prop isn't supported.
|
|
1533
1533
|
* Use the `onItemFocus` callback on the tree if you need to monitor a item's focus.
|
|
1534
1534
|
*/
|
|
1535
|
-
onFocus:
|
|
1535
|
+
onFocus: Jt,
|
|
1536
1536
|
/**
|
|
1537
1537
|
* Callback fired when a key of the keyboard is pressed on the item.
|
|
1538
1538
|
*/
|
|
@@ -1552,8 +1552,8 @@ process.env.NODE_ENV !== "production" && (Ze.propTypes = {
|
|
|
1552
1552
|
*/
|
|
1553
1553
|
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object])
|
|
1554
1554
|
});
|
|
1555
|
-
const
|
|
1556
|
-
function
|
|
1555
|
+
const An = ["ownerState"];
|
|
1556
|
+
function Fn({
|
|
1557
1557
|
slots: e,
|
|
1558
1558
|
slotProps: t,
|
|
1559
1559
|
label: n,
|
|
@@ -1573,13 +1573,13 @@ function An({
|
|
|
1573
1573
|
itemId: l,
|
|
1574
1574
|
label: n
|
|
1575
1575
|
}
|
|
1576
|
-
}), m = A(p,
|
|
1576
|
+
}), m = A(p, An), d = E.useMemo(() => h ? /* @__PURE__ */ S(et, {
|
|
1577
1577
|
itemsToRender: h,
|
|
1578
1578
|
slots: e,
|
|
1579
1579
|
slotProps: t
|
|
1580
1580
|
}) : null, [h, e, t]);
|
|
1581
1581
|
return /* @__PURE__ */ S(g, C({}, m, {
|
|
1582
|
-
children:
|
|
1582
|
+
children: d
|
|
1583
1583
|
}));
|
|
1584
1584
|
}
|
|
1585
1585
|
function et(e) {
|
|
@@ -1589,7 +1589,7 @@ function et(e) {
|
|
|
1589
1589
|
slotProps: r
|
|
1590
1590
|
} = e;
|
|
1591
1591
|
return /* @__PURE__ */ S(E.Fragment, {
|
|
1592
|
-
children: t.map((l) => /* @__PURE__ */ S(
|
|
1592
|
+
children: t.map((l) => /* @__PURE__ */ S(Fn, {
|
|
1593
1593
|
slots: n,
|
|
1594
1594
|
slotProps: r,
|
|
1595
1595
|
label: l.label,
|
|
@@ -1599,14 +1599,14 @@ function et(e) {
|
|
|
1599
1599
|
}, l.itemId))
|
|
1600
1600
|
});
|
|
1601
1601
|
}
|
|
1602
|
-
const
|
|
1602
|
+
const Ln = Ue(), jn = (e) => {
|
|
1603
1603
|
const {
|
|
1604
1604
|
classes: t
|
|
1605
1605
|
} = e;
|
|
1606
1606
|
return ze({
|
|
1607
1607
|
root: ["root"]
|
|
1608
|
-
},
|
|
1609
|
-
},
|
|
1608
|
+
}, Qt, t);
|
|
1609
|
+
}, _n = ie("ul", {
|
|
1610
1610
|
name: "MuiRichTreeView",
|
|
1611
1611
|
slot: "Root",
|
|
1612
1612
|
overridesResolver: (e, t) => t.root
|
|
@@ -1617,7 +1617,7 @@ const Fn = Ue(), Ln = (e) => {
|
|
|
1617
1617
|
outline: 0,
|
|
1618
1618
|
position: "relative"
|
|
1619
1619
|
}), tt = /* @__PURE__ */ E.forwardRef(function(t, n) {
|
|
1620
|
-
const r =
|
|
1620
|
+
const r = Ln({
|
|
1621
1621
|
props: t,
|
|
1622
1622
|
name: "MuiRichTreeView"
|
|
1623
1623
|
});
|
|
@@ -1626,21 +1626,21 @@ const Fn = Ue(), Ln = (e) => {
|
|
|
1626
1626
|
getRootProps: l,
|
|
1627
1627
|
contextValue: h,
|
|
1628
1628
|
instance: g
|
|
1629
|
-
} =
|
|
1630
|
-
plugins:
|
|
1629
|
+
} = an({
|
|
1630
|
+
plugins: Cn,
|
|
1631
1631
|
rootRef: n,
|
|
1632
1632
|
props: r
|
|
1633
1633
|
}), {
|
|
1634
1634
|
slots: p,
|
|
1635
1635
|
slotProps: m
|
|
1636
|
-
} = r,
|
|
1636
|
+
} = r, d = jn(r), o = (p == null ? void 0 : p.root) ?? _n, s = N({
|
|
1637
1637
|
elementType: o,
|
|
1638
1638
|
externalSlotProps: m == null ? void 0 : m.root,
|
|
1639
|
-
className:
|
|
1639
|
+
className: d.root,
|
|
1640
1640
|
getSlotProps: l,
|
|
1641
1641
|
ownerState: r
|
|
1642
1642
|
});
|
|
1643
|
-
return /* @__PURE__ */ S(
|
|
1643
|
+
return /* @__PURE__ */ S(cn, {
|
|
1644
1644
|
value: h,
|
|
1645
1645
|
children: /* @__PURE__ */ S(o, C({}, s, {
|
|
1646
1646
|
children: /* @__PURE__ */ S(et, {
|
|
@@ -1839,47 +1839,46 @@ process.env.NODE_ENV !== "production" && (tt.propTypes = {
|
|
|
1839
1839
|
*/
|
|
1840
1840
|
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object])
|
|
1841
1841
|
});
|
|
1842
|
-
const
|
|
1842
|
+
const io = ({
|
|
1843
1843
|
items: e,
|
|
1844
1844
|
selectedItemId: t,
|
|
1845
1845
|
handleSelectedItemChange: n,
|
|
1846
1846
|
iconColor: r = "primary"
|
|
1847
1847
|
}) => {
|
|
1848
|
-
const [l, h] = Ct([]), g = wt(() =>
|
|
1848
|
+
const [l, h] = Ct([]), g = wt(() => Kt(e), [e]);
|
|
1849
1849
|
return Rt(() => {
|
|
1850
1850
|
if (t) {
|
|
1851
|
-
const m =
|
|
1851
|
+
const m = Ut(e, t);
|
|
1852
1852
|
if (m) {
|
|
1853
|
-
const
|
|
1853
|
+
const d = m.slice(0, -1);
|
|
1854
1854
|
h((o) => {
|
|
1855
|
-
const s =
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
}), u ? s : o;
|
|
1855
|
+
const s = d.filter(
|
|
1856
|
+
(f) => !o.includes(f)
|
|
1857
|
+
);
|
|
1858
|
+
return s.length > 0 ? [...o, ...s] : o;
|
|
1860
1859
|
});
|
|
1861
1860
|
}
|
|
1862
1861
|
}
|
|
1863
|
-
}, [t, e]), /* @__PURE__ */ S(yt, { sx:
|
|
1862
|
+
}, [t, e]), /* @__PURE__ */ S(yt, { sx: $t, "data-treeview-root": "true", children: /* @__PURE__ */ S(
|
|
1864
1863
|
tt,
|
|
1865
1864
|
{
|
|
1866
1865
|
items: e,
|
|
1867
1866
|
selectedItems: t,
|
|
1868
1867
|
expandedItems: l,
|
|
1869
|
-
onExpandedItemsChange: (m,
|
|
1870
|
-
h(
|
|
1868
|
+
onExpandedItemsChange: (m, d) => {
|
|
1869
|
+
h(d);
|
|
1871
1870
|
},
|
|
1872
|
-
itemChildrenIndentation:
|
|
1871
|
+
itemChildrenIndentation: Nt,
|
|
1873
1872
|
onSelectedItemsChange: n,
|
|
1874
|
-
getItemId:
|
|
1873
|
+
getItemId: Bt,
|
|
1875
1874
|
slots: {
|
|
1876
1875
|
item: (m) => {
|
|
1877
|
-
const
|
|
1876
|
+
const d = m.itemId ? g[m.itemId] : void 0;
|
|
1878
1877
|
return /* @__PURE__ */ S(
|
|
1879
|
-
|
|
1878
|
+
_t,
|
|
1880
1879
|
{
|
|
1881
1880
|
...m,
|
|
1882
|
-
itemData:
|
|
1881
|
+
itemData: d,
|
|
1883
1882
|
iconColor: r
|
|
1884
1883
|
}
|
|
1885
1884
|
);
|
|
@@ -1889,5 +1888,5 @@ const so = ({
|
|
|
1889
1888
|
) });
|
|
1890
1889
|
};
|
|
1891
1890
|
export {
|
|
1892
|
-
|
|
1891
|
+
io as default
|
|
1893
1892
|
};
|