@sarasanalytics-com/design-system 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.eslintrc.json +22 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/manager.ts +17 -0
- package/.storybook/preview-head.html +5 -0
- package/.storybook/preview.ts +65 -0
- package/.storybook/tsconfig.doc.json +10 -0
- package/.storybook/tsconfig.json +11 -0
- package/.storybook/typings.d.ts +4 -0
- package/.vscode/extensions.json +7 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/settings.json +13 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +27 -0
- package/angular.json +189 -0
- package/build-storybook.log +39 -0
- package/documentation.json +0 -0
- package/package.json +74 -0
- package/projects/component-library/README.md +24 -0
- package/projects/component-library/ng-package.json +8 -0
- package/projects/component-library/package.json +12 -0
- package/projects/component-library/src/interfaces/avatar-interface.ts +6 -0
- package/projects/component-library/src/interfaces/button-interface.ts +12 -0
- package/projects/component-library/src/interfaces/chip-interface.ts +11 -0
- package/projects/component-library/src/interfaces/grid-interface.ts +24 -0
- package/projects/component-library/src/interfaces/select-interface.ts +19 -0
- package/projects/component-library/src/interfaces/tab-interface.ts +6 -0
- package/projects/component-library/src/lib/avatar/avatar.component.css +48 -0
- package/projects/component-library/src/lib/avatar/avatar.component.html +5 -0
- package/projects/component-library/src/lib/avatar/avatar.component.spec.ts +23 -0
- package/projects/component-library/src/lib/avatar/avatar.component.ts +50 -0
- package/projects/component-library/src/lib/button/button.component.css +145 -0
- package/projects/component-library/src/lib/button/button.component.html +11 -0
- package/projects/component-library/src/lib/button/button.component.spec.ts +23 -0
- package/projects/component-library/src/lib/button/button.component.ts +68 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.css +67 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.html +20 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.spec.ts +23 -0
- package/projects/component-library/src/lib/calendar-header/calendar-header.component.ts +196 -0
- package/projects/component-library/src/lib/chips/chips.component.css +129 -0
- package/projects/component-library/src/lib/chips/chips.component.html +17 -0
- package/projects/component-library/src/lib/chips/chips.component.spec.ts +23 -0
- package/projects/component-library/src/lib/chips/chips.component.ts +55 -0
- package/projects/component-library/src/lib/component-library.component.spec.ts +23 -0
- package/projects/component-library/src/lib/component-library.component.ts +16 -0
- package/projects/component-library/src/lib/component-library.service.spec.ts +16 -0
- package/projects/component-library/src/lib/component-library.service.ts +9 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.css +33 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.html +11 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.spec.ts +23 -0
- package/projects/component-library/src/lib/datepicker/datepicker.component.ts +37 -0
- package/projects/component-library/src/lib/form-select/form-select.component.css +156 -0
- package/projects/component-library/src/lib/form-select/form-select.component.html +38 -0
- package/projects/component-library/src/lib/form-select/form-select.component.spec.ts +23 -0
- package/projects/component-library/src/lib/form-select/form-select.component.ts +54 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.css +78 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.html +31 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.spec.ts +23 -0
- package/projects/component-library/src/lib/grid-cell/grid-cell.component.ts +89 -0
- package/projects/component-library/src/lib/header/header.component.css +62 -0
- package/projects/component-library/src/lib/header/header.component.html +23 -0
- package/projects/component-library/src/lib/header/header.component.spec.ts +23 -0
- package/projects/component-library/src/lib/header/header.component.ts +28 -0
- package/projects/component-library/src/lib/stepper/stepper.component.css +96 -0
- package/projects/component-library/src/lib/stepper/stepper.component.html +14 -0
- package/projects/component-library/src/lib/stepper/stepper.component.spec.ts +23 -0
- package/projects/component-library/src/lib/stepper/stepper.component.ts +61 -0
- package/projects/component-library/src/lib/tabs/tabs.component.css +100 -0
- package/projects/component-library/src/lib/tabs/tabs.component.html +16 -0
- package/projects/component-library/src/lib/tabs/tabs.component.spec.ts +23 -0
- package/projects/component-library/src/lib/tabs/tabs.component.ts +37 -0
- package/projects/component-library/src/lib/toast/toast.component.css +108 -0
- package/projects/component-library/src/lib/toast/toast.component.html +25 -0
- package/projects/component-library/src/lib/toast/toast.component.spec.ts +23 -0
- package/projects/component-library/src/lib/toast/toast.component.ts +37 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.css +139 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.html +31 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.spec.ts +23 -0
- package/projects/component-library/src/lib/tool-tip/tool-tip.component.ts +37 -0
- package/projects/component-library/src/public-api.ts +25 -0
- package/projects/component-library/tsconfig.lib.json +14 -0
- package/projects/component-library/tsconfig.lib.prod.json +10 -0
- package/projects/component-library/tsconfig.spec.json +14 -0
- package/src/Saras-logo.svg +15 -0
- package/src/app/app.component.css +13 -0
- package/src/app/app.component.html +77 -0
- package/src/app/app.component.spec.ts +29 -0
- package/src/app/app.component.ts +505 -0
- package/src/app/app.config.ts +27 -0
- package/src/app/app.routes.ts +3 -0
- package/src/app/data.ts +52 -0
- package/src/app/kitchen-sink/kitchen-sink.component.css +29 -0
- package/src/app/kitchen-sink/kitchen-sink.component.html +7 -0
- package/src/app/kitchen-sink/kitchen-sink.component.spec.ts +23 -0
- package/src/app/kitchen-sink/kitchen-sink.component.ts +92 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/Chevron.svg +5 -0
- package/src/assets/Frame.svg +5 -0
- package/src/assets/Grid.svg +5 -0
- package/src/assets/Location.svg +5 -0
- package/src/assets/Mail.svg +5 -0
- package/src/assets/Person.svg +5 -0
- package/src/assets/Scan.svg +5 -0
- package/src/assets/Sources.svg +5 -0
- package/src/assets/arrow.svg +5 -0
- package/src/assets/avatar.svg +12 -0
- package/src/assets/checkmark.svg +5 -0
- package/src/assets/crossmark.svg +5 -0
- package/src/assets/dot.svg +5 -0
- package/src/assets/negativemark.svg +5 -0
- package/src/assets/pointer-polygon.svg +3 -0
- package/src/assets/tick-icon.svg +5 -0
- package/src/assets/tick.svg +8 -0
- package/src/assets/warningmark.svg +5 -0
- package/src/custom-theme.scss +37 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +23 -0
- package/src/main.ts +6 -0
- package/src/stories/GettingStarted.mdx +233 -0
- package/src/stories/KitchenSink.stories.ts +86 -0
- package/src/stories/avatar.stories.ts +45 -0
- package/src/stories/chips.stories.ts +61 -0
- package/src/stories/custom-button.stories.ts +74 -0
- package/src/stories/datepicker.stories.ts +78 -0
- package/src/stories/gridCell.stories.ts +234 -0
- package/src/stories/header.stories.ts +61 -0
- package/src/stories/selectInput.stories.ts +158 -0
- package/src/stories/stepper.stories.ts +92 -0
- package/src/stories/tabs.stories.ts +97 -0
- package/src/stories/toast.stories.ts +54 -0
- package/src/stories/tool-tip.stories.ts +45 -0
- package/src/styles.css +204 -0
- package/src/svg.d.ts +1 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.json +42 -0
- package/tsconfig.spec.json +14 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
.idle {
|
|
2
|
+
--border: 1px solid var(--grey-50);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.activated {
|
|
6
|
+
--border: 1px solid var(--primary-300);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.disabled {
|
|
10
|
+
border: 1px solid var(--grey-50) !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ng-select-field:hover {
|
|
14
|
+
--border: 1px solid var(--primary-300);
|
|
15
|
+
--font-color: var(--text-highemphasis);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ng-select-field {
|
|
19
|
+
position: relative;
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
padding: 0px var(--small-12px);
|
|
22
|
+
height: 40px;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
align-items: center;
|
|
25
|
+
border: var(--border);
|
|
26
|
+
border-radius: var(--small-4px);
|
|
27
|
+
font-family: var(--font);
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-weight: 400;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
letter-spacing: 0.25px;
|
|
33
|
+
--font-color: var(--text-lowemphasis);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ng-select {
|
|
37
|
+
width: min-content;
|
|
38
|
+
min-width: 100px;
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ng-select ::ng-deep .ng-select-container {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
font-family: var(--font);
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
border: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ng-select ::ng-deep .ng-dropdown-panel {
|
|
57
|
+
margin-top: 2px;
|
|
58
|
+
border: 1px solid var(--grey-50);
|
|
59
|
+
box-shadow: none !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ng-select ::ng-deep .ng-select-container {
|
|
63
|
+
box-shadow: none !important;
|
|
64
|
+
position: relative !important;
|
|
65
|
+
z-index: 1 !important;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ng-select ::ng-deep .ng-value-container {
|
|
69
|
+
padding: 0 !important;
|
|
70
|
+
flex-wrap: nowrap !important;
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: flex-start;
|
|
73
|
+
gap: 5px;
|
|
74
|
+
overflow-x: hidden;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ng-select ::ng-deep .ng-value {
|
|
78
|
+
flex: none;
|
|
79
|
+
margin: 0 !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.overflow-label {
|
|
83
|
+
padding: 0px 5px;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ng-select ::ng-deep .ng-placeholder {
|
|
88
|
+
padding: 0 !important;
|
|
89
|
+
position: inherit !important;
|
|
90
|
+
color: var(--text-lowemphasis);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ng-select ::ng-deep .ng-input {
|
|
94
|
+
padding: 0 !important;
|
|
95
|
+
position: inherit !important;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ng-select ::ng-deep .ng-clear-wrapper {
|
|
99
|
+
z-index: 9;
|
|
100
|
+
display: flex;
|
|
101
|
+
margin-left: 5px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
.ng-select ::ng-deep .ng-arrow {
|
|
106
|
+
border-color: none !important;
|
|
107
|
+
border-style: none !important;
|
|
108
|
+
border-width: 0 !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.svg-icon {
|
|
112
|
+
mask-size: contain;
|
|
113
|
+
width: 20px;
|
|
114
|
+
height: 20px;
|
|
115
|
+
background-color: grey;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.svg-icon:hover {
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ng-select ::ng-deep .ng-arrow-wrapper {
|
|
123
|
+
display: none;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.support-label {
|
|
127
|
+
font-family: var(--font);
|
|
128
|
+
font-size: 11px;
|
|
129
|
+
font-style: normal;
|
|
130
|
+
font-weight: 400;
|
|
131
|
+
line-height: 16px;
|
|
132
|
+
letter-spacing: 0.5px;
|
|
133
|
+
color: var(--text-lowemphasis);
|
|
134
|
+
padding: var(--small-4px) var(--small-16px) 0px var(--small-16px);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.clicked-label {
|
|
138
|
+
position: relative;
|
|
139
|
+
width: max-content;
|
|
140
|
+
|
|
141
|
+
font-family: var(--font);
|
|
142
|
+
font-size: 11px;
|
|
143
|
+
font-style: normal;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
line-height: 16px;
|
|
146
|
+
letter-spacing: 0.5px;
|
|
147
|
+
|
|
148
|
+
color: var(--text-lowemphasis);
|
|
149
|
+
|
|
150
|
+
padding: 0 var(--small-8px);
|
|
151
|
+
margin-left: 12px;
|
|
152
|
+
margin-bottom: -8px;
|
|
153
|
+
z-index: 99;
|
|
154
|
+
|
|
155
|
+
background-color: white;
|
|
156
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div [style.visibility]="(openState || topLabel) ? 'visible' : 'hidden'" class="clicked-label">{{params.label}}</div>
|
|
2
|
+
<div class="ng-select-field {{openState ? 'activated' : 'idle'}} {{field.props.disabled ? 'disabled' : ''}}">
|
|
3
|
+
|
|
4
|
+
<div role="button" title="drop-button" tabindex="0" class="left-icon svg-icon" [style]="svgStyle"
|
|
5
|
+
(click)="openClose(true)" (blur)="openClose(false)"
|
|
6
|
+
*ngIf="(params.dropIconPosition == 'left' || params.dropIconPosition == 'both')">
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<ng-select (change)="checkForZero($event)" (remove)="shiftLabel('removed')" (clear)="shiftLabel('cleared')"
|
|
10
|
+
(search)="openClose(true)" (focus)="openClose(true)" (blur)=" openClose(false)" [isOpen]="openState"
|
|
11
|
+
placeholder={{params.label}} bindLabel="name" [items]="selectables" [multiple]="params.multiple"
|
|
12
|
+
[formControl]="formControl" [style] [formlyAttributes]="field">
|
|
13
|
+
<ng-template ng-multi-label-tmp let-items="items" let-clear="clear">
|
|
14
|
+
<div *ngFor="let item of (items ? items.slice(startInd,startInd+labelLimit): [])">
|
|
15
|
+
<sa-chip (onClickEvent)=" (!field.props.disabled) ? clear(item) : null" [id]="item.id"
|
|
16
|
+
[iconPath]="params.iconPath" [text]="item.name" [type]="params.type"
|
|
17
|
+
[state]="field.props.disabled ? 'neutral' : params.state" [filling]="params.filling"
|
|
18
|
+
[iconPosition]="params.iconPosition">
|
|
19
|
+
</sa-chip>
|
|
20
|
+
</div>
|
|
21
|
+
<div (click)="shiftLabel('clicked')" class="ng-value overflow-label" *ngIf="items.length > (startInd+labelLimit)">
|
|
22
|
+
<sa-chip text="+{{items.length-(startInd+labelLimit)}}" type="regular" state="default" filling="filled">
|
|
23
|
+
</sa-chip>
|
|
24
|
+
</div>
|
|
25
|
+
<div (click)="shiftLabel('cleared')" *ngIf="startInd == items.length-labelLimit" class="ng-value overflow-label">
|
|
26
|
+
<sa-chip text="..." type="regular" state="default" filling="filled">
|
|
27
|
+
</sa-chip>
|
|
28
|
+
</div>
|
|
29
|
+
</ng-template>
|
|
30
|
+
</ng-select>
|
|
31
|
+
|
|
32
|
+
<div role="button" title="drop-button" tabindex="0" class="right-icon svg-icon" [style]="svgStyle"
|
|
33
|
+
(click)="openClose(true)" (blur)="openClose(false)"
|
|
34
|
+
*ngIf="(params.dropIconPosition == 'right' || params.dropIconPosition == 'both')">
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
<div class="support-label">{{params.supportText}}</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { FormSelectComponent } from './form-select.component';
|
|
4
|
+
|
|
5
|
+
describe('FormSelectComponent', () => {
|
|
6
|
+
let component: FormSelectComponent;
|
|
7
|
+
let fixture: ComponentFixture<FormSelectComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [FormSelectComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(FormSelectComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { FormlyModule } from '@ngx-formly/core';
|
|
4
|
+
import { FieldType, FieldTypeConfig } from '@ngx-formly/core';
|
|
5
|
+
import { NgSelectModule } from '@ng-select/ng-select';
|
|
6
|
+
import { ChipsComponent } from '../chips/chips.component';
|
|
7
|
+
import { NgIf, NgFor } from '@angular/common';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'lib-form-select',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [
|
|
13
|
+
ReactiveFormsModule,
|
|
14
|
+
FormlyModule,
|
|
15
|
+
ReactiveFormsModule,
|
|
16
|
+
NgSelectModule,
|
|
17
|
+
ChipsComponent,
|
|
18
|
+
NgIf,
|
|
19
|
+
NgFor
|
|
20
|
+
],
|
|
21
|
+
templateUrl: './form-select.component.html',
|
|
22
|
+
styleUrl: './form-select.component.css'
|
|
23
|
+
})
|
|
24
|
+
export class FormSelectComponent extends FieldType<FieldTypeConfig> {
|
|
25
|
+
selectables: any;
|
|
26
|
+
params: any;
|
|
27
|
+
|
|
28
|
+
svgStyle = {};
|
|
29
|
+
openState: boolean = false;
|
|
30
|
+
topLabel: boolean;
|
|
31
|
+
startInd: number = 0;
|
|
32
|
+
labelLimit: number = 2;
|
|
33
|
+
|
|
34
|
+
ngOnInit() {
|
|
35
|
+
this.selectables = this.field.props.options;
|
|
36
|
+
this.params = this.field.props['params'];
|
|
37
|
+
this.svgStyle = {
|
|
38
|
+
'-webkit-mask-image': `url(${this.params.dropIcon})})`,
|
|
39
|
+
'mask-image': `url(${this.params.dropIcon})`,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
openClose(state: boolean) {
|
|
43
|
+
if (this.field.props.disabled) return;
|
|
44
|
+
this.openState = state;
|
|
45
|
+
}
|
|
46
|
+
shiftLabel(action: string) {
|
|
47
|
+
if (action == 'clicked') this.startInd++;
|
|
48
|
+
if (action == 'cleared') this.startInd = 0;
|
|
49
|
+
if (action == 'removed' && this.startInd > 0) this.startInd--;
|
|
50
|
+
}
|
|
51
|
+
checkForZero(selected: any) {
|
|
52
|
+
this.topLabel = selected.length == 0 ? false : true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
--bg: var(--primary-50);
|
|
3
|
+
--color: var(--text-highemphasis);
|
|
4
|
+
--border: none;
|
|
5
|
+
--flex-direction: left;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.header:hover {
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.row {
|
|
13
|
+
--color: var(--text-highemphasis);
|
|
14
|
+
--cursor: default;
|
|
15
|
+
--border: var(--grey-50);
|
|
16
|
+
--flex-direction: left;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.numeric {
|
|
20
|
+
--color: var(--text-highemphasis);
|
|
21
|
+
--cursor: default;
|
|
22
|
+
--border: var(--grey-50);
|
|
23
|
+
--flex-direction: right;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.interactive {
|
|
27
|
+
--color: var(--primary-500);
|
|
28
|
+
--cursor: pointer;
|
|
29
|
+
--border: var(--grey-50);
|
|
30
|
+
--flex-direction: left;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.grid-cell {
|
|
34
|
+
display: flex;
|
|
35
|
+
height: 48px;
|
|
36
|
+
padding: var(--small-12px);
|
|
37
|
+
justify-content: var(--flex-direction);
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: var(--small-8px);
|
|
40
|
+
flex-shrink: 0;
|
|
41
|
+
|
|
42
|
+
font-family: var(--font);
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
border-bottom: 1px solid var(--border);
|
|
45
|
+
|
|
46
|
+
width: calc(100% - 20px);
|
|
47
|
+
background-color: var(--bg);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.grid-text {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.main-text {
|
|
56
|
+
color: var(--color);
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
font-weight: 400;
|
|
59
|
+
height: 20px;
|
|
60
|
+
line-height: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.main-text:hover {
|
|
64
|
+
cursor: var(--cursor);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.sub-text {
|
|
68
|
+
font-size: 11px;
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
height: 16px;
|
|
71
|
+
line-height: 16px;
|
|
72
|
+
color: var(--text-mediumemphasis);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.icons {
|
|
76
|
+
width: var(--medium-20px);
|
|
77
|
+
height: var(--medium-20px);
|
|
78
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div class="grid-cell {{params.cellType}}">
|
|
2
|
+
|
|
3
|
+
<img class="icons" src={{params.iconPath}} [style.display]="(params.viewLeadingIcon) ? 'block' : 'none'" alt="">
|
|
4
|
+
|
|
5
|
+
<sa-avatar [id]="params.avatarConfig?.id" [altText]="params.avatarConfig?.altText"
|
|
6
|
+
[imagePath]="params.avatarConfig?.imagePath" [size]="params.avatarConfig?.size"
|
|
7
|
+
[style.display]="(params.viewAvatar) ? 'block' : 'none'" (onClickEvent)="avatarClicked($event)">
|
|
8
|
+
</sa-avatar>
|
|
9
|
+
|
|
10
|
+
<div class="grid-text" [style.display]="(params.viewText) ? 'block' : 'none'">
|
|
11
|
+
<div [style.display]="(params.text) ? 'block' : 'none'" (click)="linkClicked()" class="main-text">{{params.text}}
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div [style.display]="(params.subText) ? 'block' : 'none'" class="sub-text">{{params.subText}}</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<img class="icons" src={{params.iconPath}} [style.display]="(params.viewTrailingIcon) ? 'block' : 'none'" alt="">
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<sa-chip *ngFor="let config of params.chipConfig, let i = index" [id]="config.id" [filling]="config.filling"
|
|
21
|
+
id="chip_{{rowNum}}_{{config.id}}" [iconPath]="config.iconPath" [iconPosition]="config.iconPosition"
|
|
22
|
+
[largeStateIcon]="config.largeStateIcon" [state]="config.state" [type]="config.type" [text]="config.text"
|
|
23
|
+
[style.display]="(params.viewChip) ? 'block' : 'none'" (onClickEvent)="chipClicked($event)"></sa-chip>
|
|
24
|
+
|
|
25
|
+
<sa-button [iconPosition]="params.buttonConfig?.iconPosition" [ImagePath]="params.buttonConfig?.imagePath"
|
|
26
|
+
[id]="params.buttonConfig?.id" [size]="params.buttonConfig?.size" [state]="params.buttonConfig?.state"
|
|
27
|
+
[type]="params.buttonConfig?.type" [text]="params.buttonConfig?.text" [href]="params.buttonConfig?.href"
|
|
28
|
+
[hrefTarget]="params.buttonConfig?.hrefTarget" [style.display]="(params.viewButton) ? 'block' : 'none'"
|
|
29
|
+
(onClickEvent)="buttonClicked($event)"></sa-button>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { GridCellComponent } from './grid-cell.component';
|
|
4
|
+
|
|
5
|
+
describe('GridCellComponent', () => {
|
|
6
|
+
let component: GridCellComponent;
|
|
7
|
+
let fixture: ComponentFixture<GridCellComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [GridCellComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(GridCellComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Component, EventEmitter, input } from '@angular/core';
|
|
2
|
+
import { Output } from '@angular/core';
|
|
3
|
+
import { AvatarComponent } from '../avatar/avatar.component';
|
|
4
|
+
import { ChipsComponent } from '../chips/chips.component';
|
|
5
|
+
import { ButtonComponent } from '../button/button.component';
|
|
6
|
+
import { NgFor } from '@angular/common';
|
|
7
|
+
import { ICellRendererAngularComp, IHeaderAngularComp } from 'ag-grid-angular';
|
|
8
|
+
import { GridInterface } from '../../interfaces/grid-interface';
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'lib-grid-cell',
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [
|
|
14
|
+
AvatarComponent,
|
|
15
|
+
ChipsComponent,
|
|
16
|
+
ButtonComponent,
|
|
17
|
+
NgFor
|
|
18
|
+
],
|
|
19
|
+
templateUrl: './grid-cell.component.html',
|
|
20
|
+
styleUrl: './grid-cell.component.css'
|
|
21
|
+
})
|
|
22
|
+
export class GridCellComponent implements ICellRendererAngularComp, IHeaderAngularComp {
|
|
23
|
+
params: GridInterface;
|
|
24
|
+
rowNum: number;
|
|
25
|
+
|
|
26
|
+
@Output() onClickButtonEvent = new EventEmitter();
|
|
27
|
+
@Output() onClickChipEvent = new EventEmitter();
|
|
28
|
+
@Output() onClickLinkEvent = new EventEmitter();
|
|
29
|
+
@Output() onClickAvatarEvent = new EventEmitter();
|
|
30
|
+
|
|
31
|
+
buttonClicked(evt: Event) {
|
|
32
|
+
this.params.buttonClicked && this.params.buttonClicked({ // calls the function passed via params in gridInterface.
|
|
33
|
+
...evt,
|
|
34
|
+
rowId: this.rowNum
|
|
35
|
+
});
|
|
36
|
+
this.onClickButtonEvent.emit({ ...evt, rowId: this.rowNum }); // this event isn't caught by anything.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// above function behavior is same for all functions in this class
|
|
40
|
+
|
|
41
|
+
chipClicked(evt: Event) {
|
|
42
|
+
this.params.chipClicked && this.params.chipClicked({
|
|
43
|
+
...evt,
|
|
44
|
+
rowId: this.rowNum
|
|
45
|
+
});
|
|
46
|
+
this.onClickChipEvent.emit({ ...evt, rowId: this.rowNum });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
linkClicked() {
|
|
50
|
+
if (this.params.cellType != "interactive") return;
|
|
51
|
+
|
|
52
|
+
this.params.linkClicked && this.params.linkClicked({ //calling function passed in params with rowId object in arguments
|
|
53
|
+
rowId: this.rowNum
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (this.params.interactiveLink != "") {
|
|
57
|
+
if (this.params.interactiveLinkTarget == "blank") {
|
|
58
|
+
window.open(this.params.interactiveLink)!;
|
|
59
|
+
}
|
|
60
|
+
else if (this.params.interactiveLinkTarget == "self") {
|
|
61
|
+
location.href = this.params.interactiveLink!;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
this.onClickLinkEvent.emit({ rowId: this.rowNum });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
avatarClicked(evt: Event) {
|
|
68
|
+
this.params.avatarClicked && this.params.avatarClicked({
|
|
69
|
+
...evt,
|
|
70
|
+
rowId: this.rowNum
|
|
71
|
+
});
|
|
72
|
+
this.onClickChipEvent.emit({ ...evt, rowId: this.rowNum });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
agInit(inParams: any): void { // must exist when class implements ICellRendererAngularComp / IHeaderAngularComp
|
|
76
|
+
|
|
77
|
+
this.rowNum = inParams.rowIndex;
|
|
78
|
+
this.params = inParams.value; // inParams.value exists when gridCell is rendered as cell, `cellRenderer: GridCellComponent`
|
|
79
|
+
if (inParams.value == undefined) { // inParams.value is undefined when gridCell is rendered as header, `headerComponent: GridCellComponent`,
|
|
80
|
+
this.params = inParams
|
|
81
|
+
}
|
|
82
|
+
// console.log(this.params);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
refresh(params: any) { // must exist when class implements ICellRendererAngularComp / IHeaderAngularComp
|
|
86
|
+
return false; // not sure what this return value does.
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 96px;
|
|
4
|
+
font-family: var(--font);
|
|
5
|
+
padding: var(--medium-20px, 20px) var(--medium-32px, 32px);
|
|
6
|
+
display: flex;
|
|
7
|
+
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
align-items: center;
|
|
10
|
+
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
border-radius: var(--small-8px, 8px);
|
|
13
|
+
border: 1px solid var(--grey-50, #E9EAEB);
|
|
14
|
+
background: var(--Structural-White, #FFF);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.header-content {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: var(--small-8px, 8px);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.heading {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: flex-start;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: var(--small-8px, 8px);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.header-name {
|
|
31
|
+
font-size: 22px;
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 500;
|
|
34
|
+
line-height: 28px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.header-info {
|
|
38
|
+
display: flex;
|
|
39
|
+
gap: var(--small-12px, 12px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.info-item {
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: var(--small-4px, 4px);
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
line-height: 16px;
|
|
51
|
+
color: var(--text-mediumemphasis);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.info-item img {
|
|
55
|
+
width: 20px;
|
|
56
|
+
height: 20px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.actions {
|
|
60
|
+
display: flex;
|
|
61
|
+
gap: var(--small-12px, 12px);
|
|
62
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<div class="header">
|
|
2
|
+
<div class="header-content">
|
|
3
|
+
<div class="heading">
|
|
4
|
+
<div class="header-name">{{headerName}}</div>
|
|
5
|
+
<div *ngFor="let chip of chipConfig">
|
|
6
|
+
<sa-chip type="regular" [state]="chip[1]" filling="filled" [text]="chip[0]"></sa-chip>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="header-info">
|
|
10
|
+
<div class="info-item" *ngFor="let item of info">
|
|
11
|
+
<img [src]="item[1]" alt="">
|
|
12
|
+
{{item[0]}}
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="actions">
|
|
17
|
+
<sa-button *ngIf="buttonHelper" (onClickEvent)="clicked(0)" [text]="buttonHelper" type="transparent" size="medium"
|
|
18
|
+
state="default">
|
|
19
|
+
</sa-button>
|
|
20
|
+
<sa-button *ngIf="buttonMain" (onClickEvent)="clicked(1)" [text]="buttonMain" type="primary" size="medium"
|
|
21
|
+
state="default"></sa-button>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { HeaderComponent } from './header.component';
|
|
4
|
+
|
|
5
|
+
describe('HeaderComponent', () => {
|
|
6
|
+
let component: HeaderComponent;
|
|
7
|
+
let fixture: ComponentFixture<HeaderComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [HeaderComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(HeaderComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, EventEmitter, Output, input } from '@angular/core';
|
|
2
|
+
import { ChipsComponent } from '../chips/chips.component';
|
|
3
|
+
import { Input } from '@angular/core';
|
|
4
|
+
import { NgFor } from '@angular/common';
|
|
5
|
+
import { ButtonComponent } from '../button/button.component';
|
|
6
|
+
import { NgIf } from '@angular/common';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'sa-header',
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [ChipsComponent, NgFor, ButtonComponent, NgIf],
|
|
12
|
+
templateUrl: './header.component.html',
|
|
13
|
+
styleUrl: './header.component.css'
|
|
14
|
+
})
|
|
15
|
+
export class HeaderComponent {
|
|
16
|
+
@Input() info: string[][];
|
|
17
|
+
@Input() headerName: string;
|
|
18
|
+
@Input() chipConfig: string[][];
|
|
19
|
+
@Input() buttonHelper: string;
|
|
20
|
+
@Input() buttonMain: string;
|
|
21
|
+
|
|
22
|
+
@Output() mainButtonClicked = new EventEmitter();
|
|
23
|
+
@Output() helperButtonClicked = new EventEmitter();
|
|
24
|
+
|
|
25
|
+
clicked(num: number) {
|
|
26
|
+
num ? this.mainButtonClicked.emit() : this.helperButtonClicked.emit();
|
|
27
|
+
}
|
|
28
|
+
}
|