@manuth/generator-wsc-package
Version:
A Generator for WoltLab Suite Core Packages.
70 lines • 2.04 kB
JavaScript
import { FileUploadMapping } from "../FileMappings/FileUploadMapping.js";
import { ApplicationPrompt } from "./Inquiry/Prompts/ApplicationPrompt.js";
import { LocalInstructionComponent } from "./LocalInstructionComponent.js";
/**
* Provides a component for file-uploads.
*
* @template TSettings
* The type of the settings of the generator.
*
* @template TOptions
* The type of the options of the generator.
*
* @template TComponentOptions
* The type of the options of the component.
*/
export class FileUploadComponentBase extends LocalInstructionComponent {
/**
* Initializes a new instance of the {@link FileUploadComponentBase `FileUploadComponentBase<TSettings, TOptions, TComponentOptions>`} class.
*
* @param generator
* The generator of the component.
*/
constructor(generator) {
super(generator);
}
/**
* Gets the question for asking for the application.
*/
get AppQuestion() {
return {
type: ApplicationPrompt.TypeName,
name: "Application"
};
}
/**
* @inheritdoc
*/
get ComponentOptionQuestionCollection() {
let result = [
this.PathQuestion,
this.AppQuestion,
this.SourceQuestion
];
for (let question of super.ComponentOptionQuestionCollection) {
if (!result.includes(question)) {
result.push(question);
}
}
return result;
}
/**
* @inheritdoc
*/
get InstructionFileMapping() {
return new FileUploadMapping(this);
}
/**
* @inheritdoc
*
* @param options
* The options of the component.
*
* @returns
* The default full name of the path to suggest in the {@link LocalInstructionComponent.SourceQuestion `SourceQuestion`}.
*/
GetDefaultSource(options) {
return this.Generator.assetPath(this.DefaultSourceBaseName, options.Application);
}
}
//# sourceMappingURL=FileUploadComponentBase.js.map