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

Rename spot-text-field to spot-input-field to allow more types than just text

Henriette Dargeec80d044e9a7
diff --git a/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.html b/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.html
index 505cd6ef496..4a1b07237a6 100644
--- a/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.html
+++ b/frontend/src/app/features/team-planner/team-planner/add-work-packages/add-existing-pane.component.html
@@ -1,4 +1,4 @@
-<spot-text-field
+<spot-input-field
[ngModel]="searchString$ | async"
(ngModelChange)="searchString$.next($event)"
data-qa-selector="op-add-existing-pane--search-input"
@@ -8,7 +8,7 @@
slot="before"
class="spot-icon spot-icon_search"
></span>
-</spot-text-field>
+</spot-input-field>
<ng-container
*ngIf="(isLoading$ | async) === false; else loadingTemplate"
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
index ed29e896329..2c8063d2282 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html
@@ -33,7 +33,7 @@
</label>
<div class="form--field-container">
<div class="form--text-field-container op-datepicker-modal--date-container">
- <spot-text-field
+ <spot-input-field
name="startDate"
data-qa-selector="op-datepicker-modal--start-date-field"
class="op-datepicker-modal--date-field"
@@ -43,7 +43,7 @@
[disabled]="!isSchedulable"
[showClearButton]="currentlyActivatedDateField === 'end'"
(focusin)="setCurrentActivatedField('start')"
- ></spot-text-field>
+ ></spot-input-field>
</div>
</div>
<div class="form--field-extra-actions">
@@ -61,7 +61,7 @@
</label>
<div class="form--field-container">
<div class="form--text-field-container op-datepicker-modal--date-container">
- <spot-text-field
+ <spot-input-field
name="endDate"
data-qa-selector="op-datepicker-modal--end-date-field"
class="op-datepicker-modal--date-field"
@@ -71,7 +71,7 @@
[disabled]="!isSchedulable"
[showClearButton]="currentlyActivatedDateField === 'end'"
(focusin)="setCurrentActivatedField('end')"
- ></spot-text-field>
+ ></spot-input-field>
</div>
</div>
<div class="form--field-extra-actions">
@@ -89,7 +89,7 @@
</label>
<div class="form--field-container">
<div class="form--text-field-container op-datepicker-modal--date-container">
- <spot-text-field
+ <spot-input-field
name="duration"
data-qa-selector="op-datepicker-modal--duration-field"
class="op-datepicker-modal--date-field"
@@ -99,7 +99,7 @@
[disabled]="!isSchedulable"
(focusin)="handleDurationFocusIn()"
(focusout)="handleDurationFocusOut()"
- ></spot-text-field>
+ ></spot-input-field>
</div>
</div>
</div>
diff --git a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
index 650c9afc010..4c5c66c67fb 100644
--- a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
+++ b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.html
@@ -31,14 +31,14 @@
</label>
<div class="form--field-container">
<div class="form--text-field-container op-datepicker-modal--date-container">
- <spot-text-field
+ <spot-input-field
name="date"
class="op-datepicker-modal--date-field"
[ngClass]="{ 'op-datepicker-modal--date-field_current': this.dateModalScheduling.isSchedulable }"
[(ngModel)]="date"
(ngModelChange)="dateChangedManually$.next()"
[showClearButton]="true"
- ></spot-text-field>
+ ></spot-input-field>
</div>
</div>
<div class="form--field-extra-actions">
diff --git a/frontend/src/app/shared/components/header-project-select/header-project-select.component.html b/frontend/src/app/shared/components/header-project-select/header-project-select.component.html
index b13f0896bef..3942151fa30 100644
--- a/frontend/src/app/shared/components/header-project-select/header-project-select.component.html
+++ b/frontend/src/app/shared/components/header-project-select/header-project-select.component.html
@@ -32,7 +32,7 @@
class="op-project-list-modal--body spot-container"
*ngIf="projects$ | async as projects"
>
- <spot-text-field
+ <spot-input-field
[placeholder]="text.search_placeholder"
[(ngModel)]="searchableProjectListService.searchText"
[ngModelOptions]="{standalone: true}"
@@ -46,7 +46,7 @@
slot="before"
class="spot-icon spot-icon_search"
></span>
- </spot-text-field>
+ </spot-input-field>
<ng-container *ngIf="(loading$ | async) === false; else loadingTemplate">
<ul
diff --git a/frontend/src/app/shared/components/project-include/project-include.component.html b/frontend/src/app/shared/components/project-include/project-include.component.html
index c7f12a47a9b..f78f7cab82a 100644
--- a/frontend/src/app/shared/components/project-include/project-include.component.html
+++ b/frontend/src/app/shared/components/project-include/project-include.component.html
@@ -34,7 +34,7 @@
class="spot-container op-project-list-modal--body"
*ngIf="projects$ | async as projects"
>
- <spot-text-field
+ <spot-input-field
[placeholder]="text.search_placeholder"
name="project-include-search"
[(ngModel)]="searchableProjectListService.searchText"
@@ -50,7 +50,7 @@
slot="before"
class="spot-icon spot-icon_search"
></span>
- </spot-text-field>
+ </spot-input-field>
<ng-container *ngIf="(loading$ | async) === false; else loadingTemplate">
<ul
diff --git a/frontend/src/app/spot/components/text-field/text-field.component.html b/frontend/src/app/spot/components/input-field/input-field.component.html
similarity index 82%
rename from frontend/src/app/spot/components/text-field/text-field.component.html
rename to frontend/src/app/spot/components/input-field/input-field.component.html
index f4f78fb949d..d837433931e 100644
--- a/frontend/src/app/spot/components/text-field/text-field.component.html
+++ b/frontend/src/app/spot/components/input-field/input-field.component.html
@@ -1,10 +1,11 @@
<ng-content select="[slot=before]"></ng-content>
<input
- class="spot-text-field--input"
+ class="spot-input-field--input"
[attr.name]="name"
[disabled]="disabled"
[placeholder]="placeholder"
[(ngModel)]="value"
+ [type]="type"
(focus)="onInputFocus($event)"
(blur)="onInputBlur($event)"
#input
@@ -13,7 +14,7 @@
*ngIf="showClearButton && value !== '' && !disabled"
(click)="value = ''"
type="button"
- class="spot-text-field--clear-button"
+ class="spot-input-field--clear-button"
>
<span class="spot-icon spot-icon_close"></span>
</button>
diff --git a/frontend/src/app/spot/components/text-field/text-field.component.ts b/frontend/src/app/spot/components/input-field/input-field.component.ts
similarity index 70%
rename from frontend/src/app/spot/components/text-field/text-field.component.ts
rename to frontend/src/app/spot/components/input-field/input-field.component.ts
index b594f5d626a..2e217e7f535 100644
--- a/frontend/src/app/spot/components/text-field/text-field.component.ts
+++ b/frontend/src/app/spot/components/input-field/input-field.component.ts
@@ -11,19 +11,21 @@ import {
} from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
+type AllowedInputTypes = 'text'|'number';
+
@Component({
- selector: 'spot-text-field',
- templateUrl: './text-field.component.html',
+ selector: 'spot-input-field',
+ templateUrl: './input-field.component.html',
providers: [{
provide: NG_VALUE_ACCESSOR,
- useExisting: forwardRef(() => SpotTextFieldComponent),
+ useExisting: forwardRef(() => SpotInputFieldComponent),
multi: true,
}],
})
-export class SpotTextFieldComponent implements ControlValueAccessor {
- @HostBinding('class.spot-text-field') public className = true;
+export class SpotInputFieldComponent implements ControlValueAccessor {
+ @HostBinding('class.spot-input-field') public className = true;
- @HostBinding('class.spot-text-field_focused') public focused = false;
+ @HostBinding('class.spot-input-field_focused') public focused = false;
@HostListener('click') public onParentClick() {
this.input.nativeElement.focus();
@@ -31,14 +33,16 @@ export class SpotTextFieldComponent implements ControlValueAccessor {
@ViewChild('input') public input:ElementRef;
- @Input() name = `spot-text-field-${+(new Date())}`;
+ @Input() name = `spot-input-field-${+(new Date())}`;
- @HostBinding('class.spot-text-field_disabled') @Input() disabled = false;
+ @HostBinding('class.spot-input-field_disabled') @Input() disabled = false;
@Input() showClearButton = true;
@Input() public placeholder = '';
+ @Input() public type:AllowedInputTypes = 'text';
+
@Input('value') public _value = '';
get value():string {
diff --git a/frontend/src/app/spot/spot-docs.component.html b/frontend/src/app/spot/spot-docs.component.html
index 6cb86de62fd..c2300dc6e5f 100644
--- a/frontend/src/app/spot/spot-docs.component.html
+++ b/frontend/src/app/spot/spot-docs.component.html
@@ -368,31 +368,31 @@ Currently selected value is {{ toggleValue }}
></spot-filter-chip>
</section>
-<h1>Text Field</h1>
+<h1>Input Field</h1>
<section class="space-children">
<input
- class="spot-text-field"
+ class="spot-input-field"
placeholder="Placeholder value"
/>
<input
- class="spot-text-field"
+ class="spot-input-field"
value="Test value"
/>
- <spot-text-field
+ <spot-input-field
placeholder="Placeholder value"
value="Test value"
name="textfield-name"
- ></spot-text-field>
+ ></spot-input-field>
- <spot-text-field
+ <spot-input-field
placeholder="Placeholder value"
[(ngModel)]="textFieldValue"
- ></spot-text-field>
+ ></spot-input-field>
- <spot-text-field
+ <spot-input-field
placeholder="Placeholder value"
[(ngModel)]="textFieldValue"
>
@@ -400,9 +400,9 @@ Currently selected value is {{ toggleValue }}
slot="after"
class="spot-icon spot-icon_bell"
></span>
- </spot-text-field>
+ </spot-input-field>
- <spot-text-field
+ <spot-input-field
placeholder="Placeholder value"
[(ngModel)]="textFieldValue"
>
@@ -414,9 +414,9 @@ Currently selected value is {{ toggleValue }}
slot="after"
class="spot-icon spot-icon_bell"
></span>
- </spot-text-field>
+ </spot-input-field>
- <spot-text-field
+ <spot-input-field
placeholder="Placeholder value"
[(ngModel)]="textFieldValue"
>
@@ -424,7 +424,15 @@ Currently selected value is {{ toggleValue }}
slot="before"
class="spot-icon spot-icon_bell"
></span>
- </spot-text-field>
+ </spot-input-field>
+
+ <spot-input-field
+ placeholder="Placeholder number"
+ [(ngModel)]="numberFieldValue"
+ [type]="'number'"
+ >
+ </spot-input-field>
+
</section>
<h1>Drop Modal</h1>
@@ -459,7 +467,7 @@ Currently selected value is {{ toggleValue }}
<div class="spot-container">
<h1 class="spot-header-small">Test</h1>
- <spot-text-field
+ <spot-input-field
placeholder="Placeholder value"
[(ngModel)]="textFieldValue"
>
@@ -467,7 +475,7 @@ Currently selected value is {{ toggleValue }}
slot="before"
class="spot-icon spot-icon_bell"
></span>
- </spot-text-field>
+ </spot-input-field>
</div>
</ng-container>
</spot-drop-modal>
diff --git a/frontend/src/app/spot/spot-docs.component.ts b/frontend/src/app/spot/spot-docs.component.ts
index 2dff05bcd39..278a06e7ff2 100644
--- a/frontend/src/app/spot/spot-docs.component.ts
+++ b/frontend/src/app/spot/spot-docs.component.ts
@@ -15,6 +15,8 @@ export class SpotDocsComponent {
textFieldValue = 'ngModel value';
+ numberFieldValue = 42;
+
dropModalOpen = false;
dropModalAlignment = 'bottom-left';
diff --git a/frontend/src/app/spot/spot.module.ts b/frontend/src/app/spot/spot.module.ts
index 0d872fdd554..642fc6021a4 100644
--- a/frontend/src/app/spot/spot.module.ts
+++ b/frontend/src/app/spot/spot.module.ts
@@ -6,11 +6,11 @@ import { UIRouterModule } from '@uirouter/angular';
import { SPOT_DOCS_ROUTES } from './spot.routes';
import { SpotCheckboxComponent } from './components/checkbox/checkbox.component';
import { SpotToggleComponent } from './components/toggle/toggle.component';
-import { SpotTextFieldComponent } from './components/text-field/text-field.component';
import { SpotFilterChipComponent } from './components/filter-chip/filter-chip.component';
import { SpotDropModalComponent } from './components/drop-modal/drop-modal.component';
import { SpotTooltipComponent } from './components/tooltip/tooltip.component';
import { SpotDocsComponent } from './spot-docs.component';
+import { SpotInputFieldComponent } from 'core-app/spot/components/input-field/input-field.component';
@NgModule({
imports: [
@@ -25,7 +25,7 @@ import { SpotDocsComponent } from './spot-docs.component';
SpotCheckboxComponent,
SpotToggleComponent,
- SpotTextFieldComponent,
+ SpotInputFieldComponent,
SpotFilterChipComponent,
SpotDropModalComponent,
SpotTooltipComponent,
@@ -33,7 +33,7 @@ import { SpotDocsComponent } from './spot-docs.component';
exports: [
SpotCheckboxComponent,
SpotToggleComponent,
- SpotTextFieldComponent,
+ SpotInputFieldComponent,
SpotFilterChipComponent,
SpotDropModalComponent,
SpotTooltipComponent,
diff --git a/frontend/src/app/spot/styles/sass/common/container.sass b/frontend/src/app/spot/styles/sass/common/container.sass
index b2228a7a347..82403dea5a9 100644
--- a/frontend/src/app/spot/styles/sass/common/container.sass
+++ b/frontend/src/app/spot/styles/sass/common/container.sass
@@ -9,7 +9,7 @@
> .spot-body-big,
> .spot-body-small,
> .spot-caption,
- > .spot-text-field
+ > .spot-input-field
margin: 0 $spot-spacing-1
margin-top: $spot-spacing-1
diff --git a/frontend/src/app/spot/styles/sass/components/index.sass b/frontend/src/app/spot/styles/sass/components/index.sass
index afd751e1241..736cc440cdf 100644
--- a/frontend/src/app/spot/styles/sass/components/index.sass
+++ b/frontend/src/app/spot/styles/sass/components/index.sass
@@ -4,7 +4,7 @@
@import './link'
@import './toggle'
@import './checkbox'
-@import './text-field'
+@import './input-field'
@import './filter-chip'
@import './drop-modal'
@import './list'
diff --git a/frontend/src/app/spot/styles/sass/components/text-field.sass b/frontend/src/app/spot/styles/sass/components/input-field.sass
similarity index 98%
rename from frontend/src/app/spot/styles/sass/components/text-field.sass
rename to frontend/src/app/spot/styles/sass/components/input-field.sass
index 54a03c409f0..9d0248c69ba 100644
--- a/frontend/src/app/spot/styles/sass/components/text-field.sass
+++ b/frontend/src/app/spot/styles/sass/components/input-field.sass
@@ -1,4 +1,4 @@
-.spot-text-field
+.spot-input-field
@include spot-body-small
border: 1px solid $spot-color-basic-gray-3
diff --git a/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_mixins.scss b/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_mixins.scss
index d016288e9d6..ccd462fabf0 100644
--- a/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_mixins.scss
+++ b/frontend/src/global_styles/vendor/foundation-apps/scss/helpers/_mixins.scss
@@ -120,4 +120,4 @@
clip: auto;
}
-$text-input-selectors: 'input[type="text"], input[type="password"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="month"], input[type="week"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], input[type="time"], input[type="url"], input[type="color"], textarea';
+$text-input-selectors: 'input[type="text"]:not(.spot-input-field--input), input[type="password"]:not(.spot-input-field--input), input[type="date"]:not(.spot-input-field--input), input[type="datetime"]:not(.spot-input-field--input), input[type="datetime-local"]:not(.spot-input-field--input), input[type="month"]:not(.spot-input-field--input), input[type="week"]:not(.spot-input-field--input), input[type="email"]:not(.spot-input-field--input), input[type="number"]:not(.spot-input-field--input), input[type="search"]:not(.spot-input-field--input), input[type="tel"]:not(.spot-input-field--input), input[type="time"]:not(.spot-input-field--input), input[type="url"]:not(.spot-input-field--input), input[type="color"]:not(.spot-input-field--input), textarea';