@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.
Files changed (94) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +3 -1
  3. package/package.json +19 -17
  4. package/src/assets/globals.scss +38 -3
  5. package/src/assets/grid.scss +9 -0
  6. package/src/components/DlAccordion/DlAccordion.vue +4 -4
  7. package/src/components/DlAlert.vue +6 -6
  8. package/src/components/DlChart/BrushThumb.vue +83 -0
  9. package/src/components/DlChart/DlBarChart.vue +545 -0
  10. package/src/components/DlChart/DlBrush.vue +475 -0
  11. package/src/components/DlChart/DlChartLabels.vue +279 -0
  12. package/src/components/DlChart/DlChartLegend.vue +141 -0
  13. package/src/components/DlChart/DlColumnChart.vue +555 -0
  14. package/src/components/DlChart/DlLineChart.vue +644 -0
  15. package/src/components/DlChart/DlScrollBar.vue +147 -0
  16. package/src/components/DlChart/Doughnut/DlDoughnutChart.vue +448 -0
  17. package/src/components/DlChart/Doughnut/DlDoughnutChartLegend.vue +281 -0
  18. package/src/components/DlChart/Doughnut/DlDoughnutChartWidget.vue +64 -0
  19. package/src/components/DlChart/Doughnut/types/TDoughnutChartAnimation.ts +4 -0
  20. package/src/components/DlChart/Doughnut/types/TDoughnutChartData.ts +16 -0
  21. package/src/components/DlChart/Doughnut/types/TDoughnutChartOptions.ts +11 -0
  22. package/src/components/DlChart/Doughnut/types/TDoughnutChartProps.ts +8 -0
  23. package/src/components/DlChart/Doughnut/types/TDoughnutWithOriginalColor.ts +13 -0
  24. package/src/components/DlChart/chart.ts +122 -0
  25. package/src/components/DlChart/index.ts +36 -0
  26. package/src/components/DlChart/props.ts +348 -0
  27. package/src/components/DlChart/typedCharts.ts +88 -0
  28. package/src/components/DlChart/types.ts +63 -0
  29. package/src/components/DlChart/utils.ts +153 -0
  30. package/src/components/DlChip/DlChip.vue +40 -13
  31. package/src/components/DlCounters.vue +31 -7
  32. package/src/components/DlDatePicker/DlCalendar.vue +22 -10
  33. package/src/components/DlDatePicker/DlDatePicker.vue +8 -5
  34. package/src/components/DlDateTimeRange/types.ts +2 -2
  35. package/src/components/DlDropdownButton.vue +5 -3
  36. package/src/components/DlMenu/DlMenu.vue +4 -2
  37. package/src/components/DlPagination/RowsSelector.vue +15 -2
  38. package/src/components/DlPopup/DlPopup.vue +0 -1
  39. package/src/components/DlRange/DlRange.vue +3 -2
  40. package/src/components/DlSearch.vue +1 -1
  41. package/src/components/DlSelect/DlSelect.vue +3 -2
  42. package/src/components/DlSlider/sliderStyles.scss +4 -0
  43. package/src/components/DlSlider/useSlider.ts +39 -12
  44. package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +1 -1
  45. package/src/components/DlSpinner.vue +259 -0
  46. package/src/components/DlTable/DlTable.vue +4 -1
  47. package/src/components/DlTable/hooks/tablePagination.ts +8 -2
  48. package/src/components/DlTextArea.vue +9 -0
  49. package/src/components/DlTextInput.vue +4 -2
  50. package/src/components/DlThemeProvider.vue +22 -13
  51. package/src/components/DlToastMessage/api/useToast.ts +23 -0
  52. package/src/components/DlToastMessage/components/ToastComponent.vue +279 -0
  53. package/src/components/DlToastMessage/index.ts +5 -0
  54. package/src/components/DlToastMessage/types.ts +4 -0
  55. package/src/components/DlToastMessage/utils/config.ts +17 -0
  56. package/src/components/DlToastMessage/utils/render.ts +56 -0
  57. package/src/components/DlTypography.vue +1 -1
  58. package/src/components/DlWidget/DlGrid.vue +33 -0
  59. package/src/components/DlWidget/DlGridRow.vue +32 -0
  60. package/src/components/DlWidget/DlWidget.vue +202 -11
  61. package/src/components/DlWidget/index.ts +2 -2
  62. package/src/components/DlWidget/utils.ts +26 -19
  63. package/src/components/index.ts +8 -3
  64. package/src/demo/BarChartDemo.vue +77 -0
  65. package/src/demo/ColumnChartDemo.vue +230 -0
  66. package/src/demo/DlButtonDemo.vue +1 -1
  67. package/src/demo/DlChartDoughnutDemo.vue +229 -0
  68. package/src/demo/DlChipDemo.vue +42 -18
  69. package/src/demo/DlDialogBoxDemo.vue +4 -4
  70. package/src/demo/DlDropdownButtonDemo.vue +1 -1
  71. package/src/demo/DlLineChartDemo.vue +375 -0
  72. package/src/demo/DlMenuDemo.vue +1 -1
  73. package/src/demo/DlOptionGroupDemo.vue +1 -1
  74. package/src/demo/DlSelectDemo.vue +1 -1
  75. package/src/demo/DlSpinnerDemo.vue +20 -0
  76. package/src/demo/DlTableDemo.vue +13 -94
  77. package/src/demo/DlToastMessageDemo.vue +143 -0
  78. package/src/demo/DlWidgetDemo.vue +105 -143
  79. package/src/demo/index.ts +20 -2
  80. package/src/hooks/use-theme.ts +19 -0
  81. package/src/utils/abbreviate-to-string.ts +14 -0
  82. package/src/utils/colors.ts +47 -0
  83. package/src/utils/getRootStyles.ts +1 -1
  84. package/src/utils/index.ts +1 -0
  85. package/src/utils/position-engine.ts +11 -2
  86. package/src/utils/swapNodes.ts +30 -0
  87. package/src/utils/update-key.ts +90 -0
  88. package/tsconfig.json +0 -1
  89. package/vite.config.ts +17 -0
  90. package/Dockerfile +0 -12
  91. package/jest.config.js +0 -16
  92. package/jest.setup.js +0 -59
  93. package/src/components/DlWidget/DlWidgetGrid.vue +0 -360
  94. package/storybook.js +0 -8
@@ -0,0 +1,375 @@
1
+ <template>
2
+ <div
3
+ style="
4
+ display: flex;
5
+ width: 1000px;
6
+ flex-wrap: wrap;
7
+ flex-direction: row;
8
+ gap: 0;
9
+ "
10
+ >
11
+ <div>
12
+ <button @click="setResolution('hour')">
13
+ Hour
14
+ </button>
15
+ <button @click="setResolution('day')">
16
+ Day
17
+ </button>
18
+ <button @click="setResolution('week')">
19
+ Week
20
+ </button>
21
+ <button @click="setResolution('month')">
22
+ Month
23
+ </button>
24
+ <button @click="setResolution('year')">
25
+ Year
26
+ </button>
27
+ </div>
28
+
29
+ <dl-line-chart
30
+ id="example-one"
31
+ :brush-props="brushProps"
32
+ :legend-props="legendProps"
33
+ :data="data"
34
+ :options="options"
35
+ style="width: 100%"
36
+ />
37
+
38
+ <dl-line-chart
39
+ id="example-two"
40
+ :brush-props="brushProps"
41
+ :legend-props="legendProps"
42
+ :data="noPointsData"
43
+ :options="options"
44
+ style="width: 50%"
45
+ />
46
+
47
+ <dl-line-chart
48
+ id="example-three"
49
+ :brush-props="brushProps"
50
+ :legend-props="legendProps"
51
+ :data="tensionLineData"
52
+ :options="tensionOptions"
53
+ style="width: 50%"
54
+ />
55
+ </div>
56
+ </template>
57
+
58
+ <script lang="ts">
59
+ import { defineComponent } from 'vue-demi'
60
+ import { DlLineChart } from '../components'
61
+ import { orderBy } from 'lodash'
62
+
63
+ function randomIntFromInterval(min: number, max: number) {
64
+ return new Array(18)
65
+ .fill('')
66
+ .map(() => Math.floor(Math.random() * (max - min + 1) + min))
67
+ }
68
+
69
+ const resolutionLabels = {
70
+ hour: [
71
+ {
72
+ title: '8:00',
73
+ subtitle: 'Feb 27'
74
+ },
75
+ {
76
+ title: '8:00',
77
+ subtitle: 'Feb 28'
78
+ },
79
+ {
80
+ title: '8:00',
81
+ subtitle: 'Mar 1'
82
+ },
83
+ {
84
+ title: '8:00',
85
+ subtitle: 'Mar 2'
86
+ },
87
+ {
88
+ title: '8:00',
89
+ subtitle: 'Mar 3'
90
+ },
91
+ {
92
+ title: '8:00',
93
+ subtitle: 'Mar 4'
94
+ },
95
+ {
96
+ title: '8:00',
97
+ subtitle: 'Mar 5'
98
+ },
99
+ {
100
+ title: '8:00',
101
+ subtitle: 'Mar 6'
102
+ },
103
+ {
104
+ title: '8:00',
105
+ subtitle: 'Mar 7'
106
+ },
107
+ {
108
+ title: '8:00',
109
+ subtitle: 'Mar 8'
110
+ },
111
+ {
112
+ title: '8:00',
113
+ subtitle: 'Mar 9'
114
+ },
115
+ {
116
+ title: '8:00 long title',
117
+ subtitle: 'Mar 10 long title'
118
+ },
119
+ {
120
+ title: '8:00',
121
+ subtitle: 'Mar 11'
122
+ },
123
+ {
124
+ title: '8:00',
125
+ subtitle: 'Mar 12'
126
+ },
127
+ {
128
+ title: '8:00',
129
+ subtitle: 'Mar 13'
130
+ },
131
+ {
132
+ title: '8:00',
133
+ subtitle: 'Mar 14'
134
+ },
135
+ {
136
+ title: '8:00',
137
+ subtitle: 'Mar 15'
138
+ },
139
+ {
140
+ title: '8:00',
141
+ subtitle: 'Mar 16'
142
+ }
143
+ ],
144
+ day: [
145
+ 'Jan 1',
146
+ 'Jan 2',
147
+ 'Jan 3',
148
+ 'Jan 4',
149
+ 'Jan 5',
150
+ 'Jan 6',
151
+ 'Jan 7',
152
+ 'Jan 8',
153
+ 'Jan 9',
154
+ 'Jan 10',
155
+ 'Jan 11',
156
+ 'Jan 12',
157
+ 'Jan 13',
158
+ 'Jan 14',
159
+ 'Jan 15',
160
+ 'Jan 16',
161
+ 'Jan 17',
162
+ 'Jan 18'
163
+ ],
164
+ week: [
165
+ 'Week 1',
166
+ 'Week 2',
167
+ 'Week 3',
168
+ 'Week 4',
169
+ 'Week 5',
170
+ 'Week 6',
171
+ 'Week 7',
172
+ 'Week 8',
173
+ 'Week 9',
174
+ 'Week 10',
175
+ 'Week 11',
176
+ 'Week 12',
177
+ 'Week 13',
178
+ 'Week 14',
179
+ 'Week 15',
180
+ 'Week 16',
181
+ 'Week 17',
182
+ 'Week 18'
183
+ ],
184
+ month: [
185
+ {
186
+ title: 'Ian',
187
+ subtitle: '2022'
188
+ },
189
+ {
190
+ title: 'Feb',
191
+ subtitle: ''
192
+ },
193
+ {
194
+ title: 'Mar',
195
+ subtitle: ''
196
+ },
197
+ {
198
+ title: 'Apr',
199
+ subtitle: ''
200
+ },
201
+ {
202
+ title: 'May',
203
+ subtitle: ''
204
+ },
205
+ {
206
+ title: 'Jun',
207
+ subtitle: ''
208
+ },
209
+ {
210
+ title: 'Jul',
211
+ subtitle: ''
212
+ },
213
+ {
214
+ title: 'Aug',
215
+ subtitle: ''
216
+ },
217
+ {
218
+ title: 'Sep',
219
+ subtitle: ''
220
+ },
221
+ {
222
+ title: 'Oct',
223
+ subtitle: ''
224
+ },
225
+ {
226
+ title: 'Nov',
227
+ subtitle: ''
228
+ },
229
+ {
230
+ title: 'Dec',
231
+ subtitle: ''
232
+ },
233
+ {
234
+ title: 'Ian',
235
+ subtitle: '2023'
236
+ },
237
+ {
238
+ title: 'Feb',
239
+ subtitle: ''
240
+ },
241
+ {
242
+ title: 'Mar',
243
+ subtitle: ''
244
+ },
245
+ {
246
+ title: 'Apr',
247
+ subtitle: ''
248
+ },
249
+ {
250
+ title: 'May',
251
+ subtitle: ''
252
+ },
253
+ {
254
+ title: 'Jun',
255
+ subtitle: ''
256
+ }
257
+ ],
258
+ year: [
259
+ '1998',
260
+ '1999',
261
+ '2000',
262
+ '2001',
263
+ '2002',
264
+ '2003',
265
+ '2004',
266
+ '2005',
267
+ '2006',
268
+ '2007',
269
+ '2008',
270
+ '2009',
271
+ '2010',
272
+ '2011',
273
+ '2012',
274
+ '2013',
275
+ '2014',
276
+ '2015'
277
+ ]
278
+ }
279
+
280
+ const data = {
281
+ labels: resolutionLabels['hour'],
282
+ datasets: [
283
+ {
284
+ label: 'Discarded',
285
+ backgroundColor: '--dl-color-secondary',
286
+ borderColor: '--dl-color-secondary',
287
+ pointRadius: 4,
288
+ data: randomIntFromInterval(0, 4)
289
+ },
290
+ {
291
+ label: 'Undiscarded',
292
+ backgroundColor: '--dl-color-warning',
293
+ borderColor: '--dl-color-warning',
294
+ pointRadius: 4,
295
+ data: randomIntFromInterval(2, 6)
296
+ },
297
+ {
298
+ label: 'Completed',
299
+ backgroundColor: '--dl-color-positive',
300
+ borderColor: '--dl-color-positive',
301
+ pointRadius: 4,
302
+ data: randomIntFromInterval(1, 5)
303
+ },
304
+ {
305
+ label: 'Uncompleted',
306
+ backgroundColor: '--dl-color-negative',
307
+ borderColor: '--dl-color-negative',
308
+ pointRadius: 4,
309
+ data: randomIntFromInterval(0, 5)
310
+ }
311
+ ]
312
+ }
313
+
314
+ const brushProps = {
315
+ min: 0,
316
+ max: orderBy(data.datasets, (o) => o.data.length)[0].data.length - 1
317
+ }
318
+
319
+ const options = {
320
+ plugins: {
321
+ legend: {
322
+ display: false
323
+ }
324
+ },
325
+ scales: {
326
+ y: {
327
+ suggestedMax: 9
328
+ }
329
+ }
330
+ }
331
+
332
+ const legendProps = {
333
+ alignItems: 'center'
334
+ }
335
+
336
+ export default defineComponent({
337
+ name: 'DlLineChartDemo',
338
+ components: {
339
+ DlLineChart
340
+ },
341
+ data() {
342
+ return {
343
+ resolution: 'hour',
344
+ options,
345
+ data,
346
+ brushProps,
347
+ legendProps,
348
+ noPointsData: {
349
+ ...data,
350
+ datasets: [
351
+ { ...data.datasets[0], pointRadius: 0, borderWidth: 1 }
352
+ ]
353
+ },
354
+ tensionLineData: {
355
+ ...data,
356
+ datasets: [{ ...data.datasets[1], pointRadius: 0 }]
357
+ },
358
+ tensionOptions: { ...options, tension: 0.5 }
359
+ }
360
+ },
361
+ methods: {
362
+ setResolution(string: 'hour' | 'day' | 'week' | 'month' | 'year') {
363
+ this.resolution = string
364
+ this.data.labels = resolutionLabels[string] as any
365
+
366
+ this.data.datasets = this.data.datasets.map((dataset, i) => ({
367
+ ...dataset,
368
+ data: randomIntFromInterval(i + 1, 6)
369
+ }))
370
+ }
371
+ }
372
+ })
373
+ </script>
374
+
375
+ <style scoped lang="scss"></style>
@@ -389,7 +389,7 @@
389
389
  <h4>Sizing and styling</h4>
390
390
  <div>
391
391
  <dl-button label="Fit Menu">
392
- <dl-menu fit>
392
+ <dl-menu fit-container>
393
393
  <dl-list>
394
394
  <dl-list-item clickable>
395
395
  <dl-item-section>New tab</dl-item-section>
@@ -35,7 +35,7 @@
35
35
  >
36
36
  <dl-menu
37
37
  ref="menu"
38
- fit
38
+ fit-container
39
39
  >
40
40
  <dl-option-group
41
41
  v-model="switchValue"
@@ -167,7 +167,7 @@
167
167
  multiselect
168
168
  search
169
169
  capitalized-options
170
- fit
170
+ fit-container
171
171
  />
172
172
  With Label and sub label
173
173
  <dl-select
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <dl-spinner
3
+ text="Loading data, please wait..."
4
+ :text-styles="{
5
+ marginLeft: '10px',
6
+ color: 'var(--dl-color-tooltip-background)'
7
+ }"
8
+ />
9
+ </template>
10
+
11
+ <script>
12
+ import { defineComponent } from 'vue-demi'
13
+ import DlSpinner from '../components/DlSpinner.vue'
14
+
15
+ export default defineComponent({
16
+ components: {
17
+ DlSpinner
18
+ }
19
+ })
20
+ </script>
@@ -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
  },