@pega/react-sdk-overrides 0.23.6
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/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
- package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
- package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
- package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
- package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
- package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
- package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
- package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
- package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
- package/lib/designSystemExtensions/Operator/index.tsx +1 -0
- package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
- package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
- package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
- package/lib/forms/AutoComplete/index.tsx +1 -0
- package/lib/forms/CancelAlert/CancelAlert.css +24 -0
- package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
- package/lib/forms/CancelAlert/index.tsx +1 -0
- package/lib/forms/Checkbox/Checkbox.tsx +68 -0
- package/lib/forms/Checkbox/index.tsx +1 -0
- package/lib/forms/Currency/Currency.tsx +89 -0
- package/lib/forms/Currency/index.tsx +1 -0
- package/lib/forms/Date/Date.tsx +79 -0
- package/lib/forms/Date/index.tsx +1 -0
- package/lib/forms/DateTime/DateTime.tsx +75 -0
- package/lib/forms/DateTime/index.tsx +1 -0
- package/lib/forms/Decimal/Decimal.tsx +51 -0
- package/lib/forms/Decimal/index.tsx +1 -0
- package/lib/forms/Dropdown/Dropdown.tsx +82 -0
- package/lib/forms/Dropdown/index.tsx +1 -0
- package/lib/forms/Email/Email.tsx +68 -0
- package/lib/forms/Email/index.tsx +1 -0
- package/lib/forms/Integer/Integer.tsx +77 -0
- package/lib/forms/Integer/index.tsx +1 -0
- package/lib/forms/Percentage/Percentage.tsx +82 -0
- package/lib/forms/Percentage/index.tsx +1 -0
- package/lib/forms/Phone/Phone.tsx +90 -0
- package/lib/forms/Phone/index.tsx +1 -0
- package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
- package/lib/forms/RadioButtons/index.tsx +1 -0
- package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
- package/lib/forms/SemanticLink/index.tsx +1 -0
- package/lib/forms/SemanticLink/utils.ts +51 -0
- package/lib/forms/TextArea/TextArea.tsx +66 -0
- package/lib/forms/TextArea/index.tsx +1 -0
- package/lib/forms/TextContent/TextContent.tsx +40 -0
- package/lib/forms/TextContent/index.tsx +1 -0
- package/lib/forms/TextInput/TextInput.tsx +61 -0
- package/lib/forms/TextInput/index.tsx +1 -0
- package/lib/forms/Time/Time.tsx +71 -0
- package/lib/forms/Time/index.tsx +1 -0
- package/lib/forms/URL/URL.tsx +53 -0
- package/lib/forms/URL/index.tsx +1 -0
- package/lib/forms/UserReference/UserReference.tsx +197 -0
- package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
- package/lib/forms/UserReference/index.tsx +1 -0
- package/lib/helpers/auth.js +483 -0
- package/lib/helpers/authManager.js +630 -0
- package/lib/helpers/config_access.js +268 -0
- package/lib/helpers/data_page.ts +24 -0
- package/lib/helpers/event-utils.js +20 -0
- package/lib/helpers/field-group-utils.js +61 -0
- package/lib/helpers/formatters/Boolean.js +38 -0
- package/lib/helpers/formatters/Currency.js +74 -0
- package/lib/helpers/formatters/CurrencyMap.js +908 -0
- package/lib/helpers/formatters/Date.js +77 -0
- package/lib/helpers/formatters/common.js +10 -0
- package/lib/helpers/formatters/index.js +120 -0
- package/lib/helpers/utils.ts +334 -0
- package/lib/helpers/versionHelpers.ts +50 -0
- package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
- package/lib/infra/ActionButtons/index.tsx +1 -0
- package/lib/infra/Assignment/Assignment.tsx +301 -0
- package/lib/infra/Assignment/index.tsx +1 -0
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
- package/lib/infra/AssignmentCard/index.tsx +1 -0
- package/lib/infra/Attachment/Attachment.css +18 -0
- package/lib/infra/Attachment/Attachment.tsx +404 -0
- package/lib/infra/Attachment/AttachmentUtils.js +71 -0
- package/lib/infra/Attachment/index.tsx +1 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
- package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
- package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
- package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
- package/lib/infra/DashboardFilter/index.tsx +1 -0
- package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
- package/lib/infra/DeferLoad/index.tsx +1 -0
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
- package/lib/infra/ErrorBoundary/index.tsx +1 -0
- package/lib/infra/MultiStep/MultiStep.css +261 -0
- package/lib/infra/MultiStep/MultiStep.tsx +225 -0
- package/lib/infra/MultiStep/index.tsx +1 -0
- package/lib/infra/NavBar/NavBar.css +170 -0
- package/lib/infra/NavBar/NavBar.tsx +393 -0
- package/lib/infra/NavBar/index.tsx +1 -0
- package/lib/infra/Reference/Reference.tsx +58 -0
- package/lib/infra/Reference/index.tsx +1 -0
- package/lib/infra/Region/Region.tsx +17 -0
- package/lib/infra/Region/index.tsx +1 -0
- package/lib/infra/RootContainer/RootContainer.tsx +336 -0
- package/lib/infra/RootContainer/index.tsx +1 -0
- package/lib/infra/Stages/Stages.tsx +120 -0
- package/lib/infra/Stages/index.tsx +1 -0
- package/lib/infra/ToDo/ToDo.css +87 -0
- package/lib/infra/ToDo/ToDo.tsx +285 -0
- package/lib/infra/ToDo/index.tsx +1 -0
- package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
- package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
- package/lib/infra/VerticalTabs/index.tsx +1 -0
- package/lib/infra/View/View.css +8 -0
- package/lib/infra/View/View.tsx +175 -0
- package/lib/infra/View/index.tsx +1 -0
- package/lib/templates/AppShell/AppShell.css +40 -0
- package/lib/templates/AppShell/AppShell.tsx +439 -0
- package/lib/templates/AppShell/index.tsx +1 -0
- package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
- package/lib/templates/CaseSummary/index.tsx +1 -0
- package/lib/templates/CaseView/CaseView.tsx +261 -0
- package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
- package/lib/templates/CaseView/index.tsx +1 -0
- package/lib/templates/DataReference/DataReference.tsx +290 -0
- package/lib/templates/DataReference/index.tsx +1 -0
- package/lib/templates/DefaultForm/DefaultForm.css +25 -0
- package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
- package/lib/templates/DefaultForm/index.tsx +1 -0
- package/lib/templates/Details/Details/Details.tsx +35 -0
- package/lib/templates/Details/Details/index.tsx +1 -0
- package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
- package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
- package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
- package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
- package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
- package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
- package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
- package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
- package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
- package/lib/templates/InlineDashboard/index.tsx +1 -0
- package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
- package/lib/templates/InlineDashboardPage/index.tsx +1 -0
- package/lib/templates/ListPage/ListPage.tsx +20 -0
- package/lib/templates/ListPage/index.tsx +1 -0
- package/lib/templates/ListView/ListView.css +10 -0
- package/lib/templates/ListView/ListView.tsx +1230 -0
- package/lib/templates/ListView/index.tsx +1 -0
- package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
- package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
- package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
- package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
- package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
- package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
- package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
- package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
- package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
- package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
- package/lib/templates/PromotedFilters/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
- package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
- package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
- package/lib/templates/SimpleTable/helpers.ts +360 -0
- package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
- package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/SubTabs/SubTabs.tsx +65 -0
- package/lib/templates/SubTabs/index.tsx +1 -0
- package/lib/templates/SubTabs/tabUtils.ts +73 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
- package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
- package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
- package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
- package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
- package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
- package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
- package/lib/templates/utils.ts +23 -0
- package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
- package/lib/widgets/AppAnnouncement/index.tsx +1 -0
- package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
- package/lib/widgets/CaseHistory/index.tsx +1 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
- package/lib/widgets/FileUtility/FileUtility.css +117 -0
- package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
- package/lib/widgets/FileUtility/index.tsx +0 -0
- package/lib/widgets/Followers/Followers.tsx +43 -0
- package/lib/widgets/Followers/index.tsx +1 -0
- package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
- package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
- package/lib/widgets/SummaryItem/index.tsx +1 -0
- package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
- package/lib/widgets/SummaryList/index.tsx +1 -0
- package/package.json +14 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
3
|
+
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
4
|
+
import utc from "dayjs/plugin/utc";
|
|
5
|
+
import tzone from "dayjs/plugin/timezone";
|
|
6
|
+
|
|
7
|
+
dayjs.extend(relativeTime);
|
|
8
|
+
dayjs.extend(localizedFormat);
|
|
9
|
+
dayjs.extend(utc);
|
|
10
|
+
dayjs.extend(tzone);
|
|
11
|
+
|
|
12
|
+
const types = ["fromNow", "customFormat"];
|
|
13
|
+
|
|
14
|
+
// value should be in ISO 8601 format.
|
|
15
|
+
function DateFormatter(
|
|
16
|
+
value,
|
|
17
|
+
{ type = types[1], format = "DD/MM/YYYY", timezone } = {}
|
|
18
|
+
) {
|
|
19
|
+
if (!value) return value;
|
|
20
|
+
switch (type) {
|
|
21
|
+
case types[1]:
|
|
22
|
+
if (timezone) return dayjs(value).tz(timezone).format(format);
|
|
23
|
+
return dayjs(value).format(format);
|
|
24
|
+
case types[0]:
|
|
25
|
+
return dayjs(value).from(dayjs());
|
|
26
|
+
default:
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// value should be in hh:mm:ss format (00:00:00 - 23:59:59).
|
|
31
|
+
function TimeFormatter(value, options) {
|
|
32
|
+
if (!value) return value;
|
|
33
|
+
const { locale = "en-US" } = options;
|
|
34
|
+
const timeOnlyRegex = /^(?:[01]\d|2[0123]):(?:[012345]\d):(?:[012345]\d)$/;
|
|
35
|
+
if (value.length === 8 && timeOnlyRegex.test(value)) {
|
|
36
|
+
const tempDate = new Date();
|
|
37
|
+
const hours = parseInt(value.substr(0, 2), 10);
|
|
38
|
+
const minutes = parseInt(value.substr(3, 2), 10);
|
|
39
|
+
const seconds = parseInt(value.substr(6, 2), 10);
|
|
40
|
+
tempDate.setHours(hours);
|
|
41
|
+
tempDate.setMinutes(minutes);
|
|
42
|
+
tempDate.setSeconds(seconds);
|
|
43
|
+
return tempDate.toLocaleTimeString(locale);
|
|
44
|
+
}
|
|
45
|
+
return DateFormatter(value, options);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
"DateTime-Long": (value, options) =>
|
|
50
|
+
DateFormatter(value, { ...options, type: "customFormat", format: "LLL" }),
|
|
51
|
+
"DateTime-Short": (value, options) =>
|
|
52
|
+
DateFormatter(value, {
|
|
53
|
+
...options,
|
|
54
|
+
type: "customFormat",
|
|
55
|
+
format: "MMM DD, YYYY"
|
|
56
|
+
}),
|
|
57
|
+
"DateTime-Since": (value) => DateFormatter(value, { type: "fromNow" }),
|
|
58
|
+
"Time-Only": (value, options) =>
|
|
59
|
+
TimeFormatter(value, {
|
|
60
|
+
...options,
|
|
61
|
+
type: "customFormat",
|
|
62
|
+
format: "hh:mm:ss A"
|
|
63
|
+
}),
|
|
64
|
+
convertToTimezone: (value, options) => {
|
|
65
|
+
return value && options && options.timezone
|
|
66
|
+
? DateFormatter(value, {
|
|
67
|
+
...options,
|
|
68
|
+
type: "customFormat",
|
|
69
|
+
format: "YYYY-MM-DDTHH:mm:ss"
|
|
70
|
+
})
|
|
71
|
+
: value;
|
|
72
|
+
},
|
|
73
|
+
convertFromTimezone: (value, timezone) =>
|
|
74
|
+
value && timezone ? dayjs.tz(value, timezone).utc().format() : value,
|
|
75
|
+
Date: (value, options) =>
|
|
76
|
+
DateFormatter(value, { type: "customFormat", ...options })
|
|
77
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function getLocale(locale) {
|
|
2
|
+
if (locale) return locale;
|
|
3
|
+
return document.documentElement.lang;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function getCurrentTimezone(timezone) {
|
|
7
|
+
if (timezone) return timezone;
|
|
8
|
+
// eslint-disable-next-line no-undef
|
|
9
|
+
return PCore?.getLocaleUtils?.().getTimeZoneInUse?.();
|
|
10
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import Boolean from "./Boolean";
|
|
2
|
+
import Currency from "./Currency";
|
|
3
|
+
import DateFormatter from "./Date";
|
|
4
|
+
import { getCurrentTimezone, getLocale } from "./common";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
...Boolean,
|
|
8
|
+
...Currency,
|
|
9
|
+
...DateFormatter
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function getDateObject(text) {
|
|
13
|
+
// TODO - cleanup formatters util functions as DX APIs are returning values per ISO std now.
|
|
14
|
+
const timeStamp = text.replace(/-/g, "");
|
|
15
|
+
const isDateTime = timeStamp.indexOf("GMT") !== -1;
|
|
16
|
+
const year = parseInt(timeStamp.substr(0, 4), 10);
|
|
17
|
+
const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
|
|
18
|
+
const day = parseInt(timeStamp.substr(6, 2), 10);
|
|
19
|
+
|
|
20
|
+
const date = new Date();
|
|
21
|
+
|
|
22
|
+
date.setDate(day);
|
|
23
|
+
date.setMonth(month);
|
|
24
|
+
date.setFullYear(year);
|
|
25
|
+
|
|
26
|
+
if (isDateTime) {
|
|
27
|
+
const hours = parseInt(timeStamp.substr(9, 2), 10);
|
|
28
|
+
const minutes = parseInt(timeStamp.substr(11, 2), 10);
|
|
29
|
+
const seconds = parseInt(timeStamp.substr(13, 2), 10);
|
|
30
|
+
const ms = parseInt(timeStamp.substr(16, 3), 10);
|
|
31
|
+
date.setHours(hours);
|
|
32
|
+
date.setMinutes(minutes);
|
|
33
|
+
date.setSeconds(seconds);
|
|
34
|
+
date.setMilliseconds(ms);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return date;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function isIsoDate(str) {
|
|
41
|
+
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) return false;
|
|
42
|
+
const d = new Date(str);
|
|
43
|
+
return d.toISOString() === str;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function parseDateInISO(value) {
|
|
47
|
+
const isMilliSeconds = new RegExp("^[0-9]+$").exec(value);
|
|
48
|
+
if (isMilliSeconds) {
|
|
49
|
+
const date = new Date(parseInt(value, 10));
|
|
50
|
+
return date.toISOString();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (isIsoDate(value)) {
|
|
54
|
+
const date = new Date(value);
|
|
55
|
+
return date.toISOString();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return value ? getDateObject(value).toISOString() : value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function format(value, type, options) {
|
|
62
|
+
let formattedValue;
|
|
63
|
+
|
|
64
|
+
switch (type?.toLowerCase()) {
|
|
65
|
+
case "currency": {
|
|
66
|
+
const defaultOptions = {
|
|
67
|
+
locale: getLocale(),
|
|
68
|
+
position: "before",
|
|
69
|
+
decPlaces: 2
|
|
70
|
+
};
|
|
71
|
+
const params = { ...defaultOptions, ...options };
|
|
72
|
+
formattedValue = Currency.Currency(value, params);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
case "decimal": {
|
|
77
|
+
const defaultOptions = { locale: getLocale(), decPlaces: 2 };
|
|
78
|
+
const params = { ...defaultOptions, ...options };
|
|
79
|
+
formattedValue = Currency.Decimal(value, params);
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
case "integer": {
|
|
84
|
+
const defaultOptions = { locale: getLocale() };
|
|
85
|
+
const params = { ...defaultOptions, ...options };
|
|
86
|
+
formattedValue = Currency.Integer(value, params);
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
case "date": {
|
|
91
|
+
const defaultOptions = {
|
|
92
|
+
format: "MMM DD, YYYY",
|
|
93
|
+
timezone: getCurrentTimezone()
|
|
94
|
+
};
|
|
95
|
+
const params = { ...defaultOptions, ...options };
|
|
96
|
+
formattedValue = DateFormatter.Date(parseDateInISO(value), params);
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
case "datetime": {
|
|
101
|
+
const defaultOptions = {
|
|
102
|
+
format: "MMM DD, YYYY h:mm A",
|
|
103
|
+
timezone: getCurrentTimezone()
|
|
104
|
+
};
|
|
105
|
+
const params = { ...defaultOptions, ...options };
|
|
106
|
+
formattedValue = DateFormatter.Date(parseDateInISO(value), params);
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
case "boolean":
|
|
111
|
+
case "checkbox": {
|
|
112
|
+
formattedValue = Boolean.TrueFalse(value, { allowEmpty: false });
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
default:
|
|
117
|
+
formattedValue = value;
|
|
118
|
+
}
|
|
119
|
+
return formattedValue;
|
|
120
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
3
|
+
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
|
+
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
5
|
+
|
|
6
|
+
dayjs.extend(customParseFormat);
|
|
7
|
+
dayjs.extend(localizedFormat);
|
|
8
|
+
dayjs.extend(relativeTime);
|
|
9
|
+
|
|
10
|
+
export class Utils {
|
|
11
|
+
static lastControlID: number = 0;
|
|
12
|
+
|
|
13
|
+
static getUniqueControlID(): string {
|
|
14
|
+
const sPrefix = 'control-';
|
|
15
|
+
|
|
16
|
+
this.lastControlID += 1;
|
|
17
|
+
|
|
18
|
+
return sPrefix + this.lastControlID.toString();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static getOptionList(configProps: any, dataObject: any): Array<any> {
|
|
22
|
+
const listType = configProps.listType;
|
|
23
|
+
let arReturn: Array<any> = [];
|
|
24
|
+
|
|
25
|
+
if (listType) {
|
|
26
|
+
switch (listType.toLowerCase()) {
|
|
27
|
+
case 'associated':
|
|
28
|
+
// data source should be an array
|
|
29
|
+
if (typeof configProps.datasource === 'object') {
|
|
30
|
+
arReturn = configProps.datasource;
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
|
|
34
|
+
case 'datapage':
|
|
35
|
+
// get data page
|
|
36
|
+
// eslint-disable-next-line no-case-declarations
|
|
37
|
+
const dataPage = configProps.datasource;
|
|
38
|
+
if (dataObject[dataPage]) {
|
|
39
|
+
// eslint-disable-next-line no-alert
|
|
40
|
+
alert('need to handle data page');
|
|
41
|
+
} else {
|
|
42
|
+
let listSourceItems = configProps.listOutput;
|
|
43
|
+
if (typeof dataPage === 'object' && !Array.isArray(listSourceItems)) {
|
|
44
|
+
listSourceItems = dataPage.source ? dataPage.source : [];
|
|
45
|
+
}
|
|
46
|
+
(listSourceItems || []).forEach(item => {
|
|
47
|
+
item.value = item.text ? item.text : item.value;
|
|
48
|
+
});
|
|
49
|
+
arReturn = listSourceItems || [];
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
|
|
53
|
+
default:
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return arReturn;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static getInitials(userName: string): string {
|
|
62
|
+
let userInitials = userName;
|
|
63
|
+
|
|
64
|
+
if (userName && userName !== '') {
|
|
65
|
+
userInitials = userName.charAt(0);
|
|
66
|
+
|
|
67
|
+
if (userName.lastIndexOf(' ') > 0) {
|
|
68
|
+
const lastName = userName.substring(userName.lastIndexOf(' ') + 1);
|
|
69
|
+
userInitials += lastName.charAt(0);
|
|
70
|
+
} else if (userName.lastIndexOf('.') > 0) {
|
|
71
|
+
const lastName = userName.substring(userName.lastIndexOf('.') + 1);
|
|
72
|
+
userInitials += lastName.charAt(0);
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
userInitials = '';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return userInitials.toUpperCase();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static getImageSrc(name: string, serverUrl: string): string {
|
|
82
|
+
let iconName = name.replace('pi-', '').replace('pi ', '').trim();
|
|
83
|
+
if (iconName === 'line-chart') {
|
|
84
|
+
iconName = 'chart-line';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return this.getIconPath(serverUrl).concat(iconName).concat('.svg');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static getIconPath(serverUrl: string): string {
|
|
91
|
+
// Directory in the constellation folder where the icons will be
|
|
92
|
+
return serverUrl.concat('icons/');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static getBooleanValue(inValue: any): boolean {
|
|
96
|
+
let bReturn = false;
|
|
97
|
+
|
|
98
|
+
if (typeof inValue === 'string') {
|
|
99
|
+
// Experiment with having "" be true, too (and "on")
|
|
100
|
+
if (inValue.toLowerCase() === 'true' || inValue.toLowerCase() === 'on' || inValue === '') {
|
|
101
|
+
bReturn = true;
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
bReturn = inValue;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return bReturn;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Note: Explored using formatters/format but that doesn't do the same as this function. So not possible to just invoke
|
|
111
|
+
// format and do away with all the separate Pega possible dateFormats.
|
|
112
|
+
static generateDate(dateVal, dateFormat) {
|
|
113
|
+
let sReturnDate = dateVal;
|
|
114
|
+
|
|
115
|
+
if (dateVal === null || dateVal === '') {
|
|
116
|
+
return dateVal;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// VRS: Dont think we need the below line. Commenting out for now. (2020.05.20)
|
|
120
|
+
// dateTimeVal = dateTimeVal.replace("GMT", "+0000")
|
|
121
|
+
// Anything else would require a specific String pattern be specified as an argument to the dayjs constructor
|
|
122
|
+
|
|
123
|
+
// if date has a ".", then of the format YYYMMDD[T]HHmmss[.]SSS Z, need to change to YYYYMMDD
|
|
124
|
+
if (dateVal.indexOf('.') >= 0) {
|
|
125
|
+
// VRS: Dont think we need the dateVal.replace("GMT", "+0000"). Commenting out for now. (2020.05.20)
|
|
126
|
+
// dateVal = dayjs(dateVal.replace("GMT", "+0000"), "YYYYMMDD[T]HHmmss[.]SSS Z").format("YYYYMMDD");
|
|
127
|
+
// dateVal format appears to be YYYY-MM-DDThh:mm:ss.SSSZ (which is the default dayjs expected format)
|
|
128
|
+
// Don't change the dateVal passed to dayjs (rather just set a default sReturnDate--if that is what we want to do)
|
|
129
|
+
// (better might be just doing that in a default switch block)
|
|
130
|
+
sReturnDate = dayjs(dateVal).format('YYYYMMDD');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
switch (dateFormat) {
|
|
134
|
+
case 'Date-Short':
|
|
135
|
+
// 1/1/01
|
|
136
|
+
sReturnDate = dayjs(dateVal).format('M/D/YY');
|
|
137
|
+
break;
|
|
138
|
+
case 'Date-Short-YYYY':
|
|
139
|
+
// 1/1/2001
|
|
140
|
+
sReturnDate = dayjs(dateVal).format('M/D/YYYY');
|
|
141
|
+
break;
|
|
142
|
+
case 'Date-Short-Custom':
|
|
143
|
+
// 01/01/01
|
|
144
|
+
sReturnDate = dayjs(dateVal).format('MM/DD/YY');
|
|
145
|
+
break;
|
|
146
|
+
case 'Date-Short-Custom-YYYY':
|
|
147
|
+
// 01/01/2001
|
|
148
|
+
sReturnDate = dayjs(dateVal).format('L');
|
|
149
|
+
break;
|
|
150
|
+
case 'Date-Medium':
|
|
151
|
+
// Jan 1, 2001
|
|
152
|
+
sReturnDate = dayjs(dateVal).format('ll');
|
|
153
|
+
break;
|
|
154
|
+
case 'Date-DayMonthYear-Custom':
|
|
155
|
+
// 01-Jan-2001
|
|
156
|
+
sReturnDate = dayjs(dateVal).format('DD-MMM-YYYY');
|
|
157
|
+
break;
|
|
158
|
+
case 'Date-Full':
|
|
159
|
+
// Monday, January 1, 2001
|
|
160
|
+
sReturnDate = dayjs(dateVal).format('dddd, MMMM D, YYYY');
|
|
161
|
+
break;
|
|
162
|
+
case 'DateTime-Frame':
|
|
163
|
+
case 'DateTime-Frame-Short':
|
|
164
|
+
case 'DateTime-Since':
|
|
165
|
+
// 2 days, 5 hours ago
|
|
166
|
+
sReturnDate = dayjs(dateVal).fromNow();
|
|
167
|
+
break;
|
|
168
|
+
case 'Date-Long':
|
|
169
|
+
// January 1, 2001
|
|
170
|
+
sReturnDate = dayjs(dateVal).format('MMMM D, YYYY');
|
|
171
|
+
break;
|
|
172
|
+
case 'Date-ISO-8601':
|
|
173
|
+
// 2001/01/01 y/m/d
|
|
174
|
+
sReturnDate = dayjs(dateVal).format('YYYY/MM/DD');
|
|
175
|
+
break;
|
|
176
|
+
case 'Date-Gregorian-1':
|
|
177
|
+
// 01 January, 2001
|
|
178
|
+
sReturnDate = dayjs(dateVal).format('DD MMMM, YYYY');
|
|
179
|
+
break;
|
|
180
|
+
case 'Date-Gregorian-2':
|
|
181
|
+
// January 01, 2001
|
|
182
|
+
sReturnDate = dayjs(dateVal).format('MMMM DD, YYYY');
|
|
183
|
+
break;
|
|
184
|
+
case 'Date-Gregorian-3':
|
|
185
|
+
// 2001, January 01
|
|
186
|
+
sReturnDate = dayjs(dateVal).format('YYYY, MMMM DD');
|
|
187
|
+
break;
|
|
188
|
+
case 'DateTime-Custom':
|
|
189
|
+
break;
|
|
190
|
+
default:
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return sReturnDate;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Note: Explored using formatters/format but that doesn't do the same as this function. So not possible to just invoke
|
|
198
|
+
// format and do away with all the separate Pega possible dateFormats.
|
|
199
|
+
static generateDateTime(dateTimeVal, dateFormat) {
|
|
200
|
+
let sReturnDate = dateTimeVal;
|
|
201
|
+
|
|
202
|
+
if (dateTimeVal === null || dateTimeVal === '') {
|
|
203
|
+
return dateTimeVal;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// VRS: Dont think we need the below line. Commenting out for now. (2020.05.20)
|
|
207
|
+
// dateTimeVal = dateTimeVal.replace("GMT", "+0000")
|
|
208
|
+
// dateTimeVal format appears to be YYYY-MM-DDThh:mm:ss.SSSZ (which is the default dayjs expected format)
|
|
209
|
+
// Anything else would require a specific String pattern be specified as an argument to the dayjs constructor
|
|
210
|
+
|
|
211
|
+
switch (dateFormat) {
|
|
212
|
+
case 'DateTime-Short':
|
|
213
|
+
// 1/1/01 1:00 AM
|
|
214
|
+
sReturnDate = dayjs(dateTimeVal).format('M/D/YY h:mm A');
|
|
215
|
+
break;
|
|
216
|
+
case 'DateTime-Short-Custom':
|
|
217
|
+
// 01/01/01 01:00 AM
|
|
218
|
+
sReturnDate = dayjs(dateTimeVal).format('MM/DD/YY hh:mm A');
|
|
219
|
+
break;
|
|
220
|
+
case 'DateTime-Short-YYYY-Custom':
|
|
221
|
+
// 01/01/2001 01:00 AM
|
|
222
|
+
sReturnDate = dayjs(dateTimeVal).format('M/D/YYYY hh:mm A');
|
|
223
|
+
break;
|
|
224
|
+
case 'DateTime-Short-YYYY':
|
|
225
|
+
// 1/1/2001 1:00 AM
|
|
226
|
+
sReturnDate = dayjs(dateTimeVal).format('M/D/YYYY h:mm A');
|
|
227
|
+
break;
|
|
228
|
+
case 'DateTime-Medium':
|
|
229
|
+
// Jan 1, 2001 1:00:00 AM
|
|
230
|
+
sReturnDate = dayjs(dateTimeVal).format('MMM D, YYYY h:mm:ss A');
|
|
231
|
+
break;
|
|
232
|
+
case 'DateTime-Long':
|
|
233
|
+
// January 1, 2001 1:00:00 AM
|
|
234
|
+
sReturnDate = dayjs(dateTimeVal).format('MMMM D, YYYY h:mm:ss A');
|
|
235
|
+
break;
|
|
236
|
+
case 'DateTime-DayMonthYear-Custom':
|
|
237
|
+
// 01-Jan-2001 1:00:00 AM
|
|
238
|
+
sReturnDate = dayjs(dateTimeVal).format('DD-MMM-YYYY h:mm:ss A');
|
|
239
|
+
break;
|
|
240
|
+
case 'DateTime-Full':
|
|
241
|
+
// Monday, January 1, 2001 1:00 AM EDT
|
|
242
|
+
sReturnDate = dayjs(dateTimeVal).format('dddd, MMMM D, YYYY h:mm A z');
|
|
243
|
+
break;
|
|
244
|
+
case 'DateTime-Frame':
|
|
245
|
+
case 'DateTime-Frame-Short':
|
|
246
|
+
case 'DateTime-Since':
|
|
247
|
+
// 2 days, 5 hours ago
|
|
248
|
+
sReturnDate = dayjs(dateTimeVal).fromNow();
|
|
249
|
+
break;
|
|
250
|
+
case 'DateTime-ISO-8601':
|
|
251
|
+
// 2001/01/01 1:00:00 AM y/m/d
|
|
252
|
+
sReturnDate = dayjs(dateTimeVal).format('YYYY/MM/DD h:mm:ss A');
|
|
253
|
+
break;
|
|
254
|
+
case 'DateTime-Gregorian-1':
|
|
255
|
+
// 01 January, 2001 1:00:00 AM
|
|
256
|
+
sReturnDate = dayjs(dateTimeVal).format('DD MMMM, YYYY h:mm:ss A');
|
|
257
|
+
break;
|
|
258
|
+
case 'DateTime-Gregorian-2':
|
|
259
|
+
// January 01, 2001 1:00:00 AM
|
|
260
|
+
sReturnDate = dayjs(dateTimeVal).format('MMMM DD, YYYY h:mm:ss A');
|
|
261
|
+
break;
|
|
262
|
+
case 'DateTime-Gregorian-3':
|
|
263
|
+
// 2001, January 01 1:00:00 AM
|
|
264
|
+
sReturnDate = dayjs(dateTimeVal).format('YYYY, MMMM DD h:mm:ss A');
|
|
265
|
+
break;
|
|
266
|
+
case 'DateTime-Custom':
|
|
267
|
+
break;
|
|
268
|
+
default:
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return sReturnDate;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
static getSeconds(sTime): any {
|
|
276
|
+
return dayjs(sTime).valueOf();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static getIconFromFileType(fileType): string {
|
|
280
|
+
let icon = 'document-doc';
|
|
281
|
+
if (!fileType) return icon;
|
|
282
|
+
if (fileType.startsWith('audio')) {
|
|
283
|
+
icon = 'audio';
|
|
284
|
+
} else if (fileType.startsWith('video')) {
|
|
285
|
+
icon = 'video';
|
|
286
|
+
} else if (fileType.startsWith('image')) {
|
|
287
|
+
icon = 'picture';
|
|
288
|
+
} else if (fileType.includes('pdf')) {
|
|
289
|
+
icon = 'document-pdf';
|
|
290
|
+
} else {
|
|
291
|
+
const [, subtype] = fileType.split('/');
|
|
292
|
+
const foundMatch = sources => {
|
|
293
|
+
return sources.some(key => subtype.includes(key));
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
if (foundMatch(['excel', 'spreadsheet'])) {
|
|
297
|
+
icon = 'document-xls';
|
|
298
|
+
} else if (foundMatch(['zip', 'compressed', 'gzip', 'rar', 'tar'])) {
|
|
299
|
+
icon = 'document-compress';
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return icon;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
static getIconForAttachment(attachment) {
|
|
307
|
+
let icon;
|
|
308
|
+
switch (attachment.type) {
|
|
309
|
+
case 'FILE':
|
|
310
|
+
icon = this.getIconFromFileType(attachment.mimeType);
|
|
311
|
+
break;
|
|
312
|
+
case 'URL':
|
|
313
|
+
icon = 'chain';
|
|
314
|
+
break;
|
|
315
|
+
default:
|
|
316
|
+
icon = 'document-doc';
|
|
317
|
+
}
|
|
318
|
+
return icon;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
static getLastChar(text) {
|
|
322
|
+
return text.charAt(text.length - 1);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
static isEmptyObject(obj: Object): Boolean {
|
|
326
|
+
return Object.keys(obj).length === 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static isObject(objValue) {
|
|
330
|
+
return objValue && typeof objValue === 'object' && objValue.constructor === Object;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export default Utils;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* versionHelpers.ts
|
|
3
|
+
*
|
|
4
|
+
* Container helper functions that can identify which version of
|
|
5
|
+
* PCore/PConnect is being run
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare const PCore;
|
|
9
|
+
|
|
10
|
+
export const sdkVersion = "8.7";
|
|
11
|
+
|
|
12
|
+
export function compareSdkPCoreVersions() {
|
|
13
|
+
|
|
14
|
+
// const theConstellationVersion = PCore.getPCoreVersion();
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line no-console
|
|
17
|
+
console.warn(`Using Constellation version ${PCore.getPCoreVersion()}. Ensure this is the same version as your Infinity server.`);
|
|
18
|
+
|
|
19
|
+
// JA Testing
|
|
20
|
+
// debugger;
|
|
21
|
+
|
|
22
|
+
// const svcParams = [
|
|
23
|
+
// {
|
|
24
|
+
// "field" : "type",
|
|
25
|
+
// "value" : "Field"
|
|
26
|
+
// },
|
|
27
|
+
// {
|
|
28
|
+
// "field" : "subtype",
|
|
29
|
+
// "value" : "Text",
|
|
30
|
+
// }
|
|
31
|
+
// ];
|
|
32
|
+
|
|
33
|
+
// const options = {};
|
|
34
|
+
|
|
35
|
+
// const AssetLoader = PCore.getAssetLoader();
|
|
36
|
+
|
|
37
|
+
// AssetLoader
|
|
38
|
+
// .getSvcComponentsConfig(svcParams, options)
|
|
39
|
+
// .then((response) => {
|
|
40
|
+
// if (response?.data?.components?.[0]) {
|
|
41
|
+
// console.log(response.data.components[0]);
|
|
42
|
+
// }
|
|
43
|
+
// throw new Error('bad response');
|
|
44
|
+
// })
|
|
45
|
+
// .catch(() => {
|
|
46
|
+
// throw new Error('no response:');
|
|
47
|
+
// });
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
+
|
|
5
|
+
import Button from '@material-ui/core/Button';
|
|
6
|
+
import { Grid, Divider } from "@material-ui/core";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const useStyles = makeStyles((/* theme */) => ({
|
|
11
|
+
button: {
|
|
12
|
+
padding: "0px 5px",
|
|
13
|
+
},
|
|
14
|
+
divider: {
|
|
15
|
+
marginTop: "10px",
|
|
16
|
+
marginBottom: "10px"
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export default function ActionButtons(props) {
|
|
22
|
+
const { arMainButtons, arSecondaryButtons, onButtonPress } = props;
|
|
23
|
+
const classes = useStyles();
|
|
24
|
+
|
|
25
|
+
function _onButtonPress(sAction: string, sButtonType: string) {
|
|
26
|
+
|
|
27
|
+
onButtonPress(sAction, sButtonType);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<React.Fragment>
|
|
32
|
+
<Divider className={classes.divider}/>
|
|
33
|
+
<Grid container spacing={4} justifyContent="space-between">
|
|
34
|
+
<Grid item>
|
|
35
|
+
<Grid container spacing={1}>
|
|
36
|
+
{arSecondaryButtons.map((sButton) => (
|
|
37
|
+
<Grid item key={sButton.name}>
|
|
38
|
+
<Button variant="contained" color="secondary" onClick={() => { _onButtonPress(sButton.jsAction, "secondary")}} >{sButton.name}</Button>
|
|
39
|
+
</Grid>
|
|
40
|
+
))}
|
|
41
|
+
</Grid>
|
|
42
|
+
</Grid>
|
|
43
|
+
<Grid item>
|
|
44
|
+
<Grid container spacing={1}>
|
|
45
|
+
{arMainButtons.map((mButton) => (
|
|
46
|
+
<Grid item key={mButton.name}>
|
|
47
|
+
<Button variant="contained" color="primary" onClick={() => { _onButtonPress(mButton.jsAction, "primary")}} >{mButton.name}</Button>
|
|
48
|
+
</Grid>
|
|
49
|
+
))}
|
|
50
|
+
</Grid>
|
|
51
|
+
</Grid>
|
|
52
|
+
</Grid>
|
|
53
|
+
|
|
54
|
+
</React.Fragment>
|
|
55
|
+
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ActionButtons.propTypes = {
|
|
60
|
+
arMainButtons: PropTypes.array,
|
|
61
|
+
arSecondaryButtons: PropTypes.array,
|
|
62
|
+
onButtonPress: PropTypes.func
|
|
63
|
+
// buildName: PropTypes.string
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
ActionButtons.defaultProps = {
|
|
67
|
+
arMainButtons: [],
|
|
68
|
+
arSecondaryButtons: []
|
|
69
|
+
// buildName: null
|
|
70
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ActionButtons';
|