@pega/sdk 0.0.13 → 0.0.15
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 +46 -6
- package/dist/index.js +50 -24
- package/package.json +42 -3
- package/templates/angular-sdk-reference/extra-webpack.config.cjs +23 -0
- package/templates/angular-sdk-reference/index.html +12 -0
- package/templates/angular-sdk-reference/src/app/pconnect-renderer.component.ts +153 -0
- 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 +304 -0
- package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +89 -0
- package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +112 -0
- package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +101 -0
- package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +118 -0
- package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +104 -0
- package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +106 -0
- package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +104 -0
- package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +113 -0
- package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +111 -0
- package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +110 -0
- package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +113 -0
- package/templates/angular-sdk-reference/src/components/helpers/sdk-helpers.ts +93 -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 +75 -0
- package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +126 -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 +199 -0
- package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +89 -0
- package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +144 -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 +105 -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/tsconfig.app.json +13 -0
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +75 -34
- package/templates/react-sdk-reference/.ai-common/agents/implementation-expert.md +74 -38
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +33 -1
- package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +57 -22
- package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +25 -10
- package/templates/react-sdk-reference/.ai-common/prompts/add-component.md +40 -19
- package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +62 -1
- package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +26 -4
- package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +84 -33
- package/templates/react-sdk-reference/.ai-common/prompts/generate-dse-components.md +46 -26
- package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +28 -15
- package/templates/react-sdk-reference/.ai-common/prompts/generate-field-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/generate-infra-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/generate-template-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/generate-widget-components.md +24 -6
- package/templates/react-sdk-reference/.ai-common/prompts/identify-components.md +2 -0
- package/templates/react-sdk-reference/.ai-common/prompts/replace-design-system.md +44 -17
- package/templates/react-sdk-reference/.ai-common/skills/connect-pega-server.md +14 -1
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/AssignmentHeader.md +79 -0
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension-skills/Toast.md +96 -0
- package/templates/react-sdk-reference/.ai-common/skills/design-system-extension.md +56 -35
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +29 -3
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/run-and-verify-integration.md +97 -37
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +91 -60
- package/templates/react-sdk-reference/.ai-common/skills/field-components.md +88 -30
- 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/infra-components.md +13 -1
- package/templates/react-sdk-reference/.ai-common/skills/portal-flow/run-and-verify-portal.md +290 -0
- package/templates/react-sdk-reference/.ai-common/skills/template-components.md +13 -1
- 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
- package/templates/react-sdk-reference/.ai-common/skills/widget-components.md +13 -1
- package/templates/react-sdk-reference/assets/icons/trash.svg +3 -0
- package/templates/react-sdk-reference/index.html +0 -1
- package/templates/react-sdk-reference/package.json +2 -2
- package/templates/react-sdk-reference/package.minimal.json +2 -2
- package/templates/react-sdk-reference/sdk-config.json +3 -3
- package/templates/react-sdk-reference/src/FallbackComponent.tsx +1 -1
- package/templates/react-sdk-reference/src/MashupApp.tsx +33 -78
- package/templates/react-sdk-reference/src/PortalApp.tsx +23 -100
- package/templates/react-sdk-reference/src/components/component-map.ts +15 -1
- package/templates/react-sdk-reference/src/components/designSystemExtension/AssignmentHeader/AssignmentHeader.tsx +15 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/AssignmentHeader/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx +1 -1
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroupList/FieldGroupList.tsx +1 -1
- package/templates/react-sdk-reference/src/components/designSystemExtension/FieldValueList/FieldValueList.tsx +16 -4
- package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/ModalDialog.tsx +26 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Toast/Toast.tsx +35 -0
- package/templates/react-sdk-reference/src/components/designSystemExtension/Toast/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/AutoComplete/AutoComplete.tsx +362 -24
- package/templates/react-sdk-reference/src/components/field/CancelAlert/CancelAlert.tsx +1 -1
- package/templates/react-sdk-reference/src/components/field/Checkbox/Checkbox.tsx +3 -1
- package/templates/react-sdk-reference/src/components/field/Currency/Currency.tsx +6 -3
- package/templates/react-sdk-reference/src/components/field/Date/Date.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/DateTime/DateTime.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/Decimal/Decimal.tsx +4 -3
- package/templates/react-sdk-reference/src/components/field/Dropdown/Dropdown.tsx +2 -0
- package/templates/react-sdk-reference/src/components/field/Email/Email.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/EmbeddedDataMulti.tsx +121 -0
- package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/config-ext.json +7 -0
- package/templates/react-sdk-reference/src/components/field/EmbeddedDataMulti/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/field/Integer/Integer.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/Location/Location.tsx +1 -1
- package/templates/react-sdk-reference/src/components/field/Multiselect/Multiselect.tsx +40 -20
- package/templates/react-sdk-reference/src/components/field/ObjectReference/ObjectReference.tsx +554 -49
- package/templates/react-sdk-reference/src/components/field/ObjectReference/utils.ts +111 -20
- package/templates/react-sdk-reference/src/components/field/Percentage/Percentage.tsx +4 -3
- package/templates/react-sdk-reference/src/components/field/Phone/Phone.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/SelectableCard/SelectableCard.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/TextArea/TextArea.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/TextInput/TextInput.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/Time/Time.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/URL/URL.tsx +2 -1
- package/templates/react-sdk-reference/src/components/field/UserReference/UserReference.tsx +1 -1
- package/templates/react-sdk-reference/src/components/helpers/field-utils.ts +44 -0
- package/templates/react-sdk-reference/src/components/helpers/simpleTableHelpers.ts +19 -7
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/DataViewActionButtons/DataViewActionButtons.tsx +97 -0
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/DataViewActionButtons/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.tsx +53 -0
- package/templates/react-sdk-reference/src/components/infra/ModalViewContainer/ListViewActionButtons/index.tsx +1 -0
- package/templates/react-sdk-reference/src/components/template/AdvancedSearch/SearchGroups/SearchGroups.tsx +2 -2
- package/templates/react-sdk-reference/src/components/template/CaseSummary/CaseSummary.tsx +3 -1
- package/templates/react-sdk-reference/src/components/template/DataReference/SearchForm.tsx +4 -4
- package/templates/react-sdk-reference/src/components/template/HierarchicalForm/HierarchicalForm.tsx +2 -2
- package/templates/react-sdk-reference/src/components/template/InlineDashboard/InlineDashboard.tsx +1 -1
- package/templates/react-sdk-reference/src/components/template/ListView/ListView.tsx +7 -3
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +173 -99
- package/templates/react-sdk-reference/src/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +63 -56
- package/templates/react-sdk-reference/src/components/widget/ToDo/ToDo.tsx +1 -1
- package/templates/react-sdk-reference/vite.config.ts +26 -4
- package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +0 -47
- package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +0 -50
- package/templates/react-sdk-reference/.ai-common/instructions/infra-component.md +0 -76
- package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +0 -43
- package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +0 -45
- package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/authenticate.md +0 -311
- package/templates/react-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
- package/templates/react-sdk-reference/pega-sdk-react-0.1.0.tgz +0 -0
package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
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/sdk-helpers';
|
|
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
|
|
21
|
+
*ngIf="label"
|
|
22
|
+
style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;"
|
|
23
|
+
>
|
|
24
|
+
{{ label
|
|
25
|
+
}}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;"
|
|
26
|
+
>*</span
|
|
27
|
+
>
|
|
28
|
+
</label>
|
|
29
|
+
<input
|
|
30
|
+
type="text"
|
|
31
|
+
[attr.data-testid]="testId"
|
|
32
|
+
[value]="value"
|
|
33
|
+
[placeholder]="placeholder"
|
|
34
|
+
[disabled]="disabled"
|
|
35
|
+
[required]="required"
|
|
36
|
+
(change)="onChange($event)"
|
|
37
|
+
(blur)="onBlur($event)"
|
|
38
|
+
style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
|
|
39
|
+
[style.border]="
|
|
40
|
+
validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'
|
|
41
|
+
"
|
|
42
|
+
/>
|
|
43
|
+
<div
|
|
44
|
+
*ngIf="validatemessage"
|
|
45
|
+
style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;"
|
|
46
|
+
>
|
|
47
|
+
{{ validatemessage }}
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<div *ngIf="readOnly" style="margin-bottom: 1rem;">
|
|
51
|
+
<span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
|
|
52
|
+
<div style="font-size: 0.875rem;">{{ value }}</div>
|
|
53
|
+
</div>
|
|
54
|
+
`,
|
|
55
|
+
})
|
|
56
|
+
export class TextInputComponent implements OnInit, OnChanges {
|
|
57
|
+
@Input() props: any;
|
|
58
|
+
|
|
59
|
+
label = '';
|
|
60
|
+
value = '';
|
|
61
|
+
placeholder = '';
|
|
62
|
+
testId = '';
|
|
63
|
+
required = false;
|
|
64
|
+
disabled = false;
|
|
65
|
+
readOnly = false;
|
|
66
|
+
validatemessage = '';
|
|
67
|
+
|
|
68
|
+
private actions: any;
|
|
69
|
+
private propName = '';
|
|
70
|
+
|
|
71
|
+
ngOnInit(): void {
|
|
72
|
+
this.updateFromProps();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
76
|
+
if (changes['props']) {
|
|
77
|
+
this.updateFromProps();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private updateFromProps(): void {
|
|
82
|
+
const p = this.props;
|
|
83
|
+
this.label = p.label ?? '';
|
|
84
|
+
this.value = p.value ?? '';
|
|
85
|
+
this.placeholder = p.placeholder ?? '';
|
|
86
|
+
this.testId = p.testId ?? '';
|
|
87
|
+
this.required = p.required ?? false;
|
|
88
|
+
this.disabled = p.disabled ?? false;
|
|
89
|
+
this.readOnly = p.readOnly ?? false;
|
|
90
|
+
this.validatemessage = p.validatemessage ?? '';
|
|
91
|
+
|
|
92
|
+
const pConn = p.getPConnect?.();
|
|
93
|
+
this.actions = pConn?.getActionsApi?.();
|
|
94
|
+
this.propName =
|
|
95
|
+
((pConn?.getStateProps?.() as Record<string, unknown>)
|
|
96
|
+
?.value as string) ?? '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
onChange(event: Event): void {
|
|
100
|
+
const target = event.target as HTMLInputElement;
|
|
101
|
+
this.value = target.value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
onBlur(event: Event): void {
|
|
105
|
+
const target = event.target as HTMLInputElement;
|
|
106
|
+
if (this.actions && this.propName) {
|
|
107
|
+
handleEvent(this.actions, 'changeNblur', this.propName, target.value);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
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/sdk-helpers';
|
|
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
|
|
21
|
+
*ngIf="label"
|
|
22
|
+
style="display: block; margin-bottom: 0.25rem; font-weight: 500; font-size: 0.875rem;"
|
|
23
|
+
>
|
|
24
|
+
{{ label
|
|
25
|
+
}}<span *ngIf="required" style="color: #dc2626; margin-left: 0.25rem;"
|
|
26
|
+
>*</span
|
|
27
|
+
>
|
|
28
|
+
</label>
|
|
29
|
+
<input
|
|
30
|
+
type="url"
|
|
31
|
+
[attr.data-testid]="testId"
|
|
32
|
+
[value]="value"
|
|
33
|
+
[placeholder]="placeholder"
|
|
34
|
+
[disabled]="disabled"
|
|
35
|
+
[required]="required"
|
|
36
|
+
(blur)="onBlur($event)"
|
|
37
|
+
style="width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.375rem; font-size: 0.875rem;"
|
|
38
|
+
[style.border]="
|
|
39
|
+
validatemessage ? '1px solid #dc2626' : '1px solid #d1d5db'
|
|
40
|
+
"
|
|
41
|
+
/>
|
|
42
|
+
<div
|
|
43
|
+
*ngIf="validatemessage"
|
|
44
|
+
style="color: #dc2626; font-size: 0.75rem; margin-top: 0.25rem;"
|
|
45
|
+
>
|
|
46
|
+
{{ validatemessage }}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div *ngIf="readOnly" style="margin-bottom: 1rem;">
|
|
50
|
+
<span style="font-size: 0.75rem; color: #6b7280;">{{ label }}</span>
|
|
51
|
+
<div style="font-size: 0.875rem;">
|
|
52
|
+
<a
|
|
53
|
+
*ngIf="value"
|
|
54
|
+
[href]="value"
|
|
55
|
+
target="_blank"
|
|
56
|
+
rel="noopener noreferrer"
|
|
57
|
+
>{{ value }}</a
|
|
58
|
+
>
|
|
59
|
+
<span *ngIf="!value">—</span>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
`,
|
|
63
|
+
})
|
|
64
|
+
export class URLInputComponent implements OnInit, OnChanges {
|
|
65
|
+
@Input() props: any;
|
|
66
|
+
|
|
67
|
+
label = '';
|
|
68
|
+
value = '';
|
|
69
|
+
placeholder = '';
|
|
70
|
+
testId = '';
|
|
71
|
+
required = false;
|
|
72
|
+
disabled = false;
|
|
73
|
+
readOnly = false;
|
|
74
|
+
validatemessage = '';
|
|
75
|
+
|
|
76
|
+
private actions: any;
|
|
77
|
+
private propName = '';
|
|
78
|
+
|
|
79
|
+
ngOnInit(): void {
|
|
80
|
+
this.updateFromProps();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
84
|
+
if (changes['props']) {
|
|
85
|
+
this.updateFromProps();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private updateFromProps(): void {
|
|
90
|
+
const p = this.props;
|
|
91
|
+
this.label = p.label ?? '';
|
|
92
|
+
this.value = p.value ?? '';
|
|
93
|
+
this.placeholder = p.placeholder ?? '';
|
|
94
|
+
this.testId = p.testId ?? '';
|
|
95
|
+
this.required = p.required ?? false;
|
|
96
|
+
this.disabled = p.disabled ?? false;
|
|
97
|
+
this.readOnly = p.readOnly ?? false;
|
|
98
|
+
this.validatemessage = p.validatemessage ?? '';
|
|
99
|
+
|
|
100
|
+
const pConn = p.getPConnect?.();
|
|
101
|
+
this.actions = pConn?.getActionsApi?.();
|
|
102
|
+
this.propName =
|
|
103
|
+
((pConn?.getStateProps?.() as Record<string, unknown>)
|
|
104
|
+
?.value as string) ?? '';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
onBlur(event: Event): void {
|
|
108
|
+
const target = event.target as HTMLInputElement;
|
|
109
|
+
if (this.actions && this.propName) {
|
|
110
|
+
handleEvent(this.actions, 'changeNblur', this.propName, target.value);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export function handleEvent(
|
|
2
|
+
actions: any,
|
|
3
|
+
eventType: string,
|
|
4
|
+
propName: string,
|
|
5
|
+
value: unknown,
|
|
6
|
+
): void {
|
|
7
|
+
switch (eventType) {
|
|
8
|
+
case 'change':
|
|
9
|
+
actions.updateFieldValue(propName, value);
|
|
10
|
+
break;
|
|
11
|
+
case 'blur':
|
|
12
|
+
actions.triggerFieldChange(propName, value);
|
|
13
|
+
break;
|
|
14
|
+
case 'changeNblur':
|
|
15
|
+
actions.updateFieldValue(propName, value);
|
|
16
|
+
actions.triggerFieldChange(propName, value);
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getOptionList(
|
|
22
|
+
configProps: Record<string, any>,
|
|
23
|
+
dataObject: Record<string, any>,
|
|
24
|
+
): any[] {
|
|
25
|
+
const listType = configProps['listType']?.toLowerCase();
|
|
26
|
+
|
|
27
|
+
if (listType === 'associated') {
|
|
28
|
+
const datasource = configProps['datasource'];
|
|
29
|
+
return Array.isArray(datasource) ? datasource : [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (listType === 'datapage') {
|
|
33
|
+
const datasource = configProps['datasource'];
|
|
34
|
+
if (typeof datasource === 'string' && dataObject[datasource]) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const listOutput = configProps['listOutput'];
|
|
39
|
+
const items =
|
|
40
|
+
typeof datasource === 'object' && !Array.isArray(listOutput)
|
|
41
|
+
? datasource?.source
|
|
42
|
+
: listOutput;
|
|
43
|
+
return Array.isArray(items)
|
|
44
|
+
? items.map((item: any) => ({
|
|
45
|
+
...item,
|
|
46
|
+
value: item.text ?? item.value,
|
|
47
|
+
}))
|
|
48
|
+
: [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isAssignmentView(pConnect: any): boolean {
|
|
55
|
+
const caseInfo = PCore.getConstants().CASE_INFO;
|
|
56
|
+
const assignmentViewId = `${pConnect.getValue(caseInfo.ASSIGNMENTACTION_ID)}!${pConnect.getValue(caseInfo.CASE_INFO_CLASSID)}`;
|
|
57
|
+
const currentViewId = `${pConnect.getCurrentView()}!${pConnect.getCurrentClassID()}`;
|
|
58
|
+
return assignmentViewId === currentViewId;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getInstructions(
|
|
62
|
+
pConnect: any,
|
|
63
|
+
instructions = 'casestep',
|
|
64
|
+
): string | undefined {
|
|
65
|
+
const caseInfo = PCore.getConstants().CASE_INFO;
|
|
66
|
+
const caseStepInstructions = caseInfo.INSTRUCTIONS
|
|
67
|
+
? pConnect.getValue(caseInfo.INSTRUCTIONS)
|
|
68
|
+
: undefined;
|
|
69
|
+
|
|
70
|
+
if (
|
|
71
|
+
instructions === 'casestep' &&
|
|
72
|
+
isAssignmentView(pConnect) &&
|
|
73
|
+
caseStepInstructions?.length
|
|
74
|
+
) {
|
|
75
|
+
return caseStepInstructions;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (
|
|
79
|
+
instructions === 'none' ||
|
|
80
|
+
instructions?.startsWith('@PARAGRAPH') ||
|
|
81
|
+
instructions === 'casestep'
|
|
82
|
+
) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return instructions;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function compareSdkPCoreVersions(): void {
|
|
90
|
+
console.warn(
|
|
91
|
+
`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`,
|
|
92
|
+
);
|
|
93
|
+
}
|
package/templates/angular-sdk-reference/src/components/infra/assignment/assignment.component.ts
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assignment — renders the current assignment step and its action buttons.
|
|
3
|
+
*
|
|
4
|
+
* Receives assignment children (the form to fill) and action buttons from the
|
|
5
|
+
* case's actionButtons metadata. Delegates form rendering to children and
|
|
6
|
+
* handles submit/cancel/save/navigate actions via the actionsAPI.
|
|
7
|
+
*
|
|
8
|
+
* In the component hierarchy, FlowContainer renders Assignment explicitly,
|
|
9
|
+
* passing routed view children and itemKey. Assignment wraps those children
|
|
10
|
+
* with action buttons below — matching the reference angular-sdk pattern.
|
|
11
|
+
*
|
|
12
|
+
* Pattern reference: angular-sdk-components AssignmentComponent + sdk-react Assignment
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
+
import { Component, Input, ChangeDetectorRef, NgZone } from '@angular/core';
|
|
17
|
+
import type { OnInit, OnDestroy } from '@angular/core';
|
|
18
|
+
import { CommonModule } from '@angular/common';
|
|
19
|
+
import { PConnectBridgeComponent } from '@pega/sdk-angular';
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'pega-assignment',
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [CommonModule, PConnectBridgeComponent],
|
|
25
|
+
template: `
|
|
26
|
+
<div *ngIf="bReady">
|
|
27
|
+
<!-- Render assignment children (the form) -->
|
|
28
|
+
<div *ngFor="let child of childGetters">
|
|
29
|
+
<pconnect-bridge [getPConnect]="child"></pconnect-bridge>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<!-- Action buttons -->
|
|
33
|
+
<div
|
|
34
|
+
*ngIf="arMainButtons.length > 0 || arSecondaryButtons.length > 0"
|
|
35
|
+
style="display: flex; gap: 0.5rem; margin-top: 1rem; justify-content: flex-end;"
|
|
36
|
+
>
|
|
37
|
+
<button
|
|
38
|
+
*ngFor="let btn of arSecondaryButtons"
|
|
39
|
+
(click)="buttonPress(btn.jsAction, 'secondary')"
|
|
40
|
+
style="padding: 0.5rem 1rem; border: 1px solid #d1d5db; border-radius: 0.375rem; background: white; cursor: pointer;"
|
|
41
|
+
>
|
|
42
|
+
{{ btn.name }}
|
|
43
|
+
</button>
|
|
44
|
+
<button
|
|
45
|
+
*ngFor="let btn of arMainButtons"
|
|
46
|
+
(click)="buttonPress(btn.jsAction, 'primary')"
|
|
47
|
+
style="padding: 0.5rem 1rem; border: none; border-radius: 0.375rem; background: #2563eb; color: white; cursor: pointer;"
|
|
48
|
+
>
|
|
49
|
+
{{ btn.name }}
|
|
50
|
+
</button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
`,
|
|
54
|
+
})
|
|
55
|
+
export class AssignmentComponent implements OnInit, OnDestroy {
|
|
56
|
+
@Input() props: any;
|
|
57
|
+
|
|
58
|
+
bReady = false;
|
|
59
|
+
childGetters: Array<() => typeof PConnect> = [];
|
|
60
|
+
arMainButtons: any[] = [];
|
|
61
|
+
arSecondaryButtons: any[] = [];
|
|
62
|
+
|
|
63
|
+
private pConn: any;
|
|
64
|
+
private actionsAPI: any;
|
|
65
|
+
private itemKey = '';
|
|
66
|
+
private storeUnsub: (() => void) | undefined;
|
|
67
|
+
|
|
68
|
+
constructor(
|
|
69
|
+
private ngZone: NgZone,
|
|
70
|
+
private cdr: ChangeDetectorRef,
|
|
71
|
+
) {}
|
|
72
|
+
|
|
73
|
+
ngOnInit(): void {
|
|
74
|
+
this.pConn = this.props.getPConnect();
|
|
75
|
+
this.itemKey = this.props.itemKey ?? '';
|
|
76
|
+
|
|
77
|
+
this.initComponent();
|
|
78
|
+
|
|
79
|
+
// Subscribe to store for updates (action buttons may change between steps)
|
|
80
|
+
this.storeUnsub = PCore.getStore().subscribe(() => {
|
|
81
|
+
this.updateSelf();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
ngOnDestroy(): void {
|
|
86
|
+
this.storeUnsub?.();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private initComponent(): void {
|
|
90
|
+
const baseContext = this.pConn.getContextName?.() ?? '';
|
|
91
|
+
const acName = this.pConn.getContainerName?.() ?? '';
|
|
92
|
+
if (!this.itemKey) {
|
|
93
|
+
this.itemKey = `${baseContext}/${acName}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.pConn.isBoundToState();
|
|
97
|
+
this.updateSelf();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private updateSelf(): void {
|
|
101
|
+
// Children come from FlowContainer's arChildren prop (the routed view PConnect),
|
|
102
|
+
// matching the reference pattern where FlowContainer passes arChildren$ to Assignment.
|
|
103
|
+
const arChildrenFromProps = this.props.arChildren;
|
|
104
|
+
if (arChildrenFromProps && arChildrenFromProps.length > 0) {
|
|
105
|
+
this.childGetters = arChildrenFromProps.map((child: any) => {
|
|
106
|
+
return child.getPConnect ?? (() => child);
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
// Fallback: get children from pConn
|
|
110
|
+
const children = this.pConn.getChildren?.() ?? [];
|
|
111
|
+
this.childGetters = children.map((child: any) => {
|
|
112
|
+
return child.getPConnect ?? (() => child);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Update itemKey from props if changed
|
|
117
|
+
if (this.props.itemKey) {
|
|
118
|
+
this.itemKey = this.props.itemKey;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Extract action buttons from case data.
|
|
122
|
+
// Reference pattern: Assignment gets caseInfo from its own pConn's data object,
|
|
123
|
+
// and actionsAPI from the first child work item's pConn.
|
|
124
|
+
this.extractActionButtons();
|
|
125
|
+
|
|
126
|
+
this.ngZone.run(() => {
|
|
127
|
+
this.bReady = true;
|
|
128
|
+
this.cdr.detectChanges();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private extractActionButtons(): void {
|
|
133
|
+
// Get action buttons from the Assignment's own pConn case data
|
|
134
|
+
const oData = this.pConn.getDataObject?.() ?? {};
|
|
135
|
+
const caseInfo = oData?.caseInfo;
|
|
136
|
+
|
|
137
|
+
if (caseInfo?.actionButtons) {
|
|
138
|
+
this.arMainButtons = caseInfo.actionButtons.main ?? [];
|
|
139
|
+
this.arSecondaryButtons = caseInfo.actionButtons.secondary ?? [];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Get actionsAPI from the Assignment's own pConn (not from child).
|
|
143
|
+
// The Assignment pConn has the correct context for finishAssignment/cancelAssignment.
|
|
144
|
+
try {
|
|
145
|
+
this.actionsAPI = this.pConn.getActionsApi?.() ?? null;
|
|
146
|
+
} catch {
|
|
147
|
+
// actionsApi may not be available
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
buttonPress(sAction: string, sButtonType: string): void {
|
|
152
|
+
if (!this.actionsAPI) return;
|
|
153
|
+
|
|
154
|
+
const finishAssignment = this.actionsAPI.finishAssignment?.bind(
|
|
155
|
+
this.actionsAPI,
|
|
156
|
+
);
|
|
157
|
+
const cancelAssignment = this.actionsAPI.cancelAssignment?.bind(
|
|
158
|
+
this.actionsAPI,
|
|
159
|
+
);
|
|
160
|
+
const navigateToStep = this.actionsAPI.navigateToStep?.bind(
|
|
161
|
+
this.actionsAPI,
|
|
162
|
+
);
|
|
163
|
+
const saveAssignment = this.actionsAPI.saveAssignment?.bind(
|
|
164
|
+
this.actionsAPI,
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
if (sButtonType === 'secondary') {
|
|
168
|
+
switch (sAction) {
|
|
169
|
+
case 'navigateToStep':
|
|
170
|
+
navigateToStep?.('previous', this.itemKey)?.catch(() => {
|
|
171
|
+
console.error('Assignment: Navigation failed');
|
|
172
|
+
});
|
|
173
|
+
break;
|
|
174
|
+
case 'saveAssignment':
|
|
175
|
+
saveAssignment?.(this.itemKey)?.catch(() => {
|
|
176
|
+
console.error('Assignment: Save failed');
|
|
177
|
+
});
|
|
178
|
+
break;
|
|
179
|
+
case 'cancelAssignment': {
|
|
180
|
+
const { PUB_SUB_EVENTS } = PCore.getConstants() as any;
|
|
181
|
+
const { publish } = PCore.getPubSubUtils();
|
|
182
|
+
cancelAssignment?.(this.itemKey, false)
|
|
183
|
+
?.then((data: any) => {
|
|
184
|
+
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
185
|
+
})
|
|
186
|
+
?.catch(() => {
|
|
187
|
+
console.error('Assignment: Cancel failed');
|
|
188
|
+
});
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
default:
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
} else if (sButtonType === 'primary') {
|
|
195
|
+
switch (sAction) {
|
|
196
|
+
case 'finishAssignment':
|
|
197
|
+
finishAssignment?.(this.itemKey)?.catch(() => {
|
|
198
|
+
console.error('Assignment: Submit failed');
|
|
199
|
+
});
|
|
200
|
+
break;
|
|
201
|
+
default:
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CaseSummary — renders case summary header with status badge.
|
|
3
|
+
*
|
|
4
|
+
* Pattern reference: angular-sdk-components CaseSummaryComponent + sdk-react CaseSummary
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
import { Component, Input, ChangeDetectorRef, NgZone } from '@angular/core';
|
|
9
|
+
import type { OnInit, OnDestroy } from '@angular/core';
|
|
10
|
+
import { CommonModule } from '@angular/common';
|
|
11
|
+
import { PegaBridgeService } from '@pega/sdk-angular';
|
|
12
|
+
import type { Unsubscribe } from '@pega/sdk-angular';
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'pega-case-summary',
|
|
16
|
+
standalone: true,
|
|
17
|
+
imports: [CommonModule],
|
|
18
|
+
template: `
|
|
19
|
+
<div
|
|
20
|
+
style="display: flex; justify-content: space-between; align-items: center;
|
|
21
|
+
padding: 0.75rem 1rem; background: #f9fafb; border-radius: 0.375rem; margin-bottom: 1rem;"
|
|
22
|
+
>
|
|
23
|
+
<span style="font-weight: 600; font-size: 0.875rem;">
|
|
24
|
+
{{ header }}
|
|
25
|
+
</span>
|
|
26
|
+
<span
|
|
27
|
+
*ngIf="status"
|
|
28
|
+
style="font-size: 0.75rem; padding: 0.25rem 0.5rem; background: #dbeafe; color: #1d4ed8; border-radius: 1rem;"
|
|
29
|
+
>
|
|
30
|
+
{{ status }}
|
|
31
|
+
</span>
|
|
32
|
+
</div>
|
|
33
|
+
`,
|
|
34
|
+
})
|
|
35
|
+
export class CaseSummaryComponent implements OnInit, OnDestroy {
|
|
36
|
+
@Input() props: any;
|
|
37
|
+
|
|
38
|
+
header = '';
|
|
39
|
+
status = '';
|
|
40
|
+
|
|
41
|
+
private pConn: any;
|
|
42
|
+
private bridge = new PegaBridgeService();
|
|
43
|
+
private storeUnsub: Unsubscribe | undefined;
|
|
44
|
+
|
|
45
|
+
constructor(
|
|
46
|
+
private ngZone: NgZone,
|
|
47
|
+
private cdr: ChangeDetectorRef,
|
|
48
|
+
) {}
|
|
49
|
+
|
|
50
|
+
ngOnInit(): void {
|
|
51
|
+
this.pConn = this.props.getPConnect();
|
|
52
|
+
this.updateSelf();
|
|
53
|
+
|
|
54
|
+
const subscription = this.bridge.observe(this.pConn).subscribe(() => {
|
|
55
|
+
this.updateSelf();
|
|
56
|
+
});
|
|
57
|
+
this.storeUnsub = () => subscription.unsubscribe();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ngOnDestroy(): void {
|
|
61
|
+
this.storeUnsub?.();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private updateSelf(): void {
|
|
65
|
+
const configProps = this.pConn.resolveConfigProps(
|
|
66
|
+
this.pConn.getConfigProps(),
|
|
67
|
+
);
|
|
68
|
+
this.header = configProps.header ?? '';
|
|
69
|
+
this.status = configProps.status ?? '';
|
|
70
|
+
|
|
71
|
+
this.ngZone.run(() => {
|
|
72
|
+
this.cdr.detectChanges();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|