@pega/sdk 0.0.14 → 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/angular.json +1 -2
- 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/package.json +0 -1
- package/templates/angular-sdk-reference/src/app/app.component.ts +15 -232
- package/templates/angular-sdk-reference/src/app/pconnect-renderer.component.ts +153 -0
- package/templates/angular-sdk-reference/src/components/fields/auto-complete/auto-complete.component.ts +58 -21
- package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +8 -3
- package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +22 -7
- package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +19 -6
- package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +24 -7
- package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +19 -6
- package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +19 -6
- package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +19 -6
- package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +16 -5
- package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +19 -6
- package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +19 -6
- package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +26 -7
- package/templates/angular-sdk-reference/src/components/helpers/sdk-helpers.ts +93 -0
- package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts +8 -9
- package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +24 -12
- package/templates/angular-sdk-reference/src/components/infra/root-container/root-container.component.ts +21 -15
- package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +21 -10
- package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +14 -9
- package/templates/angular-sdk-reference/src/components/templates/default-form/default-form.component.ts +12 -8
- package/templates/angular-sdk-reference/tsconfig.app.json +13 -0
- package/templates/angular-sdk-reference/tsconfig.json +2 -5
- package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +65 -31
- 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 +55 -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 +82 -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 +13 -1
- 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/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/angular-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
- package/templates/angular-sdk-reference/src/helpers/event-utils.ts +0 -18
- package/templates/angular-sdk-reference/src/helpers/utils.ts +0 -38
- package/templates/angular-sdk-reference/src/helpers/versionHelpers.ts +0 -14
- 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
|
@@ -3,20 +3,17 @@
|
|
|
3
3
|
* in full portal mode.
|
|
4
4
|
*
|
|
5
5
|
* Flow:
|
|
6
|
-
* 1.
|
|
7
|
-
* 2.
|
|
6
|
+
* 1. PegaRuntimeProvider (mode="portal") authenticates via full-page redirect
|
|
7
|
+
* 2. It bootstraps via BootstrapClient.loadPortal()
|
|
8
8
|
* 3. PConnectComponent renders the full portal UI via registered sample components
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import { useLocation } from 'react-router-dom';
|
|
11
|
+
import { useMemo } from 'react';
|
|
13
12
|
|
|
14
|
-
import { PConnectComponent, PegaStoreContext,
|
|
13
|
+
import { PConnectComponent, PegaRuntimeProvider, PegaStoreContext, usePegaRuntime } from '@pega/sdk-react';
|
|
15
14
|
|
|
16
15
|
import { registerSampleComponents } from './components/component-map';
|
|
17
16
|
import { AppProviders } from './AppProviders';
|
|
18
|
-
import { getSdkConfig } from '@pega/auth/lib/sdk-auth-manager';
|
|
19
|
-
import { AuthClient } from '@pega/auth';
|
|
20
17
|
|
|
21
18
|
import { FallbackComponent } from './FallbackComponent';
|
|
22
19
|
|
|
@@ -35,104 +32,30 @@ function RootComponent({ renderProps, registry }: { renderProps: Record<string,
|
|
|
35
32
|
|
|
36
33
|
// ─── Portal App ─────────────────────────────────────────────────────────────
|
|
37
34
|
function PortalApp() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (localeParam) {
|
|
54
|
-
sessionStorage.setItem('rsdk_locale', localeParam);
|
|
55
|
-
}
|
|
56
|
-
}, [query]);
|
|
57
|
-
|
|
58
|
-
// ── Auth + Bootstrap portal on mount ─────────────────────────────────
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
let cancelled = false;
|
|
61
|
-
|
|
62
|
-
async function bootstrap() {
|
|
63
|
-
const auth = new AuthClient();
|
|
64
|
-
authClientRef.current = auth;
|
|
65
|
-
|
|
66
|
-
const locale = sessionStorage.getItem('rsdk_locale') || undefined;
|
|
67
|
-
await auth.login({ appName: 'portal', mainRedirect: true, locale });
|
|
68
|
-
if (cancelled) return;
|
|
69
|
-
|
|
70
|
-
sessionStorage.setItem('isLoggedIn', 'true');
|
|
71
|
-
|
|
72
|
-
const {
|
|
73
|
-
BootstrapClient,
|
|
74
|
-
compareSdkPCoreVersions,
|
|
75
|
-
createComponentRegistry,
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
} = PCore.getInitialiser().getSdkCore();
|
|
78
|
-
|
|
79
|
-
// Create component registry + register sample components
|
|
80
|
-
const registry = createComponentRegistry();
|
|
81
|
-
registerSampleComponents(registry);
|
|
82
|
-
registerComponentCreator(registry, FallbackComponent);
|
|
83
|
-
registryRef.current = registry;
|
|
84
|
-
|
|
85
|
-
// Determine which portal to load
|
|
86
|
-
const sdkConfig = (await getSdkConfig()) as Record<string, Record<string, unknown>>;
|
|
87
|
-
const appPortal = sdkConfig.serverConfig.appPortal as string;
|
|
88
|
-
const excludePortals = (sdkConfig.serverConfig.excludePortals ?? []) as string[];
|
|
89
|
-
|
|
90
|
-
const queryPortal = sessionStorage.getItem('rsdk_portalName');
|
|
91
|
-
const portalName = queryPortal || appPortal || undefined;
|
|
92
|
-
|
|
93
|
-
const client = new BootstrapClient({
|
|
94
|
-
sdkConfig: {
|
|
95
|
-
serverConfig: { infinityRestServerUrl: '', appAlias: '' },
|
|
96
|
-
authConfig: { clientId: '' },
|
|
97
|
-
},
|
|
98
|
-
componentRegistry: registry,
|
|
99
|
-
targetId: 'pega-root',
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
console.log(`Loading portal: ${portalName}, excluding portals: ${excludePortals}`);
|
|
103
|
-
const result = await client.loadPortal({
|
|
104
|
-
portalName,
|
|
105
|
-
excludePortals,
|
|
106
|
-
onPCoreReady: () => {
|
|
107
|
-
compareSdkPCoreVersions();
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
if (cancelled) return;
|
|
112
|
-
|
|
113
|
-
setRootProps(result.rootProps);
|
|
114
|
-
setIsPegaReady(true);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
bootstrap().catch(console.error);
|
|
35
|
+
return (
|
|
36
|
+
<PegaRuntimeProvider
|
|
37
|
+
mode="portal"
|
|
38
|
+
registerComponents={registerSampleComponents}
|
|
39
|
+
fallback={FallbackComponent}
|
|
40
|
+
loadingComponent={
|
|
41
|
+
<div className="loading-container">
|
|
42
|
+
<span className="loading-text">Authenticating and loading portal...</span>
|
|
43
|
+
</div>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<PortalContent />
|
|
47
|
+
</PegaRuntimeProvider>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
118
50
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
};
|
|
122
|
-
}, []);
|
|
51
|
+
function PortalContent() {
|
|
52
|
+
const { bootstrapResult, componentRegistry } = usePegaRuntime();
|
|
123
53
|
|
|
124
|
-
|
|
125
|
-
if (!isPegaReady || !rootProps) {
|
|
126
|
-
return (
|
|
127
|
-
<div className="loading-container">
|
|
128
|
-
<span className="loading-text">Authenticating and loading portal...</span>
|
|
129
|
-
</div>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
54
|
+
if (!bootstrapResult) return null;
|
|
132
55
|
|
|
133
56
|
return (
|
|
134
57
|
<div id="pega-root">
|
|
135
|
-
<RootComponent renderProps={rootProps} registry={
|
|
58
|
+
<RootComponent renderProps={bootstrapResult.rootProps} registry={componentRegistry} />
|
|
136
59
|
</div>
|
|
137
60
|
);
|
|
138
61
|
}
|
|
@@ -11,6 +11,7 @@ import DateTime from './field/DateTime';
|
|
|
11
11
|
import Decimal from './field/Decimal';
|
|
12
12
|
import Dropdown from './field/Dropdown';
|
|
13
13
|
import Email from './field/Email/Email';
|
|
14
|
+
import EmbeddedDataMulti from './field/EmbeddedDataMulti';
|
|
14
15
|
import Group from './field/Group';
|
|
15
16
|
import Integer from './field/Integer';
|
|
16
17
|
import Location from './field/Location';
|
|
@@ -94,17 +95,24 @@ import ToDo from './widget/ToDo';
|
|
|
94
95
|
|
|
95
96
|
// Design System Extension
|
|
96
97
|
import AlertBanner from './designSystemExtension/AlertBanner';
|
|
98
|
+
import AssignmentHeader from './designSystemExtension/AssignmentHeader';
|
|
97
99
|
import Banner from './designSystemExtension/Banner';
|
|
98
100
|
import CaseSummaryFields from './designSystemExtension/CaseSummaryFields';
|
|
99
101
|
import DetailsFields from './designSystemExtension/DetailsFields';
|
|
100
102
|
import FieldGroup from './designSystemExtension/FieldGroup';
|
|
101
103
|
import FieldGroupList from './designSystemExtension/FieldGroupList';
|
|
102
104
|
import FieldValueList from './designSystemExtension/FieldValueList';
|
|
105
|
+
import ModalDialog from './designSystemExtension/ModalDialog';
|
|
103
106
|
import Operator from './designSystemExtension/Operator';
|
|
104
107
|
import Pulse from './designSystemExtension/Pulse';
|
|
105
108
|
import RichTextEditor from './designSystemExtension/RichTextEditor';
|
|
109
|
+
import Toast from './designSystemExtension/Toast';
|
|
106
110
|
import WssQuickCreate from './designSystemExtension/WssQuickCreate';
|
|
107
111
|
|
|
112
|
+
// Infra (sample-specific)
|
|
113
|
+
import DataViewActionButtons from './infra/ModalViewContainer/DataViewActionButtons';
|
|
114
|
+
import ListViewActionButtons from './infra/ModalViewContainer/ListViewActionButtons';
|
|
115
|
+
|
|
108
116
|
// Infra (provided by @pega/sdk-react)
|
|
109
117
|
import {
|
|
110
118
|
ActionButtons,
|
|
@@ -135,6 +143,7 @@ function getSampleComponentMap(): Record<string, React.ComponentType<Record<stri
|
|
|
135
143
|
Decimal,
|
|
136
144
|
Dropdown,
|
|
137
145
|
Email,
|
|
146
|
+
EmbeddedDataMulti,
|
|
138
147
|
Group,
|
|
139
148
|
Integer,
|
|
140
149
|
Location,
|
|
@@ -218,22 +227,27 @@ function getSampleComponentMap(): Record<string, React.ComponentType<Record<stri
|
|
|
218
227
|
|
|
219
228
|
// Design System Extension
|
|
220
229
|
AlertBanner,
|
|
230
|
+
AssignmentHeader,
|
|
221
231
|
Banner,
|
|
222
232
|
CaseSummaryFields,
|
|
223
233
|
DetailsFields,
|
|
224
234
|
FieldGroup,
|
|
225
235
|
FieldGroupList,
|
|
226
236
|
FieldValueList,
|
|
237
|
+
ModalDialog,
|
|
227
238
|
Operator,
|
|
228
239
|
Pulse,
|
|
229
240
|
RichTextEditor,
|
|
241
|
+
Toast,
|
|
230
242
|
WssQuickCreate,
|
|
231
243
|
|
|
232
244
|
// Infra (sample-specific)
|
|
233
245
|
ActionButtons,
|
|
234
|
-
DeferLoad,
|
|
235
246
|
DashboardFilter,
|
|
247
|
+
DataViewActionButtons,
|
|
248
|
+
DeferLoad,
|
|
236
249
|
LeftAlignVerticalTabs,
|
|
250
|
+
ListViewActionButtons,
|
|
237
251
|
NavBar,
|
|
238
252
|
Stages,
|
|
239
253
|
VerticalTabs,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Typography from '@mui/material/Typography';
|
|
2
|
+
|
|
3
|
+
interface AssignmentHeaderProps {
|
|
4
|
+
title: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default function AssignmentHeader(props: AssignmentHeaderProps) {
|
|
8
|
+
const { title } = props;
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<Typography variant="h6" id="assignment-header" sx={{ mb: 2 }}>
|
|
12
|
+
{title}
|
|
13
|
+
</Typography>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AssignmentHeader';
|
package/templates/react-sdk-reference/src/components/designSystemExtension/FieldGroup/FieldGroup.tsx
CHANGED
|
@@ -55,7 +55,7 @@ export default function FieldGroup(props: PropsWithChildren<FieldGroupProps>) {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
return (
|
|
58
|
-
<Grid container spacing={4} justifyContent
|
|
58
|
+
<Grid container spacing={4} sx={{ justifyContent: 'space-between' }}>
|
|
59
59
|
<Grid style={{ width: '100%' }}>
|
|
60
60
|
{name && (
|
|
61
61
|
<div className={classes.fieldMargin}>
|
|
@@ -20,7 +20,7 @@ export default function FieldGroupList(props: FieldGroupListProps) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
|
-
<Grid container spacing={4} justifyContent
|
|
23
|
+
<Grid container spacing={4} sx={{ justifyContent: 'space-between' }}>
|
|
24
24
|
<Grid style={{ width: '100%' }}>
|
|
25
25
|
<Grid container spacing={1}>
|
|
26
26
|
{props.items.map((item) => (
|
|
@@ -32,6 +32,16 @@ const useStyles = makeStyles((theme) => ({
|
|
|
32
32
|
noPaddingBottom: {
|
|
33
33
|
paddingBottom: '0 !important',
|
|
34
34
|
},
|
|
35
|
+
htmlContent: {
|
|
36
|
+
'& ul': {
|
|
37
|
+
paddingLeft: '30px',
|
|
38
|
+
listStyleType: 'disc',
|
|
39
|
+
},
|
|
40
|
+
'& ol': {
|
|
41
|
+
paddingLeft: '30px',
|
|
42
|
+
listStyleType: 'decimal',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
35
45
|
}));
|
|
36
46
|
|
|
37
47
|
function formatItemValue(value) {
|
|
@@ -48,15 +58,17 @@ function formatItemValue(value) {
|
|
|
48
58
|
export default function FieldValueList(props: FieldValueListProps) {
|
|
49
59
|
const { name, value, variant = 'inline', isHtml = false } = props;
|
|
50
60
|
const classes = useStyles();
|
|
61
|
+
const isCompact = variant === 'inline-compact';
|
|
51
62
|
|
|
52
63
|
function getGridItemLabel() {
|
|
53
64
|
return (
|
|
54
65
|
<Grid
|
|
55
|
-
size={{ xs: variant === 'stacked' ? 12 : 4 }}
|
|
66
|
+
size={{ xs: variant === 'stacked' ? 12 : isCompact ? 'auto' : 4 }}
|
|
56
67
|
className={variant === 'stacked' ? classes.noPaddingBottom : ''}
|
|
57
68
|
>
|
|
58
69
|
<Typography variant="body2" component="span" className={`${classes.fieldLabel}`}>
|
|
59
70
|
{name}
|
|
71
|
+
{isCompact ? ':' : ''}
|
|
60
72
|
</Typography>
|
|
61
73
|
</Grid>
|
|
62
74
|
);
|
|
@@ -67,11 +79,11 @@ export default function FieldValueList(props: FieldValueListProps) {
|
|
|
67
79
|
|
|
68
80
|
return (
|
|
69
81
|
<Grid
|
|
70
|
-
size={{ xs: variant === 'stacked' || !name ? 12 : 8 }}
|
|
82
|
+
size={{ xs: variant === 'stacked' || !name ? 12 : isCompact ? 'grow' : 8 }}
|
|
71
83
|
className={variant === 'stacked' ? classes.noPaddingTop : ''}
|
|
72
84
|
>
|
|
73
85
|
{isHtml ? (
|
|
74
|
-
<div dangerouslySetInnerHTML={{ __html: formattedValue }} />
|
|
86
|
+
<div className={classes.htmlContent} dangerouslySetInnerHTML={{ __html: formattedValue }} />
|
|
75
87
|
) : (
|
|
76
88
|
<Typography variant={variant === 'stacked' ? 'h6' : 'body2'} component="span" className={classes.fieldValue}>
|
|
77
89
|
{formattedValue}
|
|
@@ -82,7 +94,7 @@ export default function FieldValueList(props: FieldValueListProps) {
|
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
return (
|
|
85
|
-
<Grid container spacing={4} justifyContent
|
|
97
|
+
<Grid container spacing={isCompact ? 1 : 4} sx={{ justifyContent: isCompact ? undefined : 'space-between' }}>
|
|
86
98
|
{name ? getGridItemLabel() : null}
|
|
87
99
|
{getGridItemValue()}
|
|
88
100
|
</Grid>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import Dialog from '@mui/material/Dialog';
|
|
3
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
4
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
5
|
+
|
|
6
|
+
interface ModalDialogProps {
|
|
7
|
+
id: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function ModalDialog(props: PropsWithChildren<ModalDialogProps>) {
|
|
13
|
+
const { id, title, actions, children } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Dialog open aria-labelledby={`form-dialog-title-${id}`} maxWidth="md" fullWidth>
|
|
17
|
+
<DialogTitle id={`form-dialog-title-${id}`} className="psdk-dialog-title" sx={{ mx: 2, mt: 2, mb: 0 }}>
|
|
18
|
+
{title}
|
|
19
|
+
</DialogTitle>
|
|
20
|
+
<DialogContent className="psdk-dialog-content" sx={{ pt: '8px !important', mx: 2, mt: 0, mb: 2 }}>
|
|
21
|
+
{children}
|
|
22
|
+
</DialogContent>
|
|
23
|
+
{actions}
|
|
24
|
+
</Dialog>
|
|
25
|
+
);
|
|
26
|
+
}
|
package/templates/react-sdk-reference/src/components/designSystemExtension/ModalDialog/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ModalDialog';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SyntheticEvent } from 'react';
|
|
2
|
+
import IconButton from '@mui/material/IconButton';
|
|
3
|
+
import Snackbar from '@mui/material/Snackbar';
|
|
4
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
5
|
+
|
|
6
|
+
interface ToastProps {
|
|
7
|
+
open: boolean;
|
|
8
|
+
message: string;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
autoHideDuration?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function Toast(props: ToastProps) {
|
|
14
|
+
const { open, message, onClose, autoHideDuration = 3000 } = props;
|
|
15
|
+
|
|
16
|
+
function handleClose(_event: SyntheticEvent | Event, reason?: string) {
|
|
17
|
+
if (reason === 'clickaway') return;
|
|
18
|
+
onClose();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Snackbar
|
|
23
|
+
open={open}
|
|
24
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
|
25
|
+
autoHideDuration={autoHideDuration}
|
|
26
|
+
onClose={handleClose}
|
|
27
|
+
message={message}
|
|
28
|
+
action={
|
|
29
|
+
<IconButton size="small" aria-label="close" color="inherit" onClick={handleClose}>
|
|
30
|
+
<CloseIcon fontSize="small" />
|
|
31
|
+
</IconButton>
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Toast';
|