@dataloop-ai/components 0.13.19 → 0.14.4
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/.nvmrc +1 -0
- package/README.md +3 -1
- package/package.json +19 -17
- package/src/assets/globals.scss +38 -3
- package/src/assets/grid.scss +9 -0
- package/src/components/DlAccordion/DlAccordion.vue +4 -4
- package/src/components/DlAlert.vue +6 -6
- package/src/components/DlChart/BrushThumb.vue +83 -0
- package/src/components/DlChart/DlBarChart.vue +545 -0
- package/src/components/DlChart/DlBrush.vue +475 -0
- package/src/components/DlChart/DlChartLabels.vue +279 -0
- package/src/components/DlChart/DlChartLegend.vue +141 -0
- package/src/components/DlChart/DlColumnChart.vue +555 -0
- package/src/components/DlChart/DlLineChart.vue +644 -0
- package/src/components/DlChart/DlScrollBar.vue +147 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChart.vue +448 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChartLegend.vue +281 -0
- package/src/components/DlChart/Doughnut/DlDoughnutChartWidget.vue +64 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartAnimation.ts +4 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartData.ts +16 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartOptions.ts +11 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutChartProps.ts +8 -0
- package/src/components/DlChart/Doughnut/types/TDoughnutWithOriginalColor.ts +13 -0
- package/src/components/DlChart/chart.ts +122 -0
- package/src/components/DlChart/index.ts +36 -0
- package/src/components/DlChart/props.ts +348 -0
- package/src/components/DlChart/typedCharts.ts +88 -0
- package/src/components/DlChart/types.ts +63 -0
- package/src/components/DlChart/utils.ts +153 -0
- package/src/components/DlChip/DlChip.vue +40 -13
- package/src/components/DlCounters.vue +31 -7
- package/src/components/DlDatePicker/DlCalendar.vue +22 -10
- package/src/components/DlDatePicker/DlDatePicker.vue +8 -5
- package/src/components/DlDateTimeRange/types.ts +2 -2
- package/src/components/DlDropdownButton.vue +5 -3
- package/src/components/DlMenu/DlMenu.vue +4 -2
- package/src/components/DlPagination/RowsSelector.vue +15 -2
- package/src/components/DlPopup/DlPopup.vue +0 -1
- package/src/components/DlRange/DlRange.vue +3 -2
- package/src/components/DlSearch.vue +1 -1
- package/src/components/DlSelect/DlSelect.vue +3 -2
- package/src/components/DlSlider/sliderStyles.scss +4 -0
- package/src/components/DlSlider/useSlider.ts +39 -12
- package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +1 -1
- package/src/components/DlSpinner.vue +259 -0
- package/src/components/DlTable/DlTable.vue +4 -1
- package/src/components/DlTable/hooks/tablePagination.ts +8 -2
- package/src/components/DlTextArea.vue +9 -0
- package/src/components/DlTextInput.vue +4 -2
- package/src/components/DlThemeProvider.vue +22 -13
- package/src/components/DlToastMessage/api/useToast.ts +23 -0
- package/src/components/DlToastMessage/components/ToastComponent.vue +279 -0
- package/src/components/DlToastMessage/index.ts +5 -0
- package/src/components/DlToastMessage/types.ts +4 -0
- package/src/components/DlToastMessage/utils/config.ts +17 -0
- package/src/components/DlToastMessage/utils/render.ts +56 -0
- package/src/components/DlTypography.vue +1 -1
- package/src/components/DlWidget/DlGrid.vue +33 -0
- package/src/components/DlWidget/DlGridRow.vue +32 -0
- package/src/components/DlWidget/DlWidget.vue +202 -11
- package/src/components/DlWidget/index.ts +2 -2
- package/src/components/DlWidget/utils.ts +26 -19
- package/src/components/index.ts +8 -3
- package/src/demo/BarChartDemo.vue +77 -0
- package/src/demo/ColumnChartDemo.vue +230 -0
- package/src/demo/DlButtonDemo.vue +1 -1
- package/src/demo/DlChartDoughnutDemo.vue +229 -0
- package/src/demo/DlChipDemo.vue +42 -18
- package/src/demo/DlDialogBoxDemo.vue +4 -4
- package/src/demo/DlDropdownButtonDemo.vue +1 -1
- package/src/demo/DlLineChartDemo.vue +375 -0
- package/src/demo/DlMenuDemo.vue +1 -1
- package/src/demo/DlOptionGroupDemo.vue +1 -1
- package/src/demo/DlSelectDemo.vue +1 -1
- package/src/demo/DlSpinnerDemo.vue +20 -0
- package/src/demo/DlTableDemo.vue +13 -94
- package/src/demo/DlToastMessageDemo.vue +143 -0
- package/src/demo/DlWidgetDemo.vue +105 -143
- package/src/demo/index.ts +20 -2
- package/src/hooks/use-theme.ts +19 -0
- package/src/utils/abbreviate-to-string.ts +14 -0
- package/src/utils/colors.ts +47 -0
- package/src/utils/getRootStyles.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/position-engine.ts +11 -2
- package/src/utils/swapNodes.ts +30 -0
- package/src/utils/update-key.ts +90 -0
- package/tsconfig.json +0 -1
- package/vite.config.ts +17 -0
- package/Dockerfile +0 -12
- package/jest.config.js +0 -16
- package/jest.setup.js +0 -59
- package/src/components/DlWidget/DlWidgetGrid.vue +0 -360
- package/storybook.js +0 -8
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Positions = Object.freeze({
|
|
2
|
+
top_right: 'top-right',
|
|
3
|
+
top: 'top',
|
|
4
|
+
top_left: 'top-left',
|
|
5
|
+
bottom_right: 'bottom-right',
|
|
6
|
+
bottom: 'bottom',
|
|
7
|
+
bottom_left: 'bottom-left'
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const Types = Object.freeze({
|
|
11
|
+
success: 'success',
|
|
12
|
+
warning: 'warning',
|
|
13
|
+
error: 'error',
|
|
14
|
+
info: 'info'
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export { Positions, Types }
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as VueDemiModule from 'vue-demi'
|
|
2
|
+
import ToastComponent from '../components/ToastComponent.vue'
|
|
3
|
+
|
|
4
|
+
let createComponent: Function
|
|
5
|
+
|
|
6
|
+
const VueDemi: any = VueDemiModule
|
|
7
|
+
|
|
8
|
+
if (VueDemi.isVue3) {
|
|
9
|
+
createComponent = function (
|
|
10
|
+
component: object,
|
|
11
|
+
props: object,
|
|
12
|
+
parentContainer: Element,
|
|
13
|
+
slots = {}
|
|
14
|
+
) {
|
|
15
|
+
const vNode = VueDemi.h(component, props, slots)
|
|
16
|
+
const container = document.createElement('div')
|
|
17
|
+
container.classList.add('v-toast--pending')
|
|
18
|
+
parentContainer.appendChild(container)
|
|
19
|
+
VueDemi.render(vNode, container)
|
|
20
|
+
|
|
21
|
+
return vNode.component
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
createComponent = function (
|
|
25
|
+
component: object,
|
|
26
|
+
props: object,
|
|
27
|
+
parentContainer: Element,
|
|
28
|
+
slots = {}
|
|
29
|
+
) {
|
|
30
|
+
const container = document.createElement('div')
|
|
31
|
+
container.classList.add('v-toast--pending')
|
|
32
|
+
parentContainer.appendChild(container)
|
|
33
|
+
renderVue2Component(ToastComponent, props, '.v-toast--pending')
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function removeElement(el: Element) {
|
|
38
|
+
if (typeof el.remove !== 'undefined') {
|
|
39
|
+
el.remove()
|
|
40
|
+
} else {
|
|
41
|
+
el.parentNode?.removeChild(el)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { createComponent }
|
|
46
|
+
|
|
47
|
+
function renderVue2Component(
|
|
48
|
+
component: Object,
|
|
49
|
+
props: Object,
|
|
50
|
+
container: string
|
|
51
|
+
) {
|
|
52
|
+
new VueDemi.Vue2({
|
|
53
|
+
render: (h: (arg0: Object, arg1: { props: Object }) => any) =>
|
|
54
|
+
h(component, { props })
|
|
55
|
+
}).$mount(container)
|
|
56
|
+
}
|
|
@@ -15,7 +15,7 @@ import { getColor } from '../utils'
|
|
|
15
15
|
|
|
16
16
|
type Variant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p'
|
|
17
17
|
|
|
18
|
-
const sizes = ['h1', 'h2', 'h3', 'h4', 'body']
|
|
18
|
+
const sizes = ['h1', 'h2', 'h3', 'h4', 'body', 'small']
|
|
19
19
|
|
|
20
20
|
export default defineComponent({
|
|
21
21
|
name: 'DlTypography',
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="rowGap"
|
|
4
|
+
class="dl-grid"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from 'vue-demi'
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
props: {
|
|
15
|
+
gap: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '30px'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
rowGap(): Record<string, string> {
|
|
22
|
+
return { '--row-gap': this.gap }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style lang="scss" scoped>
|
|
29
|
+
.dl-grid {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:style="columnGap"
|
|
4
|
+
class="dl-grid-row"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from 'vue-demi'
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
props: {
|
|
15
|
+
gap: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: '30px'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
columnGap(): Record<string, string> {
|
|
22
|
+
return { '--column-gap': this.gap }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style scoped>
|
|
29
|
+
.dl-grid-row {
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -1,29 +1,186 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
|
|
4
|
-
class="
|
|
3
|
+
ref="wrapper"
|
|
4
|
+
class="widget-wrapper"
|
|
5
5
|
>
|
|
6
|
-
<div
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<div
|
|
7
|
+
:id="uuid"
|
|
8
|
+
ref="widget"
|
|
9
|
+
:class="widgetStyles"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
class="dl-widget__header"
|
|
13
|
+
@mouseenter="visibleDragIcon = true"
|
|
14
|
+
@mouseleave="visibleDragIcon = false"
|
|
15
|
+
>
|
|
16
|
+
<div class="dl-widget__header--titles">
|
|
17
|
+
<slot name="header" />
|
|
18
|
+
</div>
|
|
19
|
+
<dl-icon
|
|
20
|
+
:style="`visibility: ${
|
|
21
|
+
visibleDragIcon ? 'visible' : 'hidden'
|
|
22
|
+
}`"
|
|
23
|
+
class="dl-widget__header--drag-icon"
|
|
24
|
+
icon="icon-dl-drag"
|
|
25
|
+
color="dl-color-medium"
|
|
26
|
+
size="15px"
|
|
27
|
+
@mousedown="startDragging"
|
|
28
|
+
/>
|
|
29
|
+
<slot name="menu" />
|
|
30
|
+
</div>
|
|
9
31
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
32
|
+
<div class="dl-widget__content">
|
|
33
|
+
<slot name="content" />
|
|
34
|
+
</div>
|
|
13
35
|
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
<div class="dl-widget__description">
|
|
37
|
+
<slot name="description" />
|
|
38
|
+
</div>
|
|
16
39
|
</div>
|
|
40
|
+
<div
|
|
41
|
+
ref="clone"
|
|
42
|
+
class="drag-clone"
|
|
43
|
+
/>
|
|
17
44
|
</div>
|
|
18
45
|
</template>
|
|
19
46
|
<script lang="ts">
|
|
20
47
|
import { v4 } from 'uuid'
|
|
21
48
|
import { defineComponent } from 'vue-demi'
|
|
49
|
+
import DlIcon from '../DlIcon.vue'
|
|
50
|
+
import {
|
|
51
|
+
getElementAbove,
|
|
52
|
+
addMouseEnter,
|
|
53
|
+
removeMouseEnter,
|
|
54
|
+
setFlexBasis,
|
|
55
|
+
insertAfter
|
|
56
|
+
} from './utils'
|
|
57
|
+
import { swapNodes } from '../../utils/swapNodes'
|
|
58
|
+
|
|
22
59
|
export default defineComponent({
|
|
23
60
|
name: 'DlWidget',
|
|
61
|
+
components: {
|
|
62
|
+
DlIcon
|
|
63
|
+
},
|
|
24
64
|
data() {
|
|
25
65
|
return {
|
|
26
|
-
uuid: `dl-widget-${v4()}
|
|
66
|
+
uuid: `dl-widget-${v4()}`,
|
|
67
|
+
draggedWidget: null,
|
|
68
|
+
hoveredWidget: null,
|
|
69
|
+
isLeftSide: false,
|
|
70
|
+
flexBasis: null,
|
|
71
|
+
isDragging: false,
|
|
72
|
+
timer: null,
|
|
73
|
+
visibleDragIcon: false
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
widgetStyles() {
|
|
78
|
+
return `${this.isDragging ? 'dl-widget__drag' : 'dl-widget'}`
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
mounted() {
|
|
82
|
+
setFlexBasis()
|
|
83
|
+
},
|
|
84
|
+
methods: {
|
|
85
|
+
startDragging(e: MouseEvent) {
|
|
86
|
+
this.isDragging = true
|
|
87
|
+
this.draggedWidget = getElementAbove(
|
|
88
|
+
e.target as HTMLElement,
|
|
89
|
+
'dl-widget'
|
|
90
|
+
)
|
|
91
|
+
if (this.draggedWidget) {
|
|
92
|
+
(this.$refs.clone as HTMLElement).appendChild(
|
|
93
|
+
this.draggedWidget.cloneNode(true)
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const sourceCanvas = this.draggedWidget?.querySelector('canvas')
|
|
98
|
+
if (sourceCanvas) {
|
|
99
|
+
const targetCanvasCtx = (this.$refs.clone as HTMLElement)
|
|
100
|
+
.querySelector('canvas')
|
|
101
|
+
.getContext('2d')
|
|
102
|
+
|
|
103
|
+
targetCanvasCtx.drawImage(sourceCanvas, 0, 0)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.moveClone(e as MouseEvent)
|
|
107
|
+
|
|
108
|
+
addMouseEnter('dl-widget', this.handleMouseEnter as any)
|
|
109
|
+
|
|
110
|
+
window.addEventListener('mousemove', this.moveClone)
|
|
111
|
+
window.addEventListener('mouseup', this.stopDragging)
|
|
112
|
+
},
|
|
113
|
+
moveClone(e: MouseEvent) {
|
|
114
|
+
if (!this.isDragging) return
|
|
115
|
+
const clone = this.$refs.clone as HTMLElement
|
|
116
|
+
clone.style.left = `${e.pageX - clone.offsetWidth / 2 - 5}px`
|
|
117
|
+
clone.style.top = `${e.pageY + 10}px`
|
|
118
|
+
},
|
|
119
|
+
stopDragging(e: MouseEvent) {
|
|
120
|
+
this.isDragging = false
|
|
121
|
+
;(this.$refs.clone as HTMLElement).innerHTML = ''
|
|
122
|
+
const target = getElementAbove(e.target as HTMLElement, 'dl-widget')
|
|
123
|
+
if (target && this.draggedWidget) {
|
|
124
|
+
swapNodes({
|
|
125
|
+
source: this.draggedWidget,
|
|
126
|
+
target
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
window.removeEventListener('mousemove', this.moveClone)
|
|
130
|
+
window.removeEventListener('mouseup', this.stopDragging)
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
removeMouseEnter('dl-widget', this.handleMouseEnter as any)
|
|
133
|
+
}, 1)
|
|
134
|
+
},
|
|
135
|
+
handleMouseEnter(e: MouseEvent) {
|
|
136
|
+
this.hoveredWidget = e.target as HTMLElement
|
|
137
|
+
const mouseOffsetInside = e.clientX - this.hoveredWidget.offsetLeft
|
|
138
|
+
this.isLeftSide =
|
|
139
|
+
mouseOffsetInside < this.hoveredWidget.offsetWidth / 2
|
|
140
|
+
this.hoveredWidget.addEventListener(
|
|
141
|
+
'mousemove',
|
|
142
|
+
this.handleMouseInsideWidget
|
|
143
|
+
)
|
|
144
|
+
this.hoveredWidget.addEventListener('mouseleave', () => {
|
|
145
|
+
clearTimeout(this.timer)
|
|
146
|
+
this.hoveredWidget.removeEventListener(
|
|
147
|
+
'mousemove',
|
|
148
|
+
this.handleMouseInsideWidget
|
|
149
|
+
)
|
|
150
|
+
})
|
|
151
|
+
this.timer = setTimeout(this.insertWidget, 1000)
|
|
152
|
+
},
|
|
153
|
+
insertWidget() {
|
|
154
|
+
const targetWidget = getElementAbove(
|
|
155
|
+
this.hoveredWidget,
|
|
156
|
+
'widget-wrapper'
|
|
157
|
+
)
|
|
158
|
+
const targetRow = getElementAbove(this.hoveredWidget, 'dl-grid-row')
|
|
159
|
+
if (this.isLeftSide) {
|
|
160
|
+
targetRow.insertBefore(
|
|
161
|
+
this.$refs.wrapper as HTMLElement,
|
|
162
|
+
targetWidget
|
|
163
|
+
)
|
|
164
|
+
} else {
|
|
165
|
+
insertAfter(
|
|
166
|
+
this.$refs.wrapper as unknown as HTMLElement,
|
|
167
|
+
targetWidget
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
this.hoveredWidget.removeEventListener(
|
|
171
|
+
'mousemove',
|
|
172
|
+
this.handleMouseInsideWidget
|
|
173
|
+
)
|
|
174
|
+
setFlexBasis()
|
|
175
|
+
},
|
|
176
|
+
handleMouseInsideWidget(e: MouseEvent) {
|
|
177
|
+
const mouseOffsetInside = e.clientX - this.hoveredWidget.offsetLeft
|
|
178
|
+
const isLeftSide =
|
|
179
|
+
mouseOffsetInside < this.hoveredWidget.offsetWidth / 2
|
|
180
|
+
if (this.isLeftSide !== isLeftSide) {
|
|
181
|
+
clearTimeout(this.timer)
|
|
182
|
+
this.handleMouseEnter(e)
|
|
183
|
+
}
|
|
27
184
|
}
|
|
28
185
|
}
|
|
29
186
|
})
|
|
@@ -31,12 +188,30 @@ export default defineComponent({
|
|
|
31
188
|
|
|
32
189
|
<style lang="scss" scoped>
|
|
33
190
|
.dl-widget {
|
|
191
|
+
border: 1px solid var(--dl-color-separator);
|
|
192
|
+
user-select: none;
|
|
34
193
|
height: 100%;
|
|
35
194
|
display: flex;
|
|
36
195
|
flex-direction: column;
|
|
37
196
|
&__header {
|
|
197
|
+
display: flex;
|
|
38
198
|
padding: 10px;
|
|
39
199
|
border-bottom: 1px solid var(--dl-color-separator);
|
|
200
|
+
|
|
201
|
+
&--drag-icon {
|
|
202
|
+
flex-grow: 1;
|
|
203
|
+
cursor: pointer;
|
|
204
|
+
|
|
205
|
+
&::v-deep .dl-icon {
|
|
206
|
+
transform: rotate(90deg) !important;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&--titles {
|
|
211
|
+
width: 50%;
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: column;
|
|
214
|
+
}
|
|
40
215
|
}
|
|
41
216
|
&__content {
|
|
42
217
|
padding: 5px;
|
|
@@ -46,5 +221,21 @@ export default defineComponent({
|
|
|
46
221
|
padding: 5px;
|
|
47
222
|
font-size: 10px;
|
|
48
223
|
}
|
|
224
|
+
|
|
225
|
+
&__drag {
|
|
226
|
+
visibility: hidden;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.drag-clone {
|
|
231
|
+
position: absolute;
|
|
232
|
+
background-color: var(--dl-color-text-buttons);
|
|
233
|
+
z-index: var(--dl-z-index-menu);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.widget-wrapper {
|
|
237
|
+
flex-basis: var(--widget-flex-basis);
|
|
238
|
+
margin: var(--row-gap) var(--column-gap);
|
|
239
|
+
transition: 0.1s;
|
|
49
240
|
}
|
|
50
241
|
</style>
|
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function getElementAbove(el: HTMLElement, className: string) {
|
|
2
2
|
//@ts-ignore
|
|
3
3
|
for (; el && el !== document; el = el.parentNode) {
|
|
4
|
-
if (el.classList.contains(
|
|
4
|
+
if (el.classList.contains(className)) {
|
|
5
5
|
return el
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
export function addMouseEnter(className: string, method: EventListenerObject) {
|
|
11
|
+
Array.from(document.getElementsByClassName(className)).forEach((widget) => {
|
|
12
|
+
widget.addEventListener('mouseenter', method)
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function removeMouseEnter(
|
|
17
|
+
className: string,
|
|
18
|
+
method: EventListenerObject
|
|
13
19
|
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
targetElement.style.top = `${
|
|
18
|
-
sourceElement.getBoundingClientRect().y + 20
|
|
19
|
-
}px`
|
|
20
|
-
targetElement.style.left = `${
|
|
21
|
-
sourceElement.getBoundingClientRect().x - 10
|
|
22
|
-
}px`
|
|
20
|
+
Array.from(document.getElementsByClassName(className)).forEach((widget) => {
|
|
21
|
+
widget.removeEventListener('mouseenter', method)
|
|
22
|
+
})
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export function
|
|
26
|
-
|
|
27
|
-
row
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
export function setFlexBasis() {
|
|
26
|
+
Array.from(document.getElementsByClassName('dl-grid-row')).forEach(
|
|
27
|
+
(row) => {
|
|
28
|
+
Array.from(row.children).forEach((widget: any) => {
|
|
29
|
+
widget.style.flexBasis = `${100 / row.children.length}%`
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function insertAfter(newNode: HTMLElement, existingNode: HTMLElement) {
|
|
36
|
+
existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling)
|
|
30
37
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -50,8 +50,10 @@ import { DlDateTimeRange } from './DlDateTimeRange'
|
|
|
50
50
|
import { DateInterval } from './DlDatePicker/types'
|
|
51
51
|
import { DlSmartSearch } from './DlSmartSearch'
|
|
52
52
|
import { DlWidget } from './DlWidget'
|
|
53
|
-
import {
|
|
53
|
+
import { DlGrid } from './DlWidget'
|
|
54
54
|
import DlTextHolder from './DlTextHolder.vue'
|
|
55
|
+
import { DlColumnChart, DlLineChart } from './DlChart'
|
|
56
|
+
import DlSpinner from './DlSpinner.vue'
|
|
55
57
|
|
|
56
58
|
export {
|
|
57
59
|
DlAccordion,
|
|
@@ -111,8 +113,11 @@ export {
|
|
|
111
113
|
DlDateTimeRange,
|
|
112
114
|
DlSmartSearch,
|
|
113
115
|
DlWidget,
|
|
114
|
-
|
|
115
|
-
DlTextHolder
|
|
116
|
+
DlGrid,
|
|
117
|
+
DlTextHolder,
|
|
118
|
+
DlColumnChart,
|
|
119
|
+
DlLineChart,
|
|
120
|
+
DlSpinner
|
|
116
121
|
}
|
|
117
122
|
|
|
118
123
|
export type { StepState, DateInterval }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
style="
|
|
4
|
+
display: flex;
|
|
5
|
+
width: 900px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
gap: 0px;
|
|
9
|
+
"
|
|
10
|
+
>
|
|
11
|
+
<dl-bar-chart
|
|
12
|
+
:legend-props="legendProps"
|
|
13
|
+
:data="data"
|
|
14
|
+
:options="options"
|
|
15
|
+
:items-in-view="6"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { defineComponent } from 'vue-demi'
|
|
22
|
+
import DlBarChart from '../components/DlChart/DlBarChart.vue'
|
|
23
|
+
|
|
24
|
+
const labelsFn = () => {
|
|
25
|
+
const a = []
|
|
26
|
+
for (let i = 0; i < 20; i++) {
|
|
27
|
+
a.push(`${i}`)
|
|
28
|
+
}
|
|
29
|
+
return a
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const dataFn = () => {
|
|
33
|
+
const a = []
|
|
34
|
+
for (let i = 1; i <= 20; i++) {
|
|
35
|
+
a.push(i)
|
|
36
|
+
}
|
|
37
|
+
return a
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const data = {
|
|
41
|
+
labels: labelsFn(),
|
|
42
|
+
datasets: [
|
|
43
|
+
{
|
|
44
|
+
label: 'Data One',
|
|
45
|
+
backgroundColor: '--dl-color-secondary',
|
|
46
|
+
borderRadius: 4,
|
|
47
|
+
data: dataFn()
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
label: 'Data Two',
|
|
51
|
+
backgroundColor: '--dl-color-warning',
|
|
52
|
+
borderRadius: 4,
|
|
53
|
+
data: dataFn()
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const legendProps = {
|
|
59
|
+
alignItems: 'center'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default defineComponent({
|
|
63
|
+
name: 'DlChartDemo',
|
|
64
|
+
components: {
|
|
65
|
+
DlBarChart
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
data,
|
|
70
|
+
legendProps
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
methods: {}
|
|
74
|
+
})
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped lang="scss"></style>
|