@cgi-learning-hub/ui 1.4.0-dev.1742394029 → 1.4.0-dev.1742469130
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/components/TreeView/TreeView.cjs.js +7 -7
- package/dist/components/TreeView/TreeView.es.js +414 -414
- package/dist/components/TreeView/style.cjs.js +1 -1
- package/dist/components/TreeView/style.es.js +15 -10
- package/dist/components/TreeView/types.d.ts +4 -0
- package/dist/components/stories/TreeView.stories.cjs.js +9 -3
- package/dist/components/stories/TreeView.stories.d.ts +1 -0
- package/dist/components/stories/TreeView.stories.es.js +267 -144
- package/package.json +1 -1
- package/dist/components/TreeView/style.d.ts +0 -12
|
@@ -1,65 +1,64 @@
|
|
|
1
1
|
import { jsx as S, jsxs as je } from "react/jsx-runtime";
|
|
2
|
-
import { B as yt } from "../../Box-C-j-U8SH.js";
|
|
3
2
|
import * as E from "react";
|
|
4
|
-
import { useState as
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import { buildItemDataMap as
|
|
3
|
+
import { useState as yt, useMemo as Ct, useEffect as wt } from "react";
|
|
4
|
+
import { a as Rt, T as St, b as _e, d as $e, e as Ne, f as se, h as Pt, i as vt, j as kt, k as he, l as ge, m as Mt, n as oe, u as H, o as Ke, p as Dt, q as Ot, r as Ue, w as xe, s as Vt, t as At, v as Ft, x as Lt, y as O, C as jt, z as _t } from "../../CustomTreeItem-BpAK85gf.js";
|
|
5
|
+
import { TreeContainer as $t, DEFAULT_CHILDREN_INDENT as Nt } from "./style.es.js";
|
|
6
|
+
import { buildItemDataMap as Kt, findItemPath as Ut, getItemId as Bt } from "./utils.es.js";
|
|
8
7
|
import { _ as C } from "../../ButtonBase-CZFKUUHD.js";
|
|
9
|
-
import { H as
|
|
8
|
+
import { H as zt, G as qt, I as Be, P as a, n as ne } from "../../generateUtilityClasses-CqzQXpT_.js";
|
|
10
9
|
import { a as A } from "../../TransitionGroupContext-DbLioz_6.js";
|
|
11
10
|
import { u as U } from "../../useEventCallback-BAQJJ3ye.js";
|
|
12
|
-
import { o as
|
|
13
|
-
import { u as
|
|
14
|
-
import { C as
|
|
11
|
+
import { o as Ht } from "../../ownerDocument-CUrv0DIK.js";
|
|
12
|
+
import { u as Xt } from "../../index-sDFEVHTg.js";
|
|
13
|
+
import { C as Wt } from "../../Checkbox-1Zr36vDa.js";
|
|
15
14
|
import { u as Ee } from "../../useForkRef-C_4o__cU.js";
|
|
16
15
|
import { u as N } from "../../useSlotProps-Ceyorp-u.js";
|
|
17
16
|
import { r as $, e as Fe } from "../../resolveComponentProps-Ctw0-dUN.js";
|
|
18
17
|
import { s as ie, c as ze, f as qe } from "../../DefaultPropsProvider-CXfMJdg8.js";
|
|
19
|
-
import { u as
|
|
20
|
-
import { e as
|
|
21
|
-
function
|
|
22
|
-
return
|
|
18
|
+
import { u as Gt } from "../../unsupportedProp-BuVD30Gh.js";
|
|
19
|
+
import { e as Jt } from "../../elementTypeAcceptingRef-1usJq_B8.js";
|
|
20
|
+
function Yt(e) {
|
|
21
|
+
return zt("MuiRichTreeView", e);
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
const
|
|
23
|
+
qt("MuiRichTreeView", ["root"]);
|
|
24
|
+
const Qt = (e, t) => {
|
|
26
25
|
const n = E.useRef({}), [r, l] = E.useState(() => {
|
|
27
|
-
const
|
|
26
|
+
const m = {};
|
|
28
27
|
return e.forEach((p) => {
|
|
29
|
-
p.models && Object.entries(p.models).forEach(([
|
|
30
|
-
n.current[
|
|
31
|
-
isControlled: t[
|
|
32
|
-
getDefaultValue:
|
|
33
|
-
}, g
|
|
28
|
+
p.models && Object.entries(p.models).forEach(([g, u]) => {
|
|
29
|
+
n.current[g] = {
|
|
30
|
+
isControlled: t[g] !== void 0,
|
|
31
|
+
getDefaultValue: u.getDefaultValue
|
|
32
|
+
}, m[g] = u.getDefaultValue(t);
|
|
34
33
|
});
|
|
35
|
-
}),
|
|
36
|
-
}),
|
|
37
|
-
const
|
|
38
|
-
return [
|
|
39
|
-
value:
|
|
40
|
-
setControlledValue: (
|
|
34
|
+
}), m;
|
|
35
|
+
}), x = Object.fromEntries(Object.entries(n.current).map(([m, p]) => {
|
|
36
|
+
const g = t[m] ?? r[m];
|
|
37
|
+
return [m, {
|
|
38
|
+
value: g,
|
|
39
|
+
setControlledValue: (u) => {
|
|
41
40
|
p.isControlled || l((o) => C({}, o, {
|
|
42
|
-
[
|
|
41
|
+
[m]: u
|
|
43
42
|
}));
|
|
44
43
|
}
|
|
45
44
|
}];
|
|
46
45
|
}));
|
|
47
|
-
return process.env.NODE_ENV !== "production" && Object.entries(n.current).forEach(([
|
|
48
|
-
const
|
|
46
|
+
return process.env.NODE_ENV !== "production" && Object.entries(n.current).forEach(([m, p]) => {
|
|
47
|
+
const g = t[m], u = p.getDefaultValue(t);
|
|
49
48
|
E.useEffect(() => {
|
|
50
|
-
p.isControlled !== (
|
|
49
|
+
p.isControlled !== (g !== void 0) && console.error([`MUI X: A component is changing the ${p.isControlled ? "" : "un"}controlled ${m} 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 ${m} 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(`
|
|
51
50
|
`));
|
|
52
|
-
}, [
|
|
51
|
+
}, [g]);
|
|
53
52
|
const {
|
|
54
53
|
current: o
|
|
55
|
-
} = E.useRef(
|
|
54
|
+
} = E.useRef(u);
|
|
56
55
|
E.useEffect(() => {
|
|
57
|
-
!p.isControlled && o !==
|
|
56
|
+
!p.isControlled && o !== u && console.error([`MUI X: A component is changing the default ${m} state of an uncontrolled TreeView after being initialized. To suppress this warning opt to use a controlled TreeView.`].join(`
|
|
58
57
|
`));
|
|
59
|
-
}, [JSON.stringify(
|
|
60
|
-
}),
|
|
58
|
+
}, [JSON.stringify(u)]);
|
|
59
|
+
}), x;
|
|
61
60
|
};
|
|
62
|
-
class
|
|
61
|
+
class Zt {
|
|
63
62
|
constructor() {
|
|
64
63
|
this.maxListeners = 20, this.warnOnce = !1, this.events = {};
|
|
65
64
|
}
|
|
@@ -69,8 +68,8 @@ class en {
|
|
|
69
68
|
highPriority: /* @__PURE__ */ new Map(),
|
|
70
69
|
regular: /* @__PURE__ */ new Map()
|
|
71
70
|
}, this.events[t] = l), r.isFirst ? l.highPriority.set(n, !0) : l.regular.set(n, !0), process.env.NODE_ENV !== "production") {
|
|
72
|
-
const
|
|
73
|
-
|
|
71
|
+
const x = l.highPriority.size + l.regular.size;
|
|
72
|
+
x > this.maxListeners && !this.warnOnce && (this.warnOnce = !0, console.warn([`Possible EventEmitter memory leak detected. ${x} ${t} listeners added.`].join(`
|
|
74
73
|
`)));
|
|
75
74
|
}
|
|
76
75
|
}
|
|
@@ -84,27 +83,27 @@ class en {
|
|
|
84
83
|
const r = this.events[t];
|
|
85
84
|
if (!r)
|
|
86
85
|
return;
|
|
87
|
-
const l = Array.from(r.highPriority.keys()),
|
|
88
|
-
for (let
|
|
89
|
-
const p = l[
|
|
86
|
+
const l = Array.from(r.highPriority.keys()), x = Array.from(r.regular.keys());
|
|
87
|
+
for (let m = l.length - 1; m >= 0; m -= 1) {
|
|
88
|
+
const p = l[m];
|
|
90
89
|
r.highPriority.has(p) && p.apply(this, n);
|
|
91
90
|
}
|
|
92
|
-
for (let
|
|
93
|
-
const p =
|
|
91
|
+
for (let m = 0; m < x.length; m += 1) {
|
|
92
|
+
const p = x[m];
|
|
94
93
|
r.regular.has(p) && p.apply(this, n);
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
once(t, n) {
|
|
98
97
|
const r = this;
|
|
99
|
-
this.on(t, function l(...
|
|
100
|
-
r.removeListener(t, l), n.apply(r,
|
|
98
|
+
this.on(t, function l(...x) {
|
|
99
|
+
r.removeListener(t, l), n.apply(r, x);
|
|
101
100
|
});
|
|
102
101
|
}
|
|
103
102
|
}
|
|
104
|
-
const
|
|
105
|
-
const [e] = E.useState(() => new
|
|
106
|
-
const [l,
|
|
107
|
-
|
|
103
|
+
const en = (e) => e.isPropagationStopped !== void 0, He = () => {
|
|
104
|
+
const [e] = E.useState(() => new Zt()), t = E.useCallback((...r) => {
|
|
105
|
+
const [l, x, m = {}] = r;
|
|
106
|
+
m.defaultMuiPrevented = !1, !(en(m) && m.isPropagationStopped()) && e.emit(l, x, m);
|
|
108
107
|
}, [e]), n = E.useCallback((r, l) => (e.on(r, l), () => {
|
|
109
108
|
e.removeListener(r, l);
|
|
110
109
|
}), [e]);
|
|
@@ -135,7 +134,7 @@ const Te = ({
|
|
|
135
134
|
E.useEffect(() => {
|
|
136
135
|
n((l) => l.id.treeId === e.id && l.id.treeId !== void 0 ? l : C({}, l, {
|
|
137
136
|
id: C({}, l.id, {
|
|
138
|
-
treeId: e.id ??
|
|
137
|
+
treeId: e.id ?? Rt()
|
|
139
138
|
})
|
|
140
139
|
}));
|
|
141
140
|
}, [n, e.id]);
|
|
@@ -159,7 +158,7 @@ Te.getInitialState = ({
|
|
|
159
158
|
treeId: e ?? void 0
|
|
160
159
|
}
|
|
161
160
|
});
|
|
162
|
-
const
|
|
161
|
+
const tn = [He, Xe, Te], nn = ["slots", "slotProps", "apiRef", "experimentalFeatures"], on = (e) => {
|
|
163
162
|
let {
|
|
164
163
|
props: {
|
|
165
164
|
slots: t,
|
|
@@ -167,144 +166,144 @@ const nn = [He, Xe, Te], on = ["slots", "slotProps", "apiRef", "experimentalFeat
|
|
|
167
166
|
apiRef: r,
|
|
168
167
|
experimentalFeatures: l
|
|
169
168
|
},
|
|
170
|
-
plugins:
|
|
171
|
-
} = e,
|
|
169
|
+
plugins: x
|
|
170
|
+
} = e, m = A(e.props, nn);
|
|
172
171
|
const p = {};
|
|
173
|
-
|
|
174
|
-
Object.assign(p,
|
|
172
|
+
x.forEach((d) => {
|
|
173
|
+
Object.assign(p, d.params);
|
|
175
174
|
});
|
|
176
|
-
const
|
|
177
|
-
Object.keys(
|
|
178
|
-
const b =
|
|
179
|
-
p[
|
|
175
|
+
const g = {}, u = {};
|
|
176
|
+
Object.keys(m).forEach((d) => {
|
|
177
|
+
const b = m[d];
|
|
178
|
+
p[d] ? g[d] = b : u[d] = b;
|
|
180
179
|
});
|
|
181
|
-
const o = l ?? {}, s =
|
|
182
|
-
params:
|
|
180
|
+
const o = l ?? {}, s = x.reduce((d, b) => b.getDefaultizedParams ? b.getDefaultizedParams({
|
|
181
|
+
params: d,
|
|
183
182
|
experimentalFeatures: o
|
|
184
|
-
}) :
|
|
183
|
+
}) : d, g);
|
|
185
184
|
return {
|
|
186
185
|
apiRef: r,
|
|
187
|
-
forwardedProps:
|
|
186
|
+
forwardedProps: u,
|
|
188
187
|
pluginParams: s,
|
|
189
188
|
slots: t ?? {},
|
|
190
189
|
slotProps: n ?? {},
|
|
191
190
|
experimentalFeatures: o
|
|
192
191
|
};
|
|
193
|
-
},
|
|
192
|
+
}, rn = ({
|
|
194
193
|
plugins: e,
|
|
195
194
|
instance: t,
|
|
196
195
|
publicAPI: n,
|
|
197
196
|
rootRef: r
|
|
198
197
|
}) => ({
|
|
199
198
|
runItemPlugins: (p) => {
|
|
200
|
-
let
|
|
199
|
+
let g = null, u = null;
|
|
201
200
|
const o = [], s = {};
|
|
202
|
-
e.forEach((
|
|
203
|
-
if (!
|
|
201
|
+
e.forEach((h) => {
|
|
202
|
+
if (!h.itemPlugin)
|
|
204
203
|
return;
|
|
205
|
-
const c =
|
|
204
|
+
const c = h.itemPlugin({
|
|
206
205
|
props: p,
|
|
207
|
-
rootRef:
|
|
208
|
-
contentRef:
|
|
206
|
+
rootRef: g,
|
|
207
|
+
contentRef: u
|
|
209
208
|
});
|
|
210
|
-
c != null && c.rootRef && (
|
|
209
|
+
c != null && c.rootRef && (g = c.rootRef), c != null && c.contentRef && (u = c.contentRef), c != null && c.propsEnhancers && (o.push(c.propsEnhancers), Object.keys(c.propsEnhancers).forEach((i) => {
|
|
211
210
|
s[i] = !0;
|
|
212
211
|
}));
|
|
213
212
|
});
|
|
214
|
-
const
|
|
213
|
+
const d = (h) => (c) => {
|
|
215
214
|
const i = {};
|
|
216
|
-
return o.forEach((
|
|
217
|
-
const I =
|
|
215
|
+
return o.forEach((f) => {
|
|
216
|
+
const I = f[h];
|
|
218
217
|
I != null && Object.assign(i, I(c));
|
|
219
218
|
}), i;
|
|
220
|
-
}, b = Object.fromEntries(Object.keys(s).map((
|
|
219
|
+
}, b = Object.fromEntries(Object.keys(s).map((h) => [h, d(h)]));
|
|
221
220
|
return {
|
|
222
|
-
contentRef:
|
|
223
|
-
rootRef:
|
|
221
|
+
contentRef: u,
|
|
222
|
+
rootRef: g,
|
|
224
223
|
propsEnhancers: b
|
|
225
224
|
};
|
|
226
225
|
},
|
|
227
226
|
wrapItem: ({
|
|
228
227
|
itemId: p,
|
|
229
|
-
children:
|
|
228
|
+
children: g
|
|
230
229
|
}) => {
|
|
231
|
-
let
|
|
230
|
+
let u = g;
|
|
232
231
|
for (let o = e.length - 1; o >= 0; o -= 1) {
|
|
233
232
|
const s = e[o];
|
|
234
|
-
s.wrapItem && (
|
|
233
|
+
s.wrapItem && (u = s.wrapItem({
|
|
235
234
|
itemId: p,
|
|
236
|
-
children:
|
|
235
|
+
children: u,
|
|
237
236
|
instance: t
|
|
238
237
|
}));
|
|
239
238
|
}
|
|
240
|
-
return
|
|
239
|
+
return u;
|
|
241
240
|
},
|
|
242
241
|
wrapRoot: ({
|
|
243
242
|
children: p
|
|
244
243
|
}) => {
|
|
245
|
-
let
|
|
246
|
-
for (let
|
|
247
|
-
const o = e[
|
|
248
|
-
o.wrapRoot && (
|
|
249
|
-
children:
|
|
244
|
+
let g = p;
|
|
245
|
+
for (let u = e.length - 1; u >= 0; u -= 1) {
|
|
246
|
+
const o = e[u];
|
|
247
|
+
o.wrapRoot && (g = o.wrapRoot({
|
|
248
|
+
children: g,
|
|
250
249
|
instance: t
|
|
251
250
|
}));
|
|
252
251
|
}
|
|
253
|
-
return
|
|
252
|
+
return g;
|
|
254
253
|
},
|
|
255
254
|
instance: t,
|
|
256
255
|
rootRef: r,
|
|
257
256
|
publicAPI: n
|
|
258
257
|
});
|
|
259
|
-
function
|
|
258
|
+
function sn(e) {
|
|
260
259
|
const t = E.useRef({});
|
|
261
260
|
return e ? (e.current == null && (e.current = {}), e.current) : t.current;
|
|
262
261
|
}
|
|
263
|
-
const
|
|
262
|
+
const ln = ({
|
|
264
263
|
plugins: e,
|
|
265
264
|
rootRef: t,
|
|
266
265
|
props: n
|
|
267
266
|
}) => {
|
|
268
|
-
const r = [...
|
|
267
|
+
const r = [...tn, ...e], {
|
|
269
268
|
pluginParams: l,
|
|
270
|
-
forwardedProps:
|
|
271
|
-
apiRef:
|
|
269
|
+
forwardedProps: x,
|
|
270
|
+
apiRef: m,
|
|
272
271
|
experimentalFeatures: p,
|
|
273
|
-
slots:
|
|
274
|
-
slotProps:
|
|
275
|
-
} =
|
|
272
|
+
slots: g,
|
|
273
|
+
slotProps: u
|
|
274
|
+
} = on({
|
|
276
275
|
plugins: r,
|
|
277
276
|
props: n
|
|
278
|
-
}), o =
|
|
277
|
+
}), o = Qt(r, l), d = E.useRef({}).current, b = sn(m), h = E.useRef(null), c = Ee(h, t), i = rn({
|
|
279
278
|
plugins: r,
|
|
280
|
-
instance:
|
|
279
|
+
instance: d,
|
|
281
280
|
publicAPI: b,
|
|
282
|
-
rootRef:
|
|
283
|
-
}), [
|
|
281
|
+
rootRef: h
|
|
282
|
+
}), [f, I] = E.useState(() => {
|
|
284
283
|
const R = {};
|
|
285
284
|
return r.forEach((v) => {
|
|
286
285
|
v.getInitialState && Object.assign(R, v.getInitialState(l));
|
|
287
286
|
}), R;
|
|
288
287
|
}), T = [], P = (R) => {
|
|
289
288
|
const v = R({
|
|
290
|
-
instance:
|
|
289
|
+
instance: d,
|
|
291
290
|
params: l,
|
|
292
|
-
slots:
|
|
293
|
-
slotProps:
|
|
291
|
+
slots: g,
|
|
292
|
+
slotProps: u,
|
|
294
293
|
experimentalFeatures: p,
|
|
295
|
-
state:
|
|
294
|
+
state: f,
|
|
296
295
|
setState: I,
|
|
297
|
-
rootRef:
|
|
296
|
+
rootRef: h,
|
|
298
297
|
models: o,
|
|
299
298
|
plugins: r
|
|
300
299
|
});
|
|
301
|
-
v.getRootProps && T.push(v.getRootProps), v.publicAPI && Object.assign(b, v.publicAPI), v.instance && Object.assign(
|
|
300
|
+
v.getRootProps && T.push(v.getRootProps), v.publicAPI && Object.assign(b, v.publicAPI), v.instance && Object.assign(d, v.instance), v.contextValue && Object.assign(i, v.contextValue);
|
|
302
301
|
};
|
|
303
302
|
return r.forEach(P), {
|
|
304
303
|
getRootProps: (R = {}) => {
|
|
305
304
|
const v = C({
|
|
306
305
|
role: "tree"
|
|
307
|
-
},
|
|
306
|
+
}, x, R, {
|
|
308
307
|
ref: c
|
|
309
308
|
});
|
|
310
309
|
return T.forEach((F) => {
|
|
@@ -313,15 +312,15 @@ const an = ({
|
|
|
313
312
|
},
|
|
314
313
|
rootRef: c,
|
|
315
314
|
contextValue: i,
|
|
316
|
-
instance:
|
|
315
|
+
instance: d
|
|
317
316
|
};
|
|
318
317
|
};
|
|
319
|
-
function
|
|
318
|
+
function an(e) {
|
|
320
319
|
const {
|
|
321
320
|
value: t,
|
|
322
321
|
children: n
|
|
323
322
|
} = e;
|
|
324
|
-
return /* @__PURE__ */ S(
|
|
323
|
+
return /* @__PURE__ */ S(St.Provider, {
|
|
325
324
|
value: t,
|
|
326
325
|
children: t.wrapRoot({
|
|
327
326
|
children: n,
|
|
@@ -329,55 +328,55 @@ function cn(e) {
|
|
|
329
328
|
})
|
|
330
329
|
});
|
|
331
330
|
}
|
|
332
|
-
const
|
|
331
|
+
const cn = (e, t, n) => {
|
|
333
332
|
e.$$publishEvent(t, n);
|
|
334
|
-
}, K = "__TREE_VIEW_ROOT_PARENT_ID__",
|
|
333
|
+
}, K = "__TREE_VIEW_ROOT_PARENT_ID__", un = (e) => {
|
|
335
334
|
const t = {};
|
|
336
335
|
return e.forEach((n, r) => {
|
|
337
336
|
t[n] = r;
|
|
338
337
|
}), t;
|
|
339
|
-
},
|
|
338
|
+
}, dn = ["children"], We = ({
|
|
340
339
|
items: e,
|
|
341
340
|
isItemDisabled: t,
|
|
342
341
|
getItemLabel: n,
|
|
343
342
|
getItemId: r
|
|
344
343
|
}) => {
|
|
345
|
-
const l = {},
|
|
344
|
+
const l = {}, x = {}, m = {
|
|
346
345
|
[K]: []
|
|
347
|
-
}, p = (
|
|
346
|
+
}, p = (u, o, s) => {
|
|
348
347
|
var c, i;
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
351
|
-
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(
|
|
348
|
+
const d = r ? r(u) : u.id;
|
|
349
|
+
if (d == null)
|
|
350
|
+
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(u)].join(`
|
|
352
351
|
`));
|
|
353
|
-
if (l[
|
|
354
|
-
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: "${
|
|
352
|
+
if (l[d] != 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.", `Two items were provided with the same id in the \`items\` prop: "${d}"`].join(`
|
|
355
354
|
`));
|
|
356
|
-
const b = n ? n(
|
|
355
|
+
const b = n ? n(u) : u.label;
|
|
357
356
|
if (b == null)
|
|
358
|
-
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(
|
|
357
|
+
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(u)].join(`
|
|
359
358
|
`));
|
|
360
|
-
l[
|
|
361
|
-
id:
|
|
359
|
+
l[d] = {
|
|
360
|
+
id: d,
|
|
362
361
|
label: b,
|
|
363
362
|
parentId: s,
|
|
364
363
|
idAttribute: void 0,
|
|
365
|
-
expandable: !!((c =
|
|
366
|
-
disabled: t ? t(
|
|
364
|
+
expandable: !!((c = u.children) != null && c.length),
|
|
365
|
+
disabled: t ? t(u) : !1,
|
|
367
366
|
depth: o
|
|
368
|
-
},
|
|
369
|
-
const
|
|
370
|
-
|
|
367
|
+
}, x[d] = u;
|
|
368
|
+
const h = s ?? K;
|
|
369
|
+
m[h] || (m[h] = []), m[h].push(d), (i = u.children) == null || i.forEach((f) => p(f, o + 1, d));
|
|
371
370
|
};
|
|
372
|
-
e.forEach((
|
|
373
|
-
const
|
|
374
|
-
return Object.keys(
|
|
375
|
-
|
|
371
|
+
e.forEach((u) => p(u, 0, null));
|
|
372
|
+
const g = {};
|
|
373
|
+
return Object.keys(m).forEach((u) => {
|
|
374
|
+
g[u] = un(m[u]);
|
|
376
375
|
}), {
|
|
377
376
|
itemMetaMap: l,
|
|
378
|
-
itemMap:
|
|
379
|
-
itemOrderedChildrenIds:
|
|
380
|
-
itemChildrenIndexes:
|
|
377
|
+
itemMap: x,
|
|
378
|
+
itemOrderedChildrenIds: m,
|
|
379
|
+
itemChildrenIndexes: g
|
|
381
380
|
};
|
|
382
381
|
}, X = ({
|
|
383
382
|
instance: e,
|
|
@@ -386,16 +385,16 @@ const un = (e, t, n) => {
|
|
|
386
385
|
setState: r,
|
|
387
386
|
experimentalFeatures: l
|
|
388
387
|
}) => {
|
|
389
|
-
const
|
|
390
|
-
const
|
|
391
|
-
const T = n.items.itemMap[I], P = A(T,
|
|
392
|
-
return y && (P.children = y.map(
|
|
388
|
+
const x = E.useCallback((f) => n.items.itemMetaMap[f], [n.items.itemMetaMap]), m = E.useCallback((f) => n.items.itemMap[f], [n.items.itemMap]), p = E.useCallback(() => {
|
|
389
|
+
const f = (I) => {
|
|
390
|
+
const T = n.items.itemMap[I], P = A(T, dn), y = n.items.itemOrderedChildrenIds[I];
|
|
391
|
+
return y && (P.children = y.map(f)), P;
|
|
393
392
|
};
|
|
394
|
-
return n.items.itemOrderedChildrenIds[K].map(
|
|
395
|
-
}, [n.items.itemMap, n.items.itemOrderedChildrenIds]),
|
|
396
|
-
if (
|
|
393
|
+
return n.items.itemOrderedChildrenIds[K].map(f);
|
|
394
|
+
}, [n.items.itemMap, n.items.itemOrderedChildrenIds]), g = E.useCallback((f) => {
|
|
395
|
+
if (f == null)
|
|
397
396
|
return !1;
|
|
398
|
-
let I = e.getItemMeta(
|
|
397
|
+
let I = e.getItemMeta(f);
|
|
399
398
|
if (!I)
|
|
400
399
|
return !1;
|
|
401
400
|
if (I.disabled)
|
|
@@ -404,32 +403,32 @@ const un = (e, t, n) => {
|
|
|
404
403
|
if (I = e.getItemMeta(I.parentId), I.disabled)
|
|
405
404
|
return !0;
|
|
406
405
|
return !1;
|
|
407
|
-
}, [e]),
|
|
408
|
-
const I = e.getItemMeta(
|
|
409
|
-
return n.items.itemChildrenIndexes[I][
|
|
410
|
-
}, [e, n.items.itemChildrenIndexes]), o = E.useCallback((
|
|
411
|
-
const I = e.getItemMeta(
|
|
406
|
+
}, [e]), u = E.useCallback((f) => {
|
|
407
|
+
const I = e.getItemMeta(f).parentId ?? K;
|
|
408
|
+
return n.items.itemChildrenIndexes[I][f];
|
|
409
|
+
}, [e, n.items.itemChildrenIndexes]), o = E.useCallback((f) => n.items.itemOrderedChildrenIds[f ?? K] ?? [], [n.items.itemOrderedChildrenIds]), s = (f) => {
|
|
410
|
+
const I = e.getItemMeta(f);
|
|
412
411
|
return I == null ? null : document.getElementById(_e({
|
|
413
412
|
treeId: n.id.treeId,
|
|
414
|
-
itemId:
|
|
413
|
+
itemId: f,
|
|
415
414
|
id: I.idAttribute
|
|
416
415
|
}));
|
|
417
|
-
},
|
|
416
|
+
}, d = (f) => t.disabledItemsFocusable ? !0 : !e.isItemDisabled(f), b = E.useRef(!1), h = E.useCallback(() => {
|
|
418
417
|
b.current = !0;
|
|
419
418
|
}, []), c = E.useCallback(() => b.current, []);
|
|
420
419
|
return E.useEffect(() => {
|
|
421
|
-
e.areItemUpdatesPrevented() || r((
|
|
420
|
+
e.areItemUpdatesPrevented() || r((f) => {
|
|
422
421
|
const I = We({
|
|
423
422
|
items: t.items,
|
|
424
423
|
isItemDisabled: t.isItemDisabled,
|
|
425
424
|
getItemId: t.getItemId,
|
|
426
425
|
getItemLabel: t.getItemLabel
|
|
427
426
|
});
|
|
428
|
-
return Object.values(
|
|
429
|
-
I.itemMetaMap[T.id] ||
|
|
427
|
+
return Object.values(f.items.itemMetaMap).forEach((T) => {
|
|
428
|
+
I.itemMetaMap[T.id] || cn(e, "removeItem", {
|
|
430
429
|
id: T.id
|
|
431
430
|
});
|
|
432
|
-
}), C({},
|
|
431
|
+
}), C({}, f, {
|
|
433
432
|
items: I
|
|
434
433
|
});
|
|
435
434
|
});
|
|
@@ -440,34 +439,34 @@ const un = (e, t, n) => {
|
|
|
440
439
|
}
|
|
441
440
|
}),
|
|
442
441
|
publicAPI: {
|
|
443
|
-
getItem:
|
|
442
|
+
getItem: m,
|
|
444
443
|
getItemDOMElement: s,
|
|
445
444
|
getItemTree: p,
|
|
446
445
|
getItemOrderedChildrenIds: o
|
|
447
446
|
},
|
|
448
447
|
instance: {
|
|
449
|
-
getItemMeta:
|
|
450
|
-
getItem:
|
|
448
|
+
getItemMeta: x,
|
|
449
|
+
getItem: m,
|
|
451
450
|
getItemTree: p,
|
|
452
451
|
getItemsToRender: () => {
|
|
453
|
-
const
|
|
452
|
+
const f = (I) => {
|
|
454
453
|
var P;
|
|
455
454
|
const T = n.items.itemMetaMap[I];
|
|
456
455
|
return {
|
|
457
456
|
label: T.label,
|
|
458
457
|
itemId: T.id,
|
|
459
458
|
id: T.idAttribute,
|
|
460
|
-
children: (P = n.items.itemOrderedChildrenIds[I]) == null ? void 0 : P.map(
|
|
459
|
+
children: (P = n.items.itemOrderedChildrenIds[I]) == null ? void 0 : P.map(f)
|
|
461
460
|
};
|
|
462
461
|
};
|
|
463
|
-
return n.items.itemOrderedChildrenIds[K].map(
|
|
462
|
+
return n.items.itemOrderedChildrenIds[K].map(f);
|
|
464
463
|
},
|
|
465
|
-
getItemIndex:
|
|
464
|
+
getItemIndex: u,
|
|
466
465
|
getItemDOMElement: s,
|
|
467
466
|
getItemOrderedChildrenIds: o,
|
|
468
|
-
isItemDisabled:
|
|
469
|
-
isItemNavigable:
|
|
470
|
-
preventItemUpdates:
|
|
467
|
+
isItemDisabled: g,
|
|
468
|
+
isItemNavigable: d,
|
|
469
|
+
preventItemUpdates: h,
|
|
471
470
|
areItemUpdatesPrevented: c
|
|
472
471
|
},
|
|
473
472
|
contextValue: {
|
|
@@ -519,39 +518,39 @@ const le = ({
|
|
|
519
518
|
}) => {
|
|
520
519
|
const r = E.useMemo(() => {
|
|
521
520
|
const s = /* @__PURE__ */ new Map();
|
|
522
|
-
return n.expandedItems.value.forEach((
|
|
523
|
-
s.set(
|
|
521
|
+
return n.expandedItems.value.forEach((d) => {
|
|
522
|
+
s.set(d, !0);
|
|
524
523
|
}), s;
|
|
525
|
-
}, [n.expandedItems.value]), l = (s,
|
|
524
|
+
}, [n.expandedItems.value]), l = (s, d) => {
|
|
526
525
|
var b;
|
|
527
|
-
(b = t.onExpandedItemsChange) == null || b.call(t, s,
|
|
528
|
-
},
|
|
529
|
-
var
|
|
530
|
-
return !!((
|
|
531
|
-
}, [e]), p = U((s,
|
|
532
|
-
const b = e.isItemExpanded(
|
|
533
|
-
e.setItemExpansion(s,
|
|
534
|
-
}),
|
|
535
|
-
if (e.isItemExpanded(
|
|
526
|
+
(b = t.onExpandedItemsChange) == null || b.call(t, s, d), n.expandedItems.setControlledValue(d);
|
|
527
|
+
}, x = E.useCallback((s) => r.has(s), [r]), m = E.useCallback((s) => {
|
|
528
|
+
var d;
|
|
529
|
+
return !!((d = e.getItemMeta(s)) != null && d.expandable);
|
|
530
|
+
}, [e]), p = U((s, d) => {
|
|
531
|
+
const b = e.isItemExpanded(d);
|
|
532
|
+
e.setItemExpansion(s, d, !b);
|
|
533
|
+
}), g = U((s, d, b) => {
|
|
534
|
+
if (e.isItemExpanded(d) === b)
|
|
536
535
|
return;
|
|
537
536
|
let c;
|
|
538
|
-
b ? c = [
|
|
539
|
-
}),
|
|
540
|
-
const b = e.getItemMeta(
|
|
541
|
-
c.length > 0 && (t.onItemExpansionToggle && c.forEach((
|
|
542
|
-
t.onItemExpansionToggle(s,
|
|
537
|
+
b ? c = [d].concat(n.expandedItems.value) : c = n.expandedItems.value.filter((i) => i !== d), t.onItemExpansionToggle && t.onItemExpansionToggle(s, d, b), l(s, c);
|
|
538
|
+
}), u = (s, d) => {
|
|
539
|
+
const b = e.getItemMeta(d), c = e.getItemOrderedChildrenIds(b.parentId).filter((f) => e.isItemExpandable(f) && !e.isItemExpanded(f)), i = n.expandedItems.value.concat(c);
|
|
540
|
+
c.length > 0 && (t.onItemExpansionToggle && c.forEach((f) => {
|
|
541
|
+
t.onItemExpansionToggle(s, f, !0);
|
|
543
542
|
}), l(s, i));
|
|
544
543
|
}, o = E.useMemo(() => t.expansionTrigger ? t.expansionTrigger : e.isTreeViewEditable ? "iconContainer" : "content", [t.expansionTrigger, e.isTreeViewEditable]);
|
|
545
544
|
return {
|
|
546
545
|
publicAPI: {
|
|
547
|
-
setItemExpansion:
|
|
546
|
+
setItemExpansion: g
|
|
548
547
|
},
|
|
549
548
|
instance: {
|
|
550
|
-
isItemExpanded:
|
|
551
|
-
isItemExpandable:
|
|
552
|
-
setItemExpansion:
|
|
549
|
+
isItemExpanded: x,
|
|
550
|
+
isItemExpandable: m,
|
|
551
|
+
setItemExpansion: g,
|
|
553
552
|
toggleItemExpansion: p,
|
|
554
|
-
expandAllSiblings:
|
|
553
|
+
expandAllSiblings: u
|
|
555
554
|
},
|
|
556
555
|
contextValue: {
|
|
557
556
|
expansion: {
|
|
@@ -565,11 +564,11 @@ le.models = {
|
|
|
565
564
|
getDefaultValue: (e) => e.defaultExpandedItems
|
|
566
565
|
}
|
|
567
566
|
};
|
|
568
|
-
const
|
|
567
|
+
const fn = [];
|
|
569
568
|
le.getDefaultizedParams = ({
|
|
570
569
|
params: e
|
|
571
570
|
}) => C({}, e, {
|
|
572
|
-
defaultExpandedItems: e.defaultExpandedItems ??
|
|
571
|
+
defaultExpandedItems: e.defaultExpandedItems ?? fn
|
|
573
572
|
});
|
|
574
573
|
le.params = {
|
|
575
574
|
expandedItems: !0,
|
|
@@ -588,81 +587,81 @@ const re = (e) => Array.isArray(e) ? e : e != null ? [e] : [], be = (e) => {
|
|
|
588
587
|
params: t,
|
|
589
588
|
models: n
|
|
590
589
|
}) => {
|
|
591
|
-
const r = E.useRef(null), l = E.useRef({}),
|
|
590
|
+
const r = E.useRef(null), l = E.useRef({}), x = E.useMemo(() => {
|
|
592
591
|
const c = /* @__PURE__ */ new Map();
|
|
593
592
|
return Array.isArray(n.selectedItems.value) ? n.selectedItems.value.forEach((i) => {
|
|
594
593
|
c.set(i, !0);
|
|
595
594
|
}) : n.selectedItems.value != null && c.set(n.selectedItems.value, !0), c;
|
|
596
|
-
}, [n.selectedItems.value]),
|
|
595
|
+
}, [n.selectedItems.value]), m = (c, i) => {
|
|
597
596
|
if (t.onItemSelectionToggle)
|
|
598
597
|
if (t.multiSelect) {
|
|
599
|
-
const
|
|
600
|
-
|
|
598
|
+
const f = i.filter((T) => !e.isItemSelected(T)), I = n.selectedItems.value.filter((T) => !i.includes(T));
|
|
599
|
+
f.forEach((T) => {
|
|
601
600
|
t.onItemSelectionToggle(c, T, !0);
|
|
602
601
|
}), I.forEach((T) => {
|
|
603
602
|
t.onItemSelectionToggle(c, T, !1);
|
|
604
603
|
});
|
|
605
604
|
} else i !== n.selectedItems.value && (n.selectedItems.value != null && t.onItemSelectionToggle(c, n.selectedItems.value, !1), i != null && t.onItemSelectionToggle(c, i, !0));
|
|
606
605
|
t.onSelectedItemsChange && t.onSelectedItemsChange(c, i), n.selectedItems.setControlledValue(i);
|
|
607
|
-
}, p = (c) =>
|
|
606
|
+
}, p = (c) => x.has(c), g = ({
|
|
608
607
|
event: c,
|
|
609
608
|
itemId: i,
|
|
610
|
-
keepExistingSelection:
|
|
609
|
+
keepExistingSelection: f = !1,
|
|
611
610
|
shouldBeSelected: I
|
|
612
611
|
}) => {
|
|
613
612
|
if (t.disableSelection)
|
|
614
613
|
return;
|
|
615
614
|
let T;
|
|
616
|
-
if (
|
|
615
|
+
if (f) {
|
|
617
616
|
const P = re(n.selectedItems.value), y = e.isItemSelected(i);
|
|
618
617
|
y && (I === !1 || I == null) ? T = P.filter((R) => R !== i) : !y && (I === !0 || I == null) ? T = [i].concat(P) : T = P;
|
|
619
618
|
} else
|
|
620
619
|
I === !1 || I == null && e.isItemSelected(i) ? T = t.multiSelect ? [] : null : T = t.multiSelect ? [i] : i;
|
|
621
|
-
|
|
622
|
-
},
|
|
620
|
+
m(c, T), r.current = i, l.current = {};
|
|
621
|
+
}, u = (c, [i, f]) => {
|
|
623
622
|
if (t.disableSelection || !t.multiSelect)
|
|
624
623
|
return;
|
|
625
624
|
let I = re(n.selectedItems.value).slice();
|
|
626
625
|
Object.keys(l.current).length > 0 && (I = I.filter((R) => !l.current[R]));
|
|
627
|
-
const T = be(I), P =
|
|
628
|
-
I = I.concat(y),
|
|
626
|
+
const T = be(I), P = kt(e, i, f), y = P.filter((R) => !T[R]);
|
|
627
|
+
I = I.concat(y), m(c, I), l.current = be(P);
|
|
629
628
|
};
|
|
630
629
|
return {
|
|
631
630
|
getRootProps: () => ({
|
|
632
631
|
"aria-multiselectable": t.multiSelect
|
|
633
632
|
}),
|
|
634
633
|
publicAPI: {
|
|
635
|
-
selectItem:
|
|
634
|
+
selectItem: g
|
|
636
635
|
},
|
|
637
636
|
instance: {
|
|
638
637
|
isItemSelected: p,
|
|
639
|
-
selectItem:
|
|
638
|
+
selectItem: g,
|
|
640
639
|
selectAllNavigableItems: (c) => {
|
|
641
640
|
if (t.disableSelection || !t.multiSelect)
|
|
642
641
|
return;
|
|
643
|
-
const i =
|
|
644
|
-
|
|
642
|
+
const i = vt(e);
|
|
643
|
+
m(c, i), l.current = be(i);
|
|
645
644
|
},
|
|
646
645
|
expandSelectionRange: (c, i) => {
|
|
647
646
|
if (r.current != null) {
|
|
648
|
-
const [
|
|
649
|
-
|
|
647
|
+
const [f, I] = Pt(e, i, r.current);
|
|
648
|
+
u(c, [f, I]);
|
|
650
649
|
}
|
|
651
650
|
},
|
|
652
651
|
selectRangeFromStartToItem: (c, i) => {
|
|
653
|
-
|
|
652
|
+
u(c, [se(e), i]);
|
|
654
653
|
},
|
|
655
654
|
selectRangeFromItemToEnd: (c, i) => {
|
|
656
|
-
|
|
655
|
+
u(c, [i, Ne(e)]);
|
|
657
656
|
},
|
|
658
|
-
selectItemFromArrowNavigation: (c, i,
|
|
657
|
+
selectItemFromArrowNavigation: (c, i, f) => {
|
|
659
658
|
if (t.disableSelection || !t.multiSelect)
|
|
660
659
|
return;
|
|
661
660
|
let I = re(n.selectedItems.value).slice();
|
|
662
|
-
Object.keys(l.current).length === 0 ? (I.push(
|
|
661
|
+
Object.keys(l.current).length === 0 ? (I.push(f), l.current = {
|
|
663
662
|
[i]: !0,
|
|
664
|
-
[
|
|
665
|
-
}) : (l.current[i] || (l.current = {}), l.current[
|
|
663
|
+
[f]: !0
|
|
664
|
+
}) : (l.current[i] || (l.current = {}), l.current[f] ? (I = I.filter((T) => T !== i), delete l.current[i]) : (I.push(f), l.current[f] = !0)), m(c, I);
|
|
666
665
|
}
|
|
667
666
|
},
|
|
668
667
|
contextValue: {
|
|
@@ -679,14 +678,14 @@ ae.models = {
|
|
|
679
678
|
getDefaultValue: (e) => e.defaultSelectedItems
|
|
680
679
|
}
|
|
681
680
|
};
|
|
682
|
-
const
|
|
681
|
+
const pn = [];
|
|
683
682
|
ae.getDefaultizedParams = ({
|
|
684
683
|
params: e
|
|
685
684
|
}) => C({}, e, {
|
|
686
685
|
disableSelection: e.disableSelection ?? !1,
|
|
687
686
|
multiSelect: e.multiSelect ?? !1,
|
|
688
687
|
checkboxSelection: e.checkboxSelection ?? !1,
|
|
689
|
-
defaultSelectedItems: e.defaultSelectedItems ?? (e.multiSelect ?
|
|
688
|
+
defaultSelectedItems: e.defaultSelectedItems ?? (e.multiSelect ? pn : null)
|
|
690
689
|
});
|
|
691
690
|
ae.params = {
|
|
692
691
|
disableSelection: !0,
|
|
@@ -698,7 +697,7 @@ ae.params = {
|
|
|
698
697
|
onItemSelectionToggle: !0
|
|
699
698
|
};
|
|
700
699
|
const Le = 1e3;
|
|
701
|
-
class
|
|
700
|
+
class mn {
|
|
702
701
|
constructor(t = Le) {
|
|
703
702
|
this.timeouts = /* @__PURE__ */ new Map(), this.cleanupTimeout = Le, this.cleanupTimeout = t;
|
|
704
703
|
}
|
|
@@ -721,7 +720,7 @@ class In {
|
|
|
721
720
|
}), this.timeouts = void 0);
|
|
722
721
|
}
|
|
723
722
|
}
|
|
724
|
-
class
|
|
723
|
+
class In {
|
|
725
724
|
constructor() {
|
|
726
725
|
this.registry = new FinalizationRegistry((t) => {
|
|
727
726
|
typeof t == "function" && t();
|
|
@@ -737,53 +736,53 @@ class gn {
|
|
|
737
736
|
reset() {
|
|
738
737
|
}
|
|
739
738
|
}
|
|
740
|
-
class
|
|
739
|
+
class gn {
|
|
741
740
|
}
|
|
742
|
-
function
|
|
741
|
+
function bn(e) {
|
|
743
742
|
let t = 0;
|
|
744
|
-
return function(r, l,
|
|
745
|
-
e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new
|
|
746
|
-
const [
|
|
747
|
-
|
|
748
|
-
const
|
|
749
|
-
if (!p.current &&
|
|
750
|
-
const o = (s,
|
|
743
|
+
return function(r, l, x) {
|
|
744
|
+
e.registry === null && (e.registry = typeof FinalizationRegistry < "u" ? new In() : new mn());
|
|
745
|
+
const [m] = E.useState(new gn()), p = E.useRef(null), g = E.useRef(void 0);
|
|
746
|
+
g.current = x;
|
|
747
|
+
const u = E.useRef(null);
|
|
748
|
+
if (!p.current && g.current) {
|
|
749
|
+
const o = (s, d) => {
|
|
751
750
|
var b;
|
|
752
|
-
|
|
751
|
+
d.defaultMuiPrevented || (b = g.current) == null || b.call(g, s, d);
|
|
753
752
|
};
|
|
754
|
-
p.current = r.$$subscribeEvent(l, o), t += 1,
|
|
753
|
+
p.current = r.$$subscribeEvent(l, o), t += 1, u.current = {
|
|
755
754
|
cleanupToken: t
|
|
756
755
|
}, e.registry.register(
|
|
757
|
-
|
|
756
|
+
m,
|
|
758
757
|
// The callback below will be called once this reference stops being retained
|
|
759
758
|
() => {
|
|
760
759
|
var s;
|
|
761
|
-
(s = p.current) == null || s.call(p), p.current = null,
|
|
760
|
+
(s = p.current) == null || s.call(p), p.current = null, u.current = null;
|
|
762
761
|
},
|
|
763
|
-
|
|
762
|
+
u.current
|
|
764
763
|
);
|
|
765
|
-
} else !
|
|
764
|
+
} else !g.current && p.current && (p.current(), p.current = null, u.current && (e.registry.unregister(u.current), u.current = null));
|
|
766
765
|
E.useEffect(() => {
|
|
767
|
-
if (!p.current &&
|
|
768
|
-
const o = (s,
|
|
766
|
+
if (!p.current && g.current) {
|
|
767
|
+
const o = (s, d) => {
|
|
769
768
|
var b;
|
|
770
|
-
|
|
769
|
+
d.defaultMuiPrevented || (b = g.current) == null || b.call(g, s, d);
|
|
771
770
|
};
|
|
772
771
|
p.current = r.$$subscribeEvent(l, o);
|
|
773
772
|
}
|
|
774
|
-
return
|
|
773
|
+
return u.current && e.registry && (e.registry.unregister(u.current), u.current = null), () => {
|
|
775
774
|
var o;
|
|
776
775
|
(o = p.current) == null || o.call(p), p.current = null;
|
|
777
776
|
};
|
|
778
777
|
}, [r, l]);
|
|
779
778
|
};
|
|
780
779
|
}
|
|
781
|
-
const
|
|
780
|
+
const hn = {
|
|
782
781
|
registry: null
|
|
783
|
-
},
|
|
782
|
+
}, xn = bn(hn), Ge = (e = document) => {
|
|
784
783
|
const t = e.activeElement;
|
|
785
784
|
return t ? t.shadowRoot ? Ge(t.shadowRoot) : t : null;
|
|
786
|
-
},
|
|
785
|
+
}, En = (e, t) => {
|
|
787
786
|
let n = re(t).find((r) => {
|
|
788
787
|
if (!e.isItemNavigable(r))
|
|
789
788
|
return !1;
|
|
@@ -797,50 +796,50 @@ const xn = {
|
|
|
797
796
|
state: n,
|
|
798
797
|
setState: r,
|
|
799
798
|
models: l,
|
|
800
|
-
rootRef:
|
|
799
|
+
rootRef: x
|
|
801
800
|
}) => {
|
|
802
|
-
const
|
|
803
|
-
const
|
|
804
|
-
n.focusedItemId !==
|
|
805
|
-
focusedItemId:
|
|
801
|
+
const m = En(e, l.selectedItems.value), p = U((i) => {
|
|
802
|
+
const f = typeof i == "function" ? i(n.focusedItemId) : i;
|
|
803
|
+
n.focusedItemId !== f && r((I) => C({}, I, {
|
|
804
|
+
focusedItemId: f
|
|
806
805
|
}));
|
|
807
|
-
}),
|
|
808
|
-
const
|
|
809
|
-
return
|
|
810
|
-
}, s = (i,
|
|
811
|
-
const I = e.getItemDOMElement(
|
|
812
|
-
I && I.focus(), p(
|
|
813
|
-
},
|
|
814
|
-
o(
|
|
806
|
+
}), g = E.useCallback(() => !!x.current && x.current.contains(Ge(Ht(x.current))), [x]), u = E.useCallback((i) => n.focusedItemId === i && g(), [n.focusedItemId, g]), o = (i) => {
|
|
807
|
+
const f = e.getItemMeta(i);
|
|
808
|
+
return f && (f.parentId == null || e.isItemExpanded(f.parentId));
|
|
809
|
+
}, s = (i, f) => {
|
|
810
|
+
const I = e.getItemDOMElement(f);
|
|
811
|
+
I && I.focus(), p(f), t.onItemFocus && t.onItemFocus(i, f);
|
|
812
|
+
}, d = U((i, f) => {
|
|
813
|
+
o(f) && s(i, f);
|
|
815
814
|
}), b = U(() => {
|
|
816
815
|
if (n.focusedItemId == null)
|
|
817
816
|
return;
|
|
818
817
|
if (e.getItemMeta(n.focusedItemId)) {
|
|
819
|
-
const
|
|
820
|
-
|
|
818
|
+
const f = e.getItemDOMElement(n.focusedItemId);
|
|
819
|
+
f && f.blur();
|
|
821
820
|
}
|
|
822
821
|
p(null);
|
|
823
|
-
}),
|
|
824
|
-
|
|
822
|
+
}), h = (i) => i === m;
|
|
823
|
+
xn(e, "removeItem", ({
|
|
825
824
|
id: i
|
|
826
825
|
}) => {
|
|
827
|
-
n.focusedItemId === i && s(null,
|
|
826
|
+
n.focusedItemId === i && s(null, m);
|
|
828
827
|
});
|
|
829
|
-
const c = (i) => (
|
|
828
|
+
const c = (i) => (f) => {
|
|
830
829
|
var I;
|
|
831
|
-
(I = i.onFocus) == null || I.call(i,
|
|
830
|
+
(I = i.onFocus) == null || I.call(i, f), !f.defaultMuiPrevented && f.target === f.currentTarget && s(f, m);
|
|
832
831
|
};
|
|
833
832
|
return {
|
|
834
833
|
getRootProps: (i) => ({
|
|
835
834
|
onFocus: c(i)
|
|
836
835
|
}),
|
|
837
836
|
publicAPI: {
|
|
838
|
-
focusItem:
|
|
837
|
+
focusItem: d
|
|
839
838
|
},
|
|
840
839
|
instance: {
|
|
841
|
-
isItemFocused:
|
|
842
|
-
canItemBeTabbed:
|
|
843
|
-
focusItem:
|
|
840
|
+
isItemFocused: u,
|
|
841
|
+
canItemBeTabbed: h,
|
|
842
|
+
focusItem: d,
|
|
844
843
|
removeFocusedItem: b
|
|
845
844
|
}
|
|
846
845
|
};
|
|
@@ -851,7 +850,7 @@ ye.getInitialState = () => ({
|
|
|
851
850
|
ye.params = {
|
|
852
851
|
onItemFocus: !0
|
|
853
852
|
};
|
|
854
|
-
function
|
|
853
|
+
function Tn(e) {
|
|
855
854
|
return !!e && e.length === 1 && !!e.match(/\S/);
|
|
856
855
|
}
|
|
857
856
|
const Je = ({
|
|
@@ -859,35 +858,35 @@ const Je = ({
|
|
|
859
858
|
params: t,
|
|
860
859
|
state: n
|
|
861
860
|
}) => {
|
|
862
|
-
const r =
|
|
861
|
+
const r = Xt(), l = E.useRef({}), x = U((o) => {
|
|
863
862
|
l.current = o(l.current);
|
|
864
863
|
});
|
|
865
864
|
E.useEffect(() => {
|
|
866
865
|
if (e.areItemUpdatesPrevented())
|
|
867
866
|
return;
|
|
868
|
-
const o = {}, s = (
|
|
869
|
-
o[
|
|
867
|
+
const o = {}, s = (d) => {
|
|
868
|
+
o[d.id] = d.label.substring(0, 1).toLowerCase();
|
|
870
869
|
};
|
|
871
870
|
Object.values(n.items.itemMetaMap).forEach(s), l.current = o;
|
|
872
871
|
}, [n.items.itemMetaMap, t.getItemId, e]);
|
|
873
|
-
const
|
|
874
|
-
const
|
|
875
|
-
const I = ge(e,
|
|
872
|
+
const m = (o, s) => {
|
|
873
|
+
const d = s.toLowerCase(), b = (f) => {
|
|
874
|
+
const I = ge(e, f);
|
|
876
875
|
return I === null ? se(e) : I;
|
|
877
876
|
};
|
|
878
|
-
let
|
|
877
|
+
let h = null, c = b(o);
|
|
879
878
|
const i = {};
|
|
880
|
-
for (;
|
|
881
|
-
l.current[c] ===
|
|
882
|
-
return
|
|
883
|
-
}, p = (o) => !t.disableSelection && !e.isItemDisabled(o),
|
|
879
|
+
for (; h == null && !i[c]; )
|
|
880
|
+
l.current[c] === d ? h = c : (i[c] = !0, c = b(c));
|
|
881
|
+
return h;
|
|
882
|
+
}, p = (o) => !t.disableSelection && !e.isItemDisabled(o), g = (o) => !e.isItemDisabled(o) && e.isItemExpandable(o);
|
|
884
883
|
return {
|
|
885
884
|
instance: {
|
|
886
|
-
updateFirstCharMap:
|
|
885
|
+
updateFirstCharMap: x,
|
|
887
886
|
handleItemKeyDown: (o, s) => {
|
|
888
887
|
if (o.defaultMuiPrevented || o.altKey || he(o.target, o.currentTarget))
|
|
889
888
|
return;
|
|
890
|
-
const
|
|
889
|
+
const d = o.ctrlKey || o.metaKey, b = o.key;
|
|
891
890
|
switch (!0) {
|
|
892
891
|
// Select the item when pressing "Space"
|
|
893
892
|
case (b === " " && p(s)): {
|
|
@@ -902,7 +901,7 @@ const Je = ({
|
|
|
902
901
|
// If the focused item has children, we expand it.
|
|
903
902
|
// If the focused item has no children, we select it.
|
|
904
903
|
case b === "Enter": {
|
|
905
|
-
oe(e, H) && e.isItemEditable(s) && !e.isItemBeingEdited(s) ? e.setEditedItemId(s) :
|
|
904
|
+
oe(e, H) && e.isItemEditable(s) && !e.isItemBeingEdited(s) ? e.setEditedItemId(s) : g(s) ? (e.toggleItemExpansion(o, s), o.preventDefault()) : p(s) && (t.multiSelect ? (o.preventDefault(), e.selectItem({
|
|
906
905
|
event: o,
|
|
907
906
|
itemId: s,
|
|
908
907
|
keepExistingSelection: !0
|
|
@@ -914,48 +913,48 @@ const Je = ({
|
|
|
914
913
|
}
|
|
915
914
|
// Focus the next focusable item
|
|
916
915
|
case b === "ArrowDown": {
|
|
917
|
-
const
|
|
918
|
-
|
|
916
|
+
const h = ge(e, s);
|
|
917
|
+
h && (o.preventDefault(), e.focusItem(o, h), t.multiSelect && o.shiftKey && p(h) && e.selectItemFromArrowNavigation(o, s, h));
|
|
919
918
|
break;
|
|
920
919
|
}
|
|
921
920
|
// Focuses the previous focusable item
|
|
922
921
|
case b === "ArrowUp": {
|
|
923
|
-
const
|
|
924
|
-
|
|
922
|
+
const h = Mt(e, s);
|
|
923
|
+
h && (o.preventDefault(), e.focusItem(o, h), t.multiSelect && o.shiftKey && p(h) && e.selectItemFromArrowNavigation(o, s, h));
|
|
925
924
|
break;
|
|
926
925
|
}
|
|
927
926
|
// If the focused item is expanded, we move the focus to its first child
|
|
928
927
|
// If the focused item is collapsed and has children, we expand it
|
|
929
928
|
case (b === "ArrowRight" && !r || b === "ArrowLeft" && r): {
|
|
930
|
-
if (
|
|
929
|
+
if (d)
|
|
931
930
|
return;
|
|
932
931
|
if (e.isItemExpanded(s)) {
|
|
933
|
-
const
|
|
934
|
-
|
|
935
|
-
} else
|
|
932
|
+
const h = ge(e, s);
|
|
933
|
+
h && (e.focusItem(o, h), o.preventDefault());
|
|
934
|
+
} else g(s) && (e.toggleItemExpansion(o, s), o.preventDefault());
|
|
936
935
|
break;
|
|
937
936
|
}
|
|
938
937
|
// If the focused item is expanded, we collapse it
|
|
939
938
|
// If the focused item is collapsed and has a parent, we move the focus to this parent
|
|
940
939
|
case (b === "ArrowLeft" && !r || b === "ArrowRight" && r): {
|
|
941
|
-
if (
|
|
940
|
+
if (d)
|
|
942
941
|
return;
|
|
943
|
-
if (
|
|
942
|
+
if (g(s) && e.isItemExpanded(s))
|
|
944
943
|
e.toggleItemExpansion(o, s), o.preventDefault();
|
|
945
944
|
else {
|
|
946
|
-
const
|
|
947
|
-
|
|
945
|
+
const h = e.getItemMeta(s).parentId;
|
|
946
|
+
h && (e.focusItem(o, h), o.preventDefault());
|
|
948
947
|
}
|
|
949
948
|
break;
|
|
950
949
|
}
|
|
951
950
|
// Focuses the first item in the tree
|
|
952
951
|
case b === "Home": {
|
|
953
|
-
p(s) && t.multiSelect &&
|
|
952
|
+
p(s) && t.multiSelect && d && o.shiftKey ? e.selectRangeFromStartToItem(o, s) : e.focusItem(o, se(e)), o.preventDefault();
|
|
954
953
|
break;
|
|
955
954
|
}
|
|
956
955
|
// Focuses the last item in the tree
|
|
957
956
|
case b === "End": {
|
|
958
|
-
p(s) && t.multiSelect &&
|
|
957
|
+
p(s) && t.multiSelect && d && o.shiftKey ? e.selectRangeFromItemToEnd(o, s) : e.focusItem(o, Ne(e)), o.preventDefault();
|
|
959
958
|
break;
|
|
960
959
|
}
|
|
961
960
|
// Expand all siblings that are at the same level as the focused item
|
|
@@ -965,15 +964,15 @@ const Je = ({
|
|
|
965
964
|
}
|
|
966
965
|
// Multi select behavior when pressing Ctrl + a
|
|
967
966
|
// Selects all the items
|
|
968
|
-
case (String.fromCharCode(o.keyCode) === "A" &&
|
|
967
|
+
case (String.fromCharCode(o.keyCode) === "A" && d && t.multiSelect && !t.disableSelection): {
|
|
969
968
|
e.selectAllNavigableItems(o), o.preventDefault();
|
|
970
969
|
break;
|
|
971
970
|
}
|
|
972
971
|
// Type-ahead
|
|
973
972
|
// TODO: Support typing multiple characters
|
|
974
|
-
case (!
|
|
975
|
-
const
|
|
976
|
-
|
|
973
|
+
case (!d && !o.shiftKey && Tn(b)): {
|
|
974
|
+
const h = m(s, b);
|
|
975
|
+
h != null && (e.focusItem(o, h), o.preventDefault());
|
|
977
976
|
break;
|
|
978
977
|
}
|
|
979
978
|
}
|
|
@@ -1002,7 +1001,7 @@ const Ye = ({
|
|
|
1002
1001
|
}
|
|
1003
1002
|
});
|
|
1004
1003
|
Ye.params = {};
|
|
1005
|
-
const
|
|
1004
|
+
const yn = [X, le, ae, ye, Je, Ye, H];
|
|
1006
1005
|
function Qe(e) {
|
|
1007
1006
|
const {
|
|
1008
1007
|
instance: t,
|
|
@@ -1012,19 +1011,19 @@ function Qe(e) {
|
|
|
1012
1011
|
selection: {
|
|
1013
1012
|
multiSelect: r,
|
|
1014
1013
|
checkboxSelection: l,
|
|
1015
|
-
disableSelection:
|
|
1014
|
+
disableSelection: x
|
|
1016
1015
|
},
|
|
1017
1016
|
expansion: {
|
|
1018
|
-
expansionTrigger:
|
|
1017
|
+
expansionTrigger: m
|
|
1019
1018
|
}
|
|
1020
|
-
} = Ke(), p = t.isItemExpandable(e),
|
|
1019
|
+
} = Ke(), p = t.isItemExpandable(e), g = t.isItemExpanded(e), u = t.isItemFocused(e), o = t.isItemSelected(e), s = t.isItemDisabled(e), d = t != null && t.isItemBeingEdited ? t == null ? void 0 : t.isItemBeingEdited(e) : !1, b = t.isItemEditable ? t.isItemEditable(e) : !1, h = (y) => {
|
|
1021
1020
|
if (!s) {
|
|
1022
|
-
|
|
1021
|
+
u || t.focusItem(y, e);
|
|
1023
1022
|
const R = r && (y.shiftKey || y.ctrlKey || y.metaKey);
|
|
1024
1023
|
p && !(R && t.isItemExpanded(e)) && t.toggleItemExpansion(y, e);
|
|
1025
1024
|
}
|
|
1026
1025
|
}, c = (y) => {
|
|
1027
|
-
s || (
|
|
1026
|
+
s || (u || t.focusItem(y, e), r && (y.shiftKey || y.ctrlKey || y.metaKey) ? y.shiftKey ? t.expandSelectionRange(y, e) : t.selectItem({
|
|
1028
1027
|
event: y,
|
|
1029
1028
|
itemId: e,
|
|
1030
1029
|
keepExistingSelection: !0
|
|
@@ -1034,7 +1033,7 @@ function Qe(e) {
|
|
|
1034
1033
|
shouldBeSelected: !0
|
|
1035
1034
|
}));
|
|
1036
1035
|
}, i = (y) => {
|
|
1037
|
-
if (
|
|
1036
|
+
if (x || s)
|
|
1038
1037
|
return;
|
|
1039
1038
|
const R = y.nativeEvent.shiftKey;
|
|
1040
1039
|
r && R ? t.expandSelectionRange(y, e) : t.selectItem({
|
|
@@ -1043,26 +1042,26 @@ function Qe(e) {
|
|
|
1043
1042
|
keepExistingSelection: r,
|
|
1044
1043
|
shouldBeSelected: y.target.checked
|
|
1045
1044
|
});
|
|
1046
|
-
},
|
|
1045
|
+
}, f = (y) => {
|
|
1047
1046
|
(y.shiftKey || y.ctrlKey || y.metaKey || s) && y.preventDefault();
|
|
1048
1047
|
}, I = () => {
|
|
1049
1048
|
oe(t, H) && t.isItemEditable(e) && (t.isItemBeingEdited(e) ? t.setEditedItemId(null) : t.setEditedItemId(e));
|
|
1050
1049
|
};
|
|
1051
1050
|
return {
|
|
1052
1051
|
disabled: s,
|
|
1053
|
-
expanded:
|
|
1052
|
+
expanded: g,
|
|
1054
1053
|
selected: o,
|
|
1055
|
-
focused:
|
|
1054
|
+
focused: u,
|
|
1056
1055
|
editable: b,
|
|
1057
|
-
editing:
|
|
1058
|
-
disableSelection:
|
|
1056
|
+
editing: d,
|
|
1057
|
+
disableSelection: x,
|
|
1059
1058
|
checkboxSelection: l,
|
|
1060
|
-
handleExpansion:
|
|
1059
|
+
handleExpansion: h,
|
|
1061
1060
|
handleSelection: c,
|
|
1062
1061
|
handleCheckboxSelection: i,
|
|
1063
1062
|
handleContentClick: n,
|
|
1064
|
-
preventSelection:
|
|
1065
|
-
expansionTrigger:
|
|
1063
|
+
preventSelection: f,
|
|
1064
|
+
expansionTrigger: m,
|
|
1066
1065
|
toggleItemEditing: I,
|
|
1067
1066
|
handleSaveItemLabel: (y, R) => {
|
|
1068
1067
|
oe(t, H) && t.isItemBeingEditedRef(e) && (t.updateItemLabel(e, R), I(), t.focusItem(y, e));
|
|
@@ -1072,23 +1071,23 @@ function Qe(e) {
|
|
|
1072
1071
|
}
|
|
1073
1072
|
};
|
|
1074
1073
|
}
|
|
1075
|
-
const
|
|
1074
|
+
const Cn = ["classes", "className", "displayIcon", "expansionIcon", "icon", "label", "itemId", "onClick", "onMouseDown", "dragAndDropOverlayProps", "labelInputProps"], Ce = /* @__PURE__ */ E.forwardRef(function(t, n) {
|
|
1076
1075
|
const {
|
|
1077
1076
|
classes: r,
|
|
1078
1077
|
className: l,
|
|
1079
|
-
displayIcon:
|
|
1080
|
-
expansionIcon:
|
|
1078
|
+
displayIcon: x,
|
|
1079
|
+
expansionIcon: m,
|
|
1081
1080
|
icon: p,
|
|
1082
|
-
label:
|
|
1083
|
-
itemId:
|
|
1081
|
+
label: g,
|
|
1082
|
+
itemId: u,
|
|
1084
1083
|
onClick: o,
|
|
1085
1084
|
onMouseDown: s,
|
|
1086
|
-
dragAndDropOverlayProps:
|
|
1085
|
+
dragAndDropOverlayProps: d,
|
|
1087
1086
|
labelInputProps: b
|
|
1088
|
-
} = t,
|
|
1087
|
+
} = t, h = A(t, Cn), {
|
|
1089
1088
|
disabled: c,
|
|
1090
1089
|
expanded: i,
|
|
1091
|
-
selected:
|
|
1090
|
+
selected: f,
|
|
1092
1091
|
focused: I,
|
|
1093
1092
|
editing: T,
|
|
1094
1093
|
editable: P,
|
|
@@ -1101,40 +1100,40 @@ const wn = ["classes", "className", "displayIcon", "expansionIcon", "icon", "lab
|
|
|
1101
1100
|
preventSelection: L,
|
|
1102
1101
|
expansionTrigger: W,
|
|
1103
1102
|
toggleItemEditing: G
|
|
1104
|
-
} = Qe(
|
|
1103
|
+
} = Qe(u), j = p || m || x, J = E.useRef(null), ce = (M) => {
|
|
1105
1104
|
L(M), s && s(M);
|
|
1106
1105
|
}, ue = (M) => {
|
|
1107
1106
|
var Y;
|
|
1108
|
-
V == null || V(M,
|
|
1107
|
+
V == null || V(M, u), !((Y = J.current) != null && Y.contains(M.target)) && (W === "content" && v(M), R || F(M), o && o(M));
|
|
1109
1108
|
}, de = (M) => {
|
|
1110
1109
|
M.defaultMuiPrevented || G();
|
|
1111
1110
|
};
|
|
1112
1111
|
return (
|
|
1113
1112
|
/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions -- Key event is handled by the TreeView */
|
|
1114
|
-
/* @__PURE__ */ je("div", C({},
|
|
1115
|
-
className: Be(r.root, l, i && r.expanded,
|
|
1113
|
+
/* @__PURE__ */ je("div", C({}, h, {
|
|
1114
|
+
className: Be(r.root, l, i && r.expanded, f && r.selected, I && r.focused, c && r.disabled, T && r.editing, P && r.editable),
|
|
1116
1115
|
onClick: ue,
|
|
1117
1116
|
onMouseDown: ce,
|
|
1118
1117
|
ref: n,
|
|
1119
1118
|
children: [/* @__PURE__ */ S("div", {
|
|
1120
1119
|
className: r.iconContainer,
|
|
1121
1120
|
children: j
|
|
1122
|
-
}), R && /* @__PURE__ */ S(
|
|
1121
|
+
}), R && /* @__PURE__ */ S(Wt, {
|
|
1123
1122
|
className: r.checkbox,
|
|
1124
|
-
checked:
|
|
1123
|
+
checked: f,
|
|
1125
1124
|
onChange: B,
|
|
1126
1125
|
disabled: c || y,
|
|
1127
1126
|
ref: J,
|
|
1128
1127
|
tabIndex: -1
|
|
1129
|
-
}), T ? /* @__PURE__ */ S(
|
|
1128
|
+
}), T ? /* @__PURE__ */ S(Dt, C({}, b, {
|
|
1130
1129
|
className: r.labelInput
|
|
1131
1130
|
})) : /* @__PURE__ */ S("div", C({
|
|
1132
1131
|
className: r.label
|
|
1133
1132
|
}, P && {
|
|
1134
1133
|
onDoubleClick: de
|
|
1135
1134
|
}, {
|
|
1136
|
-
children:
|
|
1137
|
-
})),
|
|
1135
|
+
children: g
|
|
1136
|
+
})), d && /* @__PURE__ */ S(Ot, C({}, d))]
|
|
1138
1137
|
}))
|
|
1139
1138
|
);
|
|
1140
1139
|
});
|
|
@@ -1182,7 +1181,7 @@ process.env.NODE_ENV !== "production" && (Ce.propTypes = {
|
|
|
1182
1181
|
value: a.string
|
|
1183
1182
|
})
|
|
1184
1183
|
});
|
|
1185
|
-
const
|
|
1184
|
+
const wn = ["children", "className", "slots", "slotProps", "ContentComponent", "ContentProps", "itemId", "id", "label", "onClick", "onMouseDown", "onFocus", "onBlur", "onKeyDown"], Rn = ["ownerState"], Sn = ["ownerState"], Pn = ["ownerState"], vn = Ue(), kn = (e) => {
|
|
1186
1185
|
const {
|
|
1187
1186
|
classes: t
|
|
1188
1187
|
} = e;
|
|
@@ -1200,8 +1199,8 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1200
1199
|
editing: ["editing"],
|
|
1201
1200
|
editable: ["editable"],
|
|
1202
1201
|
groupTransition: ["groupTransition"]
|
|
1203
|
-
},
|
|
1204
|
-
},
|
|
1202
|
+
}, Lt, t);
|
|
1203
|
+
}, Mn = ie("li", {
|
|
1205
1204
|
name: "MuiTreeItem",
|
|
1206
1205
|
slot: "Root",
|
|
1207
1206
|
overridesResolver: (e, t) => t.root
|
|
@@ -1210,7 +1209,7 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1210
1209
|
margin: 0,
|
|
1211
1210
|
padding: 0,
|
|
1212
1211
|
outline: 0
|
|
1213
|
-
}),
|
|
1212
|
+
}), Dn = ie(Ce, {
|
|
1214
1213
|
name: "MuiTreeItem",
|
|
1215
1214
|
slot: "Content",
|
|
1216
1215
|
overridesResolver: (e, t) => [t.content, t.iconContainer && {
|
|
@@ -1288,7 +1287,7 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1288
1287
|
paddingLeft: `calc(${e.spacing(1)} + var(--TreeView-itemChildrenIndentation) * var(--TreeView-itemDepth))`
|
|
1289
1288
|
}
|
|
1290
1289
|
}]
|
|
1291
|
-
})),
|
|
1290
|
+
})), On = ie(jt, {
|
|
1292
1291
|
name: "MuiTreeItem",
|
|
1293
1292
|
slot: "GroupTransition",
|
|
1294
1293
|
overridesResolver: (e, t) => t.groupTransition,
|
|
@@ -1311,26 +1310,26 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1311
1310
|
icons: r,
|
|
1312
1311
|
runItemPlugins: l,
|
|
1313
1312
|
items: {
|
|
1314
|
-
disabledItemsFocusable:
|
|
1315
|
-
indentationAtItemLevel:
|
|
1313
|
+
disabledItemsFocusable: x,
|
|
1314
|
+
indentationAtItemLevel: m
|
|
1316
1315
|
},
|
|
1317
1316
|
selection: {
|
|
1318
1317
|
disableSelection: p
|
|
1319
1318
|
},
|
|
1320
1319
|
expansion: {
|
|
1321
|
-
expansionTrigger:
|
|
1320
|
+
expansionTrigger: g
|
|
1322
1321
|
},
|
|
1323
|
-
treeId:
|
|
1322
|
+
treeId: u,
|
|
1324
1323
|
instance: o
|
|
1325
|
-
} = Ke(), s = E.useContext($e),
|
|
1324
|
+
} = Ke(), s = E.useContext($e), d = vn({
|
|
1326
1325
|
props: t,
|
|
1327
1326
|
name: "MuiTreeItem"
|
|
1328
1327
|
}), {
|
|
1329
1328
|
children: b,
|
|
1330
|
-
className:
|
|
1329
|
+
className: h,
|
|
1331
1330
|
slots: c,
|
|
1332
1331
|
slotProps: i,
|
|
1333
|
-
ContentComponent:
|
|
1332
|
+
ContentComponent: f = Ce,
|
|
1334
1333
|
ContentProps: I,
|
|
1335
1334
|
itemId: T,
|
|
1336
1335
|
id: P,
|
|
@@ -1339,7 +1338,7 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1339
1338
|
onMouseDown: v,
|
|
1340
1339
|
onBlur: F,
|
|
1341
1340
|
onKeyDown: B
|
|
1342
|
-
} =
|
|
1341
|
+
} = d, V = A(d, wn), {
|
|
1343
1342
|
expanded: L,
|
|
1344
1343
|
focused: W,
|
|
1345
1344
|
selected: G,
|
|
@@ -1349,24 +1348,24 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1349
1348
|
handleCancelItemLabelEditing: ue,
|
|
1350
1349
|
handleSaveItemLabel: de
|
|
1351
1350
|
} = Qe(T);
|
|
1352
|
-
process.env.NODE_ENV !== "production" && (
|
|
1351
|
+
process.env.NODE_ENV !== "production" && (d.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/."]), d.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/."]));
|
|
1353
1352
|
const {
|
|
1354
1353
|
contentRef: M,
|
|
1355
1354
|
rootRef: Y,
|
|
1356
1355
|
propsEnhancers: D
|
|
1357
|
-
} = l(
|
|
1358
|
-
expandIcon: (c == null ? void 0 : c.expandIcon) ?? r.slots.expandIcon ??
|
|
1359
|
-
collapseIcon: (c == null ? void 0 : c.collapseIcon) ?? r.slots.collapseIcon ??
|
|
1356
|
+
} = l(d), Q = E.useRef(null), we = E.useRef(null), nt = Ee(n, Y, Q), ot = Ee(I == null ? void 0 : I.ref, M, we), z = {
|
|
1357
|
+
expandIcon: (c == null ? void 0 : c.expandIcon) ?? r.slots.expandIcon ?? At,
|
|
1358
|
+
collapseIcon: (c == null ? void 0 : c.collapseIcon) ?? r.slots.collapseIcon ?? Vt,
|
|
1360
1359
|
endIcon: (c == null ? void 0 : c.endIcon) ?? r.slots.endIcon,
|
|
1361
1360
|
icon: c == null ? void 0 : c.icon,
|
|
1362
1361
|
groupTransition: c == null ? void 0 : c.groupTransition
|
|
1363
|
-
}, Re = (w) => Array.isArray(w) ? w.length > 0 && w.some(Re) : !!w, Z = Re(b), fe = C({},
|
|
1362
|
+
}, Re = (w) => Array.isArray(w) ? w.length > 0 && w.some(Re) : !!w, Z = Re(b), fe = C({}, d, {
|
|
1364
1363
|
expanded: L,
|
|
1365
1364
|
focused: W,
|
|
1366
1365
|
selected: G,
|
|
1367
1366
|
disabled: j,
|
|
1368
|
-
indentationAtItemLevel:
|
|
1369
|
-
}), k =
|
|
1367
|
+
indentationAtItemLevel: m
|
|
1368
|
+
}), k = kn(fe), Se = z.groupTransition ?? void 0, rt = N({
|
|
1370
1369
|
elementType: Se,
|
|
1371
1370
|
ownerState: {},
|
|
1372
1371
|
externalSlotProps: i == null ? void 0 : i.groupTransition,
|
|
@@ -1375,12 +1374,12 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1375
1374
|
in: L,
|
|
1376
1375
|
component: "ul",
|
|
1377
1376
|
role: "group"
|
|
1378
|
-
},
|
|
1377
|
+
}, m ? {
|
|
1379
1378
|
indentationAtItemLevel: !0
|
|
1380
1379
|
} : {}),
|
|
1381
1380
|
className: k.groupTransition
|
|
1382
1381
|
}), st = (w) => {
|
|
1383
|
-
|
|
1382
|
+
g === "iconContainer" && ce(w);
|
|
1384
1383
|
}, pe = L ? z.collapseIcon : z.expandIcon, it = N({
|
|
1385
1384
|
elementType: pe,
|
|
1386
1385
|
ownerState: {},
|
|
@@ -1388,19 +1387,19 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1388
1387
|
additionalProps: {
|
|
1389
1388
|
onClick: st
|
|
1390
1389
|
}
|
|
1391
|
-
}), lt = A(it,
|
|
1390
|
+
}), lt = A(it, Rn), at = Z && pe ? /* @__PURE__ */ S(pe, C({}, lt)) : null, me = Z ? void 0 : z.endIcon, ct = N({
|
|
1392
1391
|
elementType: me,
|
|
1393
1392
|
ownerState: {},
|
|
1394
1393
|
externalSlotProps: (w) => Z ? {} : C({}, $(r.slotProps.endIcon, w), $(i == null ? void 0 : i.endIcon, w))
|
|
1395
|
-
}), ut = A(ct,
|
|
1394
|
+
}), ut = A(ct, Sn), dt = me ? /* @__PURE__ */ S(me, C({}, ut)) : null, Ie = z.icon, ft = N({
|
|
1396
1395
|
elementType: Ie,
|
|
1397
1396
|
ownerState: {},
|
|
1398
1397
|
externalSlotProps: i == null ? void 0 : i.icon
|
|
1399
|
-
}), pt = A(ft,
|
|
1398
|
+
}), pt = A(ft, Pn), mt = Ie ? /* @__PURE__ */ S(Ie, C({}, pt)) : null;
|
|
1400
1399
|
let ee;
|
|
1401
1400
|
G ? ee = !0 : p || j ? ee = void 0 : ee = !1;
|
|
1402
1401
|
function It(w) {
|
|
1403
|
-
!W && (!j ||
|
|
1402
|
+
!W && (!j || x) && w.currentTarget === w.target && o.focusItem(w, T);
|
|
1404
1403
|
}
|
|
1405
1404
|
function gt(w) {
|
|
1406
1405
|
var _, q, Ve, Ae;
|
|
@@ -1413,7 +1412,7 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1413
1412
|
B == null || B(w), ((q = (_ = w.target) == null ? void 0 : _.dataset) == null ? void 0 : q.element) !== "labelInput" && o.handleItemKeyDown(w, T);
|
|
1414
1413
|
}, ht = _e({
|
|
1415
1414
|
itemId: T,
|
|
1416
|
-
treeId:
|
|
1415
|
+
treeId: u,
|
|
1417
1416
|
id: P
|
|
1418
1417
|
}), xt = o.canItemBeTabbed(T) ? 0 : -1, te = {
|
|
1419
1418
|
rootRefObject: Q,
|
|
@@ -1431,10 +1430,10 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1431
1430
|
}))) ?? {}, ve = ((Oe = D.labelInput) == null ? void 0 : Oe.call(D, C({}, te, {
|
|
1432
1431
|
externalEventHandlers: {}
|
|
1433
1432
|
}))) ?? {};
|
|
1434
|
-
return /* @__PURE__ */ S(
|
|
1433
|
+
return /* @__PURE__ */ S(Ft, {
|
|
1435
1434
|
itemId: T,
|
|
1436
|
-
children: /* @__PURE__ */ je(
|
|
1437
|
-
className: Be(k.root,
|
|
1435
|
+
children: /* @__PURE__ */ je(Mn, C({
|
|
1436
|
+
className: Be(k.root, h),
|
|
1438
1437
|
role: "treeitem",
|
|
1439
1438
|
"aria-expanded": Z ? L : void 0,
|
|
1440
1439
|
"aria-selected": ee,
|
|
@@ -1447,12 +1446,12 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1447
1446
|
onBlur: gt,
|
|
1448
1447
|
onKeyDown: bt,
|
|
1449
1448
|
ref: nt,
|
|
1450
|
-
style:
|
|
1449
|
+
style: m ? C({}, V.style, {
|
|
1451
1450
|
"--TreeView-itemDepth": typeof s == "function" ? s(T) : s
|
|
1452
1451
|
}) : V.style
|
|
1453
1452
|
}, Et, {
|
|
1454
|
-
children: [/* @__PURE__ */ S(
|
|
1455
|
-
as:
|
|
1453
|
+
children: [/* @__PURE__ */ S(Dn, C({
|
|
1454
|
+
as: f,
|
|
1456
1455
|
classes: {
|
|
1457
1456
|
root: k.content,
|
|
1458
1457
|
expanded: k.expanded,
|
|
@@ -1480,7 +1479,7 @@ const Rn = ["children", "className", "slots", "slotProps", "ContentComponent", "
|
|
|
1480
1479
|
labelInputProps: ve
|
|
1481
1480
|
}, {
|
|
1482
1481
|
ref: ot
|
|
1483
|
-
})), b && /* @__PURE__ */ S(
|
|
1482
|
+
})), b && /* @__PURE__ */ S(On, C({
|
|
1484
1483
|
as: Se
|
|
1485
1484
|
}, rt, {
|
|
1486
1485
|
children: b
|
|
@@ -1507,7 +1506,7 @@ process.env.NODE_ENV !== "production" && (Ze.propTypes = {
|
|
|
1507
1506
|
* @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/.
|
|
1508
1507
|
* @default TreeItemContent
|
|
1509
1508
|
*/
|
|
1510
|
-
ContentComponent:
|
|
1509
|
+
ContentComponent: Jt,
|
|
1511
1510
|
/**
|
|
1512
1511
|
* Props applied to ContentComponent.
|
|
1513
1512
|
* @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/.
|
|
@@ -1530,7 +1529,7 @@ process.env.NODE_ENV !== "production" && (Ze.propTypes = {
|
|
|
1530
1529
|
* This prop isn't supported.
|
|
1531
1530
|
* Use the `onItemFocus` callback on the tree if you need to monitor a item's focus.
|
|
1532
1531
|
*/
|
|
1533
|
-
onFocus:
|
|
1532
|
+
onFocus: Gt,
|
|
1534
1533
|
/**
|
|
1535
1534
|
* Callback fired when a key of the keyboard is pressed on the item.
|
|
1536
1535
|
*/
|
|
@@ -1550,17 +1549,17 @@ process.env.NODE_ENV !== "production" && (Ze.propTypes = {
|
|
|
1550
1549
|
*/
|
|
1551
1550
|
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object])
|
|
1552
1551
|
});
|
|
1553
|
-
const
|
|
1554
|
-
function
|
|
1552
|
+
const Vn = ["ownerState"];
|
|
1553
|
+
function An({
|
|
1555
1554
|
slots: e,
|
|
1556
1555
|
slotProps: t,
|
|
1557
1556
|
label: n,
|
|
1558
1557
|
id: r,
|
|
1559
1558
|
itemId: l,
|
|
1560
|
-
itemsToRender:
|
|
1559
|
+
itemsToRender: x
|
|
1561
1560
|
}) {
|
|
1562
|
-
const
|
|
1563
|
-
elementType:
|
|
1561
|
+
const m = (e == null ? void 0 : e.item) ?? Ze, p = N({
|
|
1562
|
+
elementType: m,
|
|
1564
1563
|
externalSlotProps: t == null ? void 0 : t.item,
|
|
1565
1564
|
additionalProps: {
|
|
1566
1565
|
itemId: l,
|
|
@@ -1571,13 +1570,13 @@ function Fn({
|
|
|
1571
1570
|
itemId: l,
|
|
1572
1571
|
label: n
|
|
1573
1572
|
}
|
|
1574
|
-
}),
|
|
1575
|
-
itemsToRender:
|
|
1573
|
+
}), g = A(p, Vn), u = E.useMemo(() => x ? /* @__PURE__ */ S(et, {
|
|
1574
|
+
itemsToRender: x,
|
|
1576
1575
|
slots: e,
|
|
1577
1576
|
slotProps: t
|
|
1578
|
-
}) : null, [
|
|
1579
|
-
return /* @__PURE__ */ S(
|
|
1580
|
-
children:
|
|
1577
|
+
}) : null, [x, e, t]);
|
|
1578
|
+
return /* @__PURE__ */ S(m, C({}, g, {
|
|
1579
|
+
children: u
|
|
1581
1580
|
}));
|
|
1582
1581
|
}
|
|
1583
1582
|
function et(e) {
|
|
@@ -1587,7 +1586,7 @@ function et(e) {
|
|
|
1587
1586
|
slotProps: r
|
|
1588
1587
|
} = e;
|
|
1589
1588
|
return /* @__PURE__ */ S(E.Fragment, {
|
|
1590
|
-
children: t.map((l) => /* @__PURE__ */ S(
|
|
1589
|
+
children: t.map((l) => /* @__PURE__ */ S(An, {
|
|
1591
1590
|
slots: n,
|
|
1592
1591
|
slotProps: r,
|
|
1593
1592
|
label: l.label,
|
|
@@ -1597,14 +1596,14 @@ function et(e) {
|
|
|
1597
1596
|
}, l.itemId))
|
|
1598
1597
|
});
|
|
1599
1598
|
}
|
|
1600
|
-
const
|
|
1599
|
+
const Fn = Ue(), Ln = (e) => {
|
|
1601
1600
|
const {
|
|
1602
1601
|
classes: t
|
|
1603
1602
|
} = e;
|
|
1604
1603
|
return ze({
|
|
1605
1604
|
root: ["root"]
|
|
1606
|
-
},
|
|
1607
|
-
},
|
|
1605
|
+
}, Yt, t);
|
|
1606
|
+
}, jn = ie("ul", {
|
|
1608
1607
|
name: "MuiRichTreeView",
|
|
1609
1608
|
slot: "Root",
|
|
1610
1609
|
overridesResolver: (e, t) => t.root
|
|
@@ -1615,36 +1614,36 @@ const Ln = Ue(), jn = (e) => {
|
|
|
1615
1614
|
outline: 0,
|
|
1616
1615
|
position: "relative"
|
|
1617
1616
|
}), tt = /* @__PURE__ */ E.forwardRef(function(t, n) {
|
|
1618
|
-
const r =
|
|
1617
|
+
const r = Fn({
|
|
1619
1618
|
props: t,
|
|
1620
1619
|
name: "MuiRichTreeView"
|
|
1621
1620
|
});
|
|
1622
1621
|
process.env.NODE_ENV !== "production" && r.children != null && xe(["MUI X: The Rich Tree View component does not support JSX children.", "If you want to add items, you need to use the `items` prop.", "Check the documentation for more details: https://mui.com/x/react-tree-view/rich-tree-view/items/."]);
|
|
1623
1622
|
const {
|
|
1624
1623
|
getRootProps: l,
|
|
1625
|
-
contextValue:
|
|
1626
|
-
instance:
|
|
1627
|
-
} =
|
|
1628
|
-
plugins:
|
|
1624
|
+
contextValue: x,
|
|
1625
|
+
instance: m
|
|
1626
|
+
} = ln({
|
|
1627
|
+
plugins: yn,
|
|
1629
1628
|
rootRef: n,
|
|
1630
1629
|
props: r
|
|
1631
1630
|
}), {
|
|
1632
1631
|
slots: p,
|
|
1633
|
-
slotProps:
|
|
1634
|
-
} = r,
|
|
1632
|
+
slotProps: g
|
|
1633
|
+
} = r, u = Ln(r), o = (p == null ? void 0 : p.root) ?? jn, s = N({
|
|
1635
1634
|
elementType: o,
|
|
1636
|
-
externalSlotProps:
|
|
1637
|
-
className:
|
|
1635
|
+
externalSlotProps: g == null ? void 0 : g.root,
|
|
1636
|
+
className: u.root,
|
|
1638
1637
|
getSlotProps: l,
|
|
1639
1638
|
ownerState: r
|
|
1640
1639
|
});
|
|
1641
|
-
return /* @__PURE__ */ S(
|
|
1642
|
-
value:
|
|
1640
|
+
return /* @__PURE__ */ S(an, {
|
|
1641
|
+
value: x,
|
|
1643
1642
|
children: /* @__PURE__ */ S(o, C({}, s, {
|
|
1644
1643
|
children: /* @__PURE__ */ S(et, {
|
|
1645
1644
|
slots: p,
|
|
1646
|
-
slotProps:
|
|
1647
|
-
itemsToRender:
|
|
1645
|
+
slotProps: g,
|
|
1646
|
+
itemsToRender: m.getItemsToRender()
|
|
1648
1647
|
})
|
|
1649
1648
|
}))
|
|
1650
1649
|
});
|
|
@@ -1837,46 +1836,47 @@ process.env.NODE_ENV !== "production" && (tt.propTypes = {
|
|
|
1837
1836
|
*/
|
|
1838
1837
|
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object])
|
|
1839
1838
|
});
|
|
1840
|
-
const
|
|
1839
|
+
const no = ({
|
|
1841
1840
|
items: e,
|
|
1842
1841
|
selectedItemId: t,
|
|
1843
1842
|
handleSelectedItemChange: n,
|
|
1844
|
-
iconColor: r = "primary"
|
|
1843
|
+
iconColor: r = "primary",
|
|
1844
|
+
height: l = 300
|
|
1845
1845
|
}) => {
|
|
1846
|
-
const [
|
|
1847
|
-
return
|
|
1846
|
+
const [x, m] = yt([]), p = Ct(() => Kt(e), [e]);
|
|
1847
|
+
return wt(() => {
|
|
1848
1848
|
if (t) {
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1851
|
-
const
|
|
1852
|
-
|
|
1853
|
-
const
|
|
1854
|
-
(
|
|
1849
|
+
const u = Ut(e, t);
|
|
1850
|
+
if (u) {
|
|
1851
|
+
const o = u.slice(0, -1);
|
|
1852
|
+
m((s) => {
|
|
1853
|
+
const d = o.filter(
|
|
1854
|
+
(b) => !s.includes(b)
|
|
1855
1855
|
);
|
|
1856
|
-
return
|
|
1856
|
+
return d.length > 0 ? [...s, ...d] : s;
|
|
1857
1857
|
});
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
|
-
}, [t, e]), /* @__PURE__ */ S(
|
|
1860
|
+
}, [t, e]), /* @__PURE__ */ S($t, { height: l, "data-treeview-root": "true", children: /* @__PURE__ */ S(
|
|
1861
1861
|
tt,
|
|
1862
1862
|
{
|
|
1863
1863
|
items: e,
|
|
1864
1864
|
selectedItems: t,
|
|
1865
|
-
expandedItems:
|
|
1866
|
-
onExpandedItemsChange: (
|
|
1867
|
-
|
|
1865
|
+
expandedItems: x,
|
|
1866
|
+
onExpandedItemsChange: (u, o) => {
|
|
1867
|
+
m(o);
|
|
1868
1868
|
},
|
|
1869
|
-
itemChildrenIndentation:
|
|
1869
|
+
itemChildrenIndentation: Nt,
|
|
1870
1870
|
onSelectedItemsChange: n,
|
|
1871
|
-
getItemId:
|
|
1871
|
+
getItemId: Bt,
|
|
1872
1872
|
slots: {
|
|
1873
|
-
item: (
|
|
1874
|
-
const
|
|
1873
|
+
item: (u) => {
|
|
1874
|
+
const o = u.itemId ? p[u.itemId] : void 0;
|
|
1875
1875
|
return /* @__PURE__ */ S(
|
|
1876
|
-
|
|
1876
|
+
_t,
|
|
1877
1877
|
{
|
|
1878
|
-
...
|
|
1879
|
-
itemData:
|
|
1878
|
+
...u,
|
|
1879
|
+
itemData: o,
|
|
1880
1880
|
iconColor: r
|
|
1881
1881
|
}
|
|
1882
1882
|
);
|
|
@@ -1886,5 +1886,5 @@ const ro = ({
|
|
|
1886
1886
|
) });
|
|
1887
1887
|
};
|
|
1888
1888
|
export {
|
|
1889
|
-
|
|
1889
|
+
no as default
|
|
1890
1890
|
};
|