@dataloop-ai/components 0.19.284 → 0.20.0

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 (42) hide show
  1. package/package.json +59 -59
  2. package/src/components/basic/DlButton/DlButton.vue +5 -5
  3. package/src/components/basic/DlPopup/DlPopup.vue +1 -1
  4. package/src/components/basic/DlProgressChart/DlProgressChart.vue +11 -19
  5. package/src/components/compound/DlCard/DlCard.vue +14 -48
  6. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +1 -1
  7. package/src/components/compound/DlCharts/components/DlChartLabels.vue +21 -25
  8. package/src/components/compound/DlCharts/components/DlChartLegend.vue +14 -17
  9. package/src/components/compound/DlRange/DlRange.vue +3 -9
  10. package/src/components/compound/DlSelect/DlSelect.vue +7 -3
  11. package/src/components/compound/DlSelect/components/DlSelectOption.vue +14 -21
  12. package/src/components/compound/DlSelect/types.ts +4 -1
  13. package/src/components/compound/DlSelect/utils.ts +1 -3
  14. package/src/components/compound/DlSlider/useSlider.ts +4 -1
  15. package/src/components/compound/DlTable/components/DlTh.vue +6 -3
  16. package/src/components/compound/DlTable/components/SortableJS.vue +3 -8
  17. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +9 -18
  18. package/src/components/essential/DlTypography/DlTypography.vue +6 -14
  19. package/src/components/essential/DlTypography/types.ts +19 -0
  20. package/src/components/essential/types.ts +1 -0
  21. package/src/demos/DlChipDemo.vue +24 -84
  22. package/src/demos/DlCounterDemo.vue +1 -1
  23. package/src/demos/DlDatasetBrowserLayoutDemo/components/MainContent/ActionsMenu.vue +4 -7
  24. package/src/demos/DlDatasetBrowserLayoutDemo/components/MainContent/AutomationMenu.vue +7 -19
  25. package/src/demos/DlDatasetBrowserLayoutDemo/components/MainContent/CardView.vue +13 -7
  26. package/src/demos/DlDatasetBrowserLayoutDemo/components/filters/AddFilter.vue +10 -23
  27. package/src/demos/DlDateTimeRangeDemo.vue +19 -16
  28. package/src/demos/DlLabelPickerDemo.vue +8 -5
  29. package/src/demos/DlMenuDemo.vue +2 -2
  30. package/src/demos/DlSelectDemo.vue +10 -10
  31. package/src/demos/DlStepperDemo/steps/GeneralStep.vue +8 -5
  32. package/src/demos/DlStudioLayoutDemo/components/StudioLeftDrawer.vue +10 -4
  33. package/src/demos/DlStudioLayoutDemo/components/StudioTabsMenu.vue +2 -10
  34. package/src/demos/DlTextInputDemo.vue +5 -5
  35. package/src/demos/DlThDemo.vue +5 -4
  36. package/src/demos/DlTooltipDemo.vue +1 -1
  37. package/src/demos/DlTreeTableDemo.vue +6 -7
  38. package/src/demos/DlTypographyDemo.vue +11 -8
  39. package/src/demos/DlVirtualScrollDemo.vue +7 -13
  40. package/tsconfig.json +1 -1
  41. package/tsconfig.vue.json +4 -0
  42. package/vite.config.ts +0 -3
@@ -1,9 +1,5 @@
1
1
  <template>
2
- <div
3
- :id="uuid"
4
- :class="identifierClass"
5
- style="width: 100%"
6
- >
2
+ <div :id="uuid" :class="identifierClass" style="width: 100%">
7
3
  <div
8
4
  v-if="readonly"
9
5
  :class="[{ 'readonly-option': true }, { capitalized }]"
@@ -22,10 +18,7 @@
22
18
  style="width: 100%"
23
19
  @click="handleClick"
24
20
  >
25
- <dl-item-section
26
- :color="color"
27
- style="width: 100%"
28
- >
21
+ <dl-item-section :color="color" style="width: 100%">
29
22
  <span
30
23
  v-if="multiselect"
31
24
  class="multiselect-option"
@@ -58,15 +51,9 @@
58
51
  }}
59
52
  </slot>
60
53
  </dl-checkbox>
61
- <span
62
- v-if="count"
63
- class="counter"
64
- > ({{ count }}) </span>
54
+ <span v-if="count" class="counter"> ({{ count }}) </span>
65
55
  </span>
66
- <div
67
- v-else
68
- :class="{ capitalized }"
69
- >
56
+ <div v-else :class="{ capitalized }">
70
57
  <slot>
71
58
  {{
72
59
  capitalized
@@ -130,8 +117,12 @@ import { DlItemSection } from '../../../shared'
130
117
  import { v4 } from 'uuid'
131
118
  import { debounce } from 'lodash'
132
119
  import { stateManager } from '../../../../StateManager'
133
- import { DlSelectOptionType, getCaseInsensitiveInput, getLabel } from '../utils'
134
- import { DlSelectedValueType, DlSelectOption } from '../../types'
120
+ import { getCaseInsensitiveInput, getLabel } from '../utils'
121
+ import {
122
+ DlSelectedValueType,
123
+ DlSelectOption,
124
+ DlSelectOptionType
125
+ } from '../../types'
135
126
 
136
127
  const ValueTypes = [Array, Boolean, String, Number, Object, Function]
137
128
 
@@ -240,7 +231,7 @@ export default defineComponent({
240
231
  getOptionLabel(option: any) {
241
232
  return getLabel(option) ?? this.getOptionValue(option)
242
233
  },
243
- getOptionHtml(option: DlSelectOptionType) {
234
+ getOptionHtml(option: DlSelectOptionType | DlSelectedValueType) {
244
235
  const label = `${this.getOptionLabel(option)}`
245
236
  let highlightedHtml = label
246
237
 
@@ -412,7 +403,9 @@ export default defineComponent({
412
403
  display: flex !important;
413
404
  justify-content: center !important;
414
405
  color: var(--dl-color-medium);
415
- transition-property: transform, -webkit-transform;
406
+ transition-property:
407
+ transform,
408
+ -webkit-transform;
416
409
  transition-duration: 0.28s, 0.28s;
417
410
  transition-timing-function: ease, ease;
418
411
  transition-delay: 0s, 0s;
@@ -1,4 +1,5 @@
1
- export interface DlSelectOption {
1
+ type Dictionary = { [key: string]: any }
2
+ export interface DlSelectOption extends Dictionary {
2
3
  label: string
3
4
  value: any
4
5
  key?: string
@@ -6,3 +7,5 @@ export interface DlSelectOption {
6
7
  children?: DlSelectOption[]
7
8
  readonly?: boolean
8
9
  }
10
+
11
+ export type DlSelectOptionType = string | number | DlSelectOption
@@ -1,7 +1,5 @@
1
1
  import { TInputSizes } from '../../../utils/input-sizes'
2
- import { DlSelectOption } from './types'
3
-
4
- export type DlSelectOptionType = string | number | DlSelectOption
2
+ import { DlSelectOptionType } from './types'
5
3
 
6
4
  export const getLabel = (option: any) => {
7
5
  if (typeof option === 'object' && 'label' in option) {
@@ -53,7 +53,10 @@ export const dragType = {
53
53
  }
54
54
 
55
55
  export const useSliderProps = {
56
- ...useFormProps,
56
+ name: {
57
+ type: String,
58
+ default: null as string
59
+ },
57
60
  text: {
58
61
  type: String,
59
62
  default: ''
@@ -147,9 +147,10 @@ export default defineComponent({
147
147
  thClasses: null,
148
148
  isSortable: false,
149
149
  hasEllipsis: false,
150
- onClick: onClickFn,
150
+ onClick: onClickFn as any as (payload: MouseEvent) => void,
151
151
  hasHint,
152
- isDense
152
+ isDense,
153
+ computedSortIcon: ''
153
154
  }
154
155
  }
155
156
 
@@ -178,7 +179,9 @@ export default defineComponent({
178
179
  onClickFn(evt, column.value.name)
179
180
  }
180
181
 
181
- const onClick = !hasOptionalProps.value ? onClickFn : handleClick
182
+ const onClick: (payload: MouseEvent) => void = !hasOptionalProps.value
183
+ ? (onClickFn as any as (payload: MouseEvent) => void)
184
+ : (handleClick as any as (payload: MouseEvent) => void)
182
185
 
183
186
  return {
184
187
  hasHint,
@@ -8,12 +8,7 @@
8
8
  >
9
9
  <slot />
10
10
  </component>
11
- <component
12
- :is="$props.tag"
13
- v-else
14
- v-bind="props"
15
- :class="$props.class"
16
- >
11
+ <component :is="$props.tag" v-else v-bind="props" :class="$props.class">
17
12
  <slot />
18
13
  </component>
19
14
  </template>
@@ -24,10 +19,10 @@ import { useSortable, useSortableProps, emits } from '../hooks/use-sortable'
24
19
  export default defineComponent({
25
20
  props: useSortableProps,
26
21
  emits,
27
- setup() {
22
+ setup(props) {
28
23
  const vm = getCurrentInstance()
29
24
  const { getKey, rootRef } = useSortable(vm)
30
- return { getKey, rootRef }
25
+ return { getKey, rootRef, props: props as { [key: string]: any } }
31
26
  }
32
27
  })
33
28
  </script>
@@ -1,9 +1,6 @@
1
1
  <template>
2
2
  <div class="slider-wrapper">
3
- <div
4
- :style="imageContainerStyles"
5
- class="slider"
6
- >
3
+ <div :style="imageContainerStyles" class="slider">
7
4
  <div class="slider__arrow">
8
5
  <div
9
6
  :class="getChevronClass('left')"
@@ -18,10 +15,7 @@
18
15
  </div>
19
16
  </div>
20
17
 
21
- <div
22
- ref="images"
23
- class="slider__images"
24
- >
18
+ <div ref="images" class="slider__images">
25
19
  <div
26
20
  v-for="image in currentImages"
27
21
  :key="image.src"
@@ -37,10 +31,7 @@
37
31
  :icon="getStatusIcon(image.status)"
38
32
  />
39
33
  </div>
40
- <img
41
- :src="image.src"
42
- @error="handleImageError"
43
- >
34
+ <img :src="image.src" @error="handleImageError" />
44
35
  <dl-tooltip>{{ image.name }}</dl-tooltip>
45
36
  </div>
46
37
  </div>
@@ -89,7 +80,7 @@ export default defineComponent({
89
80
  */
90
81
  images: {
91
82
  type: Array as PropType<DlThumbnail[]>,
92
- default: (): DlThumbnail[] => []
83
+ default: (): DlThumbnail[] => [] as DlThumbnail[]
93
84
  },
94
85
  /**
95
86
  * The number of thumbnails visible at once
@@ -127,7 +118,7 @@ export default defineComponent({
127
118
  }
128
119
  },
129
120
  computed: {
130
- imageContainerStyles(): object {
121
+ imageContainerStyles(): Record<string, any> {
131
122
  return {
132
123
  '--thumbnail-size': `${100 / this.visibleThumbnails}%`,
133
124
  '--img-object-fit':
@@ -145,7 +136,7 @@ export default defineComponent({
145
136
  return this.images.slice(
146
137
  this.currentList.first,
147
138
  this.currentList.last
148
- )
139
+ ) as DlThumbnail[]
149
140
  }
150
141
  },
151
142
  methods: {
@@ -157,8 +148,8 @@ export default defineComponent({
157
148
  this.currentList.first -= this.visibleThumbnails
158
149
  this.currentList.last -= this.visibleThumbnails
159
150
  },
160
- handleImageError(e: ErrorEvent) {
161
- (e.target as HTMLImageElement).src = this.invalidImage
151
+ handleImageError(e: any) {
152
+ ;(e.target as HTMLImageElement).src = this.invalidImage
162
153
  },
163
154
  getImageOutline(image: string) {
164
155
  return {
@@ -185,7 +176,7 @@ export default defineComponent({
185
176
  ? 'slider__arrow--icon'
186
177
  : 'slider__arrow--icon--invisible'
187
178
  },
188
- handleThumbnailMousedown(image: string) {
179
+ handleThumbnailMousedown(image: DlThumbnail) {
189
180
  this.$emit('update:model-value', image)
190
181
  this.$emit('selected', image)
191
182
  }
@@ -1,10 +1,5 @@
1
1
  <template>
2
- <component
3
- :is="variant"
4
- :id="uuid"
5
- :class="classes"
6
- :style="styles"
7
- >
2
+ <component :is="variant" :id="uuid" :class="classes" :style="styles">
8
3
  <slot />
9
4
  </component>
10
5
  </template>
@@ -13,16 +8,13 @@ import { v4 } from 'uuid'
13
8
  import { defineComponent, PropType } from 'vue-demi'
14
9
  import { getColor } from '../../../utils'
15
10
  import { DlTextTransformOptions } from '../../shared/types'
16
-
17
- type Variant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'div'
18
-
19
- const sizes = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'body', 'small']
11
+ import { DlTypographyVariant, DlTypographySizes } from './types'
20
12
 
21
13
  export default defineComponent({
22
14
  name: 'DlTypography',
23
15
  props: {
24
16
  variant: {
25
- type: String as PropType<Variant>,
17
+ type: String as PropType<DlTypographyVariant>,
26
18
  required: false,
27
19
  default: 'p'
28
20
  },
@@ -56,7 +48,7 @@ export default defineComponent({
56
48
  fontWeight: this.bold ? 'bold' : 400
57
49
  }
58
50
 
59
- if (this.size && !sizes.includes(this.size)) {
51
+ if (this.size && !DlTypographySizes.includes(this.size)) {
60
52
  styles.fontSize = this.size as string
61
53
  }
62
54
 
@@ -72,11 +64,11 @@ export default defineComponent({
72
64
  const classes = [`dl-typography`]
73
65
 
74
66
  if (this.size) {
75
- if (sizes.includes(this.size)) {
67
+ if (DlTypographySizes.includes(this.size)) {
76
68
  classes.push(`dl-typography--${this.size}`)
77
69
  }
78
70
  } else {
79
- if (sizes.includes(this.variant)) {
71
+ if (DlTypographySizes.includes(this.variant)) {
80
72
  classes.push(`dl-typography--${this.variant}`)
81
73
  } else {
82
74
  classes.push(`dl-typography--body`)
@@ -0,0 +1,19 @@
1
+ export type DlTypographyVariant =
2
+ | 'h1'
3
+ | 'h2'
4
+ | 'h3'
5
+ | 'h4'
6
+ | 'h5'
7
+ | 'h6'
8
+ | 'p'
9
+ | 'div'
10
+ export const DlTypographySizes = [
11
+ 'h1',
12
+ 'h2',
13
+ 'h3',
14
+ 'h4',
15
+ 'h5',
16
+ 'h6',
17
+ 'body',
18
+ 'small'
19
+ ]
@@ -1,2 +1,3 @@
1
1
  export * from './DlColorPicker/types'
2
2
  export * from './DlSpinner/types'
3
+ export * from './DlTypography/types'
@@ -1,18 +1,9 @@
1
1
  <template>
2
2
  <div style="width: 800px">
3
- <div
4
- class="col"
5
- style="margin-bottom: 30px"
6
- >
3
+ <div class="col" style="margin-bottom: 30px">
7
4
  <DlChip label="Lorem ipsum dolor" />
8
- <DlChip
9
- outlined
10
- label="Chip outlined"
11
- />
12
- <DlChip
13
- disabled
14
- label="Chip disabled"
15
- />
5
+ <DlChip outlined label="Chip outlined" />
6
+ <DlChip disabled label="Chip disabled" />
16
7
  <DlChip label="Ellipsed Chip with a multiple words" />
17
8
  <DlChip
18
9
  label="Ellipsed Chip with a multiple words"
@@ -25,15 +16,8 @@
25
16
  />
26
17
  </div>
27
18
  <h4>Removable Chips</h4>
28
- <div
29
- class="col"
30
- style="margin-bottom: 30px"
31
- >
32
- <DlChip
33
- removable
34
- label="Chip filled"
35
- @remove="log('removable')"
36
- />
19
+ <div class="col" style="margin-bottom: 30px">
20
+ <DlChip removable label="Chip filled" @remove="log('removable')" />
37
21
  <DlChip
38
22
  removable
39
23
  outlined
@@ -59,21 +43,14 @@
59
43
  />
60
44
  </div>
61
45
  <h4>Removable Chips with icon</h4>
62
- <div
63
- class="col"
64
- style="margin-bottom: 30px"
65
- >
46
+ <div class="col" style="margin-bottom: 30px">
66
47
  <DlChip
67
48
  removable
68
49
  icon="icon-dl-search"
69
50
  label="chip filled"
70
51
  @remove="log('test')"
71
52
  />
72
- <DlChip
73
- removable
74
- icon="icon-dl-search"
75
- @remove="log('test')"
76
- />
53
+ <DlChip removable icon="icon-dl-search" @remove="log('test')" />
77
54
  <DlChip
78
55
  removable
79
56
  icon="icon-dl-search"
@@ -103,30 +80,13 @@
103
80
  />
104
81
  </div>
105
82
  <h4>Removable Chips without icon and label</h4>
106
- <div
107
- class="col"
108
- style="margin-bottom: 30px"
109
- >
110
- <DlChip
111
- removable
112
- @remove="log('test')"
113
- />
114
- <DlChip
115
- removable
116
- outlined
117
- @remove="log('test')"
118
- />
119
- <DlChip
120
- removable
121
- disabled
122
- @remove="log('test')"
123
- />
83
+ <div class="col" style="margin-bottom: 30px">
84
+ <DlChip removable @remove="log('test')" />
85
+ <DlChip removable outlined @remove="log('test')" />
86
+ <DlChip removable disabled @remove="log('test')" />
124
87
  </div>
125
88
  <h4>Chips with label slot</h4>
126
- <div
127
- class="col"
128
- style="margin-bottom: 30px"
129
- >
89
+ <div class="col" style="margin-bottom: 30px">
130
90
  <DlChip
131
91
  ref="removableChip"
132
92
  removable
@@ -134,41 +94,23 @@
134
94
  />
135
95
  </div>
136
96
  <h4>Chips with no text transform</h4>
137
- <div
138
- class="col"
139
- style="margin-bottom: 30px"
140
- >
97
+ <div class="col" style="margin-bottom: 30px">
141
98
  <DlChip
142
99
  label="ellipsed Chip with a multiple words"
143
- transform="none"
100
+ :transform="noneOption"
144
101
  />
145
102
  </div>
146
103
  <div class="col">
147
- <DlButton
148
- label="remove chip"
149
- @click="removeChip"
150
- />
104
+ <DlButton label="remove chip" @click="removeChip" />
151
105
  </div>
152
106
  <h4>Chips with icon and without label</h4>
153
- <div
154
- class="col"
155
- style="margin-bottom: 30px"
156
- >
107
+ <div class="col" style="margin-bottom: 30px">
157
108
  <DlChip icon="icon-dl-search" />
158
- <DlChip
159
- icon="icon-dl-search"
160
- outlined
161
- />
162
- <DlChip
163
- icon="icon-dl-search"
164
- disabled
165
- />
109
+ <DlChip icon="icon-dl-search" outlined />
110
+ <DlChip icon="icon-dl-search" disabled />
166
111
  </div>
167
112
  <h4>Chips with overflow</h4>
168
- <div
169
- class="col"
170
- style="margin-bottom: 30px"
171
- >
113
+ <div class="col" style="margin-bottom: 30px">
172
114
  <DlChip
173
115
  label="Long Chip Label With Alot Of Text"
174
116
  max-width="75px"
@@ -176,10 +118,7 @@
176
118
  />
177
119
  </div>
178
120
  <h4>Chips with Fit</h4>
179
- <div
180
- class="col"
181
- style="margin-bottom: 30px"
182
- >
121
+ <div class="col" style="margin-bottom: 30px">
183
122
  <DlChip
184
123
  label="Long Chip Label With Alot Of Text"
185
124
  fit
@@ -193,6 +132,7 @@
193
132
  <script lang="ts">
194
133
  import { defineComponent, ref } from 'vue-demi'
195
134
  import { DlChip, DlButton } from '../components'
135
+ import { DlTextTransformOptions } from '../types'
196
136
  export default defineComponent({
197
137
  name: 'DlChipDemo',
198
138
  components: {
@@ -200,13 +140,13 @@ export default defineComponent({
200
140
  DlButton
201
141
  },
202
142
  setup() {
203
- const log = (e: Event) => console.log(e)
143
+ const log = (e: any) => console.log(e)
204
144
  const removableValue = ref(true)
205
- return { log, removableValue }
145
+ return { log, removableValue, noneOption: DlTextTransformOptions.NONE }
206
146
  },
207
147
  methods: {
208
148
  removeChip() {
209
- (this.$refs.removableChip as any).remove()
149
+ ;(this.$refs.removableChip as any).remove()
210
150
  }
211
151
  }
212
152
  })
@@ -49,7 +49,7 @@
49
49
  'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
50
50
  },
51
51
  {
52
- value: '154h:35m:20s',
52
+ value: 1610015720,
53
53
  text: 'ipsum lorem',
54
54
  subtext:
55
55
  'Cupidatat est labore et nisi do culpa veniam reprehenderit anim consectetur dolor mollit.',
@@ -9,10 +9,7 @@
9
9
  size="s"
10
10
  text-color="dl-color-darker"
11
11
  >
12
- <dl-list
13
- bordered
14
- separator
15
- >
12
+ <dl-list bordered separator>
16
13
  <dl-list-item
17
14
  v-for="item in items"
18
15
  :key="item.id"
@@ -31,7 +28,7 @@
31
28
  </template>
32
29
 
33
30
  <script lang="ts">
34
- import { defineComponent } from 'vue-demi'
31
+ import { defineComponent, PropType } from 'vue-demi'
35
32
  import {
36
33
  DlDropdownButton,
37
34
  DlList,
@@ -49,13 +46,13 @@ export default defineComponent({
49
46
  },
50
47
  props: {
51
48
  items: {
52
- type: Array,
49
+ type: Array as PropType<Record<string, any>[]>,
53
50
  default: () => [] as Record<string, any>[]
54
51
  }
55
52
  },
56
53
  emits: ['onChange'],
57
54
  setup(props, context) {
58
- const handleOption = (event: Event) => {
55
+ const handleOption = (event: any) => {
59
56
  console.log('click: ', event)
60
57
  context.emit('onChange', event)
61
58
  }
@@ -8,10 +8,7 @@
8
8
  size="s"
9
9
  text-color="dl-color-darker"
10
10
  >
11
- <dl-list
12
- bordered
13
- separator
14
- >
11
+ <dl-list bordered separator>
15
12
  <dl-list-item
16
13
  v-for="item in items"
17
14
  :key="item.id"
@@ -24,10 +21,7 @@
24
21
  <dl-item-section :color="item.labelColor">
25
22
  {{ item.label }}
26
23
  </dl-item-section>
27
- <dl-item-section
28
- v-if="item.children"
29
- side
30
- >
24
+ <dl-item-section v-if="item.children" side>
31
25
  <dl-icon icon="icon-dl-right-chevron" />
32
26
  </dl-item-section>
33
27
  <dl-menu
@@ -36,10 +30,7 @@
36
30
  anchor="top end"
37
31
  self="top start"
38
32
  >
39
- <dl-list
40
- bordered
41
- separator
42
- >
33
+ <dl-list bordered separator>
43
34
  <dl-list-item
44
35
  v-for="itemChildren in item.children"
45
36
  :key="itemChildren.id"
@@ -49,10 +40,7 @@
49
40
  <dl-item-section>
50
41
  {{ itemChildren.label }}
51
42
  </dl-item-section>
52
- <dl-item-section
53
- v-if="itemChildren.icon"
54
- side
55
- >
43
+ <dl-item-section v-if="itemChildren.icon" side>
56
44
  <dl-icon :icon="itemChildren.icon" />
57
45
  </dl-item-section>
58
46
  </dl-list-item>
@@ -64,7 +52,7 @@
64
52
  </template>
65
53
 
66
54
  <script lang="ts">
67
- import { defineComponent } from 'vue-demi'
55
+ import { defineComponent, PropType } from 'vue-demi'
68
56
  import {
69
57
  DlList,
70
58
  DlMenu,
@@ -85,13 +73,13 @@ export default defineComponent({
85
73
  },
86
74
  props: {
87
75
  items: {
88
- type: Array,
76
+ type: Array as PropType<Record<string, any>[]>,
89
77
  default: () => [] as Record<string, any>[]
90
78
  }
91
79
  },
92
80
  emits: ['onChange'],
93
81
  setup(props, context) {
94
- const handleOption = (event: Event) => {
82
+ const handleOption = (event: any) => {
95
83
  console.log('click: ', event)
96
84
  context.emit('onChange', event)
97
85
  }
@@ -16,10 +16,7 @@
16
16
  }"
17
17
  description="text"
18
18
  title="title"
19
- :links="{
20
- title: 'title',
21
- href: image.url
22
- }"
19
+ :links="getLinks(image)"
23
20
  :tags="[
24
21
  {
25
22
  label: 'A',
@@ -56,6 +53,7 @@
56
53
  import { defineComponent, PropType } from 'vue-demi'
57
54
  import { ImageMetadata } from '../types/imageMetadata'
58
55
  import { DlCard } from '../../../../components'
56
+ import { DlCardLinkType } from '../../../../types'
59
57
 
60
58
  export default defineComponent({
61
59
  name: 'CardView',
@@ -64,8 +62,8 @@ export default defineComponent({
64
62
  },
65
63
  props: {
66
64
  items: {
67
- type: Array,
68
- default: () => Array as PropType<ImageMetadata[]>
65
+ type: Array as PropType<ImageMetadata[]>,
66
+ default: (): ImageMetadata[] => [] as ImageMetadata[]
69
67
  }
70
68
  },
71
69
  setup() {
@@ -82,7 +80,15 @@ export default defineComponent({
82
80
  }
83
81
 
84
82
  return {
85
- imageStyles
83
+ imageStyles,
84
+ getLinks: (image: ImageMetadata): DlCardLinkType[] => {
85
+ return [
86
+ {
87
+ title: 'title',
88
+ href: image.url
89
+ }
90
+ ] as DlCardLinkType[]
91
+ }
86
92
  }
87
93
  }
88
94
  })