@sarasanalytics-com/design-system 0.0.8 → 0.0.9

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.
Files changed (160) hide show
  1. package/ng-package.json +8 -0
  2. package/package.json +2 -15
  3. package/src/interfaces/avatar-interface.ts +6 -0
  4. package/src/interfaces/button-interface.ts +12 -0
  5. package/src/interfaces/chip-interface.ts +11 -0
  6. package/src/interfaces/grid-interface.ts +24 -0
  7. package/src/interfaces/select-interface.ts +20 -0
  8. package/src/interfaces/tab-interface.ts +6 -0
  9. package/src/lib/avatar/avatar.component.css +48 -0
  10. package/src/lib/avatar/avatar.component.html +5 -0
  11. package/src/lib/avatar/avatar.component.spec.ts +23 -0
  12. package/src/lib/avatar/avatar.component.ts +50 -0
  13. package/src/lib/button/button.component.css +145 -0
  14. package/src/lib/button/button.component.html +11 -0
  15. package/src/lib/button/button.component.spec.ts +23 -0
  16. package/src/lib/button/button.component.ts +68 -0
  17. package/src/lib/calendar-header/calendar-header.component.css +67 -0
  18. package/src/lib/calendar-header/calendar-header.component.html +20 -0
  19. package/src/lib/calendar-header/calendar-header.component.spec.ts +23 -0
  20. package/src/lib/calendar-header/calendar-header.component.ts +191 -0
  21. package/src/lib/card/card-body/card-body.component.css +0 -0
  22. package/src/lib/card/card-body/card-body.component.html +1 -0
  23. package/src/lib/card/card-body/card-body.component.spec.ts +23 -0
  24. package/src/lib/card/card-body/card-body.component.ts +12 -0
  25. package/src/lib/card/card-footer-actions/card-footer-actions.component.css +4 -0
  26. package/src/lib/card/card-footer-actions/card-footer-actions.component.html +3 -0
  27. package/src/lib/card/card-footer-actions/card-footer-actions.component.spec.ts +23 -0
  28. package/src/lib/card/card-footer-actions/card-footer-actions.component.ts +12 -0
  29. package/src/lib/card/card-icon/card-icon.component.css +0 -0
  30. package/src/lib/card/card-icon/card-icon.component.html +1 -0
  31. package/src/lib/card/card-icon/card-icon.component.spec.ts +23 -0
  32. package/src/lib/card/card-icon/card-icon.component.ts +12 -0
  33. package/src/lib/card/card-title-actions/card-title-actions.component.css +3 -0
  34. package/src/lib/card/card-title-actions/card-title-actions.component.html +1 -0
  35. package/src/lib/card/card-title-actions/card-title-actions.component.spec.ts +23 -0
  36. package/src/lib/card/card-title-actions/card-title-actions.component.ts +12 -0
  37. package/src/lib/card/card.component.css +84 -0
  38. package/src/lib/card/card.component.html +34 -0
  39. package/src/lib/card/card.component.spec.ts +23 -0
  40. package/src/lib/card/card.component.ts +33 -0
  41. package/src/lib/chips/chips.component.css +129 -0
  42. package/src/lib/chips/chips.component.html +17 -0
  43. package/src/lib/chips/chips.component.spec.ts +23 -0
  44. package/src/lib/chips/chips.component.ts +54 -0
  45. package/src/lib/component-library.component.spec.ts +23 -0
  46. package/src/lib/component-library.component.ts +16 -0
  47. package/src/lib/component-library.service.spec.ts +16 -0
  48. package/src/lib/component-library.service.ts +9 -0
  49. package/src/lib/datepicker/datepicker.component.css +33 -0
  50. package/src/lib/datepicker/datepicker.component.html +11 -0
  51. package/src/lib/datepicker/datepicker.component.spec.ts +23 -0
  52. package/src/lib/datepicker/datepicker.component.ts +36 -0
  53. package/src/lib/form-input/form-input.component.css +109 -0
  54. package/src/lib/form-input/form-input.component.html +27 -0
  55. package/src/lib/form-input/form-input.component.spec.ts +23 -0
  56. package/src/lib/form-input/form-input.component.ts +196 -0
  57. package/src/lib/form-select/form-select.component.css +157 -0
  58. package/src/lib/form-select/form-select.component.html +38 -0
  59. package/src/lib/form-select/form-select.component.spec.ts +23 -0
  60. package/src/lib/form-select/form-select.component.ts +54 -0
  61. package/src/lib/grid-cell/grid-cell.component.css +78 -0
  62. package/src/lib/grid-cell/grid-cell.component.html +31 -0
  63. package/src/lib/grid-cell/grid-cell.component.spec.ts +23 -0
  64. package/src/lib/grid-cell/grid-cell.component.ts +89 -0
  65. package/src/lib/header/header.component.css +62 -0
  66. package/src/lib/header/header.component.html +23 -0
  67. package/src/lib/header/header.component.spec.ts +23 -0
  68. package/src/lib/header/header.component.ts +28 -0
  69. package/src/lib/icon/icon.component.css +21 -0
  70. package/src/lib/icon/icon.component.html +5 -0
  71. package/src/lib/icon/icon.component.ts +49 -0
  72. package/src/lib/icon/icon.service.ts +27 -0
  73. package/src/lib/left-nav/left-nav.component.css +106 -0
  74. package/src/lib/left-nav/left-nav.component.html +48 -0
  75. package/src/lib/left-nav/left-nav.component.spec.ts +23 -0
  76. package/src/lib/left-nav/left-nav.component.ts +146 -0
  77. package/src/lib/stepper/stepper.component.css +96 -0
  78. package/src/lib/stepper/stepper.component.html +14 -0
  79. package/src/lib/stepper/stepper.component.spec.ts +23 -0
  80. package/src/lib/stepper/stepper.component.ts +61 -0
  81. package/src/lib/tabs/tabs.component.css +100 -0
  82. package/src/lib/tabs/tabs.component.html +16 -0
  83. package/src/lib/tabs/tabs.component.spec.ts +23 -0
  84. package/src/lib/tabs/tabs.component.ts +37 -0
  85. package/src/lib/toast/toast.component.css +107 -0
  86. package/src/lib/toast/toast.component.html +29 -0
  87. package/src/lib/toast/toast.component.spec.ts +23 -0
  88. package/src/lib/toast/toast.component.ts +87 -0
  89. package/src/lib/tool-tip/tool-tip.component.css +139 -0
  90. package/src/lib/tool-tip/tool-tip.component.html +31 -0
  91. package/src/lib/tool-tip/tool-tip.component.spec.ts +23 -0
  92. package/src/lib/tool-tip/tool-tip.component.ts +37 -0
  93. package/{public-api.d.ts → src/public-api.ts} +8 -1
  94. package/src/utils/validators.ts +68 -0
  95. package/tsconfig.lib.json +14 -0
  96. package/tsconfig.lib.prod.json +10 -0
  97. package/tsconfig.spec.json +14 -0
  98. package/esm2022/interfaces/avatar-interface.mjs +0 -2
  99. package/esm2022/interfaces/button-interface.mjs +0 -2
  100. package/esm2022/interfaces/chip-interface.mjs +0 -2
  101. package/esm2022/interfaces/grid-interface.mjs +0 -2
  102. package/esm2022/interfaces/select-interface.mjs +0 -2
  103. package/esm2022/interfaces/tab-interface.mjs +0 -2
  104. package/esm2022/lib/avatar/avatar.component.mjs +0 -56
  105. package/esm2022/lib/button/button.component.mjs +0 -84
  106. package/esm2022/lib/calendar-header/calendar-header.component.mjs +0 -168
  107. package/esm2022/lib/card/card-footer-actions/card-footer-actions.component.mjs +0 -11
  108. package/esm2022/lib/card/card-icon/card-icon.component.mjs +0 -11
  109. package/esm2022/lib/card/card-title-actions/card-title-actions.component.mjs +0 -11
  110. package/esm2022/lib/card/card.component.mjs +0 -53
  111. package/esm2022/lib/chips/chips.component.mjs +0 -62
  112. package/esm2022/lib/component-library.component.mjs +0 -19
  113. package/esm2022/lib/component-library.service.mjs +0 -14
  114. package/esm2022/lib/datepicker/datepicker.component.mjs +0 -40
  115. package/esm2022/lib/form-input/form-input.component.mjs +0 -152
  116. package/esm2022/lib/form-select/form-select.component.mjs +0 -59
  117. package/esm2022/lib/grid-cell/grid-cell.component.mjs +0 -84
  118. package/esm2022/lib/header/header.component.mjs +0 -37
  119. package/esm2022/lib/icon/icon.component.mjs +0 -50
  120. package/esm2022/lib/icon/icon.service.mjs +0 -29
  121. package/esm2022/lib/left-nav/left-nav.component.mjs +0 -117
  122. package/esm2022/lib/stepper/stepper.component.mjs +0 -64
  123. package/esm2022/lib/tabs/tabs.component.mjs +0 -38
  124. package/esm2022/lib/toast/toast.component.mjs +0 -100
  125. package/esm2022/lib/tool-tip/tool-tip.component.mjs +0 -41
  126. package/esm2022/public-api.mjs +0 -30
  127. package/esm2022/sarasanalytics-com-design-system.mjs +0 -5
  128. package/esm2022/utils/validators.mjs +0 -70
  129. package/fesm2022/sarasanalytics-com-design-system.mjs +0 -1274
  130. package/fesm2022/sarasanalytics-com-design-system.mjs.map +0 -1
  131. package/index.d.ts +0 -5
  132. package/interfaces/avatar-interface.d.ts +0 -6
  133. package/interfaces/button-interface.d.ts +0 -12
  134. package/interfaces/chip-interface.d.ts +0 -11
  135. package/interfaces/grid-interface.d.ts +0 -24
  136. package/interfaces/select-interface.d.ts +0 -20
  137. package/interfaces/tab-interface.d.ts +0 -6
  138. package/lib/avatar/avatar.component.d.ts +0 -18
  139. package/lib/button/button.component.d.ts +0 -26
  140. package/lib/calendar-header/calendar-header.component.d.ts +0 -31
  141. package/lib/card/card-footer-actions/card-footer-actions.component.d.ts +0 -5
  142. package/lib/card/card-icon/card-icon.component.d.ts +0 -5
  143. package/lib/card/card-title-actions/card-title-actions.component.d.ts +0 -5
  144. package/lib/card/card.component.d.ts +0 -17
  145. package/lib/chips/chips.component.d.ts +0 -22
  146. package/lib/component-library.component.d.ts +0 -5
  147. package/lib/component-library.service.d.ts +0 -6
  148. package/lib/datepicker/datepicker.component.d.ts +0 -9
  149. package/lib/form-input/form-input.component.d.ts +0 -62
  150. package/lib/form-select/form-select.component.d.ts +0 -17
  151. package/lib/grid-cell/grid-cell.component.d.ts +0 -20
  152. package/lib/header/header.component.d.ts +0 -14
  153. package/lib/icon/icon.component.d.ts +0 -16
  154. package/lib/icon/icon.service.d.ts +0 -11
  155. package/lib/left-nav/left-nav.component.d.ts +0 -38
  156. package/lib/stepper/stepper.component.d.ts +0 -17
  157. package/lib/tabs/tabs.component.d.ts +0 -15
  158. package/lib/toast/toast.component.d.ts +0 -33
  159. package/lib/tool-tip/tool-tip.component.d.ts +0 -15
  160. package/utils/validators.d.ts +0 -3
@@ -0,0 +1,157 @@
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
+ width: 100%;
20
+ box-sizing: border-box;
21
+ position: relative;
22
+ display: inline-flex;
23
+ padding: 0px var(--small-12px);
24
+ height: 40px;
25
+ justify-content: center;
26
+ align-items: center;
27
+ border: var(--border);
28
+ border-radius: var(--small-4px);
29
+ font-family: var(--font);
30
+ font-size: 14px;
31
+ font-style: normal;
32
+ font-weight: 400;
33
+ line-height: 20px;
34
+ letter-spacing: 0.25px;
35
+ --font-color: var(--text-lowemphasis);
36
+ }
37
+
38
+ .ng-select {
39
+ width: inherit;
40
+ display: inline-flex;
41
+ justify-content: center;
42
+ align-items: center;
43
+ flex-shrink: 0;
44
+ }
45
+
46
+ .ng-select ::ng-deep .ng-select-container {
47
+ display: inline-flex;
48
+
49
+ justify-content: center;
50
+ align-items: center;
51
+ flex-shrink: 0;
52
+ font-family: var(--font);
53
+ box-sizing: border-box;
54
+ border: none;
55
+ }
56
+
57
+ .ng-select ::ng-deep .ng-dropdown-panel {
58
+ margin-top: 2px;
59
+ border: 1px solid var(--grey-50);
60
+ box-shadow: none !important;
61
+ }
62
+
63
+ .ng-select ::ng-deep .ng-select-container {
64
+ box-shadow: none !important;
65
+ position: relative !important;
66
+ z-index: 1 !important;
67
+ }
68
+
69
+ .ng-select ::ng-deep .ng-value-container {
70
+ padding: 0 !important;
71
+ flex-wrap: nowrap !important;
72
+ display: flex;
73
+ justify-content: flex-start;
74
+ gap: 5px;
75
+ overflow-x: hidden;
76
+ }
77
+
78
+ .ng-select ::ng-deep .ng-value {
79
+ flex: none;
80
+ margin: 0 !important;
81
+ }
82
+
83
+ .overflow-label {
84
+ padding: 0px 5px;
85
+ cursor: pointer;
86
+ }
87
+
88
+ .ng-select ::ng-deep .ng-placeholder {
89
+ padding: 0 !important;
90
+ position: inherit !important;
91
+ color: var(--text-lowemphasis);
92
+ }
93
+
94
+ .ng-select ::ng-deep .ng-input {
95
+ padding: 0 !important;
96
+ position: inherit !important;
97
+ }
98
+
99
+ .ng-select ::ng-deep .ng-clear-wrapper {
100
+ z-index: 9;
101
+ display: flex;
102
+ margin-left: 5px;
103
+ }
104
+
105
+
106
+ .ng-select ::ng-deep .ng-arrow {
107
+ border-color: none !important;
108
+ border-style: none !important;
109
+ border-width: 0 !important;
110
+ }
111
+
112
+ .svg-icon {
113
+ mask-size: contain;
114
+ width: 20px;
115
+ height: 20px;
116
+ background-color: grey;
117
+ }
118
+
119
+ .svg-icon:hover {
120
+ cursor: pointer;
121
+ }
122
+
123
+ .ng-select ::ng-deep .ng-arrow-wrapper {
124
+ display: none;
125
+ }
126
+
127
+ .support-label {
128
+ font-family: var(--font);
129
+ font-size: 11px;
130
+ font-style: normal;
131
+ font-weight: 400;
132
+ line-height: 16px;
133
+ letter-spacing: 0.5px;
134
+ color: var(--text-lowemphasis);
135
+ padding: var(--small-4px) var(--small-16px) 0px var(--small-16px);
136
+ }
137
+
138
+ .clicked-label {
139
+ position: relative;
140
+ width: max-content;
141
+
142
+ font-family: var(--font);
143
+ font-size: 11px;
144
+ font-style: normal;
145
+ font-weight: 500;
146
+ line-height: 16px;
147
+ letter-spacing: 0.5px;
148
+
149
+ color: var(--text-lowemphasis);
150
+
151
+ padding: 0 var(--small-8px);
152
+ margin-left: 12px;
153
+ margin-bottom: -8px;
154
+ z-index: 99;
155
+
156
+ background-color: white;
157
+ }
@@ -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 } 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 } 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
+ }
@@ -0,0 +1,21 @@
1
+ .sa-icon {
2
+ display: inline-flex;
3
+ /* Align with text */
4
+ align-items: center;
5
+ /* Center vertically */
6
+ justify-content: center;
7
+ /* Center horizontally */
8
+ color: inherit;
9
+ /* Inherit color from parent */
10
+ font-size: inherit;
11
+ /* Inherit font size */
12
+ }
13
+
14
+ .sa-icon>svg {
15
+ width: 1em;
16
+ /* Responsive to font size */
17
+ height: 1em;
18
+ /* Responsive to font size */
19
+ vertical-align: middle;
20
+ /* Align with text */
21
+ }
@@ -0,0 +1,5 @@
1
+ <span class="sa-icon" [innerHTML]="svgIcon" [ngStyle]="iconStyles">
2
+
3
+ </span>
4
+
5
+ <!-- <img *ngIf="svgIcon" [src]="svgIcon" [ngStyle]="iconStyles" alt="icon"> -->