@dataloop-ai/components 0.13.19 → 0.14.3
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/DlDialogBox/DlDialogBox.vue +0 -8
- package/src/components/DlDialogBox/DlDialogBoxHeader.vue +6 -22
- package/src/components/DlDropdownButton.vue +16 -4
- package/src/components/DlPagination/RowsSelector.vue +15 -1
- package/src/components/DlRange/DlRange.vue +3 -2
- package/src/components/DlSearch.vue +1 -1
- package/src/components/DlSelect/DlSelect.vue +1 -19
- package/src/components/DlSlider/sliderStyles.scss +4 -0
- package/src/components/DlSlider/useSlider.ts +39 -12
- 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 +6 -42
- 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 +54 -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/DlLineChartDemo.vue +375 -0
- 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/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
package/src/demo/DlTableDemo.vue
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
<div style="width: 900px; align-items: inherit">
|
|
3
3
|
<div>
|
|
4
4
|
<div class="settings">
|
|
5
|
+
<button @click="addRowPerPage">
|
|
6
|
+
Add Row Per Page
|
|
7
|
+
</button>
|
|
5
8
|
<dl-switch
|
|
6
9
|
left-label="bordered"
|
|
7
10
|
value="bordered"
|
|
@@ -104,105 +107,20 @@
|
|
|
104
107
|
:rows="rows"
|
|
105
108
|
:resizable="resizable"
|
|
106
109
|
row-key="name"
|
|
107
|
-
:pagination="{
|
|
108
|
-
rowsPerPage: 25,
|
|
109
|
-
maxPages: 4
|
|
110
|
-
}"
|
|
111
110
|
color="dl-color-secondary"
|
|
112
111
|
title="Table Title"
|
|
113
112
|
:virtual-scroll="vScroll"
|
|
114
113
|
style="height: 500px"
|
|
114
|
+
:rows-per-page-options="rowsPerPageOptions"
|
|
115
115
|
@row-click="log"
|
|
116
116
|
@update:selected="updateSeleted"
|
|
117
|
-
|
|
118
|
-
<!-- <template #top> Top Table </template> -->
|
|
119
|
-
<!-- <template #top-left> Top Table Left </template> -->
|
|
120
|
-
<!-- <template #top-right> Top Table Right </template>
|
|
121
|
-
|
|
122
|
-
<template #top-selection> Top Selection </template> -->
|
|
123
|
-
|
|
124
|
-
<!-- <template #header="props">
|
|
125
|
-
<dl-tr :props="props">
|
|
126
|
-
<dl-th auto-width />
|
|
127
|
-
<dl-th
|
|
128
|
-
v-for="col in props.cols"
|
|
129
|
-
:key="col.name"
|
|
130
|
-
:props="props"
|
|
131
|
-
>
|
|
132
|
-
{{ col.label }}
|
|
133
|
-
</dl-th>
|
|
134
|
-
</dl-tr>
|
|
135
|
-
</template> -->
|
|
136
|
-
|
|
137
|
-
<!-- <template #header-cell="props">
|
|
138
|
-
<dl-th :props="props">
|
|
139
|
-
{{ props.col.label }}
|
|
140
|
-
</dl-th>
|
|
141
|
-
</template>
|
|
142
|
-
|
|
143
|
-
<template #header-cell-calories="props">
|
|
144
|
-
<dl-th :props="props">
|
|
145
|
-
custom
|
|
146
|
-
{{ props.col.label }}
|
|
147
|
-
</dl-th>
|
|
148
|
-
</template> -->
|
|
149
|
-
|
|
150
|
-
<!-- <template #body="props">
|
|
151
|
-
<dl-tr :props="props">
|
|
152
|
-
<dl-td auto-width>
|
|
153
|
-
<dl-button
|
|
154
|
-
flat
|
|
155
|
-
size="s"
|
|
156
|
-
text-color="dl-color-darker"
|
|
157
|
-
style="padding: 0; border-width: 0!important; :active: border-width: 0"
|
|
158
|
-
:icon="
|
|
159
|
-
props.expand
|
|
160
|
-
? 'icon-dl-down-chevron'
|
|
161
|
-
: 'icon-dl-right-chevron'
|
|
162
|
-
"
|
|
163
|
-
@click="props.expand = !props.expand"
|
|
164
|
-
/>
|
|
165
|
-
</dl-td>
|
|
166
|
-
<dl-td
|
|
167
|
-
v-for="col in props.cols"
|
|
168
|
-
:key="col.name"
|
|
169
|
-
:props="props"
|
|
170
|
-
>
|
|
171
|
-
{{ col.value }}
|
|
172
|
-
</dl-td>
|
|
173
|
-
</dl-tr>
|
|
174
|
-
<dl-tr v-show="props.expand" :props="props">
|
|
175
|
-
<dl-td colspan="100%" style="padding: 16px">
|
|
176
|
-
<div class="text-left">
|
|
177
|
-
This is expand slot for row above:
|
|
178
|
-
{{ props.row.name }}.
|
|
179
|
-
</div>
|
|
180
|
-
</dl-td>
|
|
181
|
-
</dl-tr>
|
|
182
|
-
</template> -->
|
|
183
|
-
|
|
184
|
-
<!-- <template #loading> Loading ... </template> -->
|
|
185
|
-
|
|
186
|
-
<!-- <template #bottom="props">
|
|
187
|
-
<dl-pagination v-bind="props.pagination" />
|
|
188
|
-
</template> -->
|
|
189
|
-
</DlTable>
|
|
117
|
+
/>
|
|
190
118
|
</div>
|
|
191
119
|
</div>
|
|
192
120
|
</template>
|
|
193
121
|
|
|
194
122
|
<script lang="ts">
|
|
195
|
-
import {
|
|
196
|
-
DlTable,
|
|
197
|
-
DlOptionGroup,
|
|
198
|
-
DlSwitch,
|
|
199
|
-
DlTextInput
|
|
200
|
-
// DlTr,
|
|
201
|
-
// DlTh,
|
|
202
|
-
// DlTd,
|
|
203
|
-
// DlPagination,
|
|
204
|
-
// DlButton
|
|
205
|
-
} from '../components'
|
|
123
|
+
import { DlTable, DlOptionGroup, DlSwitch, DlTextInput } from '../components'
|
|
206
124
|
import { defineComponent } from 'vue-demi'
|
|
207
125
|
import { times } from 'lodash'
|
|
208
126
|
|
|
@@ -363,11 +281,6 @@ export default defineComponent({
|
|
|
363
281
|
DlSwitch,
|
|
364
282
|
DlOptionGroup,
|
|
365
283
|
DlTextInput
|
|
366
|
-
// DlTr,
|
|
367
|
-
// DlTh,
|
|
368
|
-
// DlPagination,
|
|
369
|
-
// DlTd,
|
|
370
|
-
// DlButton
|
|
371
284
|
},
|
|
372
285
|
data() {
|
|
373
286
|
return {
|
|
@@ -386,10 +299,16 @@ export default defineComponent({
|
|
|
386
299
|
resizableState: [] as boolean[],
|
|
387
300
|
rows,
|
|
388
301
|
draggable: 'both',
|
|
389
|
-
columns
|
|
302
|
+
columns,
|
|
303
|
+
rowsPerPageOptions: [10, 12, 14, 16]
|
|
390
304
|
}
|
|
391
305
|
},
|
|
392
306
|
methods: {
|
|
307
|
+
addRowPerPage() {
|
|
308
|
+
this.rowsPerPageOptions.push(
|
|
309
|
+
this.rowsPerPageOptions[this.rowsPerPageOptions.length - 1] + 2
|
|
310
|
+
)
|
|
311
|
+
},
|
|
393
312
|
updateSeleted(payload: any) {
|
|
394
313
|
this.selected = payload
|
|
395
314
|
},
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div style="width: 950px; padding-top: 20px">
|
|
3
|
+
<div class="flex">
|
|
4
|
+
<div>
|
|
5
|
+
<dl-text-area
|
|
6
|
+
v-model="message"
|
|
7
|
+
title="Message"
|
|
8
|
+
/>
|
|
9
|
+
<dl-text-input
|
|
10
|
+
v-model="duration"
|
|
11
|
+
type="number"
|
|
12
|
+
title="Duration seconds"
|
|
13
|
+
/>
|
|
14
|
+
<dl-text-input
|
|
15
|
+
v-model="classItem"
|
|
16
|
+
title="Custom class for toast item"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="flex">
|
|
20
|
+
<div>
|
|
21
|
+
Type
|
|
22
|
+
<dl-radio
|
|
23
|
+
v-model="type"
|
|
24
|
+
value="success"
|
|
25
|
+
label="Success"
|
|
26
|
+
/>
|
|
27
|
+
<dl-radio
|
|
28
|
+
v-model="type"
|
|
29
|
+
value="warning"
|
|
30
|
+
label="Warning"
|
|
31
|
+
/>
|
|
32
|
+
<dl-radio
|
|
33
|
+
v-model="type"
|
|
34
|
+
value="error"
|
|
35
|
+
label="Error"
|
|
36
|
+
/>
|
|
37
|
+
<dl-radio
|
|
38
|
+
v-model="type"
|
|
39
|
+
value="info"
|
|
40
|
+
label="Info"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<div>
|
|
44
|
+
Position
|
|
45
|
+
<dl-radio
|
|
46
|
+
v-model="position"
|
|
47
|
+
value="bottom"
|
|
48
|
+
label="Bottom"
|
|
49
|
+
/>
|
|
50
|
+
<dl-radio
|
|
51
|
+
v-model="position"
|
|
52
|
+
value="bottom-left"
|
|
53
|
+
label="Bottom left"
|
|
54
|
+
/>
|
|
55
|
+
<dl-radio
|
|
56
|
+
v-model="position"
|
|
57
|
+
value="bottom-right"
|
|
58
|
+
label="Bottom right"
|
|
59
|
+
/>
|
|
60
|
+
<dl-radio
|
|
61
|
+
v-model="position"
|
|
62
|
+
value="top"
|
|
63
|
+
label="Top"
|
|
64
|
+
/>
|
|
65
|
+
<dl-radio
|
|
66
|
+
v-model="position"
|
|
67
|
+
value="top-left"
|
|
68
|
+
label="Top left"
|
|
69
|
+
/>
|
|
70
|
+
<dl-radio
|
|
71
|
+
v-model="position"
|
|
72
|
+
value="top-right"
|
|
73
|
+
label="Top right"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
<div>
|
|
77
|
+
<dl-switch
|
|
78
|
+
v-model="closable"
|
|
79
|
+
left-label="Closable"
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
<dl-button @click="showToastMessage">
|
|
85
|
+
Show Toast Message
|
|
86
|
+
</dl-button>
|
|
87
|
+
</div>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<script lang="ts">
|
|
91
|
+
import { DlButton } from '../components'
|
|
92
|
+
import { DlToast } from '../components/DlToastMessage'
|
|
93
|
+
import { defineComponent, ref } from 'vue-demi'
|
|
94
|
+
import DlTextInput from '../components/DlTextInput.vue'
|
|
95
|
+
import DlRadio from '../components/DlRadio.vue'
|
|
96
|
+
import DlTextArea from '../components/DlTextArea.vue'
|
|
97
|
+
import DlSwitch from '../components/DlSwitch.vue'
|
|
98
|
+
export default defineComponent({
|
|
99
|
+
name: 'DlToast',
|
|
100
|
+
components: {
|
|
101
|
+
DlSwitch,
|
|
102
|
+
DlTextArea,
|
|
103
|
+
DlRadio,
|
|
104
|
+
DlTextInput,
|
|
105
|
+
DlButton
|
|
106
|
+
},
|
|
107
|
+
setup() {
|
|
108
|
+
const message = ref(
|
|
109
|
+
'This is a sample message with a <a href="https://google.com/">link</a>'
|
|
110
|
+
)
|
|
111
|
+
const duration = ref(10)
|
|
112
|
+
const type = ref('success')
|
|
113
|
+
const position = ref('bottom')
|
|
114
|
+
const closable = ref(true)
|
|
115
|
+
const classItem = ref('demo-toast')
|
|
116
|
+
function showToastMessage() {
|
|
117
|
+
DlToast.open({
|
|
118
|
+
message: message.value,
|
|
119
|
+
position: position.value,
|
|
120
|
+
type: type.value,
|
|
121
|
+
duration: duration.value,
|
|
122
|
+
classItem: classItem.value,
|
|
123
|
+
closable: closable.value
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
showToastMessage,
|
|
128
|
+
message,
|
|
129
|
+
duration,
|
|
130
|
+
type,
|
|
131
|
+
position,
|
|
132
|
+
classItem,
|
|
133
|
+
closable
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
</script>
|
|
138
|
+
|
|
139
|
+
<style scoped>
|
|
140
|
+
.flex {
|
|
141
|
+
display: flex;
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -1,157 +1,119 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { defineComponent
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import DlDialogBox from '../components/DlDialogBox/DlDialogBox.vue'
|
|
8
|
-
import DlDialogBoxHeader from '../components/DlDialogBox/DlDialogBoxHeader.vue'
|
|
9
|
-
import DlDialogBoxFooter from '../components/DlDialogBox/DlDialogBoxFooter.vue'
|
|
10
|
-
import DlChip from '../components/DlChip/DlChip.vue'
|
|
2
|
+
import { defineComponent } from 'vue-demi'
|
|
3
|
+
import DlBarChart from '../components/DlChart/DlBarChart.vue'
|
|
4
|
+
import DlGrid from '../components/DlWidget/DlGrid.vue'
|
|
5
|
+
import DlGridRow from '../components/DlWidget/DlGridRow.vue'
|
|
6
|
+
import DlWidget from '../components/DlWidget/DlWidget.vue'
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
DlChip
|
|
20
|
-
},
|
|
21
|
-
setup() {
|
|
22
|
-
const isEditable = ref(false)
|
|
23
|
-
const addDialog = ref(false)
|
|
24
|
-
const handleEditMode = () => (isEditable.value = !isEditable.value)
|
|
25
|
-
|
|
26
|
-
const widgetLibrary = ref([
|
|
27
|
-
{
|
|
28
|
-
title: 'Widget 1',
|
|
29
|
-
subTitle: 'first widget',
|
|
30
|
-
content: BadgeDemo,
|
|
31
|
-
description:
|
|
32
|
-
'Lorem ipsum dolor sit amet consectetur. Ultricies odio sagittis bibendum tristique congue pretium ac massa proin. Leo blandit commodo sit nibh sem. dfsdfdsfsdf dfsdfsdfsdfsd'
|
|
33
|
-
}
|
|
34
|
-
] as Widget[])
|
|
35
|
-
|
|
36
|
-
const widgets = ref([
|
|
37
|
-
[
|
|
38
|
-
{
|
|
39
|
-
title: 'Widget 8',
|
|
40
|
-
subTitle: 'eighth widget',
|
|
41
|
-
content: `Do I contradict myself?
|
|
42
|
-
Very well then I contradict myself,
|
|
43
|
-
(I am large, I contain multitudes.)
|
|
44
|
-
I concentrate toward them that are nigh, I wait on the door-slab.
|
|
45
|
-
Who has done his day's work? who will soonest be through with his supper?
|
|
46
|
-
Who wishes to walk with me?`,
|
|
47
|
-
description:
|
|
48
|
-
'Lorem dolor sit amet consectetur. Ultricies odio sagittis bibendum tristique congue pretium ac massa proin. Leo blandit commodo sit nibh sem. dfsdfdsfsdf dfsdfsdfsdfsd'
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
[
|
|
52
|
-
{
|
|
53
|
-
title: 'Widget 2',
|
|
54
|
-
subTitle: 'second widget',
|
|
55
|
-
content: `“Later she remembered all the hours of the afternoon as happy -- one of those uneventful times that seem at the moment only a link between past and future pleasure, but turn out to have been the pleasure itself.”`,
|
|
56
|
-
description:
|
|
57
|
-
'Lorem ipsum dolor sit amet consectetur. Ultricies odio sagittis bibendum tristique congue pretium ac massa proin. Leo blandit commodo sit nibh sem. dfsdfdsfsdf dfsdfsdfsdfsd'
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
title: 'Widget 3',
|
|
61
|
-
subTitle: 'third widget',
|
|
62
|
-
content: `The Bat that flits at close of Eve
|
|
63
|
-
Has left the Brain that wont Believe
|
|
64
|
-
The Owl that calls upon the Night
|
|
65
|
-
Speaks the Unbelievers fright`,
|
|
66
|
-
description:
|
|
67
|
-
'Lorem ipsum dolor sit amet consectetur. Ultricies odio sagittis bibendum tristique congue pretium ac massa proin. Leo blandit commodo sit nibh sem. dfsdfdsfsdf dfsdfsdfsdfsd'
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
[
|
|
71
|
-
{
|
|
72
|
-
title: 'Widget 4',
|
|
73
|
-
subTitle: 'fourth widget',
|
|
74
|
-
content: `That motley drama—oh, be sure
|
|
75
|
-
It shall not be forgot!
|
|
76
|
-
With its Phantom chased for evermore
|
|
77
|
-
By a crowd that seize it not,`,
|
|
78
|
-
description:
|
|
79
|
-
'Lorem ipsum dolor sit amet consectetur. Ultricies odio sagittis bibendum tristique congue pretium ac massa proin. Leo blandit commodo sit nibh sem. dfsdfdsfsdf dfsdfsdfsdfsd'
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
] as Widget[][])
|
|
8
|
+
const labelsFn = () => {
|
|
9
|
+
const a = []
|
|
10
|
+
for (let i = 0; i < 20; i++) {
|
|
11
|
+
a.push(`${i}`)
|
|
12
|
+
}
|
|
13
|
+
return a
|
|
14
|
+
}
|
|
83
15
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
16
|
+
const dataFn = () => {
|
|
17
|
+
const a = []
|
|
18
|
+
for (let i = 1; i <= 20; i++) {
|
|
19
|
+
a.push(i)
|
|
20
|
+
}
|
|
21
|
+
return a
|
|
22
|
+
}
|
|
88
23
|
|
|
89
|
-
|
|
90
|
-
|
|
24
|
+
const data = {
|
|
25
|
+
labels: labelsFn(),
|
|
26
|
+
datasets: [
|
|
27
|
+
{
|
|
28
|
+
label: 'Data One',
|
|
29
|
+
backgroundColor: '--dl-color-secondary',
|
|
30
|
+
borderRadius: 4,
|
|
31
|
+
data: dataFn()
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: 'Data Two',
|
|
35
|
+
backgroundColor: '--dl-color-warning',
|
|
36
|
+
borderRadius: 4,
|
|
37
|
+
data: dataFn()
|
|
91
38
|
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
92
41
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
42
|
+
export default defineComponent({
|
|
43
|
+
components: {
|
|
44
|
+
DlGrid,
|
|
45
|
+
DlWidget,
|
|
46
|
+
DlBarChart,
|
|
47
|
+
DlGridRow
|
|
48
|
+
},
|
|
49
|
+
setup() {
|
|
50
|
+
return { data }
|
|
102
51
|
}
|
|
103
52
|
})
|
|
104
53
|
</script>
|
|
105
54
|
|
|
106
55
|
<template>
|
|
107
|
-
<div
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
56
|
+
<div>
|
|
57
|
+
<dl-grid gap="20px">
|
|
58
|
+
<dl-grid-row>
|
|
59
|
+
<dl-widget>
|
|
60
|
+
<template #header>
|
|
61
|
+
<span>Widget 1</span>
|
|
62
|
+
<span style="font-size: 12px; color: gray">Subtitle</span>
|
|
63
|
+
</template>
|
|
64
|
+
<template #menu>
|
|
65
|
+
<div>
|
|
66
|
+
Menu
|
|
67
|
+
<div />
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
<template #content>
|
|
71
|
+
<dl-bar-chart
|
|
72
|
+
:legend-props="legendProps"
|
|
73
|
+
:data="data"
|
|
74
|
+
:options="options"
|
|
75
|
+
:items-in-view="8"
|
|
76
|
+
/>
|
|
77
|
+
</template>
|
|
78
|
+
<template #description>
|
|
79
|
+
<span>Lorem ipsum dolor sit amet consectetur adipisicing
|
|
80
|
+
elit. Libero eligendi dolore, similique possimus
|
|
81
|
+
veritatis in vitae quia praesentium fuga quibusdam
|
|
82
|
+
autem. Doloremque tenetur repudiandae a cupiditate
|
|
83
|
+
modi dicta eveniet veritatis?</span>
|
|
84
|
+
</template>
|
|
85
|
+
</dl-widget>
|
|
86
|
+
</dl-grid-row>
|
|
87
|
+
|
|
88
|
+
<dl-grid-row gap="20px">
|
|
89
|
+
<dl-widget>
|
|
90
|
+
<template #header>
|
|
91
|
+
<span>Widget 2</span>
|
|
92
|
+
</template>
|
|
93
|
+
<template #content>
|
|
94
|
+
<dl-bar-chart
|
|
95
|
+
:legend-props="legendProps"
|
|
96
|
+
:data="data"
|
|
97
|
+
:options="options"
|
|
98
|
+
:items-in-view="6"
|
|
99
|
+
/>
|
|
100
|
+
</template>
|
|
101
|
+
</dl-widget>
|
|
125
102
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
style="cursor: pointer"
|
|
142
|
-
@click="addWidget(widget)"
|
|
143
|
-
>
|
|
144
|
-
{{ widget.title }}
|
|
145
|
-
</dl-chip>
|
|
146
|
-
</div>
|
|
147
|
-
</template>
|
|
148
|
-
<template #footer>
|
|
149
|
-
<dl-dialog-box-footer>
|
|
150
|
-
<dl-button @click="addDialog = false">
|
|
151
|
-
Close
|
|
152
|
-
</dl-button>
|
|
153
|
-
</dl-dialog-box-footer>
|
|
154
|
-
</template>
|
|
155
|
-
</dl-dialog-box>
|
|
103
|
+
<dl-widget>
|
|
104
|
+
<template #header>
|
|
105
|
+
<span>Widget 3</span>
|
|
106
|
+
</template>
|
|
107
|
+
<template #content>
|
|
108
|
+
<dl-bar-chart
|
|
109
|
+
:legend-props="legendProps"
|
|
110
|
+
:data="data"
|
|
111
|
+
:options="options"
|
|
112
|
+
:items-in-view="6"
|
|
113
|
+
/>
|
|
114
|
+
</template>
|
|
115
|
+
</dl-widget>
|
|
116
|
+
</dl-grid-row>
|
|
117
|
+
</dl-grid>
|
|
156
118
|
</div>
|
|
157
119
|
</template>
|
package/src/demo/index.ts
CHANGED
|
@@ -40,7 +40,13 @@ import DlTrendDemo from './DlTrendDemo.vue'
|
|
|
40
40
|
import DlWidgetDemo from './DlWidgetDemo.vue'
|
|
41
41
|
import DlRadioDemo from './DlRadioDemo.vue'
|
|
42
42
|
import DlTextHolderDemo from './DlTextHolderDemo.vue'
|
|
43
|
+
import DlColumnChartDemo from './ColumnChartDemo.vue'
|
|
44
|
+
import DlBarChartDemo from './BarChartDemo.vue'
|
|
43
45
|
import DlSwitchDemo from './DlSwitchDemo.vue'
|
|
46
|
+
import DlToastMessageDemo from './DlToastMessageDemo.vue'
|
|
47
|
+
import DlChartDoughnutDemo from './DlChartDoughnutDemo.vue'
|
|
48
|
+
import DlLineChartDemo from './DlLineChartDemo.vue'
|
|
49
|
+
import DlSpinner from './DlSpinnerDemo.vue'
|
|
44
50
|
|
|
45
51
|
export {
|
|
46
52
|
AvatarDemo,
|
|
@@ -85,7 +91,13 @@ export {
|
|
|
85
91
|
DlWidgetDemo,
|
|
86
92
|
DlRadioDemo,
|
|
87
93
|
DlTextHolderDemo,
|
|
88
|
-
|
|
94
|
+
DlToastMessageDemo,
|
|
95
|
+
DlColumnChartDemo,
|
|
96
|
+
DlSwitchDemo,
|
|
97
|
+
DlChartDoughnutDemo,
|
|
98
|
+
DlBarChartDemo,
|
|
99
|
+
DlLineChartDemo,
|
|
100
|
+
DlSpinner
|
|
89
101
|
}
|
|
90
102
|
|
|
91
103
|
export const demoState = {
|
|
@@ -94,11 +106,15 @@ export const demoState = {
|
|
|
94
106
|
avatar: AvatarDemo,
|
|
95
107
|
badge: DlBadgeDemo,
|
|
96
108
|
button: DlButtonDemo,
|
|
109
|
+
column_chart: DlColumnChartDemo,
|
|
110
|
+
bar_chart: DlBarChartDemo,
|
|
111
|
+
line_chart: DlLineChartDemo,
|
|
97
112
|
checkbox: DlCheckboxDemo,
|
|
98
113
|
chip: DlChipDemo,
|
|
99
114
|
color_picker: DlColorPickerDemo,
|
|
100
115
|
counter: DlCounterDemo,
|
|
101
116
|
dialog_box: DlDialogBoxDemo,
|
|
117
|
+
doughnut_chart: DlChartDoughnutDemo,
|
|
102
118
|
dropdown_button: DropdownButtonDemo,
|
|
103
119
|
icon: DlIconDemo,
|
|
104
120
|
link: DlLinkDemo,
|
|
@@ -131,5 +147,7 @@ export const demoState = {
|
|
|
131
147
|
widget: DlWidgetDemo,
|
|
132
148
|
radio: DlRadioDemo,
|
|
133
149
|
switch: DlSwitchDemo,
|
|
134
|
-
smart_search: DlSmartSearchDemo
|
|
150
|
+
smart_search: DlSmartSearchDemo,
|
|
151
|
+
toast_message: DlToastMessageDemo,
|
|
152
|
+
spinner: DlSpinner
|
|
135
153
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getRootStyles } from '../utils/getRootStyles'
|
|
2
|
+
import { inject, watch, reactive } from 'vue-demi'
|
|
3
|
+
|
|
4
|
+
export const useThemeVariables = () => {
|
|
5
|
+
const isDark = inject('theme')
|
|
6
|
+
|
|
7
|
+
const variables = reactive(getRootStyles())
|
|
8
|
+
|
|
9
|
+
watch(
|
|
10
|
+
() => isDark,
|
|
11
|
+
() => {
|
|
12
|
+
Object.assign(variables, getRootStyles())
|
|
13
|
+
},
|
|
14
|
+
{ deep: true }
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
if (variables) return { variables }
|
|
18
|
+
return
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function abbreviateToString(value: number): string {
|
|
2
|
+
const suffixes = ['', 'k', 'm', 'b', 't']
|
|
3
|
+
const suffixNum = Math.floor(('' + value).length / 3)
|
|
4
|
+
const shortValue = parseFloat(
|
|
5
|
+
(suffixNum !== 0
|
|
6
|
+
? value / Math.pow(1000, suffixNum)
|
|
7
|
+
: value
|
|
8
|
+
).toPrecision(2)
|
|
9
|
+
)
|
|
10
|
+
if (shortValue % 1 !== 0) {
|
|
11
|
+
shortValue.toFixed(1)
|
|
12
|
+
}
|
|
13
|
+
return shortValue + suffixes[suffixNum]
|
|
14
|
+
}
|