@dataloop-ai/components 0.19.245 → 0.19.249

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/favicon.ico CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.19.245",
3
+ "version": "0.19.249",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -22,11 +22,12 @@
22
22
  "check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
23
23
  },
24
24
  "dependencies": {
25
- "@dataloop-ai/icons": "^3.0.66",
25
+ "@dataloop-ai/icons": "^3.0.70",
26
26
  "@types/flat": "^5.0.2",
27
27
  "@types/lodash": "^4.14.184",
28
28
  "@types/sortablejs": "^1.15.7",
29
29
  "chart.js": "^3.9.1",
30
+ "chartjs-plugin-datalabels": "^2.2.0",
30
31
  "flat": "^5.0.2",
31
32
  "highlight.js": "^11.8.0",
32
33
  "lodash": "^4.17.21",
@@ -40,8 +41,7 @@
40
41
  "vanilla-jsoneditor": "^0.10.2",
41
42
  "vue-demi": "^0.14.5",
42
43
  "vue-sortable": "^0.1.3",
43
- "vue2-teleport": "^1.0.1",
44
- "zero-md": "^2.5.3"
44
+ "vue2-teleport": "^1.0.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.17.9",
@@ -1,21 +1,9 @@
1
1
  <template>
2
2
  <div :class="chartWrapperClasses">
3
- <div
4
- class="canvas-container"
5
- :style="`height: ${wrapperHeight}`"
6
- >
7
- <dl-empty-state
8
- v-if="isEmpty"
9
- v-bind="emptyStateProps"
10
- >
11
- <template
12
- v-for="(_, slot) in $slots"
13
- #[slot]="props"
14
- >
15
- <slot
16
- :name="slot"
17
- v-bind="props"
18
- />
3
+ <div class="canvas-container" :style="`height: ${wrapperHeight}`">
4
+ <dl-empty-state v-if="isEmpty" v-bind="emptyStateProps">
5
+ <template v-for="(_, slot) in $slots" #[slot]="props">
6
+ <slot :name="slot" v-bind="props" />
19
7
  </template>
20
8
  </dl-empty-state>
21
9
  <Bar
@@ -26,11 +14,12 @@
26
14
  :style="chartStyles"
27
15
  :data="chartData"
28
16
  :options="chartOptions"
17
+ :plugins="chartPlugins"
29
18
  @mouseout="onChartLeave"
30
19
  @wheel.native="handleChartScroll"
31
20
  />
32
21
  <dl-chart-scroll-bar
33
- v-if="!isEmpty || (maxItems > thisItemsInView && !isEmpty)"
22
+ v-if="maxItems > thisItemsInView && !isEmpty"
34
23
  :wrapper-styles="{
35
24
  marginTop: '10px'
36
25
  }"
@@ -391,6 +380,8 @@ export default defineComponent({
391
380
  )
392
381
  )
393
382
 
383
+ const chartPlugins = props.plugins
384
+
394
385
  watch(
395
386
  () => chart.value?.scales?.x?.width,
396
387
  (val: string) => {
@@ -541,13 +532,14 @@ export default defineComponent({
541
532
  )
542
533
  )
543
534
 
544
- chart.value.update()
535
+ chart.value.update?.()
545
536
  })
546
537
 
547
538
  return {
548
539
  variables,
549
540
  chartData,
550
541
  chartOptions,
542
+ chartPlugins,
551
543
  xLabels,
552
544
  barChart,
553
545
  maxItems,
@@ -75,6 +75,7 @@ export default defineComponent({
75
75
  )
76
76
  }
77
77
  if (vm.vnode.key === 'visibleColumnsSlot') {
78
+ // todo: this assumes that if a column is actions slot then its always sticky. we need to see if its true
78
79
  styles = styles.concat(
79
80
  'position: sticky; right: 0; z-index: 101;'
80
81
  )
@@ -9,11 +9,7 @@
9
9
  :icon-size="iconSize"
10
10
  :icon-color="iconColor"
11
11
  />
12
- <div
13
- v-if="text"
14
- class="dl-spinner-text"
15
- :style="textStyles"
16
- >
12
+ <div v-if="text" class="dl-spinner-text" :style="textStyles">
17
13
  <span>{{ text }}</span>
18
14
  </div>
19
15
  </div>
@@ -25,7 +21,6 @@ import DlSpinnerGrid from './components/DlSpinnerGrid.vue'
25
21
  import DlSpinnerCircle from './components/DlSpinnerCircle.vue'
26
22
  import DlSpinnerClock from './components/DlSpinnerClock.vue'
27
23
  import DlSpinnerDots from './components/DlSpinnerDots.vue'
28
- import DlSpinnerLogo from './components/DlSpinnerLogo.vue'
29
24
  import { DlSpinnerTypes } from './types'
30
25
 
31
26
  export default defineComponent({
@@ -33,8 +28,7 @@ export default defineComponent({
33
28
  DlSpinnerGrid,
34
29
  DlSpinnerCircle,
35
30
  DlSpinnerClock,
36
- DlSpinnerDots,
37
- DlSpinnerLogo
31
+ DlSpinnerDots
38
32
  },
39
33
  props: {
40
34
  text: {
@@ -85,9 +79,8 @@ export default defineComponent({
85
79
  return 'DlSpinnerDots'
86
80
  case DlSpinnerTypes.CLOCK:
87
81
  return 'DlSpinnerClock'
88
- case DlSpinnerTypes.LOGO:
89
82
  default:
90
- return 'DlSpinnerLogo'
83
+ return 'DlSpinnerGrid'
91
84
  }
92
85
  }
93
86
  }
@@ -2,6 +2,5 @@ export enum DlSpinnerTypes {
2
2
  GRID = 'grid',
3
3
  CIRCLE = 'circle',
4
4
  DOTS = 'dots',
5
- CLOCK = 'clock',
6
- LOGO = 'logo'
5
+ CLOCK = 'clock'
7
6
  }
@@ -4,7 +4,7 @@
4
4
  display: flex;
5
5
  width: 900px;
6
6
  flex-wrap: wrap;
7
- flex-direction: row;
7
+ flex-direction: column;
8
8
  gap: 0px;
9
9
  "
10
10
  >
@@ -22,6 +22,19 @@
22
22
  :items-in-view="6"
23
23
  is-empty
24
24
  />
25
+
26
+ <div style="color: var(--dl-color-darker); margin-bottom: 30px">
27
+ Customized DlBarChart with data labels
28
+ </div>
29
+ <!-- @vue-ignore -->
30
+ <dl-bar-chart
31
+ :data="cdlData"
32
+ :options="cdlOptions"
33
+ :plugins="cdlPlugins"
34
+ :items-in-view="data.labels.length + 1"
35
+ >
36
+ <template #legend><span /></template>
37
+ </dl-bar-chart>
25
38
  </div>
26
39
  </template>
27
40
 
@@ -29,6 +42,7 @@
29
42
  import { defineComponent } from 'vue-demi'
30
43
  import { ChartOptions } from 'chart.js'
31
44
  import { DlBarChart } from '../components'
45
+ import ChartDataLabels from 'chartjs-plugin-datalabels'
32
46
 
33
47
  const labelsFn = () => {
34
48
  const a = []
@@ -78,6 +92,76 @@ const options: ChartOptions = {
78
92
  }
79
93
  }
80
94
 
95
+ const cdlData = {
96
+ labels: labelsFn().map((l) => `Data [${l}]:`),
97
+ datasets: [
98
+ {
99
+ label: 'Duh',
100
+ backgroundColor: '--dl-color-secondary',
101
+ borderRadius: 4,
102
+ data: dataFn(),
103
+ datalabels: {
104
+ align: 'end',
105
+ anchor: 'start'
106
+ }
107
+ },
108
+ {
109
+ label: 'Duh',
110
+ backgroundColor: '--dl-color-info-background',
111
+ borderRadius: 4,
112
+ data: dataFn().map((n) => 20 - n),
113
+ datalabels: {
114
+ align: 'start',
115
+ anchor: 'end'
116
+ }
117
+ }
118
+ ]
119
+ }
120
+
121
+ const cdlOptions: ChartOptions = {
122
+ plugins: {
123
+ datalabels: {
124
+ color: '--dl-color-darker',
125
+ font: {
126
+ weight: 'bold'
127
+ },
128
+ formatter (value, context) {
129
+ switch (context.datasetIndex) {
130
+ case 0:
131
+ return context.chart.data.labels[context.dataIndex]
132
+ case 1:
133
+ return (
134
+ 'Value is ' +
135
+ context.chart.data.datasets[0].data[
136
+ context.dataIndex
137
+ ]
138
+ )
139
+ }
140
+ }
141
+ },
142
+ tooltip: {
143
+ callbacks: {
144
+ label (tooltipItem) {
145
+ return 'Value is ' + tooltipItem.formattedValue
146
+ }
147
+ },
148
+ filter (tooltipItem) {
149
+ return tooltipItem.datasetIndex === 0
150
+ }
151
+ }
152
+ },
153
+ scales: {
154
+ x: {
155
+ stacked: true,
156
+ display: false
157
+ },
158
+ y: {
159
+ stacked: true,
160
+ display: false
161
+ }
162
+ }
163
+ }
164
+
81
165
  export default defineComponent({
82
166
  name: 'DlChartDemo',
83
167
  components: {
@@ -85,6 +169,9 @@ export default defineComponent({
85
169
  },
86
170
  data() {
87
171
  return {
172
+ cdlData,
173
+ cdlOptions,
174
+ cdlPlugins: [ChartDataLabels],
88
175
  data,
89
176
  options,
90
177
  legendProps
@@ -10,13 +10,22 @@
10
10
  >
11
11
  <div
12
12
  style="
13
- background-image: url(https://dataloop.ai/wp-content/uploads/2020/03/logo.svg);
13
+ background-image: url(https://dataloop.ai/wp-content/uploads/2024/02/dataloop-logo-main.svg);
14
14
  width: 160px;
15
- height: 28px;
15
+ height: 48px;
16
16
  display: inline-block;
17
+ background-repeat: no-repeat;
17
18
  "
18
19
  />
19
- Components library
20
+ <div
21
+ style="
22
+ position: relative;
23
+ top: -12px;
24
+ display: inline-block;
25
+ "
26
+ >
27
+ Components library
28
+ </div>
20
29
  </dl-typography>
21
30
  <div style="display: flex; align-items: center">
22
31
  <dl-icon
@@ -26,10 +35,7 @@
26
35
  !darkMode ? 'dl-color-secondary' : 'dl-color-darker'
27
36
  "
28
37
  />
29
- <dl-switch
30
- v-model="darkMode"
31
- style="margin: 0 20px"
32
- />
38
+ <dl-switch v-model="darkMode" style="margin: 0 20px" />
33
39
  <dl-icon
34
40
  icon="icon-dl-dark-theme"
35
41
  size="20px"
@@ -45,10 +51,7 @@
45
51
  style="margin-bottom: 5px"
46
52
  />
47
53
 
48
- <dl-button
49
- v-if="activeDemo"
50
- outlined
51
- >
54
+ <dl-button v-if="activeDemo" outlined>
52
55
  <span style="text-transform: capitalize">
53
56
  Selected: {{ computeDemoName(activeDemo.name) }}
54
57
  </span>
@@ -1,152 +0,0 @@
1
- <template>
2
- <div class="dl-spinner-wrapper">
3
- <div
4
- class="dl-spinner"
5
- :style="spinnerStyles"
6
- >
7
- <div class="dl-spin-bg">
8
- <svg
9
- id="dl-Layer_2"
10
- data-name="Layer 2"
11
- viewBox="0 0 140 140"
12
- >
13
- <g
14
- id="Layer_1-2"
15
- data-name="Layer 1"
16
- >
17
- <path
18
- class="dl-svg"
19
- d="M70,0C31.33,0,0,31.33,0,70s31.33,70,70,70,70-31.33,70-70S108.67,0,70,0Zm0,131.97c-34.2,0-61.97-27.77-61.97-61.97S35.8,8.03,70,8.03s61.97,27.77,61.97,61.97-27.77,61.97-61.97,61.97Z"
20
- />
21
- </g>
22
- </svg>
23
- </div>
24
- <div class="dl-spin-loader">
25
- <svg
26
- id="dl-Layer_2"
27
- data-name="Layer 2"
28
- viewBox="0 0 140 140"
29
- >
30
- <defs>
31
- <linearGradient
32
- id="linear-gradient"
33
- x1="12.53"
34
- y1="229.07"
35
- x2="119.46"
36
- y2="229.07"
37
- gradientTransform="translate(0 246.89) scale(1 -1)"
38
- gradientUnits="userSpaceOnUse"
39
- >
40
- <stop
41
- offset="0"
42
- :stop-color="color"
43
- stop-opacity="0"
44
- />
45
- <stop
46
- offset=".12"
47
- :stop-color="color"
48
- stop-opacity="0"
49
- />
50
- <stop
51
- offset=".34"
52
- :stop-color="color"
53
- />
54
- <stop
55
- offset=".69"
56
- :stop-color="color"
57
- />
58
- <stop
59
- offset=".91"
60
- :stop-color="color"
61
- stop-opacity="0"
62
- />
63
- </linearGradient>
64
- </defs>
65
- <g
66
- id="dl-Layer_1-2"
67
- data-name="Layer 1"
68
- >
69
- <g>
70
- <path
71
- class="dl-spinner-color-bg"
72
- d="M70,0C31.33,0,0,31.33,0,70s31.33,70,70,70,70-31.33,70-70S108.67,0,70,0Zm0,131.97c-34.2,0-61.97-27.77-61.97-61.97S35.8,8.03,70,8.03s61.97,27.77,61.97,61.97-27.77,61.97-61.97,61.97Z"
73
- />
74
- <path
75
- class="dl-spinner-color"
76
- d="M114.87,25.82c1.38-1.38,2.87-2.75,4.25-4.13,.46-.34,.46-1.03,0-1.49C106.49,7.69,89.16,0,70,0,46.36,0,25.48,11.7,12.74,29.72c-.34,.46-.23,.92,.11,1.38l4.25,4.25c.46,.46,1.15,.34,1.61-.11,11.25-16.52,29.95-27.2,51.3-27.2,16.98,0,32.25,6.77,43.49,17.79,.34,.34,1.03,.34,1.38,0Z"
77
- />
78
- </g>
79
- </g>
80
- </svg>
81
- </div>
82
- <div class="dl-spinner-icon">
83
- <svg
84
- viewBox="0 0 51 45"
85
- fill="none"
86
- >
87
- <path
88
- d="M23.2962 0.558083H0.830566V32.2536L10.1727 44.284H23.2962V38.5002H12.6195L6.39136 30.4028V6.11058H23.2962V0.558083Z"
89
- :fill="iconColor"
90
- />
91
- <path
92
- d="M27.5224 6.11058V0.558083C33.3056 -0.137737 52.8796 3.56565 50.6553 25.0816C48.9091 41.9727 34.3436 44.901 27.5224 44.284V38.5002C41.2242 39.4256 45.0945 29.1689 45.3169 23.9249C46.2067 8.19281 33.8246 5.49365 27.5224 6.11058Z"
93
- :fill="iconColor"
94
- />
95
- <path
96
- d="M23.2962 19.0664V13.5139H13.0643V27.3952L16.8457 31.7909H23.2962V26.2384H19.07L18.6251 25.5443V19.0664H23.2962Z"
97
- :fill="iconColor"
98
- />
99
- <path
100
- d="M27.5224 19.0664V13.5139C31.2296 13.2054 38.644 14.5782 38.644 22.5367C38.644 30.4953 31.2296 32.0223 27.5224 31.7909V26.2384C29.3018 26.7782 33.3056 26.9038 33.3056 22.9994C33.3056 19.0664 29.5984 18.758 27.5224 19.0664Z"
101
- :fill="iconColor"
102
- />
103
- </svg>
104
- </div>
105
- </div>
106
- </div>
107
- </template>
108
-
109
- <script>
110
- import { defineComponent } from 'vue-demi'
111
-
112
- export default defineComponent({
113
- props: {
114
- size: {
115
- type: String,
116
- default: '140px'
117
- },
118
- iconSize: {
119
- type: String,
120
- default: '50px'
121
- },
122
- borderColor: {
123
- type: String,
124
- default: 'var(--dl-color-separator)'
125
- },
126
- color: {
127
- type: String,
128
- default: 'var(--dl-color-secondary)'
129
- },
130
- iconColor: {
131
- type: String,
132
- default: 'var(--dl-color-tooltip-background)'
133
- }
134
- },
135
- computed: {
136
- spinnerStyles() {
137
- return {
138
- '--dl-spinner-size': this.size,
139
- '--dl-spinner-icon-size': this.iconSize,
140
- '--dl-spinner-border-color': this.borderColor,
141
- '--icon-top': `${
142
- parseInt(this.size) / 2 -
143
- parseInt(this.iconSize) / 2 +
144
- parseInt(this.iconSize) / 25
145
- }px`
146
- }
147
- }
148
- }
149
- })
150
- </script>
151
-
152
- <style lang="scss" src="../styles/spinnerStyles.scss" />