-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* AAE-25211 form styling PoC * AAE-25211 poc * AAE-25211 revert cloud form service * AAE-24927 display text schema * AAE-24927 radio button styles * AAE-24927 header styles * AAE-24927 style pipes * AAE-24927 styles for header * AAE-24927 remove redundand prop
- Loading branch information
Showing
12 changed files
with
264 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
lib/core/src/lib/form/components/widgets/header/header.schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/*! | ||
* @license | ||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { HeaderThemeVariable } from '../core/theme.model'; | ||
import { WidgetSchemaModel } from '../core/widget-schema.model'; | ||
|
||
export const headerSchema: WidgetSchemaModel<HeaderThemeVariable> = { | ||
themeProperties: [ | ||
{ | ||
name: 'FORM.FIELD_STYLE.FONT_SIZE', | ||
cssPropertyName: 'font-size', | ||
fieldVariableName: '--adf-header-font-size', | ||
formVariableName: '--adf-header-font-size', | ||
type: 'number', | ||
unit: 'px', | ||
defaultValue: '16px' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.FONT_WEIGHT', | ||
cssPropertyName: 'font-weight', | ||
fieldVariableName: '--adf-header-font-weight', | ||
formVariableName: '--adf-header-font-weight', | ||
type: 'options', | ||
options: [ | ||
{ | ||
name: 'FORM.FIELD_STYLE.REGULAR', | ||
value: 'normal' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.BOLD', | ||
value: 'bold' | ||
} | ||
], | ||
defaultValue: 'normal' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.FONT_COLOR', | ||
cssPropertyName: 'color', | ||
fieldVariableName: '--adf-header-color', | ||
formVariableName: '--adf-header-color', | ||
type: 'colorOptions', | ||
options: [ | ||
{ | ||
name: 'FORM.FIELD_STYLE.SYSTEM_COLOR', | ||
value: 'inherit' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.BLACK', | ||
value: '#000000' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.GREY', | ||
value: '#9CA3AF' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.RED', | ||
value: '#DA1500' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.GREEN', | ||
value: '#04A003' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.BLUE', | ||
value: '#0A60CE' | ||
}, | ||
{ | ||
name: 'FORM.FIELD_STYLE.YELLOW', | ||
value: '#FACC15' | ||
} | ||
], | ||
defaultValue: 'inherit' | ||
} | ||
] | ||
}; |
18 changes: 18 additions & 0 deletions
18
lib/core/src/lib/form/components/widgets/header/header.widget.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div [hidden]="!element?.isGroup()" [style]="element | adfFieldStyle" class="adf-container-widget-header"> | ||
<h4 class="adf-container-widget-header__text" id="container-header" | ||
[class.adf-collapsible]="element?.isCollapsible()"> | ||
<button *ngIf="element?.isCollapsible()" | ||
mat-icon-button | ||
class="mdl-button--icon" | ||
(click)="onExpanderClicked(element)"> | ||
<mat-icon>{{ element?.isExpanded ? 'expand_more' : 'expand_less' }}</mat-icon> | ||
</button> | ||
<span (click)="onExpanderClicked(element)" | ||
role="button" | ||
tabindex="0" | ||
(keyup.enter)="onExpanderClicked(element)" | ||
[id]="'container-header-label-' + element?.id"> | ||
{{ element.name | translate }} | ||
</span> | ||
</h4> | ||
</div> |
13 changes: 13 additions & 0 deletions
13
lib/core/src/lib/form/components/widgets/header/header.widget.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.adf-container-widget-header__text { | ||
border-bottom: 1px solid rgba(0, 0, 0, 0.87); | ||
padding-bottom: 10px; | ||
cursor: default; | ||
user-select: none; | ||
font-size: var(--adf-header-font-size); | ||
font-weight: var(--adf-header-font-weight); | ||
color: var(--adf-header-color); | ||
|
||
&.adf-collapsible { | ||
cursor: pointer; | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
lib/core/src/lib/form/components/widgets/header/header.widget.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/*! | ||
* @license | ||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { ContainerModel } from '../core/container.model'; | ||
import { FormFieldTypes } from '../core/form-field-types'; | ||
import { FormFieldModel } from '../core/form-field.model'; | ||
import { HeaderWidgetComponent } from './header.widget'; | ||
|
||
describe('HeaderWidgetComponent', () => { | ||
let component: HeaderWidgetComponent; | ||
let fixture: ComponentFixture<HeaderWidgetComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HeaderWidgetComponent, TranslateModule.forRoot()] | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(HeaderWidgetComponent); | ||
component = fixture.componentInstance; | ||
fixture.componentRef.setInput( | ||
'element', | ||
new ContainerModel( | ||
new FormFieldModel( | ||
{ | ||
onFormFieldChanged: () => {} | ||
}, | ||
{ | ||
type: FormFieldTypes.GROUP, | ||
name: 'test-name', | ||
id: 'test-id', | ||
params: { allowCollapse: true } | ||
} | ||
) | ||
) | ||
); | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should render the header widget template', () => { | ||
const nativeElement = fixture.nativeElement; | ||
expect(nativeElement.querySelector('.adf-container-widget-header')).toBeTruthy(); | ||
expect(nativeElement.querySelector('#container-header-label-test-id').textContent.trim()).toEqual('test-name'); | ||
}); | ||
|
||
it('should call onExpanderClicked method when expander is clicked', () => { | ||
spyOn(component, 'onExpanderClicked'); | ||
const expander = fixture.nativeElement.querySelector('#container-header-label-test-id'); | ||
expander.click(); | ||
expect(component.onExpanderClicked).toHaveBeenCalled(); | ||
}); | ||
}); |
42 changes: 42 additions & 0 deletions
42
lib/core/src/lib/form/components/widgets/header/header.widget.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*! | ||
* @license | ||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Component, Input, ViewEncapsulation } from '@angular/core'; | ||
import { ContainerModel } from '../core/container.model'; | ||
import { FieldStylePipe } from './../../../pipes/field-style.pipe'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { NgIf } from '@angular/common'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { MatButtonModule } from '@angular/material/button'; | ||
|
||
@Component({ | ||
selector: 'adf-header-widget', | ||
templateUrl: './header.widget.html', | ||
styleUrls: ['./header.widget.scss'], | ||
standalone: true, | ||
encapsulation: ViewEncapsulation.None, | ||
imports: [FieldStylePipe, MatIconModule, MatButtonModule, TranslateModule, NgIf] | ||
}) | ||
export class HeaderWidgetComponent { | ||
@Input() element: ContainerModel; | ||
|
||
onExpanderClicked(content: ContainerModel) { | ||
if (content?.isCollapsible()) { | ||
content.isExpanded = !content.isExpanded; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
* @license | ||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
export * from './header.schema'; | ||
export * from './header.widget'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters