@dataloop-ai/components 0.18.4 → 0.18.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.18.4",
3
+ "version": "0.18.6",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -51,24 +51,23 @@ import {
51
51
  } from 'vue-demi'
52
52
  import { getColor, includes } from '../../../utils'
53
53
  import { DlIcon } from '../../essential'
54
+ import { DlAlertType } from './types'
54
55
 
55
- type AlertType = 'info' | 'success' | 'warning' | 'error'
56
-
57
- const typeToIconMap: Record<AlertType, string> = {
56
+ const typeToIconMap: Record<DlAlertType, string> = {
58
57
  info: 'icon-dl-info-filled',
59
58
  success: 'icon-dl-approve-filled',
60
59
  warning: 'icon-dl-alert-filled',
61
60
  error: 'icon-dl-error-filled'
62
61
  }
63
62
 
64
- const typeToIconColorMap: Record<AlertType, string> = {
63
+ const typeToIconColorMap: Record<DlAlertType, string> = {
65
64
  info: 'dl-color-info',
66
65
  success: 'dl-color-positive',
67
66
  warning: 'dl-color-warning',
68
67
  error: 'dl-color-negative'
69
68
  }
70
69
 
71
- const typeToBackgroundMap: Record<AlertType, string> = {
70
+ const typeToBackgroundMap: Record<DlAlertType, string> = {
72
71
  info: 'dl-color-info-background',
73
72
  success: 'dl-color-positive-background',
74
73
  warning: 'dl-color-warning-background',
@@ -115,7 +114,7 @@ export default defineComponent({
115
114
  emits: ['update:model-value'],
116
115
  setup(props, { emit }) {
117
116
  const show = ref(props.modelValue)
118
- const type = props.type as AlertType
117
+ const type = props.type as DlAlertType
119
118
  const typeIcon = typeToIconMap[type]
120
119
  const icon = computed(() => typeToIconMap[type])
121
120
  const iconColor = computed(() => typeToIconColorMap[type])
@@ -0,0 +1 @@
1
+ export type DlAlertType = 'info' | 'success' | 'warning' | 'error'
@@ -8,3 +8,4 @@ export * from './DlWidget/types'
8
8
  export * from './DlButton/types'
9
9
  export * from './DlGrid/types'
10
10
  export * from './DlEmptyState/types'
11
+ export * from './DlAlert/types'
@@ -8,15 +8,7 @@
8
8
  'read-only': readOnly,
9
9
  wrap: wrap
10
10
  }"
11
- :style="{
12
- width: width,
13
- height: height,
14
- zIndex: zIndex,
15
- maxWidth: maxWidth,
16
- minWidth: minWidth,
17
- maxHeight: maxHeight,
18
- minHeight: minHeight
19
- }"
11
+ :style="editorStyle"
20
12
  >
21
13
  <div
22
14
  class="hljs"
@@ -211,7 +203,7 @@ export default defineComponent({
211
203
  },
212
204
  borderRadius: {
213
205
  type: String,
214
- default: '12px'
206
+ default: '0px'
215
207
  },
216
208
  languages: {
217
209
  type: Array as PropType<string[][]>,
@@ -259,7 +251,13 @@ export default defineComponent({
259
251
  height,
260
252
  fontSize,
261
253
  header,
262
- padding
254
+ padding,
255
+ width,
256
+ zIndex,
257
+ minHeight,
258
+ maxHeight,
259
+ minWidth,
260
+ maxWidth
263
261
  } = toRefs(props)
264
262
  const scrollBarWidth = ref(0)
265
263
  const scrollBarHeight = ref(0)
@@ -312,6 +310,18 @@ export default defineComponent({
312
310
  return height.value == 'auto' ? false : true
313
311
  })
314
312
 
313
+ const editorStyle = computed<Record<string, any>>(() => {
314
+ return {
315
+ width: width.value,
316
+ height: height.value,
317
+ zIndex: zIndex.value,
318
+ maxWidth: maxWidth.value,
319
+ minWidth: minWidth.value,
320
+ maxHeight: maxHeight.value,
321
+ minHeight: minHeight.value
322
+ }
323
+ })
324
+
315
325
  watch(contentValue, () => {
316
326
  nextTick(() => {
317
327
  code.value!.textContent = contentValue.value
@@ -520,7 +530,8 @@ export default defineComponent({
520
530
  tab,
521
531
  changeLang,
522
532
  updateValue,
523
- textAreaStyle
533
+ textAreaStyle,
534
+ editorStyle
524
535
  }
525
536
  }
526
537
  })
@@ -232,13 +232,10 @@
232
232
  name="option"
233
233
  :opt="item"
234
234
  >
235
- {{
236
- capitalizedOptions
237
- ? typeof getOptionLabel(item) ===
238
- 'string' &&
239
- getOptionLabel(item).toLowerCase()
240
- : getOptionLabel(item)
241
- }}
235
+ <span
236
+ class="inner-option"
237
+ v-html="getOptionHtml(item)"
238
+ />
242
239
  </slot>
243
240
  </dl-select-option>
244
241
  </dl-virtual-scroll>
@@ -139,11 +139,13 @@ export default defineComponent({
139
139
  const demos: {
140
140
  name: string
141
141
  component: any
142
- }[] = names.map((n: string) => ({
143
- name: n,
144
- // @ts-ignore
145
- component: Demos[n]
146
- }))
142
+ }[] = names
143
+ .map((n: string) => ({
144
+ name: n,
145
+ // @ts-ignore
146
+ component: Demos[n]
147
+ }))
148
+ .sort((a, b) => a.name.localeCompare(b.name))
147
149
 
148
150
  const filteredDemos = computed(() => {
149
151
  if (!filterTerm.value || !filterTerm.value.length) {
@@ -198,7 +200,8 @@ export default defineComponent({
198
200
 
199
201
  <style scoped lang="scss">
200
202
  .layout-wrapper {
201
- display: flex;
203
+ display: grid;
204
+ grid-template-columns: 12% 85%;
202
205
  }
203
206
 
204
207
  .sidebar {
@@ -172,6 +172,7 @@
172
172
  />
173
173
  With Fit
174
174
  <dl-select
175
+ v-model="selectedWithFit"
175
176
  :options="[
176
177
  { label: 'Option 1', value: 1 },
177
178
  { label: 'Option 2, longer one', value: 2 },
@@ -182,10 +183,12 @@
182
183
  searchable
183
184
  capitalized-options
184
185
  fit-content
186
+ @change="logEvent"
185
187
  />
186
188
  With Label and sub label
187
189
  <dl-select
188
190
  v-model="selectedOption"
191
+ searchable
189
192
  :options="[
190
193
  {
191
194
  subLabel: 'not so high',
@@ -487,6 +490,7 @@ export default defineComponent({
487
490
  components: { DlSelect, DlIcon, DlChip, DlBadge },
488
491
  data() {
489
492
  return {
493
+ selectedWithFit: [],
490
494
  selectedOption: {
491
495
  label: 'High',
492
496
  value: 'high',
@@ -537,6 +541,9 @@ export default defineComponent({
537
541
  }
538
542
  },
539
543
  methods: {
544
+ logEvent(e: any) {
545
+ console.log(e)
546
+ },
540
547
  filterFn(val: string) {
541
548
  this.searchOptions = defaultOptions.filter(
542
549
  (v: { label: string; value: string } | undefined) =>