@pega/sdk 0.0.13 → 0.0.14

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 (48) hide show
  1. package/package.json +1 -1
  2. package/templates/angular-sdk-reference/angular.json +2 -1
  3. package/templates/angular-sdk-reference/package.json +1 -0
  4. package/templates/angular-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
  5. package/templates/angular-sdk-reference/src/app/app.component.ts +232 -15
  6. package/templates/angular-sdk-reference/src/components/component-map.ts +90 -0
  7. package/templates/angular-sdk-reference/src/components/fields/auto-complete/auto-complete.component.ts +267 -0
  8. package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +84 -0
  9. package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +97 -0
  10. package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +88 -0
  11. package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +101 -0
  12. package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +91 -0
  13. package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +93 -0
  14. package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +91 -0
  15. package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +102 -0
  16. package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +98 -0
  17. package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +97 -0
  18. package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +94 -0
  19. package/templates/angular-sdk-reference/src/components/infra/assignment/assignment.component.ts +206 -0
  20. package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts +76 -0
  21. package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +114 -0
  22. package/templates/angular-sdk-reference/src/components/infra/flow-container/flow-container.component.ts +411 -0
  23. package/templates/angular-sdk-reference/src/components/infra/reference/reference.component.ts +158 -0
  24. package/templates/angular-sdk-reference/src/components/infra/region/region.component.ts +39 -0
  25. package/templates/angular-sdk-reference/src/components/infra/root-container/root-container.component.ts +193 -0
  26. package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +78 -0
  27. package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +139 -0
  28. package/templates/angular-sdk-reference/src/components/infra/view-container/view-container.component.ts +191 -0
  29. package/templates/angular-sdk-reference/src/components/templates/default-form/default-form.component.ts +101 -0
  30. package/templates/angular-sdk-reference/src/components/templates/narrow-wide/narrow-wide.component.ts +37 -0
  31. package/templates/angular-sdk-reference/src/components/templates/one-column/one-column.component.ts +37 -0
  32. package/templates/angular-sdk-reference/src/components/templates/two-column/two-column.component.ts +37 -0
  33. package/templates/angular-sdk-reference/src/components/templates/wide-narrow/wide-narrow.component.ts +37 -0
  34. package/templates/angular-sdk-reference/src/helpers/event-utils.ts +18 -0
  35. package/templates/angular-sdk-reference/src/helpers/utils.ts +38 -0
  36. package/templates/angular-sdk-reference/src/helpers/versionHelpers.ts +14 -0
  37. package/templates/angular-sdk-reference/tsconfig.json +5 -2
  38. package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +11 -4
  39. package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +7 -0
  40. package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +3 -1
  41. package/templates/react-sdk-reference/.ai-common/skills/field-components.md +75 -29
  42. package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +133 -101
  43. package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedData.md +385 -0
  44. package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedDataMulti.md +506 -0
  45. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +549 -86
  46. package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +181 -83
  47. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +125 -153
  48. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +90 -81
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Checkbox — boolean checkbox field.
3
+ *
4
+ * Pattern reference: sdk-react Checkbox
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { handleEvent } from '../../../helpers/event-utils';
12
+
13
+ @Component({
14
+ selector: 'pega-checkbox',
15
+ standalone: true,
16
+ imports: [CommonModule],
17
+ template: `
18
+ <div style="margin-bottom: 1rem;">
19
+ <label
20
+ style="display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem;"
21
+ [style.cursor]="disabled || readOnly ? 'default' : 'pointer'"
22
+ >
23
+ <input
24
+ type="checkbox"
25
+ [attr.data-testid]="testId"
26
+ [checked]="checked"
27
+ [disabled]="disabled || readOnly"
28
+ (change)="onCheckChange($event)"
29
+ />
30
+ {{ label }}
31
+ <span *ngIf="required" style="color: #dc2626;">*</span>
32
+ </label>
33
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
34
+ {{ validatemessage }}
35
+ </div>
36
+ </div>
37
+ `,
38
+ })
39
+ export class CheckboxComponent implements OnInit, OnChanges {
40
+ @Input() props: any;
41
+
42
+ label = '';
43
+ checked = false;
44
+ testId = '';
45
+ required = false;
46
+ disabled = false;
47
+ readOnly = false;
48
+ validatemessage = '';
49
+
50
+ private actions: any;
51
+ private propName = '';
52
+
53
+ ngOnInit(): void {
54
+ this.updateFromProps();
55
+ }
56
+
57
+ ngOnChanges(changes: SimpleChanges): void {
58
+ if (changes['props']) {
59
+ this.updateFromProps();
60
+ }
61
+ }
62
+
63
+ private updateFromProps(): void {
64
+ const p = this.props;
65
+ this.label = p.label ?? '';
66
+ this.checked = p.value === true || p.value === 'true';
67
+ this.testId = p.testId ?? '';
68
+ this.required = p.required ?? false;
69
+ this.disabled = p.disabled ?? false;
70
+ this.readOnly = p.readOnly ?? false;
71
+ this.validatemessage = p.validatemessage ?? '';
72
+
73
+ const pConn = p.getPConnect?.();
74
+ this.actions = pConn?.getActionsApi?.();
75
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
76
+ }
77
+
78
+ onCheckChange(event: Event): void {
79
+ const target = event.target as HTMLInputElement;
80
+ if (this.actions && this.propName) {
81
+ handleEvent(this.actions, 'changeNblur', this.propName, target.checked);
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Currency — currency input field with formatting.
3
+ *
4
+ * Pattern reference: sdk-react Currency
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { FormsModule } from '@angular/forms';
12
+ import { handleEvent } from '../../../helpers/event-utils';
13
+
14
+ @Component({
15
+ selector: 'pega-currency',
16
+ standalone: true,
17
+ imports: [CommonModule, FormsModule],
18
+ template: `
19
+ <div *ngIf="!readOnly" style="margin-bottom: 1rem;">
20
+ <label *ngIf="label" style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;">
21
+ {{ label }}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;">*</span>
22
+ </label>
23
+ <div style="display: flex; align-items: center;">
24
+ <span style="margin-right: 0.25rem; font-size: 0.875rem;">{{ currencySymbol }}</span>
25
+ <input
26
+ type="number"
27
+ step="0.01"
28
+ [attr.data-testid]="testId"
29
+ [value]="value"
30
+ [placeholder]="placeholder"
31
+ [disabled]="disabled"
32
+ [required]="required"
33
+ (blur)="onBlur($event)"
34
+ style="flex: 1; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
35
+ [style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
36
+ />
37
+ </div>
38
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
39
+ {{ validatemessage }}
40
+ </div>
41
+ </div>
42
+ <div *ngIf="readOnly" style="margin-bottom: 1rem;">
43
+ <span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
44
+ <div style="font-size: 0.875rem;">{{ currencySymbol }}{{ value }}</div>
45
+ </div>
46
+ `,
47
+ })
48
+ export class CurrencyComponent implements OnInit, OnChanges {
49
+ @Input() props: any;
50
+
51
+ label = '';
52
+ value: any = '';
53
+ placeholder = '';
54
+ testId = '';
55
+ required = false;
56
+ disabled = false;
57
+ readOnly = false;
58
+ validatemessage = '';
59
+ currencySymbol = '$';
60
+
61
+ private actions: any;
62
+ private propName = '';
63
+
64
+ ngOnInit(): void {
65
+ this.updateFromProps();
66
+ }
67
+
68
+ ngOnChanges(changes: SimpleChanges): void {
69
+ if (changes['props']) {
70
+ this.updateFromProps();
71
+ }
72
+ }
73
+
74
+ private updateFromProps(): void {
75
+ const p = this.props;
76
+ this.label = p.label ?? '';
77
+ this.value = p.value ?? '';
78
+ this.placeholder = p.placeholder ?? '';
79
+ this.testId = p.testId ?? '';
80
+ this.required = p.required ?? false;
81
+ this.disabled = p.disabled ?? false;
82
+ this.readOnly = p.readOnly ?? false;
83
+ this.validatemessage = p.validatemessage ?? '';
84
+ this.currencySymbol = p.currencyISOCode ?? p.currencySymbol ?? '$';
85
+
86
+ const pConn = p.getPConnect?.();
87
+ this.actions = pConn?.getActionsApi?.();
88
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
89
+ }
90
+
91
+ onBlur(event: Event): void {
92
+ const target = event.target as HTMLInputElement;
93
+ if (this.actions && this.propName) {
94
+ handleEvent(this.actions, 'changeNblur', this.propName, target.value);
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * DateInput — date picker field.
3
+ *
4
+ * Pattern reference: sdk-react DateInput
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { FormsModule } from '@angular/forms';
12
+ import { handleEvent } from '../../../helpers/event-utils';
13
+
14
+ @Component({
15
+ selector: 'pega-date-input',
16
+ standalone: true,
17
+ imports: [CommonModule, FormsModule],
18
+ template: `
19
+ <div *ngIf="!readOnly" style="margin-bottom: 1rem;">
20
+ <label *ngIf="label" style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;">
21
+ {{ label }}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;">*</span>
22
+ </label>
23
+ <input
24
+ type="date"
25
+ [attr.data-testid]="testId"
26
+ [value]="value"
27
+ [disabled]="disabled"
28
+ [required]="required"
29
+ (change)="onDateChange($event)"
30
+ style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
31
+ [style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
32
+ />
33
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
34
+ {{ validatemessage }}
35
+ </div>
36
+ </div>
37
+ <div *ngIf="readOnly" style="margin-bottom: 1rem;">
38
+ <span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
39
+ <div style="font-size: 0.875rem;">{{ value }}</div>
40
+ </div>
41
+ `,
42
+ })
43
+ export class DateInputComponent implements OnInit, OnChanges {
44
+ @Input() props: any;
45
+
46
+ label = '';
47
+ value = '';
48
+ testId = '';
49
+ required = false;
50
+ disabled = false;
51
+ readOnly = false;
52
+ validatemessage = '';
53
+
54
+ private actions: any;
55
+ private propName = '';
56
+
57
+ ngOnInit(): void {
58
+ this.updateFromProps();
59
+ }
60
+
61
+ ngOnChanges(changes: SimpleChanges): void {
62
+ if (changes['props']) {
63
+ this.updateFromProps();
64
+ }
65
+ }
66
+
67
+ private updateFromProps(): void {
68
+ const p = this.props;
69
+ this.label = p.label ?? '';
70
+ this.value = p.value ?? '';
71
+ this.testId = p.testId ?? '';
72
+ this.required = p.required ?? false;
73
+ this.disabled = p.disabled ?? false;
74
+ this.readOnly = p.readOnly ?? false;
75
+ this.validatemessage = p.validatemessage ?? '';
76
+
77
+ const pConn = p.getPConnect?.();
78
+ this.actions = pConn?.getActionsApi?.();
79
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
80
+ }
81
+
82
+ onDateChange(event: Event): void {
83
+ const target = event.target as HTMLInputElement;
84
+ if (this.actions && this.propName) {
85
+ handleEvent(this.actions, 'changeNblur', this.propName, target.value);
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Dropdown — select/dropdown field.
3
+ *
4
+ * Pattern reference: sdk-react Dropdown
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { FormsModule } from '@angular/forms';
12
+ import { handleEvent } from '../../../helpers/event-utils';
13
+
14
+ @Component({
15
+ selector: 'pega-dropdown',
16
+ standalone: true,
17
+ imports: [CommonModule, FormsModule],
18
+ template: `
19
+ <div *ngIf="!readOnly" style="margin-bottom: 1rem;">
20
+ <label *ngIf="label" style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;">
21
+ {{ label }}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;">*</span>
22
+ </label>
23
+ <select
24
+ [attr.data-testid]="testId"
25
+ [disabled]="disabled"
26
+ [required]="required"
27
+ (change)="onSelectChange($event)"
28
+ style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
29
+ [style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
30
+ >
31
+ <option value="" [selected]="!value">
32
+ {{ placeholder || 'Select...' }}
33
+ </option>
34
+ <option *ngFor="let opt of options" [value]="opt.value" [selected]="opt.value === value">
35
+ {{ opt.text || opt.value }}
36
+ </option>
37
+ </select>
38
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
39
+ {{ validatemessage }}
40
+ </div>
41
+ </div>
42
+ <div *ngIf="readOnly" style="margin-bottom: 1rem;">
43
+ <span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
44
+ <div style="font-size: 0.875rem;">{{ displayValue }}</div>
45
+ </div>
46
+ `,
47
+ })
48
+ export class DropdownComponent implements OnInit, OnChanges {
49
+ @Input() props: any;
50
+
51
+ label = '';
52
+ value: any = '';
53
+ placeholder = '';
54
+ testId = '';
55
+ required = false;
56
+ disabled = false;
57
+ readOnly = false;
58
+ validatemessage = '';
59
+ options: Array<{ value: string; text?: string }> = [];
60
+ displayValue = '';
61
+
62
+ private actions: any;
63
+ private propName = '';
64
+
65
+ ngOnInit(): void {
66
+ this.updateFromProps();
67
+ }
68
+
69
+ ngOnChanges(changes: SimpleChanges): void {
70
+ if (changes['props']) {
71
+ this.updateFromProps();
72
+ }
73
+ }
74
+
75
+ private updateFromProps(): void {
76
+ const p = this.props;
77
+ this.label = p.label ?? '';
78
+ this.value = p.value ?? '';
79
+ this.placeholder = p.placeholder ?? '';
80
+ this.testId = p.testId ?? '';
81
+ this.required = p.required ?? false;
82
+ this.disabled = p.disabled ?? false;
83
+ this.readOnly = p.readOnly ?? false;
84
+ this.validatemessage = p.validatemessage ?? '';
85
+ this.options = Array.isArray(p.datasource) ? p.datasource : [];
86
+
87
+ const match = this.options.find((o) => o.value === this.value);
88
+ this.displayValue = match?.text ?? match?.value ?? String(this.value);
89
+
90
+ const pConn = p.getPConnect?.();
91
+ this.actions = pConn?.getActionsApi?.();
92
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
93
+ }
94
+
95
+ onSelectChange(event: Event): void {
96
+ const target = event.target as HTMLSelectElement;
97
+ if (this.actions && this.propName) {
98
+ handleEvent(this.actions, 'changeNblur', this.propName, target.value);
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Email — email input field.
3
+ *
4
+ * Pattern reference: sdk-react Email
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { FormsModule } from '@angular/forms';
12
+ import { handleEvent } from '../../../helpers/event-utils';
13
+
14
+ @Component({
15
+ selector: 'pega-email',
16
+ standalone: true,
17
+ imports: [CommonModule, FormsModule],
18
+ template: `
19
+ <div *ngIf="!readOnly" style="margin-bottom: 1rem;">
20
+ <label *ngIf="label" style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;">
21
+ {{ label }}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;">*</span>
22
+ </label>
23
+ <input
24
+ type="email"
25
+ [attr.data-testid]="testId"
26
+ [value]="value"
27
+ [placeholder]="placeholder"
28
+ [disabled]="disabled"
29
+ [required]="required"
30
+ (blur)="onBlur($event)"
31
+ style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
32
+ [style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
33
+ />
34
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
35
+ {{ validatemessage }}
36
+ </div>
37
+ </div>
38
+ <div *ngIf="readOnly" style="margin-bottom: 1rem;">
39
+ <span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
40
+ <div style="font-size: 0.875rem;">{{ value }}</div>
41
+ </div>
42
+ `,
43
+ })
44
+ export class EmailComponent implements OnInit, OnChanges {
45
+ @Input() props: any;
46
+
47
+ label = '';
48
+ value = '';
49
+ placeholder = '';
50
+ testId = '';
51
+ required = false;
52
+ disabled = false;
53
+ readOnly = false;
54
+ validatemessage = '';
55
+
56
+ private actions: any;
57
+ private propName = '';
58
+
59
+ ngOnInit(): void {
60
+ this.updateFromProps();
61
+ }
62
+
63
+ ngOnChanges(changes: SimpleChanges): void {
64
+ if (changes['props']) {
65
+ this.updateFromProps();
66
+ }
67
+ }
68
+
69
+ private updateFromProps(): void {
70
+ const p = this.props;
71
+ this.label = p.label ?? '';
72
+ this.value = p.value ?? '';
73
+ this.placeholder = p.placeholder ?? '';
74
+ this.testId = p.testId ?? '';
75
+ this.required = p.required ?? false;
76
+ this.disabled = p.disabled ?? false;
77
+ this.readOnly = p.readOnly ?? false;
78
+ this.validatemessage = p.validatemessage ?? '';
79
+
80
+ const pConn = p.getPConnect?.();
81
+ this.actions = pConn?.getActionsApi?.();
82
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
83
+ }
84
+
85
+ onBlur(event: Event): void {
86
+ const target = event.target as HTMLInputElement;
87
+ if (this.actions && this.propName) {
88
+ handleEvent(this.actions, 'changeNblur', this.propName, target.value);
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Integer — numeric integer input field.
3
+ *
4
+ * Pattern reference: sdk-react Integer
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { FormsModule } from '@angular/forms';
12
+ import { handleEvent } from '../../../helpers/event-utils';
13
+
14
+ @Component({
15
+ selector: 'pega-integer',
16
+ standalone: true,
17
+ imports: [CommonModule, FormsModule],
18
+ template: `
19
+ <div *ngIf="!readOnly" style="margin-bottom: 1rem;">
20
+ <label *ngIf="label" style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;">
21
+ {{ label }}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;">*</span>
22
+ </label>
23
+ <input
24
+ type="number"
25
+ step="1"
26
+ [attr.data-testid]="testId"
27
+ [value]="value"
28
+ [placeholder]="placeholder"
29
+ [disabled]="disabled"
30
+ [required]="required"
31
+ (blur)="onBlur($event)"
32
+ style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
33
+ [style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
34
+ />
35
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
36
+ {{ validatemessage }}
37
+ </div>
38
+ </div>
39
+ <div *ngIf="readOnly" style="margin-bottom: 1rem;">
40
+ <span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
41
+ <div style="font-size: 0.875rem;">{{ value }}</div>
42
+ </div>
43
+ `,
44
+ })
45
+ export class IntegerComponent implements OnInit, OnChanges {
46
+ @Input() props: any;
47
+
48
+ label = '';
49
+ value: any = '';
50
+ placeholder = '';
51
+ testId = '';
52
+ required = false;
53
+ disabled = false;
54
+ readOnly = false;
55
+ validatemessage = '';
56
+
57
+ private actions: any;
58
+ private propName = '';
59
+
60
+ ngOnInit(): void {
61
+ this.updateFromProps();
62
+ }
63
+
64
+ ngOnChanges(changes: SimpleChanges): void {
65
+ if (changes['props']) {
66
+ this.updateFromProps();
67
+ }
68
+ }
69
+
70
+ private updateFromProps(): void {
71
+ const p = this.props;
72
+ this.label = p.label ?? '';
73
+ this.value = p.value ?? '';
74
+ this.placeholder = p.placeholder ?? '';
75
+ this.testId = p.testId ?? '';
76
+ this.required = p.required ?? false;
77
+ this.disabled = p.disabled ?? false;
78
+ this.readOnly = p.readOnly ?? false;
79
+ this.validatemessage = p.validatemessage ?? '';
80
+
81
+ const pConn = p.getPConnect?.();
82
+ this.actions = pConn?.getActionsApi?.();
83
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
84
+ }
85
+
86
+ onBlur(event: Event): void {
87
+ const target = event.target as HTMLInputElement;
88
+ if (this.actions && this.propName) {
89
+ const intVal = target.value ? parseInt(target.value, 10) : '';
90
+ handleEvent(this.actions, 'changeNblur', this.propName, intVal);
91
+ }
92
+ }
93
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Phone — telephone input field.
3
+ *
4
+ * Pattern reference: sdk-react Phone
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input } from '@angular/core';
9
+ import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import { FormsModule } from '@angular/forms';
12
+ import { handleEvent } from '../../../helpers/event-utils';
13
+
14
+ @Component({
15
+ selector: 'pega-phone',
16
+ standalone: true,
17
+ imports: [CommonModule, FormsModule],
18
+ template: `
19
+ <div *ngIf="!readOnly" style="margin-bottom: 1rem;">
20
+ <label *ngIf="label" style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;">
21
+ {{ label }}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;">*</span>
22
+ </label>
23
+ <input
24
+ type="tel"
25
+ [attr.data-testid]="testId"
26
+ [value]="value"
27
+ [placeholder]="placeholder"
28
+ [disabled]="disabled"
29
+ [required]="required"
30
+ (blur)="onBlur($event)"
31
+ style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
32
+ [style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
33
+ />
34
+ <div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
35
+ {{ validatemessage }}
36
+ </div>
37
+ </div>
38
+ <div *ngIf="readOnly" style="margin-bottom: 1rem;">
39
+ <span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
40
+ <div style="font-size: 0.875rem;">{{ value }}</div>
41
+ </div>
42
+ `,
43
+ })
44
+ export class PhoneComponent implements OnInit, OnChanges {
45
+ @Input() props: any;
46
+
47
+ label = '';
48
+ value = '';
49
+ placeholder = '';
50
+ testId = '';
51
+ required = false;
52
+ disabled = false;
53
+ readOnly = false;
54
+ validatemessage = '';
55
+
56
+ private actions: any;
57
+ private propName = '';
58
+
59
+ ngOnInit(): void {
60
+ this.updateFromProps();
61
+ }
62
+
63
+ ngOnChanges(changes: SimpleChanges): void {
64
+ if (changes['props']) {
65
+ this.updateFromProps();
66
+ }
67
+ }
68
+
69
+ private updateFromProps(): void {
70
+ const p = this.props;
71
+ this.label = p.label ?? '';
72
+ this.value = p.value ?? '';
73
+ this.placeholder = p.placeholder ?? '';
74
+ this.testId = p.testId ?? '';
75
+ this.required = p.required ?? false;
76
+ this.disabled = p.disabled ?? false;
77
+ this.readOnly = p.readOnly ?? false;
78
+ this.validatemessage = p.validatemessage ?? '';
79
+
80
+ const pConn = p.getPConnect?.();
81
+ this.actions = pConn?.getActionsApi?.();
82
+ this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
83
+ }
84
+
85
+ onBlur(event: Event): void {
86
+ const target = event.target as HTMLInputElement;
87
+ if (this.actions && this.propName) {
88
+ handleEvent(this.actions, 'changeNblur', this.propName, target.value);
89
+ }
90
+ }
91
+ }