Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-132300 / 25.04 / Create a configurable full-page form with glossary section and help #11091

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0a011be
NAS-132300: Add id to ix-forms components
RehanY147 Nov 22, 2024
01f9e38
NAS-132300: Created full-page-form
RehanY147 Nov 22, 2024
f19660d
NAS-132300: Replaced instance-wizard
RehanY147 Nov 22, 2024
b9c6fba
NAS-132300: Update instance-wizard.component.html
RehanY147 Nov 22, 2024
b67d462
NAS-132300: Better separation of properties
RehanY147 Nov 30, 2024
3ae6564
NAS-132300: Update ix-full-page-form.component.ts
RehanY147 Nov 30, 2024
d4df88c
Merge branch 'master' into NAS-132300
RehanY147 Dec 2, 2024
50240cf
NAS-132300: Added new components
RehanY147 Dec 2, 2024
b8c7526
NAS-132300: Clean up instance-form
RehanY147 Dec 2, 2024
a08540d
NAS-132300: Using directive approach
RehanY147 Dec 3, 2024
9788e13
NAS-132300: Remove form-section and use controlDirective for names
RehanY147 Dec 5, 2024
bdb11ba
NAS-132300: Revert required labels
RehanY147 Dec 5, 2024
cbca47a
NAS-132300: Clean up non-control registration
RehanY147 Dec 5, 2024
540f2cb
NAS-132300: Remove `attr.id`
RehanY147 Dec 5, 2024
282538a
NAS-132300: Add section labels and validity info
RehanY147 Dec 7, 2024
7392d5c
NAS-132300: Create ix-form-glossary.component.ts
RehanY147 Dec 7, 2024
9c64de1
NAS-132300: Update ix-form-glossary.component.ts
RehanY147 Dec 7, 2024
6c2278a
NAS-132300: Update ix-form-glossary.component.ts
RehanY147 Dec 7, 2024
c578de1
NAS-132300: Update ix-form-glossary.component.ts
RehanY147 Dec 7, 2024
50592df
NAS-132300: Add section click
RehanY147 Dec 7, 2024
3b8a2f8
NAS-132300: Renamed method
RehanY147 Dec 10, 2024
a4b2c11
NAS-132300: Renamed controlNamesWithLabels
RehanY147 Dec 10, 2024
70913bd
NAS-132300: Automatic directive application
RehanY147 Dec 12, 2024
da40c94
Merge branch 'master' into NAS-132300
RehanY147 Dec 12, 2024
485ae1f
NAS-132300: Remove empty lines
RehanY147 Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncPipe } from '@angular/common';
import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input,
ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, input, Input,
} from '@angular/core';
import { ControlValueAccessor, NgControl } from '@angular/forms';
import { MatButtonToggleChange, MatButtonToggleGroup, MatButtonToggle } from '@angular/material/button-toggle';
Expand Down Expand Up @@ -41,6 +41,8 @@ export class IxButtonGroupComponent implements ControlValueAccessor {
@HostBinding('class.inlineFields')
@Input() inlineFields = false;

formControlName = input<string>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to use this.controlDirective.name or label input?


isDisabled = false;
value: string;

Expand All @@ -51,6 +53,10 @@ export class IxButtonGroupComponent implements ControlValueAccessor {
this.controlDirective.valueAccessor = this;
}

@HostBinding('attr.id') get id(): string {
return this.formControlName() || '';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you set id here, but also set ix-label in ixRegisteredControl. Can you use one of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases, label might not be set. In other cases, id might not be set. So, these give more of a chance that at least one will be set and allow usage for the ixRegisteredControl directive.

}

onChange: (value: string) => void = (): void => {};
onTouch: () => void = (): void => {};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncPipe } from '@angular/common';
import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, Input,
ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input,
} from '@angular/core';
import { ControlValueAccessor, NgControl } from '@angular/forms';
import { MatCheckbox } from '@angular/material/checkbox';
Expand Down Expand Up @@ -36,6 +36,7 @@ export class IxCheckboxListComponent implements ControlValueAccessor {
@Input() options: Observable<Option[]>;
@Input() inlineFields: boolean;
@Input() inlineFieldFlex: string;
@Input() formControlName: string;

isDisabled = false;
value: (string | number)[];
Expand All @@ -62,6 +63,10 @@ export class IxCheckboxListComponent implements ControlValueAccessor {
onChange: (value: (string | number)[]) => void = (): void => {};
onTouch: () => void = (): void => {};

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

writeValue(value: (string | number)[]): void {
this.value = value;
this.cdr.markForCheck();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, Input,
ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input,
} from '@angular/core';
import {
ControlValueAccessor, NgControl,
Expand Down Expand Up @@ -34,6 +34,7 @@ export class IxCheckboxComponent implements ControlValueAccessor {
@Input() tooltip: string;
@Input() warning: string;
@Input() required: boolean;
@Input() formControlName: string;

isDisabled = false;
value: boolean;
Expand All @@ -45,6 +46,10 @@ export class IxCheckboxComponent implements ControlValueAccessor {
this.controlDirective.valueAccessor = this;
}

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

onChange: (value: boolean) => void = (): void => {};
onTouch: () => void = (): void => {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ChangeDetectorRef,
Component,
ElementRef,
HostBinding,
Input,
OnChanges,
ViewChild,
Expand Down Expand Up @@ -62,6 +63,7 @@ export class IxChipsComponent implements OnChanges, ControlValueAccessor {
@Input() tooltip: string;
@Input() required: boolean;
@Input() allowNewEntries = true;
@Input() formControlName: string;
/**
* A function that provides the options for the autocomplete dropdown.
* This function is called when the user types into the input field,
Expand Down Expand Up @@ -108,6 +110,10 @@ export class IxChipsComponent implements OnChanges, ControlValueAccessor {

inputReset$ = new Subject<void>();

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

onChange: (value: string[]) => void = (): void => {};
onTouch: () => void = (): void => {};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { AsyncPipe } from '@angular/common';
import {
AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, OnChanges, OnInit, ViewChild,
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
HostBinding,
Input,
OnChanges,
OnInit,
ViewChild,
} from '@angular/core';
import { ControlValueAccessor, NgControl } from '@angular/forms';
import { MatHint } from '@angular/material/form-field';
Expand Down Expand Up @@ -42,6 +51,7 @@ export class IxCodeEditorComponent implements OnChanges, OnInit, AfterViewInit,
@Input() tooltip: string;
@Input() language: CodeEditorLanguage;
@Input() placeholder: string;
@Input() formControlName: string;

afterViewInit$ = new BehaviorSubject<boolean>(false);

Expand All @@ -68,6 +78,10 @@ export class IxCodeEditorComponent implements OnChanges, OnInit, AfterViewInit,
this.controlDirective.valueAccessor = this;
}

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

ngOnChanges(changes: IxSimpleChanges<this>): void {
if (changes.language?.currentValue) {
this.afterViewInit$.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ChangeDetectionStrategy, ChangeDetectorRef,
Component,
ElementRef,
HostBinding,
Input,
OnInit,
ViewChild,
Expand Down Expand Up @@ -66,6 +67,8 @@ export class IxComboboxComponent implements ControlValueAccessor, OnInit {
this.cdr.markForCheck();
}

@Input() formControlName: string;

private comboboxProviderHandler: IxComboboxProviderManager;

@ViewChild('ixInput') inputElementRef: ElementRef<HTMLInputElement>;
Expand Down Expand Up @@ -95,6 +98,10 @@ export class IxComboboxComponent implements ControlValueAccessor, OnInit {
this.controlDirective.valueAccessor = this;
}

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

writeValue(value: string | number): void {
this.value = value;
if (this.value && this.options?.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
HostBinding,
Input,
OnChanges,
OnInit,
Expand Down Expand Up @@ -69,6 +70,7 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
@Input() nodeProvider: TreeNodeProvider;
@Input() canCreateDataset = false;
@Input() createDatasetProps: Omit<DatasetCreate, 'name'> = {};
@Input() formControlName: string;

@ViewChild('tree', { static: true }) tree: TreeComponent;

Expand All @@ -91,6 +93,10 @@ export class IxExplorerComponent implements OnInit, OnChanges, ControlValueAcces
|| this.isDisabled;
}

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

private readonly actionMapping: IActionMapping = {
mouse: {
dblClick: (tree, node, $event) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ChangeDetectionStrategy, ChangeDetectorRef, Component, Input,
ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Input,
} from '@angular/core';
import {
ControlValueAccessor, NgControl,
Expand Down Expand Up @@ -39,6 +39,7 @@ export class IxFileInputComponent implements ControlValueAccessor {
@Input() acceptedFiles = '*.*';
@Input() multiple: boolean;
@Input() required: boolean;
@Input() formControlName: string;

value: FileList;
isDisabled = false;
Expand All @@ -54,6 +55,10 @@ export class IxFileInputComponent implements ControlValueAccessor {
this.controlDirective.valueAccessor = this;
}

@HostBinding('attr.id') get id(): string {
return this.formControlName || '';
}

onChanged(value: FileList): void {
this.value = value;
this.onChange([...value]);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div class="wrapper">
<div class="wizard-container">
<div class="mini-search-card">
<ix-input
[prefixIcon]="iconMarker('search')"
[formControl]="searchControl"
[placeholder]="'Search Input Fields' | translate"
[autocompleteOptions]="searchOptions()"
></ix-input>
</div>
<ng-container #contentContainer></ng-container>
</div>

<div class="search-container">
<div class="search-card">
<ix-input
[prefixIcon]="iconMarker('search')"
[formControl]="searchControl"
[placeholder]="'Search Input Fields' | translate"
[autocompleteOptions]="searchOptions()"
></ix-input>

@for (section of sections(); track section) {
<div class="section" (click)="onSectionClick(section.label)">
{{ section.label }}
<!-- @if (!section.valid()) {
<ix-icon name="warning"></ix-icon>
} -->
</div>
}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
@import 'scss-imports/variables';

:host {
width: 100%;
}

.wrapper {
display: flex;
}

.wizard-container {
width: 80%;

@media (max-width: $breakpoint-sm) {
width: 100%;
}

.actions {
padding: 0 10px;

@media (max-width: $breakpoint-xs) {
margin: 0 10px;
padding: 0;

button {
width: 100%;
}
}
}
}

.search-container {
margin-left: 16px;
min-width: 250px;
width: 20%;

@media (max-width: $breakpoint-xs) {
display: none;
}

.search-card {
background-color: var(--bg2);
display: flex;
flex-direction: column;
gap: 5px;
padding: 0 14px 14px;
position: sticky;
top: 10px;

.section {
color: var(--fg1);
display: flex;
font-family: var(--font-family-body);
font-size: 15px;
gap: 5px;
padding: 10px;

ix-icon {
color: var(--red);
}
}

.section:hover {
background-color: var(--contrast-lighter);
cursor: pointer;
}
}
}

.mini-search-card {
background-color: var(--bg2);
display: none;
padding: 2px 14px;
position: sticky;
top: -16px;
z-index: 99;

@media (max-width: $breakpoint-xs) {
display: block;
margin: 0 9px;
top: 0;
}
}
Loading