@bigplay/tree-view 0.3.1 → 0.5.0
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/BracketCard.vue.d.ts +13 -0
- package/dist/BracketRounds.vue.d.ts +37 -13
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +276 -211
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { IDENTITY_TRANSFORM as
|
|
3
|
-
import { DEFAULT_OPTIONS as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as D, openBlock as s, createElementBlock as d, createElementVNode as C, toDisplayString as _, withModifiers as Q, createCommentVNode as z, ref as g, watch as O, onBeforeUnmount as P, computed as f, onMounted as V, nextTick as U, normalizeStyle as S, normalizeClass as E, unref as j, Fragment as I, renderList as M, renderSlot as R, createVNode as K, createTextVNode as q } from "vue";
|
|
2
|
+
import { IDENTITY_TRANSFORM as J, PanZoomController as X, toTree as ee, applyCollapsed as te, layoutTree as oe, toggleCollapsed as ne, estimateVisibleRect as ae, measureVisibleRect as re, DEFAULT_OVERSCAN as ie, visibleLayout as le, toCssTransform as se, DEFAULT_SCALE_LIMITS as de, buildBracketCard as ce, MOBILE_MEDIA_QUERY as ve, resolveOptions as ue, DEFAULT_OPTIONS as pe, levelGapForWidth as fe, buildBracketRounds as he, SWIPE_ELBOW_OFFSET as be, roundSiblingGap as we, watchMedia as me, watchWidth as ge, watchChildren as ke, hideRoundsBefore as xe, roundOfDepth as _e, roundAtScroll as ye, findScrollParent as Ce, nodesInColumn as Te, horizontalBox as ze, offsetWithin as Se, smoothScrollLeft as Ee, roundScrollLeft as $e, injectStyles as Be } from "@bigplay/tree-view-core";
|
|
3
|
+
import { DEFAULT_OPTIONS as at, MOBILE_MEDIA_QUERY as rt, bracketCardHeight as it, buildBracketCard as lt, buildBracketRounds as st } from "@bigplay/tree-view-core";
|
|
4
|
+
const Le = { class: "tree-view-card" }, Ie = { class: "tree-view-card__label" }, Oe = ["aria-label"], Y = /* @__PURE__ */ D({
|
|
5
5
|
__name: "TreeNodeCard",
|
|
6
6
|
props: {
|
|
7
7
|
label: {},
|
|
@@ -9,70 +9,70 @@ const me = { class: "tree-view-card" }, ge = { class: "tree-view-card__label" },
|
|
|
9
9
|
collapsed: { type: Boolean }
|
|
10
10
|
},
|
|
11
11
|
emits: ["toggle"],
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
return (e,
|
|
15
|
-
C("span",
|
|
16
|
-
|
|
12
|
+
setup(o, { emit: c }) {
|
|
13
|
+
const i = c;
|
|
14
|
+
return (e, a) => (s(), d("div", Le, [
|
|
15
|
+
C("span", Ie, _(o.label), 1),
|
|
16
|
+
o.hasChildren ? (s(), d("button", {
|
|
17
17
|
key: 0,
|
|
18
18
|
type: "button",
|
|
19
19
|
class: "tree-view-card__toggle",
|
|
20
20
|
"data-tv-no-pan": "",
|
|
21
|
-
"aria-label":
|
|
22
|
-
onClick:
|
|
23
|
-
},
|
|
21
|
+
"aria-label": o.collapsed ? "Развернуть" : "Свернуть",
|
|
22
|
+
onClick: a[0] || (a[0] = Q((u) => i("toggle"), ["stop"]))
|
|
23
|
+
}, _(o.collapsed ? "+" : "−"), 9, Oe)) : z("", !0)
|
|
24
24
|
]));
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
pannable:
|
|
30
|
-
zoomable:
|
|
31
|
-
limits:
|
|
27
|
+
function Me(o) {
|
|
28
|
+
const c = g({ ...J }), i = new X({
|
|
29
|
+
pannable: o.pannable,
|
|
30
|
+
zoomable: o.zoomable,
|
|
31
|
+
limits: o.limits,
|
|
32
32
|
onChange: (e) => {
|
|
33
|
-
|
|
33
|
+
c.value = e;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
(e,
|
|
39
|
-
e && (
|
|
36
|
+
return O(
|
|
37
|
+
o.element,
|
|
38
|
+
(e, a, u) => {
|
|
39
|
+
e && (i.attach(e), u(() => i.detach()));
|
|
40
40
|
},
|
|
41
41
|
{ immediate: !0 }
|
|
42
|
-
),
|
|
43
|
-
transform:
|
|
44
|
-
fit: (e,
|
|
45
|
-
zoomIn: () =>
|
|
46
|
-
zoomOut: () =>
|
|
47
|
-
reset: () =>
|
|
48
|
-
setTransform: (e) =>
|
|
42
|
+
), P(() => i.detach()), {
|
|
43
|
+
transform: c,
|
|
44
|
+
fit: (e, a) => i.fit(e, a),
|
|
45
|
+
zoomIn: () => i.zoomIn(),
|
|
46
|
+
zoomOut: () => i.zoomOut(),
|
|
47
|
+
reset: () => i.reset(),
|
|
48
|
+
setTransform: (e) => i.set(e)
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const
|
|
53
|
-
function
|
|
54
|
-
return
|
|
51
|
+
function Re(o) {
|
|
52
|
+
const c = g(/* @__PURE__ */ new Set()), i = f(() => ee(o.data(), o.accessors())), e = f(() => te(i.value, c.value)), a = f(() => oe(e.value, o.options()));
|
|
53
|
+
function u(b) {
|
|
54
|
+
return c.value.has(b);
|
|
55
55
|
}
|
|
56
56
|
function m(b) {
|
|
57
|
-
|
|
57
|
+
c.value = ne(c.value, b);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
59
|
+
function l() {
|
|
60
|
+
c.value = /* @__PURE__ */ new Set();
|
|
61
61
|
}
|
|
62
|
-
return { layout:
|
|
62
|
+
return { layout: a, isCollapsed: u, toggle: m, expandAll: l };
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const e = g(
|
|
66
|
-
function
|
|
67
|
-
e.value =
|
|
64
|
+
function De(o, c, i) {
|
|
65
|
+
const e = g(i() ? ae() : null);
|
|
66
|
+
function a() {
|
|
67
|
+
e.value = i() ? re(o.value, c()) : null;
|
|
68
68
|
}
|
|
69
69
|
return V(() => {
|
|
70
|
-
|
|
71
|
-
}),
|
|
72
|
-
window.removeEventListener("scroll",
|
|
73
|
-
}), { rect: e, update:
|
|
70
|
+
a(), window.addEventListener("scroll", a, { passive: !0, capture: !0 }), window.addEventListener("resize", a, { passive: !0 });
|
|
71
|
+
}), P(() => {
|
|
72
|
+
window.removeEventListener("scroll", a, { capture: !0 }), window.removeEventListener("resize", a);
|
|
73
|
+
}), { rect: e, update: a };
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const Ne = ["width", "height"], We = ["data-depth"], Fe = ["d"], He = ["data-depth", "onClick"], Ae = /* @__PURE__ */ D({
|
|
76
76
|
__name: "TreeView",
|
|
77
77
|
props: {
|
|
78
78
|
data: {},
|
|
@@ -88,11 +88,11 @@ const ye = ["width", "height"], Ce = ["d"], Te = ["onClick"], ze = /* @__PURE__
|
|
|
88
88
|
scaleLimits: { default: void 0 },
|
|
89
89
|
nodeClass: { type: [String, Function], default: void 0 },
|
|
90
90
|
virtualize: { type: Boolean, default: !0 },
|
|
91
|
-
overscan: { default:
|
|
91
|
+
overscan: { default: ie }
|
|
92
92
|
},
|
|
93
93
|
emits: ["node-click", "toggle", "transform"],
|
|
94
|
-
setup(
|
|
95
|
-
const e =
|
|
94
|
+
setup(o, { expose: c, emit: i }) {
|
|
95
|
+
const e = o, a = i, u = g(null), m = g(null), { layout: l, isCollapsed: b, toggle: r, expandAll: w } = Re({
|
|
96
96
|
data: () => e.data,
|
|
97
97
|
options: () => e.options,
|
|
98
98
|
accessors: () => ({
|
|
@@ -100,31 +100,31 @@ const ye = ["width", "height"], Ce = ["d"], Te = ["onClick"], ze = /* @__PURE__
|
|
|
100
100
|
getChildren: e.getChildren,
|
|
101
101
|
getParentId: e.getParentId
|
|
102
102
|
})
|
|
103
|
-
}), p =
|
|
104
|
-
element:
|
|
103
|
+
}), p = Me({
|
|
104
|
+
element: u,
|
|
105
105
|
pannable: () => e.pannable,
|
|
106
106
|
zoomable: () => e.zoomable,
|
|
107
|
-
limits: () => e.scaleLimits ??
|
|
108
|
-
}), T =
|
|
107
|
+
limits: () => e.scaleLimits ?? de
|
|
108
|
+
}), T = De(
|
|
109
109
|
m,
|
|
110
110
|
() => p.transform.value.scale,
|
|
111
111
|
() => e.virtualize
|
|
112
|
-
),
|
|
113
|
-
() => e.virtualize ?
|
|
114
|
-
),
|
|
115
|
-
width: `${
|
|
116
|
-
height: `${
|
|
117
|
-
transform:
|
|
118
|
-
})),
|
|
112
|
+
), $ = f(
|
|
113
|
+
() => e.virtualize ? le(l.value, T.rect.value, e.overscan) : l.value
|
|
114
|
+
), k = f(() => ({
|
|
115
|
+
width: `${l.value.width}px`,
|
|
116
|
+
height: `${l.value.height}px`,
|
|
117
|
+
transform: se(p.transform.value)
|
|
118
|
+
})), N = f(() => {
|
|
119
119
|
if (e.size !== "content") return;
|
|
120
120
|
const { scale: n } = p.transform.value;
|
|
121
121
|
return {
|
|
122
|
-
width: `${
|
|
123
|
-
height: `${
|
|
122
|
+
width: `${l.value.width * n}px`,
|
|
123
|
+
height: `${l.value.height * n}px`,
|
|
124
124
|
overflow: "visible"
|
|
125
125
|
};
|
|
126
126
|
});
|
|
127
|
-
function
|
|
127
|
+
function W(n) {
|
|
128
128
|
return {
|
|
129
129
|
left: `${n.x}px`,
|
|
130
130
|
top: `${n.y}px`,
|
|
@@ -132,229 +132,294 @@ const ye = ["width", "height"], Ce = ["d"], Te = ["onClick"], ze = /* @__PURE__
|
|
|
132
132
|
height: `${n.height}px`
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function F(n) {
|
|
136
136
|
return typeof e.nodeClass == "function" ? e.nodeClass(n) : e.nodeClass;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function H(n) {
|
|
139
139
|
const x = n.data;
|
|
140
140
|
return x?.name ?? x?.title ?? x?.label ?? n.id;
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
142
|
+
function y(n) {
|
|
143
|
+
r(n.id), a("toggle", n, b(n.id));
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
|
|
145
|
+
function A(n, x) {
|
|
146
|
+
a("node-click", n, x), e.collapsible && n.hasChildren && y(n);
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
p.fit({ width:
|
|
148
|
+
function B(n) {
|
|
149
|
+
p.fit({ width: l.value.width, height: l.value.height }, n);
|
|
150
150
|
}
|
|
151
151
|
return V(() => {
|
|
152
|
-
e.fitOnMount &&
|
|
153
|
-
}),
|
|
152
|
+
e.fitOnMount && U(() => B());
|
|
153
|
+
}), O(
|
|
154
154
|
() => p.transform.value,
|
|
155
155
|
(n) => {
|
|
156
|
-
T.update(),
|
|
156
|
+
T.update(), a("transform", n);
|
|
157
157
|
}
|
|
158
|
-
),
|
|
159
|
-
|
|
160
|
-
}),
|
|
161
|
-
fit:
|
|
158
|
+
), O(l, () => {
|
|
159
|
+
U(() => T.update());
|
|
160
|
+
}), c({
|
|
161
|
+
fit: B,
|
|
162
162
|
zoomIn: p.zoomIn,
|
|
163
163
|
zoomOut: p.zoomOut,
|
|
164
164
|
resetTransform: p.reset,
|
|
165
165
|
setTransform: p.setTransform,
|
|
166
|
-
expandAll:
|
|
167
|
-
toggle:
|
|
168
|
-
layout:
|
|
166
|
+
expandAll: w,
|
|
167
|
+
toggle: r,
|
|
168
|
+
layout: l,
|
|
169
169
|
transform: p.transform
|
|
170
|
-
}), (n, x) => (
|
|
170
|
+
}), (n, x) => (s(), d("div", {
|
|
171
171
|
ref_key: "rootElement",
|
|
172
|
-
ref:
|
|
173
|
-
class:
|
|
174
|
-
style:
|
|
172
|
+
ref: u,
|
|
173
|
+
class: E(["tree-view", { "tree-view--pannable": o.pannable, "tree-view--content": o.size === "content" }]),
|
|
174
|
+
style: S(N.value)
|
|
175
175
|
}, [
|
|
176
176
|
C("div", {
|
|
177
177
|
ref_key: "canvasElement",
|
|
178
178
|
ref: m,
|
|
179
179
|
class: "tree-view__canvas",
|
|
180
|
-
style:
|
|
180
|
+
style: S(k.value)
|
|
181
181
|
}, [
|
|
182
|
-
(
|
|
182
|
+
(s(), d("svg", {
|
|
183
183
|
class: "tree-view__links",
|
|
184
|
-
width:
|
|
185
|
-
height:
|
|
184
|
+
width: j(l).width,
|
|
185
|
+
height: j(l).height
|
|
186
186
|
}, [
|
|
187
|
-
(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
187
|
+
(s(!0), d(I, null, M($.value.links, (t) => (s(), d("g", {
|
|
188
|
+
key: t.id,
|
|
189
|
+
"data-depth": t.target.depth
|
|
190
|
+
}, [
|
|
191
|
+
R(n.$slots, "link", { link: t }, () => [
|
|
192
|
+
C("path", {
|
|
193
|
+
class: "tree-view__link",
|
|
194
|
+
d: t.path
|
|
195
|
+
}, null, 8, Fe)
|
|
196
|
+
])
|
|
197
|
+
], 8, We))), 128))
|
|
198
|
+
], 8, Ne)),
|
|
199
|
+
(s(!0), d(I, null, M($.value.nodes, (t) => (s(), d("div", {
|
|
200
|
+
key: t.id,
|
|
201
|
+
class: E(["tree-view__node", F(t)]),
|
|
202
|
+
style: S(W(t)),
|
|
203
|
+
"data-depth": t.depth,
|
|
204
|
+
onClick: (h) => A(t, h)
|
|
199
205
|
}, [
|
|
200
|
-
|
|
201
|
-
node:
|
|
202
|
-
data:
|
|
203
|
-
depth:
|
|
204
|
-
collapsed:
|
|
205
|
-
hasChildren:
|
|
206
|
-
toggle: () =>
|
|
206
|
+
R(n.$slots, "node", {
|
|
207
|
+
node: t,
|
|
208
|
+
data: t.data,
|
|
209
|
+
depth: t.depth,
|
|
210
|
+
collapsed: t.collapsed,
|
|
211
|
+
hasChildren: t.hasChildren,
|
|
212
|
+
toggle: () => y(t)
|
|
207
213
|
}, () => [
|
|
208
|
-
|
|
209
|
-
label:
|
|
210
|
-
"has-children":
|
|
211
|
-
collapsed:
|
|
212
|
-
onToggle: (
|
|
214
|
+
K(Y, {
|
|
215
|
+
label: H(t),
|
|
216
|
+
"has-children": t.hasChildren,
|
|
217
|
+
collapsed: t.collapsed,
|
|
218
|
+
onToggle: (h) => y(t)
|
|
213
219
|
}, null, 8, ["label", "has-children", "collapsed", "onToggle"])
|
|
214
220
|
])
|
|
215
|
-
], 14,
|
|
221
|
+
], 14, He))), 128))
|
|
216
222
|
], 4)
|
|
217
223
|
], 6));
|
|
218
224
|
}
|
|
219
|
-
}),
|
|
225
|
+
}), Pe = {
|
|
220
226
|
key: 0,
|
|
221
227
|
class: "tv-bracket__hint"
|
|
222
|
-
},
|
|
228
|
+
}, Ve = ["title", "aria-label", "aria-expanded"], Ge = { class: "tv-bracket__rows" }, Ue = ["title", "onClick", "onMouseenter"], je = {
|
|
223
229
|
key: 0,
|
|
224
230
|
class: "tv-bracket__tooltip"
|
|
225
|
-
},
|
|
231
|
+
}, Qe = { class: "tv-bracket__name" }, Ye = { class: "tv-bracket__score" }, Ze = /* @__PURE__ */ D({
|
|
226
232
|
__name: "BracketCard",
|
|
227
233
|
props: {
|
|
228
234
|
match: {},
|
|
229
235
|
rows: { default: void 0 },
|
|
230
236
|
myTeamHint: { default: "Нажми для перехода в матч 👇" },
|
|
231
237
|
techDefeatLabel: { default: "ТП" },
|
|
232
|
-
techDefeatHint: { default: "Техническое поражение" }
|
|
238
|
+
techDefeatHint: { default: "Техническое поражение" },
|
|
239
|
+
hasChildren: { type: Boolean, default: !1 },
|
|
240
|
+
collapsed: { type: Boolean, default: !1 },
|
|
241
|
+
collapseHint: { default: "Свернуть предыдущие матчи" },
|
|
242
|
+
expandHint: { default: "Показать предыдущие матчи" }
|
|
233
243
|
},
|
|
234
|
-
emits: ["select"],
|
|
235
|
-
setup(
|
|
236
|
-
const
|
|
237
|
-
() =>
|
|
244
|
+
emits: ["select", "toggle"],
|
|
245
|
+
setup(o, { emit: c }) {
|
|
246
|
+
const i = o, e = c, a = g(null), u = f(
|
|
247
|
+
() => ce(i.match, { rows: i.rows, techDefeatLabel: i.techDefeatLabel })
|
|
238
248
|
);
|
|
239
|
-
function m(
|
|
240
|
-
|
|
249
|
+
function m(l) {
|
|
250
|
+
l.team && e("select", l.team, l);
|
|
241
251
|
}
|
|
242
|
-
return (
|
|
243
|
-
class:
|
|
252
|
+
return (l, b) => (s(), d("div", {
|
|
253
|
+
class: E(["tv-bracket", { "tv-bracket--my-team": u.value.hasMyTeam }])
|
|
244
254
|
}, [
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
key:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
255
|
+
u.value.hasMyTeam && o.myTeamHint ? (s(), d("div", Pe, _(o.myTeamHint), 1)) : z("", !0),
|
|
256
|
+
o.hasChildren ? (s(), d("button", {
|
|
257
|
+
key: 1,
|
|
258
|
+
type: "button",
|
|
259
|
+
class: E(["tv-bracket__toggle", { "tv-bracket__toggle--collapsed": o.collapsed }]),
|
|
260
|
+
title: o.collapsed ? o.expandHint : o.collapseHint,
|
|
261
|
+
"aria-label": o.collapsed ? o.expandHint : o.collapseHint,
|
|
262
|
+
"aria-expanded": !o.collapsed,
|
|
263
|
+
"data-tv-no-pan": "",
|
|
264
|
+
onClick: b[0] || (b[0] = Q((r) => e("toggle"), ["stop"]))
|
|
265
|
+
}, _(o.collapsed ? "+" : "−"), 11, Ve)) : z("", !0),
|
|
266
|
+
C("div", Ge, [
|
|
267
|
+
(s(!0), d(I, null, M(u.value.rows, (r) => (s(), d("div", {
|
|
268
|
+
key: r.key,
|
|
269
|
+
class: E(["tv-bracket__row", {
|
|
270
|
+
"tv-bracket__row--winner": r.isWinner,
|
|
271
|
+
"tv-bracket__row--loser": r.isLoser && !r.isEmpty,
|
|
272
|
+
"tv-bracket__row--my": r.isMyTeam,
|
|
273
|
+
"tv-bracket__row--empty": r.isEmpty
|
|
274
|
+
}]),
|
|
275
|
+
title: r.isMyTeam ? "Моя команда" : void 0,
|
|
276
|
+
onClick: (w) => m(r),
|
|
277
|
+
onMouseenter: (w) => a.value = r.key,
|
|
278
|
+
onMouseleave: b[1] || (b[1] = (w) => a.value = null)
|
|
279
|
+
}, [
|
|
280
|
+
r.team ? (s(), d(I, { key: 0 }, [
|
|
281
|
+
r.isTechDefeat && a.value === r.key ? (s(), d("span", je, _(o.techDefeatHint), 1)) : z("", !0),
|
|
282
|
+
C("span", Qe, _(r.team.name), 1),
|
|
283
|
+
C("span", Ye, _(r.score), 1)
|
|
284
|
+
], 64)) : z("", !0)
|
|
285
|
+
], 42, Ue))), 128))
|
|
286
|
+
])
|
|
265
287
|
], 2));
|
|
266
288
|
}
|
|
267
|
-
}),
|
|
289
|
+
}), Ke = ["onClick"], qe = /* @__PURE__ */ D({
|
|
268
290
|
__name: "BracketRounds",
|
|
269
291
|
props: {
|
|
270
292
|
rounds: {},
|
|
271
|
-
|
|
272
|
-
levelGap: { default: 60 },
|
|
293
|
+
options: { default: void 0 },
|
|
273
294
|
isShow: { type: Boolean, default: !0 },
|
|
274
|
-
|
|
275
|
-
|
|
295
|
+
swipeSiblingGap: { default: 12 },
|
|
296
|
+
hidePassed: { type: Boolean, default: !0 },
|
|
297
|
+
swipe: { type: Boolean, default: void 0 },
|
|
298
|
+
mobileQuery: { default: ve }
|
|
276
299
|
},
|
|
277
|
-
emits: ["select"],
|
|
278
|
-
setup(
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
})
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
300
|
+
emits: ["select", "round"],
|
|
301
|
+
setup(o, { expose: c, emit: i }) {
|
|
302
|
+
const e = o, a = i, u = g(null), m = g(null), l = g(!1), b = g(0), r = g(0), w = f(() => e.isShow && (e.swipe ?? l.value)), p = f(() => ue(e.options)), T = f(
|
|
303
|
+
() => typeof p.value.nodeWidth == "number" ? p.value.nodeWidth : pe.nodeWidth
|
|
304
|
+
), $ = f(
|
|
305
|
+
() => w.value ? fe(b.value, T.value) : p.value.levelGap
|
|
306
|
+
), k = f(
|
|
307
|
+
() => he(e.rounds, { nodeWidth: T.value, levelGap: $.value })
|
|
308
|
+
), N = f(
|
|
309
|
+
() => p.value.direction === "right-to-left" || p.value.direction === "bottom-to-top"
|
|
310
|
+
), W = f(
|
|
311
|
+
() => w.value ? {
|
|
312
|
+
...e.options,
|
|
313
|
+
levelGap: $.value,
|
|
314
|
+
levelLayout: "stack",
|
|
315
|
+
siblingGap: e.swipeSiblingGap,
|
|
316
|
+
groupGap: (t, h) => we(h, e.swipeSiblingGap),
|
|
317
|
+
linkStyle: "bracket",
|
|
318
|
+
elbowOffset: e.options?.elbowOffset ?? be
|
|
319
|
+
} : { ...e.options }
|
|
320
|
+
), F = f(() => ({ width: `${k.value.width}px` })), H = f(
|
|
321
|
+
() => e.isShow ? { paddingLeft: `${k.value.offset}px` } : void 0
|
|
290
322
|
);
|
|
291
|
-
function
|
|
292
|
-
const
|
|
293
|
-
if (!
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
323
|
+
function y() {
|
|
324
|
+
const t = m.value;
|
|
325
|
+
if (!t) return;
|
|
326
|
+
const h = w.value && e.hidePassed ? r.value : 0, v = k.value.columns.length;
|
|
327
|
+
xe(t, h, (L) => _e(L, v, N.value));
|
|
328
|
+
}
|
|
329
|
+
function A() {
|
|
330
|
+
const t = u.value;
|
|
331
|
+
if (!t || !w.value) return;
|
|
332
|
+
const h = k.value.columns[0]?.width ?? 0, v = ye(t.scrollLeft, h, k.value.columns.length);
|
|
333
|
+
v !== r.value && (r.value = v, a("round", v));
|
|
334
|
+
}
|
|
335
|
+
O([r, w, k], () => y());
|
|
336
|
+
const B = [];
|
|
337
|
+
V(() => {
|
|
338
|
+
B.push(
|
|
339
|
+
me(e.mobileQuery, (t) => {
|
|
340
|
+
l.value = t;
|
|
341
|
+
}),
|
|
342
|
+
ge(u.value?.parentElement, (t) => {
|
|
343
|
+
b.value = t;
|
|
344
|
+
}),
|
|
345
|
+
// Сетка перерисовывает карточки — скрытое расставляем заново.
|
|
346
|
+
ke(m.value, y)
|
|
347
|
+
), y();
|
|
348
|
+
}), P(() => B.forEach((t) => t()));
|
|
349
|
+
function n(t) {
|
|
350
|
+
const h = u.value;
|
|
351
|
+
if (!h) return;
|
|
352
|
+
const v = w.value ? h : Ce(h);
|
|
353
|
+
if (!v) return;
|
|
354
|
+
const L = m.value, G = L ? Te(L, t.index, t.width, k.value.offset)[0] : void 0, Z = G ? ze(G, v) : { left: Se(h, v) + t.index * t.width, width: t.width };
|
|
355
|
+
Ee(
|
|
356
|
+
v,
|
|
357
|
+
$e({
|
|
358
|
+
...Z,
|
|
359
|
+
viewport: v.clientWidth,
|
|
360
|
+
scrollWidth: v.scrollWidth
|
|
301
361
|
})
|
|
302
362
|
);
|
|
303
363
|
}
|
|
304
|
-
function
|
|
305
|
-
|
|
364
|
+
function x(t) {
|
|
365
|
+
a("select", t), n(t);
|
|
306
366
|
}
|
|
307
|
-
return (
|
|
367
|
+
return c({ scrollToRound: n }), (t, h) => (s(), d("div", {
|
|
308
368
|
ref_key: "rootElement",
|
|
309
|
-
ref:
|
|
310
|
-
class: "tv-rounds"
|
|
369
|
+
ref: u,
|
|
370
|
+
class: E(["tv-rounds", { "tv-rounds--swipe": w.value }]),
|
|
371
|
+
onScroll: A
|
|
311
372
|
}, [
|
|
312
|
-
|
|
373
|
+
o.isShow ? (s(), d("div", {
|
|
313
374
|
key: 0,
|
|
314
375
|
class: "tv-rounds__bar",
|
|
315
|
-
style:
|
|
376
|
+
style: S(F.value)
|
|
316
377
|
}, [
|
|
317
|
-
(
|
|
318
|
-
key:
|
|
378
|
+
(s(!0), d(I, null, M(k.value.columns, (v) => (s(), d("div", {
|
|
379
|
+
key: v.key,
|
|
319
380
|
class: "tv-rounds__item",
|
|
320
|
-
style:
|
|
321
|
-
onClick: (
|
|
381
|
+
style: S({ width: `${v.width}px` }),
|
|
382
|
+
onClick: (L) => x(v)
|
|
322
383
|
}, [
|
|
323
|
-
|
|
324
|
-
|
|
384
|
+
R(t.$slots, "round", { round: v }, () => [
|
|
385
|
+
q(_(v.name), 1)
|
|
325
386
|
])
|
|
326
|
-
], 12,
|
|
327
|
-
], 4)) :
|
|
387
|
+
], 12, Ke))), 128))
|
|
388
|
+
], 4)) : z("", !0),
|
|
328
389
|
C("div", {
|
|
329
390
|
ref_key: "contentElement",
|
|
330
|
-
ref:
|
|
391
|
+
ref: m,
|
|
331
392
|
class: "tv-rounds__content",
|
|
332
|
-
style:
|
|
393
|
+
style: S(H.value)
|
|
333
394
|
}, [
|
|
334
|
-
|
|
395
|
+
R(t.$slots, "default", {
|
|
396
|
+
options: W.value,
|
|
397
|
+
isSwipe: w.value,
|
|
398
|
+
round: r.value
|
|
399
|
+
})
|
|
335
400
|
], 4)
|
|
336
|
-
],
|
|
401
|
+
], 34));
|
|
337
402
|
}
|
|
338
|
-
}),
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
install(
|
|
342
|
-
|
|
403
|
+
}), Je = ".tree-view{--tv-link-color: #cbd5e1;--tv-link-width: 2px;--tv-node-bg: #ffffff;--tv-node-color: #0f172a;--tv-node-border: 1px solid #e2e8f0;--tv-node-radius: 10px;--tv-node-shadow: 0 1px 2px rgb(15 23 42 / 8%);--tv-node-padding: 8px 12px;--tv-accent: #2563eb;position:relative;width:100%;height:100%;overflow:hidden}.tree-view--pannable{cursor:grab;touch-action:none}.tree-view--content{width:auto;height:auto;overflow:visible}.tree-view__canvas{position:absolute;top:0;left:0;transform-origin:0 0}.tree-view__links{position:absolute;top:0;left:0;overflow:visible;pointer-events:none}.tree-view__link{fill:none;stroke:var(--tv-link-color);stroke-width:var(--tv-link-width)}.tree-view__node{position:absolute;box-sizing:border-box;display:flex;align-items:stretch;justify-content:stretch}.tree-view-card{box-sizing:border-box;display:flex;gap:8px;align-items:center;justify-content:space-between;width:100%;height:100%;padding:var(--tv-node-padding);overflow:hidden;color:var(--tv-node-color);background:var(--tv-node-bg);border:var(--tv-node-border);border-radius:var(--tv-node-radius);box-shadow:var(--tv-node-shadow)}.tree-view-card__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree-view-card__toggle{flex:none;width:20px;height:20px;padding:0;font:inherit;line-height:1;color:var(--tv-accent);cursor:pointer;background:none;border:none}.tv-bracket{--tv-bracket-winner-bg: #0427c4;--tv-bracket-winner-color: #ffffff;--tv-bracket-loser-bg: #e5e5e5;--tv-bracket-loser-color: #7d7d8d;--tv-bracket-my-bg: #00146c;--tv-bracket-my-color: #ffffff;--tv-bracket-radius: 6px;--tv-bracket-shadow: 0 0 0 1px rgb(15 23 42 / 8%), 0 1px 3px rgb(15 23 42 / 10%);position:relative;box-sizing:border-box;display:flex;flex-direction:column;width:100%;height:100%;font-size:12px}.tv-bracket__rows{box-sizing:border-box;display:flex;flex:1 1 auto;flex-direction:column;min-height:0;overflow:hidden;border-radius:var(--tv-bracket-radius);box-shadow:var(--tv-bracket-shadow)}.tv-bracket--my-team .tv-bracket__rows{outline:2px solid var(--tv-bracket-my-bg)}.tv-bracket__hint{position:absolute;right:0;bottom:100%;left:0;padding:3px 8px;overflow:hidden;font-size:11px;font-weight:600;line-height:1.2;color:var(--tv-bracket-my-color);text-align:center;text-overflow:ellipsis;white-space:nowrap;background:var(--tv-bracket-my-bg);border-radius:var(--tv-bracket-radius) var(--tv-bracket-radius) 0 0}.tv-bracket__row{position:relative;box-sizing:border-box;display:flex;flex:1 1 0;align-items:center;justify-content:space-between;min-height:0;padding:4px 8px;cursor:pointer;transition:all 75ms}.tv-bracket__row--winner{font-weight:700;color:var(--tv-bracket-winner-color);background:var(--tv-bracket-winner-bg)}.tv-bracket__row--loser{color:var(--tv-bracket-loser-color);background:var(--tv-bracket-loser-bg)}.tv-bracket__row--my{color:var(--tv-bracket-my-color);background:var(--tv-bracket-my-bg)}.tv-bracket__row--empty{cursor:default;background:var(--tv-bracket-loser-bg)}.tv-bracket__toggle{position:absolute;top:50%;left:-11px;z-index:1;display:flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;font:inherit;font-size:13px;font-weight:700;line-height:1;color:var(--tv-bracket-winner-bg);cursor:pointer;background:#fff;border:1px solid #d1d5db;border-radius:50%;box-shadow:0 1px 3px #0f172a2e;transform:translateY(-50%)}.tv-bracket__toggle:hover{border-color:var(--tv-bracket-winner-bg)}.tv-bracket__toggle--collapsed{color:var(--tv-bracket-winner-color);background:var(--tv-bracket-winner-bg);border-color:var(--tv-bracket-winner-bg)}.tv-bracket__name{max-width:120px;overflow:hidden;font-weight:600;text-overflow:ellipsis;white-space:nowrap}.tv-bracket__score{display:flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;font-weight:700;font-variant-numeric:tabular-nums}.tv-bracket__tooltip{position:absolute;top:-26px;left:6px;z-index:5000;padding:4px 8px;font-weight:400;color:var(--tv-bracket-loser-color);white-space:nowrap;background:#fff;border:1px solid #d1d5db;border-radius:4px;box-shadow:0 4px 10px #0f172a26}.tv-rounds{--tv-rounds-bg: #f5f5f7;--tv-rounds-color: #9ca3af;--tv-rounds-border: 2px solid #e5e7eb;--tv-rounds-gap: 20px;--tv-rounds-fade: .22s;--tv-rounds-collapse-scale: .86;--tv-rounds-collapse-ease: cubic-bezier(.4, 0, .2, 1);--tv-rounds-link-color: #94a3b8;--tv-rounds-link-width: 3px;display:flex;flex-direction:column;width:max-content;min-width:100%}.tv-rounds__bar{display:flex;min-width:100%;margin-bottom:var(--tv-rounds-gap);background:var(--tv-rounds-bg);border-bottom:var(--tv-rounds-border)}.tv-rounds__item{flex:none;box-sizing:border-box;padding:10px 20px;font:inherit;font-size:14px;font-weight:600;color:var(--tv-rounds-color);text-align:center;text-transform:uppercase;white-space:nowrap;background:none;border:none;border-right:var(--tv-rounds-border)}.tv-rounds--swipe .tv-bracket__hint{display:none}.tv-rounds--swipe .tree-view{--tv-link-color: var(--tv-rounds-link-color);--tv-link-width: var(--tv-rounds-link-width)}.tv-rounds--swipe{width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scrollbar-width:none}.tv-rounds--swipe::-webkit-scrollbar{display:none}.tv-rounds--swipe .tv-rounds__item{scroll-snap-align:start;scroll-snap-stop:always}.tv-rounds--swipe [data-depth]{transition:opacity var(--tv-rounds-fade, .22s) ease,transform var(--tv-rounds-fade, .22s) var(--tv-rounds-collapse-ease)}.tv-rounds--swipe [data-depth].tv-hidden{visibility:hidden;opacity:0;transition:opacity var(--tv-rounds-fade, .22s) ease,transform var(--tv-rounds-fade, .22s) var(--tv-rounds-collapse-ease),visibility 0s linear var(--tv-rounds-fade, .22s)}.tv-rounds--swipe .tree-view__node.tv-hidden{transform:scale(var(--tv-rounds-collapse-scale));transform-origin:right center}.tv-hidden{visibility:hidden}@media(prefers-reduced-motion:reduce){.tv-rounds--swipe [data-depth],.tv-rounds--swipe [data-depth].tv-hidden{transition:none}.tv-rounds--swipe .tree-view__node.tv-hidden{transform:none}}";
|
|
404
|
+
Be(Je);
|
|
405
|
+
const tt = {
|
|
406
|
+
install(o) {
|
|
407
|
+
o.component("TreeView", Ae), o.component("TreeNodeCard", Y), o.component("BracketCard", Ze), o.component("BracketRounds", qe);
|
|
343
408
|
}
|
|
344
409
|
};
|
|
345
410
|
export {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
411
|
+
Ze as BracketCard,
|
|
412
|
+
qe as BracketRounds,
|
|
413
|
+
at as DEFAULT_OPTIONS,
|
|
414
|
+
rt as MOBILE_MEDIA_QUERY,
|
|
415
|
+
Y as TreeNodeCard,
|
|
416
|
+
Ae as TreeView,
|
|
417
|
+
tt as TreeViewPlugin,
|
|
418
|
+
it as bracketCardHeight,
|
|
419
|
+
lt as buildBracketCard,
|
|
420
|
+
st as buildBracketRounds,
|
|
421
|
+
tt as default,
|
|
422
|
+
Me as usePanZoom,
|
|
423
|
+
Re as useTreeLayout
|
|
359
424
|
};
|
|
360
425
|
//# sourceMappingURL=index.js.map
|