diff --git a/frontend/projects/ui/src/app/components/form-object/form-label.component.html b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html similarity index 82% rename from frontend/projects/ui/src/app/components/form-object/form-label.component.html rename to frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html index 0827348ad..2095516ad 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-label.component.html +++ b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html @@ -2,7 +2,7 @@ *ngIf="data.description" class="slot-start" fill="clear" - (click)="presentAlertDescription($event)" + (click.stop)="presentAlertDescription()" > @@ -13,4 +13,4 @@  (New Options)  (Edited) -  * + * diff --git a/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.scss b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.scss new file mode 100644 index 000000000..99e8f5d91 --- /dev/null +++ b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.scss @@ -0,0 +1,9 @@ +:host { + display: flex; + align-items: center; +} + +.slot-start { + --padding-start: 0; + --padding-end: 7px; +} diff --git a/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts new file mode 100644 index 000000000..45b7a0144 --- /dev/null +++ b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts @@ -0,0 +1,35 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core' +import { AlertController } from '@ionic/angular' + +@Component({ + selector: 'form-label', + templateUrl: './form-label.component.html', + styleUrls: ['./form-label.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class FormLabelComponent { + @Input() data!: { + name: string + new: boolean + edited: boolean + description?: string + required?: boolean + newOptions?: boolean + } + + constructor(private readonly alertCtrl: AlertController) {} + + async presentAlertDescription() { + const alert = await this.alertCtrl.create({ + header: this.data.name, + message: this.data.description, + buttons: [ + { + text: 'OK', + cssClass: 'enter-click', + }, + ], + }) + await alert.present() + } +} diff --git a/frontend/projects/ui/src/app/components/form-object/form-object.component.scss b/frontend/projects/ui/src/app/components/form-object/form-object.component.scss deleted file mode 100644 index a98a0ff72..000000000 --- a/frontend/projects/ui/src/app/components/form-object/form-object.component.scss +++ /dev/null @@ -1,42 +0,0 @@ -.slot-start { - display: inline-block; - vertical-align: middle; - --padding-start: 0; - --padding-end: 7px; -} - -.error-border { - border-color: var(--ion-color-danger-shade); - --border-color: var(--ion-color-danger-shade); -} - -.redacted { - font-family: 'Redacted' -} - -ion-input { - font-family: 'Courier New'; - font-weight: bold; - --placeholder-font-weight: 400; -} - -ion-item-divider { - text-transform: unset; - --padding-top: 18px; - --padding-start: 0; - border-bottom: 1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13)))) -} - -.nested-wrapper { - padding: 0 0 16px 24px; -} - -.error-message { - margin-top: 2px; - font-size: small; - color: var(--ion-color-danger); -} - -.indent { - margin-left: 24px; -} \ No newline at end of file diff --git a/frontend/projects/ui/src/app/components/form-object/form-object.component.module.ts b/frontend/projects/ui/src/app/components/form-object/form-object.module.ts similarity index 81% rename from frontend/projects/ui/src/app/components/form-object/form-object.component.module.ts rename to frontend/projects/ui/src/app/components/form-object/form-object.module.ts index 06af388c0..229015290 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-object.component.module.ts +++ b/frontend/projects/ui/src/app/components/form-object/form-object.module.ts @@ -1,10 +1,15 @@ -import { NgModule } from '@angular/core' import { CommonModule } from '@angular/common' -import { - FormObjectComponent, - FormUnionComponent, - FormLabelComponent, -} from './form-object.component' +import { NgModule } from '@angular/core' +import { FormsModule, ReactiveFormsModule } from '@angular/forms' +import { IonicModule } from '@ionic/angular' +import { SharedPipesModule } from '@start9labs/shared' +import { TuiElasticContainerModule } from '@taiga-ui/kit' +import { TuiExpandModule } from '@taiga-ui/core' +import { EnumListPageModule } from 'src/app/modals/enum-list/enum-list.module' + +import { FormLabelComponent } from './form-label/form-label.component' +import { FormObjectComponent } from './form-object/form-object.component' +import { FormUnionComponent } from './form-union/form-union.component' import { GetErrorPipe, ToWarningTextPipe, @@ -13,12 +18,6 @@ import { ToEnumListDisplayPipe, ToRangePipe, } from './form-object.pipes' -import { IonicModule } from '@ionic/angular' -import { FormsModule, ReactiveFormsModule } from '@angular/forms' -import { SharedPipesModule } from '@start9labs/shared' -import { TuiElasticContainerModule } from '@taiga-ui/kit' -import { EnumListPageModule } from 'src/app/modals/enum-list/enum-list.module' -import { TuiExpandModule } from '@taiga-ui/core' @NgModule({ declarations: [ @@ -44,4 +43,4 @@ import { TuiExpandModule } from '@taiga-ui/core' ], exports: [FormObjectComponent, FormLabelComponent], }) -export class FormObjectComponentModule {} +export class FormObjectModule {} diff --git a/frontend/projects/ui/src/app/components/form-object/form-object.pipes.ts b/frontend/projects/ui/src/app/components/form-object/form-object.pipes.ts index 49af5c307..8a8ad74f0 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-object.pipes.ts +++ b/frontend/projects/ui/src/app/components/form-object/form-object.pipes.ts @@ -8,7 +8,7 @@ import { import { IonicSafeString } from '@ionic/angular' import { ListValueSpecOf } from 'start-sdk/types/config-types' import { Range } from 'src/app/util/config-utilities' -import { getElementId } from './form-object.component' +import { getElementId } from './form-object/form-object.component' @Pipe({ name: 'getError', diff --git a/frontend/projects/ui/src/app/components/form-object/form-object.component.html b/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html similarity index 99% rename from frontend/projects/ui/src/app/components/form-object/form-object.component.html rename to frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html index 48b649764..b1c0b1529 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-object.component.html +++ b/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html @@ -26,13 +26,14 @@