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