Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add more input and output docs

Benjamin Bädorf64af5c8779a0
diff --git a/frontend/src/app/spot/components/text-field/text-field.component.ts b/frontend/src/app/spot/components/text-field/text-field.component.ts
index 2c2f9c1dd62..3ae31666c4b 100644
--- a/frontend/src/app/spot/components/text-field/text-field.component.ts
+++ b/frontend/src/app/spot/components/text-field/text-field.component.ts
@@ -49,12 +49,22 @@ export class SpotTextFieldComponent implements ControlValueAccessor {
@Input() @HostBinding('class.spot-text-field_disabled') public disabled = false;
/**
- *
+ * By default, we show a small "x" inside the input on the right hand side if
+ * some value has been set. This is a button that clears the input. Setting this option
+ * to false will not show this clear button.
*/
@Input() showClearButton = true;
+ /**
+ * The placeholder text.
+ * This should never be a label replacement, since placeholders are not properly accessible.
+ */
@Input() public placeholder = '';
+ /**
+ * If you're not using Angular Reactive Forms (Which you should be using!)
+ * then you can manually set the value via this input.
+ */
@Input() public value = '';
valueChanged(value:string):void {
diff --git a/frontend/src/app/spot/components/toggle/toggle.component.ts b/frontend/src/app/spot/components/toggle/toggle.component.ts
index e2d9abf640f..dc26158e9b9 100644
--- a/frontend/src/app/spot/components/toggle/toggle.component.ts
+++ b/frontend/src/app/spot/components/toggle/toggle.component.ts
@@ -31,16 +31,44 @@ export class SpotToggleComponent<T> implements ControlValueAccessor {
@HostBinding('class.spot-toggle') public className = true;
- @Output() valueChange = new EventEmitter<T>();
-
+ /**
+ * The array of options that should be shown. Options have a simple structure:
+ *
+ * ```
+ * {
+ * title:string;
+ * value:T;
+ * }
+ * ```
+ *
+ * `title` will be shown in the toggle for the user to read, while `value` will be the
+ * value that is set as the ngModel if the option is selected.
+ */
@Input() options:SpotToggleOption<T>[] = [];
+ /**
+ * Whether the input should be disabled
+ */
@Input() disabled = false;
+ /**
+ * The name of the input. Will be autogenerated if not given,
+ * but especially useful to provide in a hybrid Rails <-> Angular context
+ * where a submit of a form is handled without JS.
+ */
@Input() name = `spot-toggle-${+(new Date())}`;
+ /**
+ * If you're not using Angular Reactive Forms (Which you should be using!)
+ * then you can manually set the value via this input.
+ */
@Input() public value:T;
+ /**
+ * Emits when the selected value changes.
+ */
+ @Output() valueChange = new EventEmitter<T>();
+
constructor(
private cdRef:ChangeDetectorRef,
) {}
diff --git a/frontend/src/app/spot/components/tooltip/tooltip.component.ts b/frontend/src/app/spot/components/tooltip/tooltip.component.ts
index 4a8671ca838..232b122574b 100644
--- a/frontend/src/app/spot/components/tooltip/tooltip.component.ts
+++ b/frontend/src/app/spot/components/tooltip/tooltip.component.ts
@@ -16,8 +16,16 @@ export class SpotTooltipComponent {
@Input() @HostBinding('class.spot-tooltip_dark') public dark = false;
+ /**
+ * Whether the tooltip should be disabled.
+ * In that case, hovering the trigger element will not do anything.
+ */
@Input() public disabled = false;
+ /**
+ * The alignment of the tooltip. There are twelve alignments in total. You can check which ones they are
+ * from the `SpotDropAlignmentOption` Enum that is available in 'core-app/spot/drop-alignment-options'.
+ */
@Input() public alignment:SpotDropAlignmentOption = SpotDropAlignmentOption.BottomCenter;
get alignmentClass():string {