Skip to content

Commit 32eee15

Browse files
authored
Merge pull request #254 from pegasystems/mod/tor/IssueFix
Fixes for issues identified in adoption testing
2 parents e9a2c18 + eca4717 commit 32eee15

File tree

8 files changed

+74
-18
lines changed

8 files changed

+74
-18
lines changed

packages/angular-sdk-components/src/lib/_components/field/currency/currency.component.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,17 @@ export class CurrencyComponent implements OnInit, OnDestroy {
201201
const propName = this.pConn$?.getStateProps().value;
202202
let value = event?.target?.value;
203203
value = value?.substring(1);
204-
if (this.currSep === ',') {
205-
value = value.replace(/,/g, '');
206-
} else {
204+
// replacing thousand seperator with empty string as not required in api call
205+
if (this.currSep === '.') {
207206
value = value?.replace(/\./g, '');
208-
value = value?.replace(/,/g, '.');
207+
} else {
208+
const regExp = new RegExp(String.raw`${this.currSep}`, 'g');
209+
value = value.replace(regExp, '');
210+
}
211+
// replacing decimal seperator with '.'
212+
if (this.currDec !== '.') {
213+
const regExp = new RegExp(String.raw`${this.currDec}`, 'g');
214+
value = value.replace(regExp, '.');
209215
}
210216
handleEvent(actionsApi, 'changeNblur', propName, value);
211217
}

packages/angular-sdk-components/src/lib/_components/field/decimal/decimal.component.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,19 @@ export class DecimalComponent implements OnInit, OnDestroy {
196196
const actionsApi = this.pConn$?.getActionsApi();
197197
const propName = this.pConn$?.getStateProps().value;
198198
let value = event?.target?.value;
199-
if (this.currSep === ',') {
200-
value = value.replace(/,/g, '');
201-
} else {
202-
value = value?.replace(/\./g, '');
203-
value = value?.replace(/,/g, '.');
199+
// replacing thousand seperator with empty string as not required in api call
200+
if (this.configProps$.showGroupSeparators) {
201+
if (this.currSep === '.') {
202+
value = value?.replace(/\./g, '');
203+
} else {
204+
const regExp = new RegExp(String.raw`${this.currSep}`, 'g');
205+
value = value.replace(regExp, '');
206+
}
207+
}
208+
// replacing decimal seperator with '.'
209+
if (this.currDec !== '.') {
210+
const regExp = new RegExp(String.raw`${this.currDec}`, 'g');
211+
value = value.replace(regExp, '.');
204212
}
205213
handleEvent(actionsApi, 'changeNblur', propName, value);
206214
}

packages/angular-sdk-components/src/lib/_components/field/percentage/percentage.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
(change)="fieldOnChange()"
3030
(blur)="fieldOnBlur($event)"
3131
[readonly]="bReadonly$"
32-
[value]="value$"
3332
/>
3433
<mat-error *ngIf="fieldControl.invalid">{{ getErrorMessage() }}</mat-error>
3534
</mat-form-field>

packages/angular-sdk-components/src/lib/_components/field/percentage/percentage.component.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export class PercentageComponent implements OnInit, OnDestroy {
121121
const nValue: any = this.configProps$.value;
122122
if (nValue) {
123123
this.value$ = nValue;
124+
this.fieldControl.setValue(nValue);
124125
}
125126
this.helperText = this.configProps$.helperText;
126127
this.placeholder = this.configProps$.placeholder || '';
@@ -187,11 +188,19 @@ export class PercentageComponent implements OnInit, OnDestroy {
187188
fieldOnBlur(event: any) {
188189
let value = event?.target?.value;
189190
value = value ? value.replace(/%/g, '') : '';
190-
if (this.currSep === '.') {
191-
value = value?.replace(/\./g, '');
192-
value = value?.replace(/,/g, '.');
193-
} else {
194-
value = value.replace(/,/g, '');
191+
// replacing thousand seperator with empty string as not required in api call
192+
if (this.configProps$.showGroupSeparators) {
193+
if (this.currSep === '.') {
194+
value = value?.replace(/\./g, '');
195+
} else {
196+
const regExp = new RegExp(String.raw`${this.currSep}`, 'g');
197+
value = value.replace(regExp, '');
198+
}
199+
}
200+
// replacing decimal seperator with '.'
201+
if (this.currDec !== '.') {
202+
const regExp = new RegExp(String.raw`${this.currDec}`, 'g');
203+
value = value.replace(regExp, '.');
195204
}
196205
handleEvent(this.actionsApi, 'changeNblur', this.propName, value);
197206
}

packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<div class="psdk-list-header">
22
<div>
3+
<h3 *ngIf="label" class="label" style="font-weight: bold">
4+
{{ label }} <span class="results-count">{{ getResultsText() }}</span>
5+
</h3>
36
<mat-form-field class="psdk-search" *ngIf="bShowSearch$">
47
<mat-label><img class="psdk-icon-search" src="{{ searchIcon$ }}" /> <span class="psdk-search-label">Search</span> </mat-label>
58
<input matInput id="search" (keyup)="applySearch($event)" placeholder="" />

packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,14 @@ tr.mat-mdc-row {
165165
background-color: transparent;
166166
align-items: center;
167167
}
168+
169+
.results-count {
170+
opacity: 0.7;
171+
font-size: 0.8rem;
172+
font-weight: bold;
173+
margin-inline-start: 0.625rem;
174+
}
175+
176+
.label {
177+
margin: 8px;
178+
}

packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable max-classes-per-file */
21
import { Component, OnInit, Input, ViewChild, forwardRef, OnDestroy } from '@angular/core';
32
import { CommonModule } from '@angular/common';
43
import { MatDatepickerModule } from '@angular/material/datepicker';
@@ -29,6 +28,8 @@ declare const window: any;
2928
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
3029

3130
interface ListViewProps {
31+
inheritedProps: any;
32+
title: string | undefined;
3233
// If any, enter additional props that only exist on this component
3334
globalSearch?: boolean;
3435
referenceList?: any;
@@ -42,6 +43,7 @@ interface ListViewProps {
4243
grouping: string | boolean;
4344
value: any;
4445
readonlyContextList: any;
46+
label?: string;
4547
}
4648

4749
export class Group {
@@ -159,6 +161,7 @@ export class ListViewComponent implements OnInit, OnDestroy {
159161
xRayApis = PCore.getDebugger().getXRayRuntime();
160162
xRayUid = this.xRayApis.startXRay();
161163
checkBoxValue: string;
164+
label?: string = '';
162165

163166
constructor(
164167
private psService: ProgressSpinnerService,
@@ -192,6 +195,18 @@ export class ListViewComponent implements OnInit, OnDestroy {
192195
this.arFilterMainButtons$.push({ actionID: 'submit', jsAction: 'submit', name: 'Submit' });
193196
this.arFilterSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' });
194197

198+
let title = this.configProps$?.title || this.configProps$?.label || 'List';
199+
const inheritedProps = this.configProps$?.inheritedProps;
200+
if (title === 'List' && inheritedProps) {
201+
for (const inheritedProp of inheritedProps) {
202+
if (inheritedProp?.prop === 'label') {
203+
title = inheritedProp?.value;
204+
break;
205+
}
206+
}
207+
}
208+
this.label = title;
209+
195210
this.searchIcon$ = this.utils.getImageSrc('search', this.utils.getSDKStaticContentUrl());
196211
setTimeout(() => {
197212
PCore.getPubSubUtils().subscribe(
@@ -1380,6 +1395,11 @@ export class ListViewComponent implements OnInit, OnDestroy {
13801395
return listFields;
13811396
}
13821397

1398+
getResultsText() {
1399+
const recordsCount = this.repeatList$?.paginator?.length || 0;
1400+
return `${recordsCount || 0} result${recordsCount > 1 ? 's' : ''}`;
1401+
}
1402+
13831403
getField(fieldDefs, columnId) {
13841404
const fieldsMap = this.getFieldsMap(fieldDefs);
13851405
return fieldsMap.get(columnId);

projects/angular-test-app/tests/e2e/DigV2/LandingPages/InlineDashboard.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ test.describe('E2E test', () => {
4949
await expect(inlineDashboardTitle).toBeVisible();
5050

5151
/** Testing Complex Fields list presence */
52-
const complexFieldsList = page.locator('span:has-text("Complex Fields - List")');
52+
const complexFieldsList = page.locator('h3:has-text("Complex Fields - List")');
5353
await expect(complexFieldsList).toBeVisible();
5454

5555
/** Testing My Work List presence */
56-
const myworkList = page.locator('span:has-text("My Work List")');
56+
const myworkList = page.locator('h3:has-text("My Work List")');
5757
await expect(myworkList).toBeVisible();
5858

5959
await expect(page.getByRole('button', { name: ' Case ID ' })).toBeVisible();

0 commit comments

Comments
 (0)