@dataloop-ai/components 0.17.10 → 0.17.11
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
|
@@ -115,11 +115,11 @@ export class Stepper {
|
|
|
115
115
|
const { step } = options
|
|
116
116
|
const stepToFail = step ?? this.currentStep
|
|
117
117
|
|
|
118
|
-
if (stepToFail) {
|
|
118
|
+
if (!stepToFail) {
|
|
119
119
|
return
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
stepToFail.error = message ?? ''
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
@@ -136,11 +136,11 @@ export class Stepper {
|
|
|
136
136
|
const { step, preventNext } = options
|
|
137
137
|
const stepToWarn = step ?? this.currentStep
|
|
138
138
|
|
|
139
|
-
if (stepToWarn) {
|
|
139
|
+
if (!stepToWarn) {
|
|
140
140
|
return
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
stepToWarn.warning = message ?? ''
|
|
144
144
|
|
|
145
145
|
if (!preventNext) {
|
|
146
146
|
this.moveToNextStep()
|
|
@@ -157,10 +157,10 @@ export class Stepper {
|
|
|
157
157
|
const { step } = options
|
|
158
158
|
const stepToReset = step ?? this.currentStep
|
|
159
159
|
|
|
160
|
-
if (stepToReset) {
|
|
160
|
+
if (!stepToReset) {
|
|
161
161
|
return
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
stepToReset.reset()
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -43,31 +43,40 @@ export default defineComponent({
|
|
|
43
43
|
|
|
44
44
|
virtualScrollSliceRatioBefore: {
|
|
45
45
|
type: [Number, String],
|
|
46
|
+
required: false,
|
|
46
47
|
default: 1
|
|
47
48
|
},
|
|
48
49
|
|
|
49
50
|
virtualScrollSliceRatioAfter: {
|
|
50
51
|
type: [Number, String],
|
|
52
|
+
required: false,
|
|
51
53
|
default: 1
|
|
52
54
|
},
|
|
53
55
|
|
|
54
56
|
virtualScrollItemSize: {
|
|
55
57
|
type: [Number, String],
|
|
58
|
+
required: false,
|
|
56
59
|
default: 0
|
|
57
60
|
},
|
|
58
61
|
|
|
59
62
|
virtualScrollStickySizeStart: {
|
|
60
63
|
type: [Number, String],
|
|
64
|
+
required: false,
|
|
61
65
|
default: 0
|
|
62
66
|
},
|
|
63
67
|
|
|
64
68
|
virtualScrollStickySizeEnd: {
|
|
65
69
|
type: [Number, String],
|
|
70
|
+
required: false,
|
|
66
71
|
default: 0
|
|
67
72
|
},
|
|
68
|
-
tableColspan: [Number, String],
|
|
69
|
-
virtualScrollHorizontal:
|
|
70
|
-
|
|
73
|
+
tableColspan: { type: [Number, String], required: false, default: 1 },
|
|
74
|
+
virtualScrollHorizontal: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
required: false,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
onVirtualScroll: { type: Function, default: null },
|
|
71
80
|
items: {
|
|
72
81
|
type: Array,
|
|
73
82
|
default: () => [] as Record<string, any>[]
|
|
@@ -80,11 +89,12 @@ export default defineComponent({
|
|
|
80
89
|
typeOptions.includes(v)
|
|
81
90
|
},
|
|
82
91
|
|
|
83
|
-
itemsFn: { type: Function, default:
|
|
92
|
+
itemsFn: { type: Function, default: null },
|
|
84
93
|
itemsSize: { type: Number, default: 0 },
|
|
85
94
|
|
|
86
95
|
scrollTarget: {
|
|
87
|
-
|
|
96
|
+
type: [String, Object],
|
|
97
|
+
default: null
|
|
88
98
|
}
|
|
89
99
|
},
|
|
90
100
|
emits: ['virtual-scroll'],
|
|
@@ -92,8 +102,10 @@ export default defineComponent({
|
|
|
92
102
|
let localScrollTarget: HTMLElement | undefined
|
|
93
103
|
const rootRef: Ref<HTMLElement | null> = ref(null)
|
|
94
104
|
|
|
105
|
+
const isDefined = (v: any) => v !== undefined && v !== null
|
|
106
|
+
|
|
95
107
|
const virtualScrollLength = computed(() => {
|
|
96
|
-
return props.itemsSize >= 0 && props.itemsFn
|
|
108
|
+
return props.itemsSize >= 0 && isDefined(props.itemsFn)
|
|
97
109
|
? parseInt(props.itemsSize as unknown as string, 10)
|
|
98
110
|
: Array.isArray(props.items)
|
|
99
111
|
? props.items.length
|
|
@@ -121,20 +133,21 @@ export default defineComponent({
|
|
|
121
133
|
item
|
|
122
134
|
})
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
const itemsFn = props.itemsFn as Function
|
|
137
|
+
const items = props.items as Record<string, any>[]
|
|
138
|
+
|
|
139
|
+
return isDefined(itemsFn)
|
|
140
|
+
? itemsFn(
|
|
141
|
+
virtualScrollSliceRange.value.from,
|
|
142
|
+
virtualScrollSliceRange.value.to -
|
|
143
|
+
virtualScrollSliceRange.value.from
|
|
144
|
+
).map(mapFn)
|
|
145
|
+
: items
|
|
126
146
|
.slice(
|
|
127
147
|
virtualScrollSliceRange.value.from,
|
|
128
148
|
virtualScrollSliceRange.value.to
|
|
129
149
|
)
|
|
130
150
|
.map(mapFn)
|
|
131
|
-
: props
|
|
132
|
-
.itemsFn(
|
|
133
|
-
virtualScrollSliceRange.value.from,
|
|
134
|
-
virtualScrollSliceRange.value.to -
|
|
135
|
-
virtualScrollSliceRange.value.from
|
|
136
|
-
)
|
|
137
|
-
.map(mapFn)
|
|
138
151
|
})
|
|
139
152
|
|
|
140
153
|
const classes = computed(
|
|
@@ -143,11 +156,11 @@ export default defineComponent({
|
|
|
143
156
|
(props.virtualScrollHorizontal === true
|
|
144
157
|
? '--horizontal'
|
|
145
158
|
: '--vertical') +
|
|
146
|
-
(props.scrollTarget
|
|
159
|
+
(isDefined(props.scrollTarget) ? '' : ' scroll')
|
|
147
160
|
)
|
|
148
161
|
|
|
149
162
|
const attributes = computed(() =>
|
|
150
|
-
props.scrollTarget
|
|
163
|
+
isDefined(props.scrollTarget) ? {} : { tabindex: 0 }
|
|
151
164
|
)
|
|
152
165
|
|
|
153
166
|
watch(virtualScrollLength, () => {
|
|
@@ -173,7 +186,7 @@ export default defineComponent({
|
|
|
173
186
|
function configureScrollTarget() {
|
|
174
187
|
localScrollTarget = getScrollTarget(
|
|
175
188
|
getVirtualScrollEl(),
|
|
176
|
-
props.scrollTarget
|
|
189
|
+
props.scrollTarget as any
|
|
177
190
|
)
|
|
178
191
|
|
|
179
192
|
localScrollTarget!.addEventListener(
|
|
@@ -184,13 +197,13 @@ export default defineComponent({
|
|
|
184
197
|
}
|
|
185
198
|
|
|
186
199
|
function unconfigureScrollTarget() {
|
|
187
|
-
if (localScrollTarget
|
|
200
|
+
if (isDefined(localScrollTarget)) {
|
|
188
201
|
localScrollTarget.removeEventListener(
|
|
189
202
|
'scroll',
|
|
190
203
|
onVirtualScrollEvt,
|
|
191
204
|
listenOpts.passive
|
|
192
205
|
)
|
|
193
|
-
localScrollTarget =
|
|
206
|
+
localScrollTarget = null
|
|
194
207
|
}
|
|
195
208
|
}
|
|
196
209
|
|
|
@@ -203,7 +216,7 @@ export default defineComponent({
|
|
|
203
216
|
create
|
|
204
217
|
)
|
|
205
218
|
|
|
206
|
-
if (slots.before
|
|
219
|
+
if (isDefined(slots.before)) {
|
|
207
220
|
child = slots.before().concat(child)
|
|
208
221
|
}
|
|
209
222
|
|
|
@@ -245,6 +258,12 @@ export default defineComponent({
|
|
|
245
258
|
}
|
|
246
259
|
},
|
|
247
260
|
render(createElement: Function) {
|
|
261
|
+
/**
|
|
262
|
+
* Had to do some general Typescript hackery here to get this to work in webpack based builder project.
|
|
263
|
+
* The original code is written in Vue 2, but this project is using Vue 3.
|
|
264
|
+
* Some of the types are not compatible, so I had to cast some of the types to any.
|
|
265
|
+
*/
|
|
266
|
+
|
|
248
267
|
const renderFn = isVue2 ? createElement : h
|
|
249
268
|
const renderSlot = (fn: Function) => (isVue2 ? fn() : () => fn())
|
|
250
269
|
|
|
@@ -255,25 +274,36 @@ export default defineComponent({
|
|
|
255
274
|
return
|
|
256
275
|
}
|
|
257
276
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
+
const isDlTable = (this.$props as any).type === '__dltable'
|
|
278
|
+
const getVirtualChildren = (this as any).getVirtualChildren as Function
|
|
279
|
+
|
|
280
|
+
if (isDlTable) {
|
|
281
|
+
return getTableMiddle(
|
|
282
|
+
{
|
|
283
|
+
ref: 'rootRef',
|
|
284
|
+
class: 'dl-table__middle ' + this.classes
|
|
285
|
+
},
|
|
286
|
+
getVirtualChildren(renderFn),
|
|
287
|
+
renderFn
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const attrs = this.attrs as Record<string, any>
|
|
292
|
+
const attributes = this.attributes as Record<string, any>
|
|
293
|
+
const classes = this.classes as string // todo: does this have to be casted to an object?
|
|
294
|
+
const attributeClasses = attrs.class as Record<string, any>
|
|
295
|
+
const tag = this.tag as string
|
|
296
|
+
|
|
297
|
+
return renderFn(
|
|
298
|
+
tag,
|
|
299
|
+
{
|
|
300
|
+
...attrs,
|
|
301
|
+
ref: 'rootRef',
|
|
302
|
+
class: [attributeClasses, classes],
|
|
303
|
+
...attributes
|
|
304
|
+
},
|
|
305
|
+
renderSlot(() => getVirtualChildren(renderFn))
|
|
306
|
+
)
|
|
277
307
|
}
|
|
278
308
|
})
|
|
279
309
|
</script>
|