@dataloop-ai/components 0.17.9 → 0.17.10
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
|
@@ -83,25 +83,84 @@ export class Stepper {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @param options { step?: number; preventNext?: boolean }
|
|
89
|
+
* @param options.step The steps to complete
|
|
90
|
+
* @param options.preventNext Prevents the stepper from moving to the next step
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
public completeStep(options: { step?: Step; preventNext?: boolean } = {}) {
|
|
94
|
+
const { step, preventNext } = options
|
|
95
|
+
const stepToComplete = step ?? this.currentStep
|
|
96
|
+
|
|
97
|
+
if (!stepToComplete) {
|
|
98
|
+
return
|
|
99
|
+
}
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
stepToComplete.completed = true
|
|
102
|
+
|
|
103
|
+
if (!preventNext) {
|
|
104
|
+
this.moveToNextStep()
|
|
105
|
+
}
|
|
95
106
|
}
|
|
96
107
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
108
|
+
/**
|
|
109
|
+
* @param message The error message
|
|
110
|
+
* @param options { step?: number; preventNext?: boolean }
|
|
111
|
+
* @param options.step The steps to Fail
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
public failStep(message?: string, options: { step?: Step } = {}) {
|
|
115
|
+
const { step } = options
|
|
116
|
+
const stepToFail = step ?? this.currentStep
|
|
117
|
+
|
|
118
|
+
if (stepToFail) {
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.currentStep.error = message ?? ''
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param message The warning message
|
|
127
|
+
* @param options { step?: number; preventNext?: boolean }
|
|
128
|
+
* @param options.step The steps to Warn
|
|
129
|
+
* @param options.preventNext Prevents the stepper from moving to the next step
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
public setStepWarning(
|
|
133
|
+
message?: string,
|
|
134
|
+
options: { step?: Step; preventNext?: boolean } = {}
|
|
135
|
+
) {
|
|
136
|
+
const { step, preventNext } = options
|
|
137
|
+
const stepToWarn = step ?? this.currentStep
|
|
138
|
+
|
|
139
|
+
if (stepToWarn) {
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this.currentStep.warning = message ?? ''
|
|
144
|
+
|
|
145
|
+
if (!preventNext) {
|
|
146
|
+
this.moveToNextStep()
|
|
147
|
+
}
|
|
101
148
|
}
|
|
102
149
|
|
|
103
|
-
|
|
104
|
-
|
|
150
|
+
/**
|
|
151
|
+
*
|
|
152
|
+
* @param options { step?: number; preventNext?: boolean }
|
|
153
|
+
* @param options.step The steps to reset
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
public resetStep(options: { step?: Step } = {}) {
|
|
157
|
+
const { step } = options
|
|
158
|
+
const stepToReset = step ?? this.currentStep
|
|
159
|
+
|
|
160
|
+
if (stepToReset) {
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
|
|
105
164
|
this.currentStep.reset()
|
|
106
165
|
}
|
|
107
166
|
}
|