@golstats/gsc-reports 1.0.56 → 1.0.57
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/{FilterConditions-55d68355-DMqzcKBO-C_38-UtQ-I4EI-PPf.js → FilterConditions-55d68355-DMqzcKBO-CgZ2Bws6-BA3vKTMH.js} +1 -1
- package/dist/{FilterField-59a73e38-CNaE03Ge-BFSDTkDc-DMVHttnm.js → FilterField-59a73e38-CNaE03Ge-D6Qm0WVk-CYhTlEKz.js} +1 -1
- package/dist/{FilterSubcategories-a9b32cc9-_h5FCZ4r-BfnH8dG2-42c1SG74.js → FilterSubcategories-a9b32cc9-_h5FCZ4r-BJzGxe0g-Cy8PlaUW.js} +1 -1
- package/dist/gsc-reports.css +1 -1
- package/dist/gsc-reports.es.js +1 -1
- package/dist/gsc-reports.umd.js +4 -4
- package/dist/{index-DXR88fvk.js → index-B9F2yNJu.js} +32 -24
- package/package.json +2 -2
- package/src/components/template-report-maker/CoverPage.vue +636 -636
- package/src/components/template-report-maker/CoverSelector.vue +165 -165
- package/src/components/template-report-maker/ReportView.vue +66 -66
- package/src/components/template-report-maker/TemplateReportPage.vue +398 -398
- package/dist/images/cancha-horizontal.jpg +0 -0
- package/dist/images/canchaRPH.svg +0 -30
|
@@ -1,398 +1,398 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import '@@/@golstats/gsc-volumetric-field/dist/gsc-volumetric-field.css'
|
|
3
|
-
import { GSCVolumetricField } from '@golstats/gsc-volumetric-field'
|
|
4
|
-
import 'gridstack/dist/gridstack.min.css'
|
|
5
|
-
import { computed, nextTick, onMounted, ref } from 'vue'
|
|
6
|
-
import ReportView from '@/components/template-report-maker/ReportView.vue'
|
|
7
|
-
import emitter from 'tiny-emitter/instance'
|
|
8
|
-
import { GridStack, GridStackEngine, GridStackMoveOpts, GridStackNode } from 'gridstack'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const templatePage = ref(null)
|
|
12
|
-
|
|
13
|
-
class CustomEngine extends GridStackEngine {
|
|
14
|
-
|
|
15
|
-
/** refined this to move the node to the given new location */
|
|
16
|
-
public override moveNode(node: GridStackNode, o: GridStackMoveOpts): boolean {
|
|
17
|
-
console.log('CustomEngine.moveNode', node, o)
|
|
18
|
-
const item = itemsMap.get(node.id)
|
|
19
|
-
// keep the same original X and Width and let base do it all...
|
|
20
|
-
if (item) {
|
|
21
|
-
if (o.w > item.maxWidth) {
|
|
22
|
-
o.w = item.maxWidth
|
|
23
|
-
}
|
|
24
|
-
if (o.h > item.maxHeight) {
|
|
25
|
-
o.h = item.maxHeight
|
|
26
|
-
}
|
|
27
|
-
if (o.w < item.minWidth) {
|
|
28
|
-
o.w = item.minWidth
|
|
29
|
-
}
|
|
30
|
-
if (o.h < item.minHeight) {
|
|
31
|
-
o.h = item.minHeight
|
|
32
|
-
}
|
|
33
|
-
item.x = o.x
|
|
34
|
-
item.y = o.y
|
|
35
|
-
item.w = o.w
|
|
36
|
-
item.h = o.h
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return super.moveNode(node, o)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log('beforeeeeeeeeeeeeeeeeeeeeeeeeeeee')
|
|
44
|
-
GridStack.registerEngine(CustomEngine) // globally set our custom class
|
|
45
|
-
let grid = null
|
|
46
|
-
const props = defineProps({
|
|
47
|
-
game: {
|
|
48
|
-
type: Object,
|
|
49
|
-
default: () => null
|
|
50
|
-
},
|
|
51
|
-
id: {
|
|
52
|
-
type: [String, Number],
|
|
53
|
-
default: () => String(Date.now())
|
|
54
|
-
},
|
|
55
|
-
page: {
|
|
56
|
-
type: Object,
|
|
57
|
-
default: () => ({
|
|
58
|
-
title: 'Page 1',
|
|
59
|
-
items: [
|
|
60
|
-
{
|
|
61
|
-
name: 'Tabla jugadores',
|
|
62
|
-
id: `w-${String(Date.now())}`,
|
|
63
|
-
x: 0,
|
|
64
|
-
y: 0,
|
|
65
|
-
w: 4,
|
|
66
|
-
h: 4,
|
|
67
|
-
maxWidth: 4,
|
|
68
|
-
maxHeight: 4,
|
|
69
|
-
noResize: false,
|
|
70
|
-
noMove: false,
|
|
71
|
-
componentProps: {}
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
isPostMatch: {
|
|
77
|
-
type: Boolean,
|
|
78
|
-
default: false
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
const emit = defineEmits(
|
|
83
|
-
['intersection-changed']
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const itemsMap = props.page.items.reduce((acc, item) => {
|
|
88
|
-
acc.set(item.id, item)
|
|
89
|
-
return acc
|
|
90
|
-
}, new Map())
|
|
91
|
-
|
|
92
|
-
const teamsInfo = computed(() => {
|
|
93
|
-
if (props.game) {
|
|
94
|
-
return {
|
|
95
|
-
homeTeam: {
|
|
96
|
-
name: 'LOC'
|
|
97
|
-
},
|
|
98
|
-
awayTeam: {
|
|
99
|
-
name: 'VIS'
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
homeTeam: {
|
|
105
|
-
name: 'LOC'
|
|
106
|
-
},
|
|
107
|
-
awayTeam: {
|
|
108
|
-
name: 'VIS'
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
const callback = (entries, observer) => {
|
|
114
|
-
entries.forEach(entry => {
|
|
115
|
-
|
|
116
|
-
emit('intersection-changed', entry.isIntersecting)
|
|
117
|
-
/*if (entry.isIntersecting) {
|
|
118
|
-
console.log('Element is in the viewport!');
|
|
119
|
-
emit('intersection-changed', true)
|
|
120
|
-
// Perform actions when the element is visible
|
|
121
|
-
} else {
|
|
122
|
-
console.log('Element is out of the viewport!');
|
|
123
|
-
// Perform actions when the element is not visible
|
|
124
|
-
emit('intersection-changed', entry.isIntersecting && entry.isVisible)
|
|
125
|
-
}*/
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let observer = null
|
|
131
|
-
|
|
132
|
-
function setUpIntersectionObserver() {
|
|
133
|
-
const options = {
|
|
134
|
-
root: null, // Use the viewport as the root
|
|
135
|
-
rootMargin: '0px', // Margin around the root
|
|
136
|
-
threshold: 0.7 // Trigger when 50% of the element is visible
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
observer = new IntersectionObserver(callback, options)
|
|
140
|
-
|
|
141
|
-
// Step 3: Select the target element and start observing
|
|
142
|
-
const target = templatePage.value
|
|
143
|
-
if (target) {
|
|
144
|
-
observer.observe(target)
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
onMounted(async () => {
|
|
149
|
-
await nextTick()
|
|
150
|
-
grid = GridStack.init({
|
|
151
|
-
column: 12, // number of columns
|
|
152
|
-
row: 12, // number of rows
|
|
153
|
-
maxRow: 12, // max number of rows
|
|
154
|
-
cellHeight: 60, // height of each cell
|
|
155
|
-
float: true, // allow overlapping
|
|
156
|
-
resizable: {
|
|
157
|
-
handles: 'e, se, s, sw, w'
|
|
158
|
-
}
|
|
159
|
-
}, `#grid-stack-${props.id}`)
|
|
160
|
-
setUpIntersectionObserver()
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
emitter.on('add-view', (pageId) => {
|
|
164
|
-
console.log('add-view', pageId, props.page)
|
|
165
|
-
if (props.page.id === pageId) {
|
|
166
|
-
console.log('add-view', props.page.id)
|
|
167
|
-
if (grid) {
|
|
168
|
-
const newWidget = {
|
|
169
|
-
w: 4,
|
|
170
|
-
h: 4
|
|
171
|
-
}
|
|
172
|
-
const willFit = grid.willItFit(0, 0, newWidget.w, newWidget.h, true)
|
|
173
|
-
console.log('------------------------------------------------------------')
|
|
174
|
-
console.log('willFit', willFit)
|
|
175
|
-
if (willFit) {
|
|
176
|
-
const widget = grid.addWidget(
|
|
177
|
-
newWidget
|
|
178
|
-
)
|
|
179
|
-
const x = Number(widget.getAttribute('gs-x') || 0)
|
|
180
|
-
const y = Number(widget.getAttribute('gs-y') || 0)
|
|
181
|
-
grid.removeWidget(widget)
|
|
182
|
-
emitter.emit('add-page-view', {
|
|
183
|
-
pageId,
|
|
184
|
-
grid,
|
|
185
|
-
view: {
|
|
186
|
-
name: 'Tabla jugadores',
|
|
187
|
-
id: `w-${String(Date.now())}`,
|
|
188
|
-
x,
|
|
189
|
-
y,
|
|
190
|
-
w: 4,
|
|
191
|
-
h: 4,
|
|
192
|
-
maxWidth: 4,
|
|
193
|
-
maxHeight: 4,
|
|
194
|
-
noResize: false,
|
|
195
|
-
noMove: false,
|
|
196
|
-
componentProps: {}
|
|
197
|
-
}
|
|
198
|
-
})
|
|
199
|
-
console.log('widget:', widget)
|
|
200
|
-
console.log('widget.gs-x', widget.getAttribute('gs-x'))
|
|
201
|
-
console.log('widget.gs-y', widget.getAttribute('gs-y'))
|
|
202
|
-
} else {
|
|
203
|
-
console.warn('No space to add new widget')
|
|
204
|
-
}
|
|
205
|
-
// grid.addWidget({
|
|
206
|
-
// w: 3,
|
|
207
|
-
// h: 2,
|
|
208
|
-
// });
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
</script>
|
|
213
|
-
|
|
214
|
-
<template>
|
|
215
|
-
<div ref="templatePage" class="template-page">
|
|
216
|
-
<div class="template-page__header">
|
|
217
|
-
<div class="template-page__header__name">
|
|
218
|
-
<div>
|
|
219
|
-
<svg width="19" height="21" viewBox="0 0 19 21" fill="none"
|
|
220
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
221
|
-
<path
|
|
222
|
-
d="M11.2986 12.9994C7.62909 14.8341 4.11744 16.0178 1.35547 16.4518L9.18763 20.0029C9.34545 20.0818 9.60192 20.0818 9.74002 20.0029L17.8878 16.3137C18.0457 16.2348 18.164 16.0572 18.164 15.8797V8.75781C16.2898 10.2177 13.9422 11.6776 11.2986 12.9994Z"
|
|
223
|
-
fill="white" />
|
|
224
|
-
<path
|
|
225
|
-
d="M4.7152 8.89735C4.7152 8.89735 10.9494 3.76802 16.8482 1.20335C15.0529 0.946887 11.3637 0.43395 9.3711 0.453678C4.41928 0.493135 1.06546 1.34145 1.06546 1.34145C0.90763 1.3809 0.769531 1.55846 0.769531 1.71629V8.12795C3.01857 6.56942 5.34651 5.56329 5.34651 5.56329C5.34651 5.56329 2.72264 7.06263 0.769531 8.81844V9.41028V14.1648C3.09748 13.9675 6.62886 12.7641 10.3575 10.7321C13.6719 8.91707 16.4733 6.84562 18.17 5.05035V2.40677C14.3032 3.37346 4.7152 8.89735 4.7152 8.89735Z"
|
|
226
|
-
fill="white" />
|
|
227
|
-
</svg>
|
|
228
|
-
</div>
|
|
229
|
-
<div class="separator" />
|
|
230
|
-
<input
|
|
231
|
-
v-model="page.title"
|
|
232
|
-
type="text"
|
|
233
|
-
class="page-title-input"
|
|
234
|
-
onclick="this.select()"
|
|
235
|
-
>
|
|
236
|
-
</div>
|
|
237
|
-
<div class="template-page__header__details">
|
|
238
|
-
<div class="template-page__header__details__teams">
|
|
239
|
-
<div class="template-page__header__details__teams__team">
|
|
240
|
-
<div v-if="teamsInfo.homeTeam.logo">
|
|
241
|
-
|
|
242
|
-
</div>
|
|
243
|
-
<svg v-else width="25" height="25" viewBox="0 0 25 25" fill="none"
|
|
244
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
245
|
-
<path opacity="0.4"
|
|
246
|
-
d="M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z"
|
|
247
|
-
fill="#54728B" />
|
|
248
|
-
</svg>
|
|
249
|
-
|
|
250
|
-
<span>{{ teamsInfo.homeTeam.name }}</span>
|
|
251
|
-
</div>
|
|
252
|
-
<div class="template-page__header__details__teams__vs">
|
|
253
|
-
VS
|
|
254
|
-
</div>
|
|
255
|
-
<div class="template-page__header__details__teams__team">
|
|
256
|
-
<span>{{ teamsInfo.awayTeam.name }}</span>
|
|
257
|
-
<div v-if="teamsInfo.awayTeam.logo">
|
|
258
|
-
</div>
|
|
259
|
-
<svg v-else width="25" height="25" viewBox="0 0 25 25" fill="none"
|
|
260
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
261
|
-
<path opacity="0.4"
|
|
262
|
-
d="M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z"
|
|
263
|
-
fill="#54728B" />
|
|
264
|
-
</svg>
|
|
265
|
-
|
|
266
|
-
</div>
|
|
267
|
-
</div>
|
|
268
|
-
<div class="template-page__header__details__options">
|
|
269
|
-
<svg width="17" height="13" viewBox="0 0 17 13" fill="none"
|
|
270
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
271
|
-
<path
|
|
272
|
-
d="M3.56953 6.28672C3.56953 7.19972 2.83253 7.93672 1.91953 7.93672C1.00653 7.93672 0.269531 7.19972 0.269531 6.28672C0.269531 5.37372 1.00653 4.63672 1.91953 4.63672C2.83253 4.63672 3.56953 5.37372 3.56953 6.28672ZM8.51953 4.63672C7.60653 4.63672 6.86953 5.37372 6.86953 6.28672C6.86953 7.19972 7.60653 7.93672 8.51953 7.93672C9.43253 7.93672 10.1695 7.19972 10.1695 6.28672C10.1695 5.37372 9.43253 4.63672 8.51953 4.63672ZM15.1195 4.63672C14.2065 4.63672 13.4695 5.37372 13.4695 6.28672C13.4695 7.19972 14.2065 7.93672 15.1195 7.93672C16.0325 7.93672 16.7695 7.19972 16.7695 6.28672C16.7695 5.37372 16.0325 4.63672 15.1195 4.63672Z"
|
|
273
|
-
fill="white" />
|
|
274
|
-
</svg>
|
|
275
|
-
</div>
|
|
276
|
-
</div>
|
|
277
|
-
</div>
|
|
278
|
-
<div class="template-page__content">
|
|
279
|
-
<div :id="`grid-stack-${id}`" class="grid-stack">
|
|
280
|
-
<div
|
|
281
|
-
class="grid-stack-item"
|
|
282
|
-
v-for="(item, index) of page.items"
|
|
283
|
-
:key="item.id"
|
|
284
|
-
:gs-id="item.id"
|
|
285
|
-
:gs-x="item.x"
|
|
286
|
-
:gs-y="item.y"
|
|
287
|
-
:gs-w="item.w"
|
|
288
|
-
:gs-h="item.h"
|
|
289
|
-
:gs-no-resize="item.noResize"
|
|
290
|
-
:gs-no-move="item.noMove"
|
|
291
|
-
gs-auto-position="true"
|
|
292
|
-
>
|
|
293
|
-
<div class="grid-stack-item-content">
|
|
294
|
-
<ReportView :title="item.title">
|
|
295
|
-
<template #default>
|
|
296
|
-
<GSCVolumetricField
|
|
297
|
-
:is-game-pre-match="!isPostMatch"
|
|
298
|
-
:are-teams-visible="false"
|
|
299
|
-
:is-title-visible="false"
|
|
300
|
-
:is-ghost-effect="item.isTemplateMode"
|
|
301
|
-
/>
|
|
302
|
-
</template>
|
|
303
|
-
</ReportView>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
</div>
|
|
308
|
-
</div>
|
|
309
|
-
</template>
|
|
310
|
-
<style scoped lang="scss">
|
|
311
|
-
.page-title-input {
|
|
312
|
-
&:focus {
|
|
313
|
-
outline: none;
|
|
314
|
-
border-radius: 3.1px;
|
|
315
|
-
border: solid 1px #216ea5;
|
|
316
|
-
background-color: #17212a;
|
|
317
|
-
padding: 0 12px;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.template-page {
|
|
322
|
-
width: 100%;
|
|
323
|
-
height: 776px;
|
|
324
|
-
padding: 12px 16px;
|
|
325
|
-
display: flex;
|
|
326
|
-
flex-direction: column;
|
|
327
|
-
background-color: #1d2a35;
|
|
328
|
-
|
|
329
|
-
&__header {
|
|
330
|
-
display: flex;
|
|
331
|
-
justify-content: space-between;
|
|
332
|
-
border-bottom: solid 1.1px rgba(255, 255, 255, 0.2);
|
|
333
|
-
padding-bottom: 6px;
|
|
334
|
-
|
|
335
|
-
&__name {
|
|
336
|
-
display: flex;
|
|
337
|
-
align-items: center;
|
|
338
|
-
gap: 12px;
|
|
339
|
-
|
|
340
|
-
& > div.separator {
|
|
341
|
-
width: 1px;
|
|
342
|
-
height: 18px;
|
|
343
|
-
background-color: #87878f;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
& > input {
|
|
347
|
-
margin-left: 10px;
|
|
348
|
-
font-family: Poppins-Medium, sans-serif;
|
|
349
|
-
font-size: 14px;
|
|
350
|
-
font-weight: 500;
|
|
351
|
-
font-stretch: normal;
|
|
352
|
-
font-style: normal;
|
|
353
|
-
line-height: normal;
|
|
354
|
-
letter-spacing: normal;
|
|
355
|
-
text-align: left;
|
|
356
|
-
color: #fff;
|
|
357
|
-
background-color: #1d2a35;
|
|
358
|
-
border: 0;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
&__details {
|
|
363
|
-
display: flex;
|
|
364
|
-
align-items: center;
|
|
365
|
-
gap: 14px;
|
|
366
|
-
font-size: 13.7px;
|
|
367
|
-
font-weight: 500;
|
|
368
|
-
font-stretch: normal;
|
|
369
|
-
font-style: normal;
|
|
370
|
-
line-height: normal;
|
|
371
|
-
letter-spacing: normal;
|
|
372
|
-
text-align: right;
|
|
373
|
-
color: #fff;
|
|
374
|
-
|
|
375
|
-
&__teams {
|
|
376
|
-
display: flex;
|
|
377
|
-
align-items: center;
|
|
378
|
-
gap: 24px;
|
|
379
|
-
font-family: Poppins-Medium, sans-serif;
|
|
380
|
-
|
|
381
|
-
&__team {
|
|
382
|
-
display: flex;
|
|
383
|
-
align-items: center;
|
|
384
|
-
gap: 5px;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
&__vs {
|
|
388
|
-
font-family: Poppins-Light, sans-serif;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
&__options {
|
|
393
|
-
cursor: pointer;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import '@@/@golstats/gsc-volumetric-field/dist/gsc-volumetric-field.css'
|
|
3
|
+
import { GSCVolumetricField } from '@golstats/gsc-volumetric-field'
|
|
4
|
+
import 'gridstack/dist/gridstack.min.css'
|
|
5
|
+
import { computed, nextTick, onMounted, ref } from 'vue'
|
|
6
|
+
import ReportView from '@/components/template-report-maker/ReportView.vue'
|
|
7
|
+
import emitter from 'tiny-emitter/instance'
|
|
8
|
+
import { GridStack, GridStackEngine, GridStackMoveOpts, GridStackNode } from 'gridstack'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const templatePage = ref(null)
|
|
12
|
+
|
|
13
|
+
class CustomEngine extends GridStackEngine {
|
|
14
|
+
|
|
15
|
+
/** refined this to move the node to the given new location */
|
|
16
|
+
public override moveNode(node: GridStackNode, o: GridStackMoveOpts): boolean {
|
|
17
|
+
console.log('CustomEngine.moveNode', node, o)
|
|
18
|
+
const item = itemsMap.get(node.id)
|
|
19
|
+
// keep the same original X and Width and let base do it all...
|
|
20
|
+
if (item) {
|
|
21
|
+
if (o.w > item.maxWidth) {
|
|
22
|
+
o.w = item.maxWidth
|
|
23
|
+
}
|
|
24
|
+
if (o.h > item.maxHeight) {
|
|
25
|
+
o.h = item.maxHeight
|
|
26
|
+
}
|
|
27
|
+
if (o.w < item.minWidth) {
|
|
28
|
+
o.w = item.minWidth
|
|
29
|
+
}
|
|
30
|
+
if (o.h < item.minHeight) {
|
|
31
|
+
o.h = item.minHeight
|
|
32
|
+
}
|
|
33
|
+
item.x = o.x
|
|
34
|
+
item.y = o.y
|
|
35
|
+
item.w = o.w
|
|
36
|
+
item.h = o.h
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return super.moveNode(node, o)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log('beforeeeeeeeeeeeeeeeeeeeeeeeeeeee')
|
|
44
|
+
GridStack.registerEngine(CustomEngine) // globally set our custom class
|
|
45
|
+
let grid = null
|
|
46
|
+
const props = defineProps({
|
|
47
|
+
game: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: () => null
|
|
50
|
+
},
|
|
51
|
+
id: {
|
|
52
|
+
type: [String, Number],
|
|
53
|
+
default: () => String(Date.now())
|
|
54
|
+
},
|
|
55
|
+
page: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: () => ({
|
|
58
|
+
title: 'Page 1',
|
|
59
|
+
items: [
|
|
60
|
+
{
|
|
61
|
+
name: 'Tabla jugadores',
|
|
62
|
+
id: `w-${String(Date.now())}`,
|
|
63
|
+
x: 0,
|
|
64
|
+
y: 0,
|
|
65
|
+
w: 4,
|
|
66
|
+
h: 4,
|
|
67
|
+
maxWidth: 4,
|
|
68
|
+
maxHeight: 4,
|
|
69
|
+
noResize: false,
|
|
70
|
+
noMove: false,
|
|
71
|
+
componentProps: {}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
},
|
|
76
|
+
isPostMatch: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const emit = defineEmits(
|
|
83
|
+
['intersection-changed']
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
const itemsMap = props.page.items.reduce((acc, item) => {
|
|
88
|
+
acc.set(item.id, item)
|
|
89
|
+
return acc
|
|
90
|
+
}, new Map())
|
|
91
|
+
|
|
92
|
+
const teamsInfo = computed(() => {
|
|
93
|
+
if (props.game) {
|
|
94
|
+
return {
|
|
95
|
+
homeTeam: {
|
|
96
|
+
name: 'LOC'
|
|
97
|
+
},
|
|
98
|
+
awayTeam: {
|
|
99
|
+
name: 'VIS'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
homeTeam: {
|
|
105
|
+
name: 'LOC'
|
|
106
|
+
},
|
|
107
|
+
awayTeam: {
|
|
108
|
+
name: 'VIS'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
const callback = (entries, observer) => {
|
|
114
|
+
entries.forEach(entry => {
|
|
115
|
+
|
|
116
|
+
emit('intersection-changed', entry.isIntersecting)
|
|
117
|
+
/*if (entry.isIntersecting) {
|
|
118
|
+
console.log('Element is in the viewport!');
|
|
119
|
+
emit('intersection-changed', true)
|
|
120
|
+
// Perform actions when the element is visible
|
|
121
|
+
} else {
|
|
122
|
+
console.log('Element is out of the viewport!');
|
|
123
|
+
// Perform actions when the element is not visible
|
|
124
|
+
emit('intersection-changed', entry.isIntersecting && entry.isVisible)
|
|
125
|
+
}*/
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
let observer = null
|
|
131
|
+
|
|
132
|
+
function setUpIntersectionObserver() {
|
|
133
|
+
const options = {
|
|
134
|
+
root: null, // Use the viewport as the root
|
|
135
|
+
rootMargin: '0px', // Margin around the root
|
|
136
|
+
threshold: 0.7 // Trigger when 50% of the element is visible
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
observer = new IntersectionObserver(callback, options)
|
|
140
|
+
|
|
141
|
+
// Step 3: Select the target element and start observing
|
|
142
|
+
const target = templatePage.value
|
|
143
|
+
if (target) {
|
|
144
|
+
observer.observe(target)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
onMounted(async () => {
|
|
149
|
+
await nextTick()
|
|
150
|
+
grid = GridStack.init({
|
|
151
|
+
column: 12, // number of columns
|
|
152
|
+
row: 12, // number of rows
|
|
153
|
+
maxRow: 12, // max number of rows
|
|
154
|
+
cellHeight: 60, // height of each cell
|
|
155
|
+
float: true, // allow overlapping
|
|
156
|
+
resizable: {
|
|
157
|
+
handles: 'e, se, s, sw, w'
|
|
158
|
+
}
|
|
159
|
+
}, `#grid-stack-${props.id}`)
|
|
160
|
+
setUpIntersectionObserver()
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
emitter.on('add-view', (pageId) => {
|
|
164
|
+
console.log('add-view', pageId, props.page)
|
|
165
|
+
if (props.page.id === pageId) {
|
|
166
|
+
console.log('add-view', props.page.id)
|
|
167
|
+
if (grid) {
|
|
168
|
+
const newWidget = {
|
|
169
|
+
w: 4,
|
|
170
|
+
h: 4
|
|
171
|
+
}
|
|
172
|
+
const willFit = grid.willItFit(0, 0, newWidget.w, newWidget.h, true)
|
|
173
|
+
console.log('------------------------------------------------------------')
|
|
174
|
+
console.log('willFit', willFit)
|
|
175
|
+
if (willFit) {
|
|
176
|
+
const widget = grid.addWidget(
|
|
177
|
+
newWidget
|
|
178
|
+
)
|
|
179
|
+
const x = Number(widget.getAttribute('gs-x') || 0)
|
|
180
|
+
const y = Number(widget.getAttribute('gs-y') || 0)
|
|
181
|
+
grid.removeWidget(widget)
|
|
182
|
+
emitter.emit('add-page-view', {
|
|
183
|
+
pageId,
|
|
184
|
+
grid,
|
|
185
|
+
view: {
|
|
186
|
+
name: 'Tabla jugadores',
|
|
187
|
+
id: `w-${String(Date.now())}`,
|
|
188
|
+
x,
|
|
189
|
+
y,
|
|
190
|
+
w: 4,
|
|
191
|
+
h: 4,
|
|
192
|
+
maxWidth: 4,
|
|
193
|
+
maxHeight: 4,
|
|
194
|
+
noResize: false,
|
|
195
|
+
noMove: false,
|
|
196
|
+
componentProps: {}
|
|
197
|
+
}
|
|
198
|
+
})
|
|
199
|
+
console.log('widget:', widget)
|
|
200
|
+
console.log('widget.gs-x', widget.getAttribute('gs-x'))
|
|
201
|
+
console.log('widget.gs-y', widget.getAttribute('gs-y'))
|
|
202
|
+
} else {
|
|
203
|
+
console.warn('No space to add new widget')
|
|
204
|
+
}
|
|
205
|
+
// grid.addWidget({
|
|
206
|
+
// w: 3,
|
|
207
|
+
// h: 2,
|
|
208
|
+
// });
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<template>
|
|
215
|
+
<div ref="templatePage" class="template-page">
|
|
216
|
+
<div class="template-page__header">
|
|
217
|
+
<div class="template-page__header__name">
|
|
218
|
+
<div>
|
|
219
|
+
<svg width="19" height="21" viewBox="0 0 19 21" fill="none"
|
|
220
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
221
|
+
<path
|
|
222
|
+
d="M11.2986 12.9994C7.62909 14.8341 4.11744 16.0178 1.35547 16.4518L9.18763 20.0029C9.34545 20.0818 9.60192 20.0818 9.74002 20.0029L17.8878 16.3137C18.0457 16.2348 18.164 16.0572 18.164 15.8797V8.75781C16.2898 10.2177 13.9422 11.6776 11.2986 12.9994Z"
|
|
223
|
+
fill="white" />
|
|
224
|
+
<path
|
|
225
|
+
d="M4.7152 8.89735C4.7152 8.89735 10.9494 3.76802 16.8482 1.20335C15.0529 0.946887 11.3637 0.43395 9.3711 0.453678C4.41928 0.493135 1.06546 1.34145 1.06546 1.34145C0.90763 1.3809 0.769531 1.55846 0.769531 1.71629V8.12795C3.01857 6.56942 5.34651 5.56329 5.34651 5.56329C5.34651 5.56329 2.72264 7.06263 0.769531 8.81844V9.41028V14.1648C3.09748 13.9675 6.62886 12.7641 10.3575 10.7321C13.6719 8.91707 16.4733 6.84562 18.17 5.05035V2.40677C14.3032 3.37346 4.7152 8.89735 4.7152 8.89735Z"
|
|
226
|
+
fill="white" />
|
|
227
|
+
</svg>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="separator" />
|
|
230
|
+
<input
|
|
231
|
+
v-model="page.title"
|
|
232
|
+
type="text"
|
|
233
|
+
class="page-title-input"
|
|
234
|
+
onclick="this.select()"
|
|
235
|
+
>
|
|
236
|
+
</div>
|
|
237
|
+
<div class="template-page__header__details">
|
|
238
|
+
<div class="template-page__header__details__teams">
|
|
239
|
+
<div class="template-page__header__details__teams__team">
|
|
240
|
+
<div v-if="teamsInfo.homeTeam.logo">
|
|
241
|
+
|
|
242
|
+
</div>
|
|
243
|
+
<svg v-else width="25" height="25" viewBox="0 0 25 25" fill="none"
|
|
244
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
245
|
+
<path opacity="0.4"
|
|
246
|
+
d="M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z"
|
|
247
|
+
fill="#54728B" />
|
|
248
|
+
</svg>
|
|
249
|
+
|
|
250
|
+
<span>{{ teamsInfo.homeTeam.name }}</span>
|
|
251
|
+
</div>
|
|
252
|
+
<div class="template-page__header__details__teams__vs">
|
|
253
|
+
VS
|
|
254
|
+
</div>
|
|
255
|
+
<div class="template-page__header__details__teams__team">
|
|
256
|
+
<span>{{ teamsInfo.awayTeam.name }}</span>
|
|
257
|
+
<div v-if="teamsInfo.awayTeam.logo">
|
|
258
|
+
</div>
|
|
259
|
+
<svg v-else width="25" height="25" viewBox="0 0 25 25" fill="none"
|
|
260
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
261
|
+
<path opacity="0.4"
|
|
262
|
+
d="M12.0153 0.261719C12.0153 0.261719 13.6664 1.94994 17.7355 2.06744C21.149 2.16638 22.3796 1.30063 22.3796 1.30063C22.3796 1.30063 25.4902 10.2488 20.3822 17.7005C17.6983 21.615 12.5533 24.1504 12.0091 24.2617C11.4711 24.1504 6.31984 21.615 3.636 17.7005C-1.4596 10.2488 1.65094 1.30063 1.65094 1.30063C1.65094 1.30063 2.88155 2.16638 6.2951 2.06744C10.3642 1.94994 12.0153 0.261719 12.0153 0.261719Z"
|
|
263
|
+
fill="#54728B" />
|
|
264
|
+
</svg>
|
|
265
|
+
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
<div class="template-page__header__details__options">
|
|
269
|
+
<svg width="17" height="13" viewBox="0 0 17 13" fill="none"
|
|
270
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
271
|
+
<path
|
|
272
|
+
d="M3.56953 6.28672C3.56953 7.19972 2.83253 7.93672 1.91953 7.93672C1.00653 7.93672 0.269531 7.19972 0.269531 6.28672C0.269531 5.37372 1.00653 4.63672 1.91953 4.63672C2.83253 4.63672 3.56953 5.37372 3.56953 6.28672ZM8.51953 4.63672C7.60653 4.63672 6.86953 5.37372 6.86953 6.28672C6.86953 7.19972 7.60653 7.93672 8.51953 7.93672C9.43253 7.93672 10.1695 7.19972 10.1695 6.28672C10.1695 5.37372 9.43253 4.63672 8.51953 4.63672ZM15.1195 4.63672C14.2065 4.63672 13.4695 5.37372 13.4695 6.28672C13.4695 7.19972 14.2065 7.93672 15.1195 7.93672C16.0325 7.93672 16.7695 7.19972 16.7695 6.28672C16.7695 5.37372 16.0325 4.63672 15.1195 4.63672Z"
|
|
273
|
+
fill="white" />
|
|
274
|
+
</svg>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
<div class="template-page__content">
|
|
279
|
+
<div :id="`grid-stack-${id}`" class="grid-stack">
|
|
280
|
+
<div
|
|
281
|
+
class="grid-stack-item"
|
|
282
|
+
v-for="(item, index) of page.items"
|
|
283
|
+
:key="item.id"
|
|
284
|
+
:gs-id="item.id"
|
|
285
|
+
:gs-x="item.x"
|
|
286
|
+
:gs-y="item.y"
|
|
287
|
+
:gs-w="item.w"
|
|
288
|
+
:gs-h="item.h"
|
|
289
|
+
:gs-no-resize="item.noResize"
|
|
290
|
+
:gs-no-move="item.noMove"
|
|
291
|
+
gs-auto-position="true"
|
|
292
|
+
>
|
|
293
|
+
<div class="grid-stack-item-content">
|
|
294
|
+
<ReportView :title="item.title">
|
|
295
|
+
<template #default>
|
|
296
|
+
<GSCVolumetricField
|
|
297
|
+
:is-game-pre-match="!isPostMatch"
|
|
298
|
+
:are-teams-visible="false"
|
|
299
|
+
:is-title-visible="false"
|
|
300
|
+
:is-ghost-effect="item.isTemplateMode"
|
|
301
|
+
/>
|
|
302
|
+
</template>
|
|
303
|
+
</ReportView>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
</template>
|
|
310
|
+
<style scoped lang="scss">
|
|
311
|
+
.page-title-input {
|
|
312
|
+
&:focus {
|
|
313
|
+
outline: none;
|
|
314
|
+
border-radius: 3.1px;
|
|
315
|
+
border: solid 1px #216ea5;
|
|
316
|
+
background-color: #17212a;
|
|
317
|
+
padding: 0 12px;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.template-page {
|
|
322
|
+
width: 100%;
|
|
323
|
+
height: 776px;
|
|
324
|
+
padding: 12px 16px;
|
|
325
|
+
display: flex;
|
|
326
|
+
flex-direction: column;
|
|
327
|
+
background-color: #1d2a35;
|
|
328
|
+
|
|
329
|
+
&__header {
|
|
330
|
+
display: flex;
|
|
331
|
+
justify-content: space-between;
|
|
332
|
+
border-bottom: solid 1.1px rgba(255, 255, 255, 0.2);
|
|
333
|
+
padding-bottom: 6px;
|
|
334
|
+
|
|
335
|
+
&__name {
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: center;
|
|
338
|
+
gap: 12px;
|
|
339
|
+
|
|
340
|
+
& > div.separator {
|
|
341
|
+
width: 1px;
|
|
342
|
+
height: 18px;
|
|
343
|
+
background-color: #87878f;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
& > input {
|
|
347
|
+
margin-left: 10px;
|
|
348
|
+
font-family: Poppins-Medium, sans-serif;
|
|
349
|
+
font-size: 14px;
|
|
350
|
+
font-weight: 500;
|
|
351
|
+
font-stretch: normal;
|
|
352
|
+
font-style: normal;
|
|
353
|
+
line-height: normal;
|
|
354
|
+
letter-spacing: normal;
|
|
355
|
+
text-align: left;
|
|
356
|
+
color: #fff;
|
|
357
|
+
background-color: #1d2a35;
|
|
358
|
+
border: 0;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
&__details {
|
|
363
|
+
display: flex;
|
|
364
|
+
align-items: center;
|
|
365
|
+
gap: 14px;
|
|
366
|
+
font-size: 13.7px;
|
|
367
|
+
font-weight: 500;
|
|
368
|
+
font-stretch: normal;
|
|
369
|
+
font-style: normal;
|
|
370
|
+
line-height: normal;
|
|
371
|
+
letter-spacing: normal;
|
|
372
|
+
text-align: right;
|
|
373
|
+
color: #fff;
|
|
374
|
+
|
|
375
|
+
&__teams {
|
|
376
|
+
display: flex;
|
|
377
|
+
align-items: center;
|
|
378
|
+
gap: 24px;
|
|
379
|
+
font-family: Poppins-Medium, sans-serif;
|
|
380
|
+
|
|
381
|
+
&__team {
|
|
382
|
+
display: flex;
|
|
383
|
+
align-items: center;
|
|
384
|
+
gap: 5px;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&__vs {
|
|
388
|
+
font-family: Poppins-Light, sans-serif;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
&__options {
|
|
393
|
+
cursor: pointer;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
</style>
|