@pega/sdk 0.0.12 → 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.
- package/README.md +32 -11
- package/package.json +1 -1
- package/templates/angular-sdk-reference/angular.json +2 -1
- package/templates/angular-sdk-reference/package.json +1 -0
- package/templates/angular-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
- package/templates/angular-sdk-reference/src/app/app.component.ts +232 -15
- package/templates/angular-sdk-reference/src/components/component-map.ts +90 -0
- package/templates/angular-sdk-reference/src/components/fields/auto-complete/auto-complete.component.ts +267 -0
- package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +84 -0
- package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +97 -0
- package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +88 -0
- package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +101 -0
- package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +91 -0
- package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +93 -0
- package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +91 -0
- package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +102 -0
- package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +98 -0
- package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +97 -0
- package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +94 -0
- package/templates/angular-sdk-reference/src/components/infra/assignment/assignment.component.ts +206 -0
- package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts +76 -0
- package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +114 -0
- package/templates/angular-sdk-reference/src/components/infra/flow-container/flow-container.component.ts +411 -0
- package/templates/angular-sdk-reference/src/components/infra/reference/reference.component.ts +158 -0
- package/templates/angular-sdk-reference/src/components/infra/region/region.component.ts +39 -0
- package/templates/angular-sdk-reference/src/components/infra/root-container/root-container.component.ts +193 -0
- package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +78 -0
- package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +139 -0
- package/templates/angular-sdk-reference/src/components/infra/view-container/view-container.component.ts +191 -0
- package/templates/angular-sdk-reference/src/components/templates/default-form/default-form.component.ts +101 -0
- package/templates/angular-sdk-reference/src/components/templates/narrow-wide/narrow-wide.component.ts +37 -0
- package/templates/angular-sdk-reference/src/components/templates/one-column/one-column.component.ts +37 -0
- package/templates/angular-sdk-reference/src/components/templates/two-column/two-column.component.ts +37 -0
- package/templates/angular-sdk-reference/src/components/templates/wide-narrow/wide-narrow.component.ts +37 -0
- package/templates/angular-sdk-reference/src/helpers/event-utils.ts +18 -0
- package/templates/angular-sdk-reference/src/helpers/utils.ts +38 -0
- package/templates/angular-sdk-reference/src/helpers/versionHelpers.ts +14 -0
- package/templates/angular-sdk-reference/tsconfig.json +5 -2
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +20 -13
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +2 -2
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +1 -1
- package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +1 -1
- package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +1 -1
- package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +1 -1
- package/templates/react-sdk-reference/.ai-common/instructions/infra-component.md +1 -1
- package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +1 -1
- package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +1 -1
- package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +7 -0
- package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +2 -2
- package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +4 -2
- package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +10 -11
- package/templates/react-sdk-reference/.ai-common/skills/connect-pega-server.md +84 -31
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +11 -2
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +6 -6
- package/templates/react-sdk-reference/.ai-common/skills/field-components.md +75 -29
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +133 -101
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedData.md +385 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedDataMulti.md +506 -0
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +549 -86
- package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +181 -83
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +125 -153
- package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +90 -81
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RadioButtons — radio button group field.
|
|
3
|
+
*
|
|
4
|
+
* Pattern reference: sdk-react RadioButtons
|
|
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-radio-buttons',
|
|
15
|
+
standalone: true,
|
|
16
|
+
imports: [CommonModule],
|
|
17
|
+
template: `
|
|
18
|
+
<div *ngIf="!readOnly" style="margin-bottom: 1rem;">
|
|
19
|
+
<fieldset style="border: none; padding: 0; margin: 0;">
|
|
20
|
+
<legend *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
|
+
</legend>
|
|
23
|
+
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
|
|
24
|
+
<label
|
|
25
|
+
*ngFor="let opt of options"
|
|
26
|
+
style="display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer;"
|
|
27
|
+
>
|
|
28
|
+
<input
|
|
29
|
+
type="radio"
|
|
30
|
+
[attr.data-testid]="testId"
|
|
31
|
+
[name]="propName"
|
|
32
|
+
[value]="opt.value"
|
|
33
|
+
[checked]="opt.value === value"
|
|
34
|
+
[disabled]="disabled"
|
|
35
|
+
(change)="onRadioChange($event)"
|
|
36
|
+
/>
|
|
37
|
+
{{ opt.text || opt.value }}
|
|
38
|
+
</label>
|
|
39
|
+
</div>
|
|
40
|
+
</fieldset>
|
|
41
|
+
<div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
|
|
42
|
+
{{ validatemessage }}
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div *ngIf="readOnly" style="margin-bottom: 1rem;">
|
|
46
|
+
<span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
|
|
47
|
+
<div style="font-size: 0.875rem;">{{ displayValue }}</div>
|
|
48
|
+
</div>
|
|
49
|
+
`,
|
|
50
|
+
})
|
|
51
|
+
export class RadioButtonsComponent implements OnInit, OnChanges {
|
|
52
|
+
@Input() props: any;
|
|
53
|
+
|
|
54
|
+
label = '';
|
|
55
|
+
value: any = '';
|
|
56
|
+
testId = '';
|
|
57
|
+
required = false;
|
|
58
|
+
disabled = false;
|
|
59
|
+
readOnly = false;
|
|
60
|
+
validatemessage = '';
|
|
61
|
+
options: Array<{ value: string; text?: string }> = [];
|
|
62
|
+
displayValue = '';
|
|
63
|
+
propName = '';
|
|
64
|
+
|
|
65
|
+
private actions: any;
|
|
66
|
+
|
|
67
|
+
ngOnInit(): void {
|
|
68
|
+
this.updateFromProps();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
72
|
+
if (changes['props']) {
|
|
73
|
+
this.updateFromProps();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private updateFromProps(): void {
|
|
78
|
+
const p = this.props;
|
|
79
|
+
this.label = p.label ?? '';
|
|
80
|
+
this.value = p.value ?? '';
|
|
81
|
+
this.testId = p.testId ?? '';
|
|
82
|
+
this.required = p.required ?? false;
|
|
83
|
+
this.disabled = p.disabled ?? false;
|
|
84
|
+
this.readOnly = p.readOnly ?? false;
|
|
85
|
+
this.validatemessage = p.validatemessage ?? '';
|
|
86
|
+
this.options = Array.isArray(p.datasource) ? p.datasource : [];
|
|
87
|
+
|
|
88
|
+
const match = this.options.find((o) => o.value === this.value);
|
|
89
|
+
this.displayValue = match?.text ?? match?.value ?? String(this.value);
|
|
90
|
+
|
|
91
|
+
const pConn = p.getPConnect?.();
|
|
92
|
+
this.actions = pConn?.getActionsApi?.();
|
|
93
|
+
this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
onRadioChange(event: Event): void {
|
|
97
|
+
const target = event.target as HTMLInputElement;
|
|
98
|
+
if (this.actions && this.propName) {
|
|
99
|
+
handleEvent(this.actions, 'changeNblur', this.propName, target.value);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextArea — multi-line text input field.
|
|
3
|
+
*
|
|
4
|
+
* Pattern reference: sdk-react TextArea
|
|
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-text-area',
|
|
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
|
+
<textarea
|
|
24
|
+
[attr.data-testid]="testId"
|
|
25
|
+
[value]="value"
|
|
26
|
+
[placeholder]="placeholder"
|
|
27
|
+
[disabled]="disabled"
|
|
28
|
+
[required]="required"
|
|
29
|
+
(change)="onChange($event)"
|
|
30
|
+
(blur)="onBlur($event)"
|
|
31
|
+
rows="3"
|
|
32
|
+
style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem; resize: vertical;"
|
|
33
|
+
[style.border]="validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'"
|
|
34
|
+
>
|
|
35
|
+
</textarea>
|
|
36
|
+
<div *ngIf="validatemessage" style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;">
|
|
37
|
+
{{ validatemessage }}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div *ngIf="readOnly" style="margin-bottom: 1rem;">
|
|
41
|
+
<span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
|
|
42
|
+
<div style="font-size: 0.875rem; white-space: pre-wrap;">{{ value }}</div>
|
|
43
|
+
</div>
|
|
44
|
+
`,
|
|
45
|
+
})
|
|
46
|
+
export class TextAreaComponent implements OnInit, OnChanges {
|
|
47
|
+
@Input() props: any;
|
|
48
|
+
|
|
49
|
+
label = '';
|
|
50
|
+
value = '';
|
|
51
|
+
placeholder = '';
|
|
52
|
+
testId = '';
|
|
53
|
+
required = false;
|
|
54
|
+
disabled = false;
|
|
55
|
+
readOnly = false;
|
|
56
|
+
validatemessage = '';
|
|
57
|
+
|
|
58
|
+
private actions: any;
|
|
59
|
+
private propName = '';
|
|
60
|
+
|
|
61
|
+
ngOnInit(): void {
|
|
62
|
+
this.updateFromProps();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
66
|
+
if (changes['props']) {
|
|
67
|
+
this.updateFromProps();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private updateFromProps(): void {
|
|
72
|
+
const p = this.props;
|
|
73
|
+
this.label = p.label ?? '';
|
|
74
|
+
this.value = p.value ?? '';
|
|
75
|
+
this.placeholder = p.placeholder ?? '';
|
|
76
|
+
this.testId = p.testId ?? '';
|
|
77
|
+
this.required = p.required ?? false;
|
|
78
|
+
this.disabled = p.disabled ?? false;
|
|
79
|
+
this.readOnly = p.readOnly ?? false;
|
|
80
|
+
this.validatemessage = p.validatemessage ?? '';
|
|
81
|
+
|
|
82
|
+
const pConn = p.getPConnect?.();
|
|
83
|
+
this.actions = pConn?.getActionsApi?.();
|
|
84
|
+
this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onChange(event: Event): void {
|
|
88
|
+
const target = event.target as HTMLTextAreaElement;
|
|
89
|
+
this.value = target.value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onBlur(event: Event): void {
|
|
93
|
+
const target = event.target as HTMLTextAreaElement;
|
|
94
|
+
if (this.actions && this.propName) {
|
|
95
|
+
handleEvent(this.actions, 'changeNblur', this.propName, target.value);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextInput — standard text input field.
|
|
3
|
+
*
|
|
4
|
+
* Pattern reference: angular-sdk-components TextInputComponent + sdk-react TextInput
|
|
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-text-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="text"
|
|
25
|
+
[attr.data-testid]="testId"
|
|
26
|
+
[value]="value"
|
|
27
|
+
[placeholder]="placeholder"
|
|
28
|
+
[disabled]="disabled"
|
|
29
|
+
[required]="required"
|
|
30
|
+
(change)="onChange($event)"
|
|
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 TextInputComponent implements OnInit, OnChanges {
|
|
46
|
+
@Input() props: any;
|
|
47
|
+
|
|
48
|
+
label = '';
|
|
49
|
+
value = '';
|
|
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
|
+
onChange(event: Event): void {
|
|
87
|
+
const target = event.target as HTMLInputElement;
|
|
88
|
+
this.value = target.value;
|
|
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
|
+
}
|
package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URLInput — URL input field.
|
|
3
|
+
*
|
|
4
|
+
* Pattern reference: sdk-react URL
|
|
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-url-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="url"
|
|
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;">
|
|
41
|
+
<a *ngIf="value" [href]="value" target="_blank" rel="noopener noreferrer">{{ value }}</a>
|
|
42
|
+
<span *ngIf="!value">—</span>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
`,
|
|
46
|
+
})
|
|
47
|
+
export class URLInputComponent implements OnInit, OnChanges {
|
|
48
|
+
@Input() props: any;
|
|
49
|
+
|
|
50
|
+
label = '';
|
|
51
|
+
value = '';
|
|
52
|
+
placeholder = '';
|
|
53
|
+
testId = '';
|
|
54
|
+
required = false;
|
|
55
|
+
disabled = false;
|
|
56
|
+
readOnly = false;
|
|
57
|
+
validatemessage = '';
|
|
58
|
+
|
|
59
|
+
private actions: any;
|
|
60
|
+
private propName = '';
|
|
61
|
+
|
|
62
|
+
ngOnInit(): void {
|
|
63
|
+
this.updateFromProps();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
67
|
+
if (changes['props']) {
|
|
68
|
+
this.updateFromProps();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private updateFromProps(): void {
|
|
73
|
+
const p = this.props;
|
|
74
|
+
this.label = p.label ?? '';
|
|
75
|
+
this.value = p.value ?? '';
|
|
76
|
+
this.placeholder = p.placeholder ?? '';
|
|
77
|
+
this.testId = p.testId ?? '';
|
|
78
|
+
this.required = p.required ?? false;
|
|
79
|
+
this.disabled = p.disabled ?? false;
|
|
80
|
+
this.readOnly = p.readOnly ?? false;
|
|
81
|
+
this.validatemessage = p.validatemessage ?? '';
|
|
82
|
+
|
|
83
|
+
const pConn = p.getPConnect?.();
|
|
84
|
+
this.actions = pConn?.getActionsApi?.();
|
|
85
|
+
this.propName = ((pConn?.getStateProps?.() as Record<string, unknown>)?.value as string) ?? '';
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
onBlur(event: Event): void {
|
|
89
|
+
const target = event.target as HTMLInputElement;
|
|
90
|
+
if (this.actions && this.propName) {
|
|
91
|
+
handleEvent(this.actions, 'changeNblur', this.propName, target.value);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|