@eturnity/eturnity_reusable_components 8.13.13-epic-shading.1 → 8.13.13-qa-16-03-26.1
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/package.json +1 -1
- package/src/DemoCharts.vue +424 -0
- package/src/TestChart.vue +241 -0
- package/src/assets/svgIcons/refresh.svg +3 -0
- package/src/assets/theme.js +16 -1
- package/src/components/barchart/BottomFields.vue +253 -0
- package/src/components/barchart/ChartControls.vue +113 -0
- package/src/components/barchart/SelectionBox.vue +150 -0
- package/src/components/barchart/composables/index.js +5 -0
- package/src/components/barchart/composables/useAxisCalculations.js +104 -0
- package/src/components/barchart/composables/useChartData.js +114 -0
- package/src/components/barchart/composables/useChartScroll.js +61 -0
- package/src/components/barchart/composables/useSelection.js +75 -0
- package/src/components/barchart/composables/useTooltip.js +100 -0
- package/src/components/barchart/index.vue +376 -0
- package/src/components/barchart/styles/bottomFields.js +66 -0
- package/src/components/barchart/styles/chart.js +259 -0
- package/src/components/barchart/styles/chartControls.js +59 -0
- package/src/components/buttons/splitButtons/index.vue +86 -0
- package/src/components/collapsableInfoText/index.vue +2 -2
- package/src/components/inputs/checkbox/index.vue +2 -2
- package/src/components/inputs/inputNumber/index.vue +78 -80
- package/src/components/inputs/select/index.vue +89 -16
- package/src/components/modals/modal/index.vue +15 -5
- package/src/helpers/isObjectEqual.js +22 -0
- package/src/helpers/numberConverter.js +1 -1
- package/src/main.js +8 -0
- package/src/router/dynamicRoutes.js +12 -0
- package/src/assets/icons/collapse_arrow_icon_white.svg +0 -1
- package/src/assets/svgIcons/house_sun.svg +0 -3
- package/src/components/draggableCard/defaultProps.js +0 -16
- package/src/components/draggableCard/draggableCard.spec.js +0 -99
- package/src/components/draggableCard/draggableCard.stories.js +0 -79
- package/src/components/draggableCard/index.vue +0 -363
@@ -1,363 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<CardContainer
|
3
|
-
data-test-id="draggable_card_container"
|
4
|
-
:initial-position="initialPosition"
|
5
|
-
:width="width"
|
6
|
-
>
|
7
|
-
<HeaderContainer data-test-id="draggable_card_header">
|
8
|
-
<SubHeaderWrapper>
|
9
|
-
<LeftIconsContainer>
|
10
|
-
<DragHandleWrapper :class="{ dragging: isDragging }">
|
11
|
-
<RCIcon
|
12
|
-
:color="theme.colors.grey3"
|
13
|
-
data-test-id="draggable_card_drag_icon"
|
14
|
-
name="drag_icon"
|
15
|
-
size="14px"
|
16
|
-
:title="$gettext('drag_drop')"
|
17
|
-
@mousedown="(event) => onDragStart(event, false)"
|
18
|
-
@touchstart="
|
19
|
-
(event) => {
|
20
|
-
onDragStart(event, true)
|
21
|
-
}
|
22
|
-
"
|
23
|
-
/>
|
24
|
-
</DragHandleWrapper>
|
25
|
-
<ArrowIconWrapper
|
26
|
-
v-if="isCollapsible"
|
27
|
-
data-test-id="draggable_card_collapse_button"
|
28
|
-
:is-collapsed="isCollapsed"
|
29
|
-
@click="toggleCollapse"
|
30
|
-
>
|
31
|
-
<img :src="CollapseArrowIconUrl" />
|
32
|
-
</ArrowIconWrapper>
|
33
|
-
</LeftIconsContainer>
|
34
|
-
<TitleContainer :data-id="titleDataId">
|
35
|
-
<TextContainer>{{ title }}</TextContainer>
|
36
|
-
<InfoText v-if="infoText?.length" :text="infoText" />
|
37
|
-
</TitleContainer>
|
38
|
-
</SubHeaderWrapper>
|
39
|
-
<CloseButton
|
40
|
-
class="close"
|
41
|
-
data-test-id="draggable_card_close_button"
|
42
|
-
@click="$emit('on-close')"
|
43
|
-
/>
|
44
|
-
</HeaderContainer>
|
45
|
-
<BodyContainer v-if="!isCollapsed" data-test-id="draggable_card_body">
|
46
|
-
<slot name="body"></slot>
|
47
|
-
</BodyContainer>
|
48
|
-
<FooterContainer v-if="$slots.footer" data-test-id="draggable_card_footer">
|
49
|
-
<slot name="footer"></slot>
|
50
|
-
</FooterContainer>
|
51
|
-
</CardContainer>
|
52
|
-
</template>
|
53
|
-
|
54
|
-
<script>
|
55
|
-
import styled from 'vue3-styled-components'
|
56
|
-
import theme from '../../assets/theme.js'
|
57
|
-
import RCIcon from '../icon'
|
58
|
-
import CloseButton from '../buttons/closeButton'
|
59
|
-
import InfoText from '../infoText'
|
60
|
-
import CollapseArrowIconUrl from '../../assets/icons/collapse_arrow_icon_white.svg?url'
|
61
|
-
|
62
|
-
const CardContainerAttr = {
|
63
|
-
initialPosition: Object,
|
64
|
-
width: String,
|
65
|
-
}
|
66
|
-
const CardContainer = styled('div', CardContainerAttr)`
|
67
|
-
position: absolute;
|
68
|
-
display: flex;
|
69
|
-
flex-direction: column;
|
70
|
-
border-radius: 4px;
|
71
|
-
width: ${(props) => props.width};
|
72
|
-
background: ${theme.colors.transparentBlack2};
|
73
|
-
z-index: 5;
|
74
|
-
${(props) =>
|
75
|
-
props.initialPosition?.top && `top: ${props.initialPosition.top};`}
|
76
|
-
${(props) =>
|
77
|
-
props.initialPosition?.right && `right: ${props.initialPosition.right};`}
|
78
|
-
${(props) =>
|
79
|
-
props.initialPosition?.left && `left: ${props.initialPosition.left};`}
|
80
|
-
${(props) =>
|
81
|
-
props.initialPosition?.bottom &&
|
82
|
-
`bottom: ${props.initialPosition.bottom};`}
|
83
|
-
`
|
84
|
-
|
85
|
-
const HeaderContainer = styled.div`
|
86
|
-
display: flex;
|
87
|
-
align-items: center;
|
88
|
-
justify-content: space-between;
|
89
|
-
padding: 8px;
|
90
|
-
`
|
91
|
-
|
92
|
-
const SubHeaderWrapper = styled.div`
|
93
|
-
display: flex;
|
94
|
-
min-width: 180px;
|
95
|
-
align-items: center;
|
96
|
-
height: fit-content;
|
97
|
-
margin-right: 30px;
|
98
|
-
`
|
99
|
-
|
100
|
-
const LeftIconsContainer = styled.div`
|
101
|
-
display: flex;
|
102
|
-
align-items: center;
|
103
|
-
gap: 4px;
|
104
|
-
margin-right: 14px;
|
105
|
-
`
|
106
|
-
|
107
|
-
const TitleContainer = styled.div`
|
108
|
-
display: flex;
|
109
|
-
align-items: center;
|
110
|
-
gap: 8px;
|
111
|
-
`
|
112
|
-
|
113
|
-
const TextContainer = styled.div`
|
114
|
-
font-family: ${theme.fonts.mainFont};
|
115
|
-
font-weight: 600;
|
116
|
-
font-size: 14px;
|
117
|
-
line-height: 19.6px;
|
118
|
-
letter-spacing: -1%;
|
119
|
-
color: ${theme.colors.white};
|
120
|
-
word-break: break-word;
|
121
|
-
overflow-wrap: break-word;
|
122
|
-
white-space: normal;
|
123
|
-
`
|
124
|
-
|
125
|
-
const DragHandleWrapper = styled.div`
|
126
|
-
display: grid;
|
127
|
-
align-items: center;
|
128
|
-
justify-items: center;
|
129
|
-
width: 26px;
|
130
|
-
height: 26px;
|
131
|
-
cursor: grab;
|
132
|
-
&.dragging {
|
133
|
-
cursor: grabbing;
|
134
|
-
}
|
135
|
-
`
|
136
|
-
|
137
|
-
const collapsedAttrs = {
|
138
|
-
isCollapsed: Boolean,
|
139
|
-
}
|
140
|
-
const ArrowIconWrapper = styled('div', collapsedAttrs)`
|
141
|
-
display: flex;
|
142
|
-
align-items: center;
|
143
|
-
justify-content: center;
|
144
|
-
width: 8px;
|
145
|
-
height: 26px;
|
146
|
-
cursor: pointer;
|
147
|
-
transition: transform 0.3s ease;
|
148
|
-
${(props) => props.isCollapsed && 'transform: rotate(-180deg);'}
|
149
|
-
`
|
150
|
-
|
151
|
-
const BodyContainer = styled.div`
|
152
|
-
display: flex;
|
153
|
-
flex-direction: column;
|
154
|
-
gap: 16px;
|
155
|
-
padding-top: 8px;
|
156
|
-
padding-right: 16px;
|
157
|
-
padding-bottom: 8px;
|
158
|
-
padding-left: 16px;
|
159
|
-
word-break: break-word;
|
160
|
-
overflow-wrap: break-word;
|
161
|
-
white-space: normal;
|
162
|
-
`
|
163
|
-
|
164
|
-
const FooterContainer = styled.div`
|
165
|
-
display: flex;
|
166
|
-
border-radius: 4px;
|
167
|
-
align-items: center;
|
168
|
-
justify-content: space-between;
|
169
|
-
padding: 8px;
|
170
|
-
background: ${theme.colors.eturnityGrey};
|
171
|
-
word-break: break-word;
|
172
|
-
overflow-wrap: break-word;
|
173
|
-
white-space: normal;
|
174
|
-
`
|
175
|
-
|
176
|
-
export default {
|
177
|
-
name: 'DraggableCard',
|
178
|
-
components: {
|
179
|
-
CardContainer,
|
180
|
-
HeaderContainer,
|
181
|
-
SubHeaderWrapper,
|
182
|
-
LeftIconsContainer,
|
183
|
-
TextContainer,
|
184
|
-
DragHandleWrapper,
|
185
|
-
ArrowIconWrapper,
|
186
|
-
RCIcon,
|
187
|
-
CloseButton,
|
188
|
-
InfoText,
|
189
|
-
TitleContainer,
|
190
|
-
BodyContainer,
|
191
|
-
FooterContainer,
|
192
|
-
},
|
193
|
-
props: {
|
194
|
-
width: {
|
195
|
-
required: true,
|
196
|
-
type: String,
|
197
|
-
},
|
198
|
-
initialPosition: {
|
199
|
-
required: true,
|
200
|
-
type: Object,
|
201
|
-
},
|
202
|
-
title: {
|
203
|
-
required: true,
|
204
|
-
type: String,
|
205
|
-
},
|
206
|
-
titleDataId: {
|
207
|
-
required: false,
|
208
|
-
type: String,
|
209
|
-
default: '',
|
210
|
-
},
|
211
|
-
isCollapsible: {
|
212
|
-
required: false,
|
213
|
-
type: Boolean,
|
214
|
-
default: true,
|
215
|
-
},
|
216
|
-
infoText: {
|
217
|
-
required: false,
|
218
|
-
type: String,
|
219
|
-
default: '',
|
220
|
-
},
|
221
|
-
dragTargets: {
|
222
|
-
required: false,
|
223
|
-
type: Array,
|
224
|
-
default: () => ['document'],
|
225
|
-
},
|
226
|
-
dragBounds: {
|
227
|
-
required: false,
|
228
|
-
type: Object,
|
229
|
-
default: () => {},
|
230
|
-
},
|
231
|
-
},
|
232
|
-
emits: ['on-close'],
|
233
|
-
data() {
|
234
|
-
return {
|
235
|
-
isCollapsed: false,
|
236
|
-
isDragging: false,
|
237
|
-
isTouchStart: false,
|
238
|
-
eventCoordinates: {
|
239
|
-
x: 0,
|
240
|
-
y: 0,
|
241
|
-
},
|
242
|
-
CollapseArrowIconUrl,
|
243
|
-
}
|
244
|
-
},
|
245
|
-
computed: {
|
246
|
-
dragBoundsEnabled() {
|
247
|
-
const minPosition = this.dragBounds?.min
|
248
|
-
const maxPosition = this.dragBounds?.max
|
249
|
-
return (
|
250
|
-
Number.isFinite(minPosition?.top) &&
|
251
|
-
Number.isFinite(minPosition?.left) &&
|
252
|
-
Number.isFinite(maxPosition?.top) &&
|
253
|
-
Number.isFinite(maxPosition?.left)
|
254
|
-
)
|
255
|
-
},
|
256
|
-
theme() {
|
257
|
-
return theme
|
258
|
-
},
|
259
|
-
},
|
260
|
-
watch: {
|
261
|
-
dragBounds() {
|
262
|
-
this.clampElementPosition()
|
263
|
-
},
|
264
|
-
},
|
265
|
-
beforeUnmount() {
|
266
|
-
this.removeEvents()
|
267
|
-
},
|
268
|
-
methods: {
|
269
|
-
toggleCollapse() {
|
270
|
-
this.isCollapsed = !this.isCollapsed
|
271
|
-
},
|
272
|
-
onDragStart(e, isTouchStart) {
|
273
|
-
e.preventDefault()
|
274
|
-
this.isDragging = true
|
275
|
-
this.isTouchStart = isTouchStart
|
276
|
-
this.eventCoordinates.x = isTouchStart
|
277
|
-
? e.touches[0].clientX
|
278
|
-
: e.clientX
|
279
|
-
this.eventCoordinates.y = isTouchStart
|
280
|
-
? e.touches[0].clientY
|
281
|
-
: e.clientY
|
282
|
-
this.dragTargets.forEach((id) => {
|
283
|
-
const target =
|
284
|
-
id === 'document' ? document : document.getElementById(id)
|
285
|
-
if (target && target.addEventListener) {
|
286
|
-
target.addEventListener(
|
287
|
-
isTouchStart ? 'touchend' : 'mouseup',
|
288
|
-
this.onDragEnd
|
289
|
-
)
|
290
|
-
target.addEventListener(
|
291
|
-
isTouchStart ? 'touchmove' : 'mousemove',
|
292
|
-
this.onDrag
|
293
|
-
)
|
294
|
-
}
|
295
|
-
})
|
296
|
-
document.addEventListener(
|
297
|
-
isTouchStart ? 'touchend' : 'mouseup',
|
298
|
-
this.onDragEnd
|
299
|
-
)
|
300
|
-
},
|
301
|
-
onDrag(e) {
|
302
|
-
e.preventDefault()
|
303
|
-
const eventX = this.isTouchStart ? e.touches[0].clientX : e.clientX
|
304
|
-
const eventY = this.isTouchStart ? e.touches[0].clientY : e.clientY
|
305
|
-
const deltaX = this.eventCoordinates.x - eventX
|
306
|
-
const deltaY = this.eventCoordinates.y - eventY
|
307
|
-
this.eventCoordinates.x = eventX
|
308
|
-
this.eventCoordinates.y = eventY
|
309
|
-
const element = this.$el
|
310
|
-
let positionY = element.offsetTop - deltaY
|
311
|
-
let positionX = element.offsetLeft - deltaX
|
312
|
-
element.style.top = positionY + 'px'
|
313
|
-
element.style.left = positionX + 'px'
|
314
|
-
if (this.dragBoundsEnabled) {
|
315
|
-
this.clampElementPosition()
|
316
|
-
}
|
317
|
-
},
|
318
|
-
onDragEnd() {
|
319
|
-
this.isDragging = false
|
320
|
-
this.removeEvents()
|
321
|
-
},
|
322
|
-
clampElementPosition() {
|
323
|
-
if (!this.dragBoundsEnabled) return
|
324
|
-
|
325
|
-
const element = this.$el
|
326
|
-
const rect = element.getBoundingClientRect()
|
327
|
-
const computedStyle = window.getComputedStyle(element)
|
328
|
-
const currentX = parseFloat(computedStyle.left) || 0
|
329
|
-
const currentY = parseFloat(computedStyle.top) || 0
|
330
|
-
|
331
|
-
const minPosition = this.dragBounds.min
|
332
|
-
const maxPosition = this.dragBounds.max
|
333
|
-
|
334
|
-
const y = Math.min(
|
335
|
-
Math.max(currentY, minPosition.top),
|
336
|
-
maxPosition.top - rect.height
|
337
|
-
)
|
338
|
-
|
339
|
-
const x = Math.min(
|
340
|
-
Math.max(currentX, minPosition.left),
|
341
|
-
maxPosition.left - rect.width
|
342
|
-
)
|
343
|
-
|
344
|
-
element.style.top = y + 'px'
|
345
|
-
element.style.left = x + 'px'
|
346
|
-
},
|
347
|
-
removeEvents() {
|
348
|
-
this.dragTargets.forEach((id) => {
|
349
|
-
const target =
|
350
|
-
id === 'document' ? document : document.getElementById(id)
|
351
|
-
if (target && target.removeEventListener) {
|
352
|
-
target.removeEventListener('mouseup', this.onDragEnd)
|
353
|
-
target.removeEventListener('touchend', this.onDragEnd)
|
354
|
-
target.removeEventListener('mousemove', this.onDrag)
|
355
|
-
target.removeEventListener('touchmove', this.onDrag)
|
356
|
-
}
|
357
|
-
})
|
358
|
-
document.removeEventListener('mouseup', this.onDragEnd)
|
359
|
-
document.removeEventListener('touchend', this.onDragEnd)
|
360
|
-
},
|
361
|
-
},
|
362
|
-
}
|
363
|
-
</script>
|