@omnia/tooling-vue 8.0.241-dev → 8.0.243-dev
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.
|
@@ -201,12 +201,27 @@ function extractTypes(types, componentInfo) {
|
|
|
201
201
|
// if(!type)console.log(filePath, name, params[1])
|
|
202
202
|
const required = params.length > 2 ? extractTypeValue(params[2]) : false;
|
|
203
203
|
const defaultValue = params.length > 3 ? extractTypeValue(params[3], true) : undefined;
|
|
204
|
-
|
|
204
|
+
let disableAutoEmit = false;
|
|
205
|
+
let description = "";
|
|
206
|
+
if (typeName === "DefineVModel") {
|
|
207
|
+
disableAutoEmit = params.length > 4 ? extractTypeValue(params[4]) : false;
|
|
208
|
+
description = params.length > 5 ? extractTypeValue(params[5]) : "";
|
|
209
|
+
}
|
|
210
|
+
else if (typeName === "DefineProp" && params.length > 4) {
|
|
211
|
+
description = extractTypeValue(params[4]);
|
|
212
|
+
}
|
|
205
213
|
const info = {
|
|
206
214
|
type: type,
|
|
207
|
-
description: description,
|
|
208
|
-
required: required.toString().toLowerCase() === "true" ? true : false
|
|
209
215
|
};
|
|
216
|
+
if (description.length > 0) {
|
|
217
|
+
info.description = description;
|
|
218
|
+
}
|
|
219
|
+
if (required.toString().toLowerCase() === "true") {
|
|
220
|
+
info.required = true;
|
|
221
|
+
}
|
|
222
|
+
if (disableAutoEmit.toString().toLowerCase() === "true") {
|
|
223
|
+
info.disableAutoEmit = true;
|
|
224
|
+
}
|
|
210
225
|
if (defaultValue !== undefined && defaultValue !== "null") {
|
|
211
226
|
info.defaultValue = defaultValue;
|
|
212
227
|
}
|
|
@@ -217,25 +232,22 @@ function extractTypes(types, componentInfo) {
|
|
|
217
232
|
componentInfo.props[name] = info;
|
|
218
233
|
}
|
|
219
234
|
}
|
|
220
|
-
else if (typeName === "DefineEmit") {
|
|
235
|
+
else if (typeName === "DefineEmit" || typeName === "DefineSlot") {
|
|
221
236
|
const params = t.typeParams.params;
|
|
222
237
|
const name = extractTypeValue(params[0]);
|
|
223
238
|
const type = extractTypeValue(params[1]);
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
type: type,
|
|
237
|
-
description: description,
|
|
238
|
-
};
|
|
239
|
+
const info = typeName === "DefineEmit" ? componentInfo.emits : componentInfo.slots;
|
|
240
|
+
if (params.length > 2) {
|
|
241
|
+
info[name] = {
|
|
242
|
+
type: type,
|
|
243
|
+
description: extractTypeValue(params[2]),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
info[name] = {
|
|
248
|
+
type: type
|
|
249
|
+
};
|
|
250
|
+
}
|
|
239
251
|
}
|
|
240
252
|
});
|
|
241
253
|
}
|
|
@@ -253,7 +265,15 @@ function convertComponentOptionsToString(component) {
|
|
|
253
265
|
result = `${result} ${name}:${component.props[name].defaultValue !== undefined && component.props[name].defaultValue !== "null" ? `{default: ${component.props[name].defaultValue}},` : "{},"}`;
|
|
254
266
|
});
|
|
255
267
|
Object.keys(component.models).forEach(name => {
|
|
256
|
-
|
|
268
|
+
let propResult = "{";
|
|
269
|
+
if (component.models[name].defaultValue !== undefined && component.models[name].defaultValue !== "null") {
|
|
270
|
+
propResult = `${propResult}default: ${component.models[name].defaultValue},`;
|
|
271
|
+
}
|
|
272
|
+
if (component.models[name].disableAutoEmit) {
|
|
273
|
+
propResult = `${propResult}disableAutoEmit: true,`;
|
|
274
|
+
}
|
|
275
|
+
propResult = `${propResult}},`;
|
|
276
|
+
result = `${result} ${name}:${propResult}`;
|
|
257
277
|
});
|
|
258
278
|
return result;
|
|
259
279
|
}
|