@pega/react-sdk-components 24.2.10 → 24.2.11
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/components/designSystemExtension/FieldValueList/FieldValueList.js +2 -2
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.d.ts.map +1 -1
- package/lib/components/field/CancelAlert/CancelAlert.js +1 -4
- package/lib/components/field/CancelAlert/CancelAlert.js.map +1 -1
- package/lib/components/field/Currency/Currency.d.ts.map +1 -1
- package/lib/components/field/Currency/Currency.js +7 -6
- package/lib/components/field/Currency/Currency.js.map +1 -1
- package/lib/components/field/Date/Date.d.ts.map +1 -1
- package/lib/components/field/Date/Date.js +4 -1
- package/lib/components/field/Date/Date.js.map +1 -1
- package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
- package/lib/components/field/DateTime/DateTime.js +11 -4
- package/lib/components/field/DateTime/DateTime.js.map +1 -1
- package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
- package/lib/components/field/Decimal/Decimal.js +6 -3
- package/lib/components/field/Decimal/Decimal.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +16 -10
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
- package/lib/components/field/Percentage/Percentage.js +5 -2
- package/lib/components/field/Percentage/Percentage.js.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +3 -9
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/ScalarList/ScalarList.d.ts.map +1 -1
- package/lib/components/field/ScalarList/ScalarList.js +3 -3
- package/lib/components/field/ScalarList/ScalarList.js.map +1 -1
- package/lib/components/field/Time/Time.js +1 -1
- package/lib/components/field/Time/Time.js.map +1 -1
- package/lib/components/field/UserReference/UserReference.d.ts.map +1 -1
- package/lib/components/field/UserReference/UserReference.js +1 -3
- package/lib/components/field/UserReference/UserReference.js.map +1 -1
- package/lib/components/helpers/common-utils.d.ts +7 -0
- package/lib/components/helpers/common-utils.d.ts.map +1 -1
- package/lib/components/helpers/common-utils.js +21 -1
- package/lib/components/helpers/common-utils.js.map +1 -1
- package/lib/components/helpers/formatters/Currency.d.ts.map +1 -1
- package/lib/components/helpers/formatters/Currency.js +12 -15
- package/lib/components/helpers/formatters/Currency.js.map +1 -1
- package/lib/components/helpers/formatters/common.d.ts +2 -2
- package/lib/components/helpers/formatters/common.d.ts.map +1 -1
- package/lib/components/helpers/formatters/common.js +2 -1
- package/lib/components/helpers/formatters/common.js.map +1 -1
- package/lib/components/helpers/formatters/index.d.ts.map +1 -1
- package/lib/components/helpers/formatters/index.js +2 -3
- package/lib/components/helpers/formatters/index.js.map +1 -1
- package/lib/components/helpers/simpleTableHelpers.d.ts +1 -1
- package/lib/components/infra/Assignment/Assignment.d.ts.map +1 -1
- package/lib/components/infra/Assignment/Assignment.js +3 -8
- package/lib/components/infra/Assignment/Assignment.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +4 -15
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/helpers.js +1 -5
- package/lib/components/infra/Containers/FlowContainer/helpers.js.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.d.ts.map +1 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js +3 -1
- package/lib/components/infra/Containers/ModalViewContainer/ListViewActionButtons/ListViewActionButtons.js.map +1 -1
- package/lib/components/infra/Containers/SimpleView/helper.js +1 -1
- package/lib/components/infra/Containers/SimpleView/helper.js.map +1 -1
- package/lib/components/infra/Containers/container-helpers.d.ts +2 -0
- package/lib/components/infra/Containers/container-helpers.d.ts.map +1 -0
- package/lib/components/infra/Containers/{helpers.js → container-helpers.js} +1 -1
- package/lib/components/infra/Containers/container-helpers.js.map +1 -0
- package/lib/components/infra/DashboardFilter/DashboardFilter.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/DashboardFilter.js +2 -3
- package/lib/components/infra/DashboardFilter/DashboardFilter.js.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.d.ts.map +1 -1
- package/lib/components/infra/DashboardFilter/filterUtils.js +1 -3
- package/lib/components/infra/DashboardFilter/filterUtils.js.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts +1 -0
- package/lib/components/infra/DeferLoad/DeferLoad.d.ts.map +1 -1
- package/lib/components/infra/DeferLoad/DeferLoad.js +4 -5
- package/lib/components/infra/DeferLoad/DeferLoad.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.d.ts.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.js +1 -5
- package/lib/components/infra/MultiStep/MultiStep.js.map +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js +1 -1
- package/lib/components/infra/RootContainer/RootContainer.js.map +1 -1
- package/lib/components/template/AppShell/AppShell.js +6 -6
- package/lib/components/template/AppShell/AppShell.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts +1 -0
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +2 -2
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/Confirmation/Confirmation.js +1 -1
- package/lib/components/template/Confirmation/Confirmation.js.map +1 -1
- package/lib/components/template/Details/DynamicTabs/DynamicTabs.d.ts.map +1 -1
- package/lib/components/template/Details/DynamicTabs/DynamicTabs.js +0 -1
- package/lib/components/template/Details/DynamicTabs/DynamicTabs.js.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.d.ts.map +1 -1
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js +0 -2
- package/lib/components/template/FieldGroupTemplate/FieldGroupTemplate.js.map +1 -1
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +2 -4
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/utils.d.ts.map +1 -1
- package/lib/components/template/ListView/utils.js +0 -1
- package/lib/components/template/ListView/utils.js.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.d.ts.map +1 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.js +0 -1
- package/lib/components/template/PromotedFilters/PromotedFilters.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js +0 -2
- package/lib/components/template/SimpleTable/SimpleTable/SimpleTable.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts +2 -0
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js +36 -21
- package/lib/components/template/SimpleTable/SimpleTableManual/SimpleTableManual.js.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.d.ts.map +1 -1
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js +2 -4
- package/lib/components/template/SimpleTable/SimpleTableSelect/SimpleTableSelect.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.css +1 -0
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +2 -7
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js +1 -1
- package/lib/components/widget/FileUtility/FileUtility/FileUtility.js.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.d.ts.map +1 -1
- package/lib/components/widget/QuickCreate/QuickCreate.js +0 -1
- package/lib/components/widget/QuickCreate/QuickCreate.js.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/widget/ToDo/ToDo.js +1 -1
- package/lib/components/widget/ToDo/ToDo.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/infra/Containers/helpers.d.ts +0 -2
- package/lib/components/infra/Containers/helpers.d.ts.map +0 -1
- package/lib/components/infra/Containers/helpers.js.map +0 -1
|
@@ -39,10 +39,10 @@ export default function FieldValueList(props) {
|
|
|
39
39
|
}
|
|
40
40
|
function getGridItemValue() {
|
|
41
41
|
const formattedValue = formatItemValue(value);
|
|
42
|
-
return (_jsx(Grid, { item: true, xs: variant === 'stacked' ? 12 : 8, className: variant === 'stacked' ? classes.noPaddingTop : '', children: isHtml ? (
|
|
42
|
+
return (_jsx(Grid, { item: true, xs: variant === 'stacked' || !name ? 12 : 8, className: variant === 'stacked' ? classes.noPaddingTop : '', children: isHtml ? (
|
|
43
43
|
// eslint-disable-next-line react/no-danger
|
|
44
44
|
_jsx("div", { dangerouslySetInnerHTML: { __html: formattedValue } })) : (_jsx(Typography, { variant: variant === 'stacked' ? 'h6' : 'body2', component: 'span', className: classes.fieldValue, children: formattedValue })) }));
|
|
45
45
|
}
|
|
46
|
-
return (_jsxs(Grid, { container: true, spacing: 4, justifyContent: 'space-between', children: [getGridItemLabel(), getGridItemValue()] }));
|
|
46
|
+
return (_jsxs(Grid, { container: true, spacing: 4, justifyContent: 'space-between', children: [name ? getGridItemLabel() : null, getGridItemValue()] }));
|
|
47
47
|
}
|
|
48
48
|
//# sourceMappingURL=FieldValueList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../../src/components/designSystemExtension/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AA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O,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,YAC5G,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,MAAM,EAAC,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,YAC5E,IAAI,GACM,GACR,CACR,CAAC;IACJ,CAAC;IAED,SAAS,gBAAgB;QACvB,MAAM,cAAc,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QAE9C,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,QAAC,EAAE,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"FieldValueList.js","sourceRoot":"","sources":["../../../../src/components/designSystemExtension/FieldValueList/FieldValueList.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAYhD,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrC,IAAI,EAAE;QACJ,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7B,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5B,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/B;IACD,UAAU,EAAE;QACV,UAAU,EAAE,GAAG;QACf,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,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,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YACjH,MAAM,CAAC,CAAC,CAAC;YACR,2CAA2C;YAC3C,cAAK,uBAAuB,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,GAAI,CAC7D,CAAC,CAAC,CAAC,CACF,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAE,OAAO,CAAC,UAAU,YACxG,cAAc,GACJ,CACd,GACI,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,CAAC,EAAE,cAAc,EAAC,eAAe,aACvD,IAAI,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,IAAI,EAChC,gBAAgB,EAAE,IACd,CACR,CAAC;AACJ,CAAC","sourcesContent":["import Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport makeStyles from '@mui/styles/makeStyles';\n\n// FieldValueList is one of the few components that does NOT have getPConnect.\n// So, no need to extend PConnProps\ninterface FieldValueListProps {\n // If any, enter additional props that only exist on this component\n name?: string;\n value: any;\n variant?: string;\n isHtml?: boolean;\n}\n\nconst useStyles = makeStyles(theme => ({\n root: {\n marginRight: theme.spacing(1),\n marginLeft: theme.spacing(1),\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1)\n },\n fieldLabel: {\n fontWeight: 400,\n color: theme.palette.text.secondary\n },\n fieldValue: {\n color: theme.palette.text.primary\n },\n noPaddingTop: {\n paddingTop: '0 !important'\n },\n noPaddingBottom: {\n paddingBottom: '0 !important'\n }\n}));\n\nfunction formatItemValue(value) {\n let formattedVal = value;\n\n // if the value is undefined or an empty string, we want to display it as \"---\"\n if (formattedVal === undefined || formattedVal === '') {\n formattedVal = '---';\n }\n\n return formattedVal;\n}\n\nexport default function FieldValueList(props: FieldValueListProps) {\n const { name, value, variant = 'inline', isHtml = false } = props;\n const classes = useStyles();\n\n function getGridItemLabel() {\n return (\n <Grid item xs={variant === 'stacked' ? 12 : 4} className={variant === 'stacked' ? classes.noPaddingBottom : ''}>\n <Typography variant='body2' component='span' className={`${classes.fieldLabel}`}>\n {name}\n </Typography>\n </Grid>\n );\n }\n\n function getGridItemValue() {\n const formattedValue = formatItemValue(value);\n\n return (\n <Grid item xs={variant === 'stacked' || !name ? 12 : 8} className={variant === 'stacked' ? classes.noPaddingTop : ''}>\n {isHtml ? (\n // eslint-disable-next-line react/no-danger\n <div dangerouslySetInnerHTML={{ __html: formattedValue }} />\n ) : (\n <Typography variant={variant === 'stacked' ? 'h6' : 'body2'} component='span' className={classes.fieldValue}>\n {formattedValue}\n </Typography>\n )}\n </Grid>\n );\n }\n\n return (\n <Grid container spacing={4} justifyContent='space-between'>\n {name ? getGridItemLabel() : null}\n {getGridItemValue()}\n </Grid>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CancelAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/field/CancelAlert/CancelAlert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,mBAAmB,CAAC;AAE3B,UAAU,gBAAiB,SAAQ,eAAe;IAEhD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,sBAAsB,EAAE,GAAG,CAAC;IAC5B,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"CancelAlert.d.ts","sourceRoot":"","sources":["../../../../src/components/field/CancelAlert/CancelAlert.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,mBAAmB,CAAC;AAE3B,UAAU,gBAAiB,SAAQ,eAAe;IAEhD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,sBAAsB,EAAE,GAAG,CAAC;IAC5B,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAiI1D"}
|
|
@@ -40,7 +40,6 @@ export default function CancelAlert(props) {
|
|
|
40
40
|
function cancelHandler() {
|
|
41
41
|
if (isReverseCoexistence) {
|
|
42
42
|
dismiss(true);
|
|
43
|
-
// @ts-ignore - An argument for 'payload' was not provided.
|
|
44
43
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);
|
|
45
44
|
}
|
|
46
45
|
else if (!isDataObject && !isLocalAction && !isBulkAction) {
|
|
@@ -48,7 +47,6 @@ export default function CancelAlert(props) {
|
|
|
48
47
|
actionsAPI
|
|
49
48
|
.deleteCaseInCreateStage(containerItemID, hideDelete)
|
|
50
49
|
.then(() => {
|
|
51
|
-
// @ts-ignore - An argument for 'payload' was not provided.
|
|
52
50
|
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);
|
|
53
51
|
})
|
|
54
52
|
.catch(() => {
|
|
@@ -62,7 +60,7 @@ export default function CancelAlert(props) {
|
|
|
62
60
|
}
|
|
63
61
|
else if (isLocalAction) {
|
|
64
62
|
dismiss(true);
|
|
65
|
-
actionsAPI.cancelAssignment(containerItemID);
|
|
63
|
+
actionsAPI.cancelAssignment(containerItemID, false);
|
|
66
64
|
}
|
|
67
65
|
else if (isBulkAction) {
|
|
68
66
|
dismiss(true);
|
|
@@ -70,7 +68,6 @@ export default function CancelAlert(props) {
|
|
|
70
68
|
}
|
|
71
69
|
else {
|
|
72
70
|
dismiss(true);
|
|
73
|
-
// @ts-ignore - Argument of type '{ containerItemID: string; skipReleaseLockRequest: any; }' is not assignable to parameter of type 'ContainerInfo'.
|
|
74
71
|
containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });
|
|
75
72
|
}
|
|
76
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CancelAlert.js","sourceRoot":"","sources":["../../../../src/components/field/CancelAlert/CancelAlert.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAGlD,OAAO,mBAAmB,CAAC;AAa3B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAuB;IACzD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACrI,MAAM,UAAU,GAAG,WAAW,EAAE,CAAC,aAAa,EAAE,CAAC;IACjD,MAAM,mBAAmB,GAAG,WAAW,EAAE,CAAC,mBAAmB,EAAE,CAAC;IAChE,MAAM,aAAa,GAAG,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC7F,yFAAyF;IACzF,MAAM,YAAY,GAAG,WAAW,EAAE,EAAE,OAAO,EAAE,YAAY,CAAC;IAC1D,MAAM,YAAY,GA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,CAAC,SAAS,EAAE,cAAc,CAAC,GACjC,CACV,CAAC;IAEF,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,yBAAyB,YACtC,eAAK,SAAS,EAAC,kBAAkB,aAC/B,uBAAK,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,GAAM,EAChD,wBACE,sBAAI,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,GAAK,GAC1C,EACN,cAAK,SAAS,EAAC,iBAAiB,YAC9B,MAAC,IAAI,IAAC,SAAS,QAAC,OAAO,EAAE,CAAC,EAAE,cAAc,EAAC,eAAe,aACxD,KAAC,IAAI,IAAC,IAAI,kBAAE,UAAU,GAAQ,EAC9B,KAAC,IAAI,IAAC,IAAI,kBAAE,WAAW,GAAQ,IAC1B,GACH,IACF,GACF,EACN,KAAC,QAAQ,IACP,IAAI,EAAE,YAAY,EAClB,gBAAgB,EAAE,IAAI,EACtB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,eAAe,EACxB,MAAM,EACJ,KAAC,UAAU,IAAC,IAAI,EAAC,OAAO,gBAAY,OAAO,EAAC,KAAK,EAAC,SAAS,EAAC,OAAO,EAAE,mBAAmB,YACtF,KAAC,SAAS,IAAC,QAAQ,EAAC,OAAO,GAAG,GACnB,GAEf,IACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Button, Grid, IconButton, Snackbar } from '@mui/material';\nimport CloseIcon from '@mui/icons-material/Close';\n\nimport { PConnFieldProps } from '../../../types/PConnProps';\nimport './CancelAlert.css';\n\ninterface CancelAlertProps extends PConnFieldProps {\n // If any, enter additional props that only exist on CancelAlert here\n heading: string;\n content: string;\n itemKey: string;\n hideDelete: boolean;\n isDataObject: boolean;\n skipReleaseLockRequest: any;\n dismiss: Function;\n}\n\nexport default function CancelAlert(props: CancelAlertProps) {\n const { heading, content, getPConnect, itemKey: containerItemID, hideDelete, isDataObject, skipReleaseLockRequest, dismiss } = props;\n const actionsAPI = getPConnect().getActionsApi();\n const containerManagerAPI = getPConnect().getContainerManager();\n const isLocalAction = getPConnect().getValue(PCore.getConstants().CASE_INFO.IS_LOCAL_ACTION);\n // @ts-ignore - Property 'options' is private and only accessible within class 'C11nEnv'.\n const isBulkAction = getPConnect()?.options?.isBulkAction;\n const localizedVal = PCore.getLocaleUtils().getLocaleValue;\n const broadCastUtils: any = PCore.getCoexistenceManager().getBroadcastUtils();\n const isReverseCoexistence = broadCastUtils.isReverseCoexistenceCaseLoaded();\n const localeCategory = 'ModalContainer';\n const btnIds = {\n SAVE_AND_CLOSE: 'saveAndClose',\n CONTINUE_WORKING: 'continueWorking',\n DELETE: 'delete'\n };\n\n const [buttonsState, setButtonsState] = useState({\n [btnIds.SAVE_AND_CLOSE]: false,\n [btnIds.DELETE]: false\n });\n\n const [showSnackbar, setShowSnackbar] = useState(false);\n const [snackbarMessage, setSnackbarMessage] = useState('');\n\n function disableButton(id) {\n setButtonsState(prevState => ({\n ...prevState,\n [id]: true\n }));\n }\n\n function enableButton(id) {\n setButtonsState(prevState => ({\n ...prevState,\n [id]: false\n }));\n }\n\n function cancelHandler() {\n if (isReverseCoexistence) {\n dismiss(true);\n PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.REVERSE_COEXISTENCE_EVENTS.HANDLE_DISCARD);\n } else if (!isDataObject && !isLocalAction && !isBulkAction) {\n disableButton(btnIds.DELETE);\n actionsAPI\n .deleteCaseInCreateStage(containerItemID, hideDelete)\n .then(() => {\n PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL);\n })\n .catch(() => {\n setSnackbarMessage(localizedVal('Delete failed.', localeCategory));\n setShowSnackbar(true);\n })\n .finally(() => {\n enableButton(btnIds.DELETE);\n dismiss(true);\n });\n } else if (isLocalAction) {\n dismiss(true);\n actionsAPI.cancelAssignment(containerItemID, false);\n } else if (isBulkAction) {\n dismiss(true);\n actionsAPI.cancelBulkAction(containerItemID);\n } else {\n dismiss(true);\n containerManagerAPI.removeContainerItem({ containerItemID, skipReleaseLockRequest });\n }\n }\n\n function handleSnackbarClose(event: React.SyntheticEvent<any> | Event, reason?: string) {\n if (reason === 'clickaway') {\n return;\n }\n setShowSnackbar(false);\n }\n\n const leftButton = (\n <Button\n name={btnIds.CONTINUE_WORKING}\n variant='contained'\n color='secondary'\n onClick={() => {\n dismiss();\n if (isReverseCoexistence) {\n broadCastUtils.setCallBackFunction(null);\n broadCastUtils.setIsDirtyDialogActive(false);\n }\n }}\n >\n {localizedVal('Go back', localeCategory)}\n </Button>\n );\n\n const rightButton = (\n <Button name={btnIds.DELETE} variant='contained' color='primary' disabled={buttonsState[btnIds.DELETE]} onClick={cancelHandler}>\n {localizedVal('Discard', localeCategory)}\n </Button>\n );\n\n return (\n <>\n <div className='cancel-alert-background'>\n <div className='cancel-alert-top'>\n <h3>{localizedVal(heading, localeCategory)}</h3>\n <div>\n <p>{localizedVal(content, localeCategory)}</p>\n </div>\n <div className='action-controls'>\n <Grid container spacing={4} justifyContent='space-between'>\n <Grid item>{leftButton}</Grid>\n <Grid item>{rightButton}</Grid>\n </Grid>\n </div>\n </div>\n </div>\n <Snackbar\n open={showSnackbar}\n autoHideDuration={3000}\n onClose={handleSnackbarClose}\n message={snackbarMessage}\n action={\n <IconButton size='small' aria-label='close' color='inherit' onClick={handleSnackbarClose}>\n <CloseIcon fontSize='small' />\n </IconButton>\n }\n />\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Currency/Currency.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ5D,UAAU,cAAe,SAAQ,eAAe;IAE9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Currency.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Currency/Currency.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ5D,UAAU,cAAe,SAAQ,eAAe;IAE9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,cAAc,2CA4FrD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { NumericFormat } from 'react-number-format';
|
|
4
4
|
import { TextField } from '@mui/material';
|
|
5
5
|
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
|
|
@@ -17,16 +17,17 @@ export default function Currency(props) {
|
|
|
17
17
|
const propName = pConn.getStateProps().value;
|
|
18
18
|
const helperTextToDisplay = validatemessage || helperText;
|
|
19
19
|
const [values, setValues] = useState(value.toString());
|
|
20
|
-
const testProp = {
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const testProp = { 'data-test-id': testId };
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setValues(value.toString());
|
|
23
|
+
}, [value]);
|
|
23
24
|
// currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }
|
|
24
25
|
const theSymbols = getCurrencyCharacters(currencyISOCode);
|
|
25
26
|
const theCurrSym = theSymbols.theCurrencySymbol;
|
|
26
27
|
const theCurrDec = theSymbols.theDecimalIndicator;
|
|
27
28
|
const theCurrSep = theSymbols.theDigitGroupSeparator;
|
|
28
29
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
29
|
-
const formattedValue = format(value, pConn.getComponentName()
|
|
30
|
+
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
30
31
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
31
32
|
if (readOnly) {
|
|
32
33
|
readOnlyProp = { readOnly: true };
|
|
@@ -45,7 +46,7 @@ export default function Currency(props) {
|
|
|
45
46
|
const handleChange = val => {
|
|
46
47
|
setValues(val.value);
|
|
47
48
|
};
|
|
48
|
-
return (_jsx(NumericFormat, { valueIsNumericString: true, label: label, helperText: helperTextToDisplay, placeholder: placeholder ?? '', required: required, disabled: disabled, onValueChange: val => {
|
|
49
|
+
return (_jsx(NumericFormat, { valueIsNumericString: true, variant: readOnly ? 'standard' : 'outlined', label: label, helperText: helperTextToDisplay, placeholder: placeholder ?? '', required: required, disabled: disabled, onValueChange: val => {
|
|
49
50
|
handleChange(val);
|
|
50
51
|
}, onBlur: !readOnly ? currOnBlur : undefined, error: status === 'error', name: 'numberformat', value: values, ...currencyProp, decimalScale: allowDecimals !== false ? 2 : 0, fixedDecimalScale: allowDecimals, InputProps: { ...readOnlyProp, inputProps: { ...testProp } }, customInput: TextField }));
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Currency.js","sourceRoot":"","sources":["../../../../src/components/field/Currency/Currency.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Currency.js","sourceRoot":"","sources":["../../../../src/components/field/Currency/Currency.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,q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,aAAa,EAAE,GAAG,CAAC,EAAE;YACnB,YAAY,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC,EACD,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC1C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,IAAI,EAAC,cAAc,EACnB,KAAK,EAAE,MAAM,KACT,YAAY,EAChB,YAAY,EAAE,aAAa,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC7C,iBAAiB,EAAE,aAAa,EAChC,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE,EAC5D,WAAW,EAAE,SAAS,GACtB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { NumericFormat } from 'react-number-format';\nimport { TextField } from '@mui/material';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\nimport handleEvent from '../../helpers/event-utils';\nimport { format } from '../../helpers/formatters';\nimport { getCurrencyCharacters, getCurrencyOptions } from './currency-utils';\n\n/* Using react-number-format component here, since it allows formatting decimal values,\nas per the locale.\n*/\ninterface CurrrencyProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Currency here\n currencyISOCode?: string;\n allowDecimals: boolean;\n}\n\nexport default function Currency(props: CurrrencyProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n /* onChange, onBlur, */\n readOnly,\n testId,\n helperText,\n displayMode,\n hideLabel,\n currencyISOCode = 'USD',\n placeholder,\n allowDecimals\n } = props;\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n const helperTextToDisplay = validatemessage || helperText;\n const [values, setValues] = useState(value.toString());\n\n const testProp = { 'data-test-id': testId };\n\n useEffect(() => {\n setValues(value.toString());\n }, [value]);\n\n // currencySymbols looks like this: { theCurrencySymbol: '$', theDecimalIndicator: '.', theSeparator: ',' }\n const theSymbols = getCurrencyCharacters(currencyISOCode);\n const theCurrSym = theSymbols.theCurrencySymbol;\n const theCurrDec = theSymbols.theDecimalIndicator;\n const theCurrSep = theSymbols.theDigitGroupSeparator;\n\n const theCurrencyOptions = getCurrencyOptions(currencyISOCode);\n const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);\n\n let readOnlyProp = {}; // Note: empty if NOT ReadOnly\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n let currencyProp = {};\n currencyProp = { prefix: theCurrSym, decimalSeparator: theCurrDec, thousandSeparator: theCurrSep };\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;\n }\n\n function currOnBlur() {\n handleEvent(actions, 'changeNblur', propName, values);\n }\n\n const handleChange = val => {\n setValues(val.value);\n };\n\n return (\n <NumericFormat\n valueIsNumericString\n variant={readOnly ? 'standard' : 'outlined'}\n label={label}\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n required={required}\n disabled={disabled}\n onValueChange={val => {\n handleChange(val);\n }}\n onBlur={!readOnly ? currOnBlur : undefined}\n error={status === 'error'}\n name='numberformat'\n value={values}\n {...currencyProp}\n decimalScale={allowDecimals !== false ? 2 : 0}\n fixedDecimalScale={allowDecimals}\n InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}\n customInput={TextField}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Date.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Date/Date.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D,UAAU,SAAU,SAAQ,eAAe;CAE1C;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Date.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Date/Date.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAO5D,UAAU,SAAU,SAAQ,eAAe;CAE1C;AAED,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,SAAS,2CA8E5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import handleEvent from '../../helpers/event-utils';
|
|
@@ -27,6 +27,9 @@ export default function Date(props) {
|
|
|
27
27
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
28
28
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
29
29
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setDateValue(dayjs(value));
|
|
32
|
+
}, [value]);
|
|
30
33
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
31
34
|
const formattedDate = format(props.value, 'date', {
|
|
32
35
|
format: dateFormatInfo.dateFormatString
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Date.js","sourceRoot":"","sources":["../../../../src/components/field/Date/Date.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Date.js","sourceRoot":"","sources":["../../../../src/components/field/Date/Date.tsx"],"names":[],"mappings":";A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KACjG;IAED,IAAI,QAAQ,EAAE;QACZ,8CAA8C;QAC9C,OAAO,KAAC,SAAS,OAAK,KAAK,GAAI,CAAC;KACjC;IAED,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,QAAQ,GAAG;QACT,cAAc,EAAE,MAAM;KACvB,CAAC;IAEF,MAAM,YAAY,GAAG,IAAI,CAAC,EAAE;QAC1B,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YAC1B,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,WAAW,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;SACvE;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,UAAU,IACT,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,cAAc,CAAC,gBAAgB,EACvC,KAAK,EAAE,SAAS,EAChB,SAAS,EAAE;YACT,SAAS,EAAE;gBACT,QAAQ;gBACR,OAAO,EAAE,UAAU;gBACnB,WAAW,EAAE,cAAc,CAAC,kBAAkB;gBAC9C,KAAK,EAAE,MAAM,KAAK,OAAO;gBACzB,UAAU,EAAE,mBAAmB;gBAC/B,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE;aAC5B;SACF,EACD,QAAQ,EAAE,YAAY,GACtB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { DatePicker } from '@mui/x-date-pickers/DatePicker';\nimport dayjs, { Dayjs } from 'dayjs';\n\nimport handleEvent from '../../helpers/event-utils';\nimport { format } from '../../helpers/formatters';\nimport { dateFormatInfoDefault, getDateFormatInfo } from '../../helpers/date-format-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\n// Will return the date string in YYYY-MM-DD format which we'll be POSTing to the server\nfunction getFormattedDate(date) {\n return `${date.$y.toString()}-${(date.$M + 1).toString().padStart(2, '0')}-${date.$D.toString().padStart(2, '0')}`;\n}\n\ninterface DateProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Date here\n}\n\nexport default function Date(props: DateProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const TextInput = getComponentFromMap('TextInput');\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const { getPConnect, label, required, disabled, value, validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;\n\n const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(value) : null);\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n const helperTextToDisplay = validatemessage || helperText;\n\n // Start with default dateFormatInfo\n const dateFormatInfo = dateFormatInfoDefault;\n // and then update, as needed, based on locale, etc.\n const theDateFormat = getDateFormatInfo();\n dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;\n dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;\n dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;\n\n useEffect(() => {\n setDateValue(dayjs(value));\n }, [value]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n const formattedDate = format(props.value, 'date', {\n format: dateFormatInfo.dateFormatString\n });\n return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n const formattedDate = format(props.value, 'date', {\n format: dateFormatInfo.dateFormatString\n });\n return <FieldValueList name={hideLabel ? '' : label} value={formattedDate} variant='stacked' />;\n }\n\n if (readOnly) {\n // const theReadOnlyComp = <TextInput props />\n return <TextInput {...props} />;\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = date => {\n if (date && date.isValid()) {\n setDateValue(date);\n handleEvent(actions, 'changeNblur', propName, getFormattedDate(date));\n }\n };\n\n return (\n <DatePicker\n label={label}\n disabled={disabled}\n format={dateFormatInfo.dateFormatString}\n value={dateValue}\n slotProps={{\n textField: {\n required,\n variant: 'outlined',\n placeholder: dateFormatInfo.dateFormatStringLC,\n error: status === 'error',\n helperText: helperTextToDisplay,\n size: 'small',\n InputProps: { ...testProp }\n }\n }}\n onChange={handleChange}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../../../src/components/field/DateTime/DateTime.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,aAAc,SAAQ,eAAe;CAE9C;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../../../src/components/field/DateTime/DateTime.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,aAAc,SAAQ,eAAe;CAE9C;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,2CA2FpD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
|
+
import DateFormatter from '../../helpers/formatters/Date';
|
|
5
6
|
import handleEvent from '../../helpers/event-utils';
|
|
6
7
|
import { format } from '../../helpers/formatters';
|
|
7
8
|
import { dateFormatInfoDefault, getDateFormatInfo } from '../../helpers/date-format-utils';
|
|
@@ -11,7 +12,9 @@ export default function DateTime(props) {
|
|
|
11
12
|
const TextInput = getComponentFromMap('TextInput');
|
|
12
13
|
const FieldValueList = getComponentFromMap('FieldValueList');
|
|
13
14
|
const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;
|
|
14
|
-
const
|
|
15
|
+
const environmentInfo = PCore.getEnvironmentInfo();
|
|
16
|
+
const timezone = environmentInfo && environmentInfo.getTimeZone();
|
|
17
|
+
const [dateValue, setDateValue] = useState(value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null);
|
|
15
18
|
const pConn = getPConnect();
|
|
16
19
|
const actions = pConn.getActionsApi();
|
|
17
20
|
const propName = pConn.getStateProps().value;
|
|
@@ -23,6 +26,9 @@ export default function DateTime(props) {
|
|
|
23
26
|
dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;
|
|
24
27
|
dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;
|
|
25
28
|
dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));
|
|
31
|
+
}, [value]);
|
|
26
32
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
27
33
|
const formattedDateTime = format(props.value, 'datetime', {
|
|
28
34
|
format: `${dateFormatInfo.dateFormatString} hh:mm a`
|
|
@@ -44,8 +50,9 @@ export default function DateTime(props) {
|
|
|
44
50
|
'data-test-id': testId
|
|
45
51
|
};
|
|
46
52
|
const handleChange = date => {
|
|
47
|
-
|
|
48
|
-
const changeValue =
|
|
53
|
+
const timeZoneDateTime = dayjs.tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone);
|
|
54
|
+
const changeValue = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';
|
|
55
|
+
setDateValue(timeZoneDateTime);
|
|
49
56
|
handleEvent(actions, 'changeNblur', propName, changeValue);
|
|
50
57
|
};
|
|
51
58
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.js","sourceRoot":"","sources":["../../../../src/components/field/DateTime/DateTime.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE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AAQ;gBACR,WAAW,EAAE,GAAG,cAAc,CAAC,kBAAkB,UAAU;gBAC3D,KAAK,EAAE,MAAM,KAAK,OAAO;gBACzB,UAAU,EAAE,mBAAmB;gBAC/B,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE;aAC5B;SACF,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';\nimport dayjs, { Dayjs } from 'dayjs';\nimport DateFormatter from '../../helpers/formatters/Date';\nimport handleEvent from '../../helpers/event-utils';\nimport { format } from '../../helpers/formatters';\nimport { dateFormatInfoDefault, getDateFormatInfo } from '../../helpers/date-format-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface DateTimeProps extends PConnFieldProps {\n // If any, enter additional props that only exist on DateTime here\n}\n\nexport default function DateTime(props: DateTimeProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const TextInput = getComponentFromMap('TextInput');\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const { getPConnect, label, required, disabled, value = '', validatemessage, status, readOnly, testId, helperText, displayMode, hideLabel } = props;\n\n const environmentInfo = PCore.getEnvironmentInfo();\n const timezone = environmentInfo && environmentInfo.getTimeZone();\n\n const [dateValue, setDateValue] = useState<Dayjs | null>(value ? dayjs(DateFormatter.convertToTimezone(value, { timezone })) : null);\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n const helperTextToDisplay = validatemessage || helperText;\n\n // Start with default dateFormatInfo\n const dateFormatInfo = dateFormatInfoDefault;\n // and then update, as needed, based on locale, etc.\n const theDateFormat = getDateFormatInfo();\n dateFormatInfo.dateFormatString = theDateFormat.dateFormatString;\n dateFormatInfo.dateFormatStringLC = theDateFormat.dateFormatStringLC;\n dateFormatInfo.dateFormatMask = theDateFormat.dateFormatMask;\n\n useEffect(() => {\n setDateValue(dayjs(DateFormatter.convertToTimezone(value, { timezone })));\n }, [value]);\n\n if (displayMode === 'DISPLAY_ONLY') {\n const formattedDateTime = format(props.value, 'datetime', {\n format: `${dateFormatInfo.dateFormatString} hh:mm a`\n });\n return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n const formattedDateTime = format(props.value, 'datetime', {\n format: `${dateFormatInfo.dateFormatString} hh:mm a`\n });\n return <FieldValueList name={hideLabel ? '' : label} value={formattedDateTime} variant='stacked' />;\n }\n\n if (readOnly) {\n const formattedDateTime = format(props.value, 'datetime');\n return <TextInput {...props} value={formattedDateTime} />;\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = date => {\n const timeZoneDateTime = (dayjs as any).tz(date.format('YYYY-MM-DDTHH:mm:ss'), timezone);\n const changeValue = timeZoneDateTime && timeZoneDateTime.isValid() ? timeZoneDateTime.toISOString() : '';\n setDateValue(timeZoneDateTime);\n handleEvent(actions, 'changeNblur', propName, changeValue);\n };\n\n //\n // TODO: Keyboard doesn't work in the minute field, it updates one digit then jump to am/pm field\n // try an older version of the lib or use DateTimePicker\n //\n\n return (\n <DateTimePicker\n // fullWidth\n // autoOk\n disabled={disabled}\n format={`${dateFormatInfo.dateFormatString} hh:mm a`}\n // mask={`${dateFormatInfo.dateFormatMask} __:__ _m`}\n minutesStep={5}\n label={label}\n value={dateValue}\n onChange={handleChange}\n data-test-id={testId}\n slotProps={{\n textField: {\n variant: 'outlined',\n required,\n placeholder: `${dateFormatInfo.dateFormatStringLC} hh:mm a`,\n error: status === 'error',\n helperText: helperTextToDisplay,\n size: 'small',\n InputProps: { ...testProp }\n }\n }}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Decimal.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Decimal/Decimal.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAM5D,UAAU,YAAa,SAAQ,eAAe;IAE5C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"Decimal.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Decimal/Decimal.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAM5D,UAAU,YAAa,SAAQ,eAAe;IAE5C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,2CAsGlD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { NumericFormat } from 'react-number-format';
|
|
3
3
|
import { TextField } from '@mui/material';
|
|
4
|
-
import { useState } from 'react';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
5
|
import { getCurrencyCharacters, getCurrencyOptions } from '../Currency/currency-utils';
|
|
6
6
|
import handleEvent from '../../helpers/event-utils';
|
|
7
7
|
import { format } from '../../helpers/formatters';
|
|
@@ -22,6 +22,9 @@ export default function Decimal(props) {
|
|
|
22
22
|
const theCurrSep = theSymbols.theDigitGroupSeparator;
|
|
23
23
|
const theCurrSym = theSymbols.theCurrencySymbol;
|
|
24
24
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setValues(value.toString());
|
|
27
|
+
}, [value]);
|
|
25
28
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
26
29
|
if (readOnly) {
|
|
27
30
|
readOnlyProp = { readOnly: true };
|
|
@@ -31,7 +34,7 @@ export default function Decimal(props) {
|
|
|
31
34
|
formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);
|
|
32
35
|
}
|
|
33
36
|
else {
|
|
34
|
-
formattedValue = format(value, pConn.getComponentName()
|
|
37
|
+
formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
35
38
|
}
|
|
36
39
|
if (displayMode === 'DISPLAY_ONLY') {
|
|
37
40
|
return _jsx(FieldValueList, { name: hideLabel ? '' : label, value: formattedValue });
|
|
@@ -50,6 +53,6 @@ export default function Decimal(props) {
|
|
|
50
53
|
};
|
|
51
54
|
return (_jsx(NumericFormat, { valueIsNumericString: true, fullWidth: true, variant: readOnly ? 'standard' : 'outlined', helperText: helperTextToDisplay, placeholder: placeholder ?? '', size: 'small', required: required, disabled: disabled, error: status === 'error', label: label, value: values, onValueChange: val => {
|
|
52
55
|
handleChange(val);
|
|
53
|
-
}, onBlur: !readOnly ? decimalOnBlur : undefined, prefix: readOnly && formatter === 'Currency' ? theCurrSym : '', decimalSeparator: theCurrDec, thousandSeparator: showGroupSeparators ? theCurrSep : '', decimalScale: readOnly && formatter === 'Currency' ? undefined : decimalPrecision, InputProps: { ...readOnlyProp, inputProps: { ...testProp } }, customInput: TextField }));
|
|
56
|
+
}, onBlur: !readOnly ? decimalOnBlur : undefined, prefix: readOnly && formatter === 'Currency' ? theCurrSym : '', suffix: readOnly && formatter === 'Percentage' ? '%' : '', decimalSeparator: theCurrDec, thousandSeparator: showGroupSeparators ? theCurrSep : '', decimalScale: readOnly && formatter === 'Currency' ? undefined : decimalPrecision, InputProps: { ...readOnlyProp, inputProps: { ...testProp } }, customInput: TextField }));
|
|
54
57
|
}
|
|
55
58
|
//# sourceMappingURL=Decimal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Decimal.js","sourceRoot":"","sources":["../../../../src/components/field/Decimal/Decimal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Decimal.js","sourceRoot":"","sources":["../../../../src/components/field/Decimal/Decimal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAehF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,KAAmB;IACjD,8EAA8E;IAC9E,MAAM,cAAc,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE7D,MAAM,EACJ,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,eAAe,EACf,MAAM;IACN,uBAAuB;IACvB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACT,eAAe,GAAG,KAAK,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,SAAS,EACV,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEvD,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AAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EACxD,YAAY,EAAE,QAAQ,IAAI,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,EACjF,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE,EAC5D,WAAW,EAAE,SAAS,GACtB,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { NumericFormat } from 'react-number-format';\nimport { TextField } from '@mui/material';\nimport { useEffect, useState } from 'react';\nimport { getCurrencyCharacters, getCurrencyOptions } from '../Currency/currency-utils';\nimport handleEvent from '../../helpers/event-utils';\nimport { format } from '../../helpers/formatters';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\n/* Using react-number-format component here, since it allows formatting decimal values,\nas per the locale.\n*/\n\ninterface DecimalProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Decimal here\n currencyISOCode?: string;\n decimalPrecision?: number;\n showGroupSeparators?: boolean;\n formatter?: string;\n}\n\nexport default function Decimal(props: DecimalProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n /* onChange, onBlur, */\n readOnly,\n helperText,\n displayMode,\n hideLabel,\n currencyISOCode = 'USD',\n decimalPrecision,\n showGroupSeparators,\n testId,\n placeholder,\n formatter\n } = props;\n\n const [values, setValues] = useState(value.toString());\n\n const pConn = getPConnect();\n const actions = pConn.getActionsApi();\n const propName = (pConn.getStateProps() as any).value;\n const helperTextToDisplay = validatemessage || helperText;\n\n const theSymbols = getCurrencyCharacters(currencyISOCode);\n const theCurrDec = theSymbols.theDecimalIndicator;\n const theCurrSep = theSymbols.theDigitGroupSeparator;\n const theCurrSym = theSymbols.theCurrencySymbol;\n\n const theCurrencyOptions = getCurrencyOptions(currencyISOCode);\n\n useEffect(() => {\n setValues(value.toString());\n }, [value]);\n\n let readOnlyProp = {}; // Note: empty if NOT ReadOnly\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n let formattedValue = '';\n if (formatter === 'Currency') {\n formattedValue = format(value, formatter.toLowerCase(), theCurrencyOptions);\n } else {\n formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);\n }\n\n if (displayMode === 'DISPLAY_ONLY') {\n return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} />;\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return <FieldValueList name={hideLabel ? '' : label} value={formattedValue} variant='stacked' />;\n }\n\n const testProp = {\n 'data-test-id': testId\n };\n\n function decimalOnBlur() {\n handleEvent(actions, 'changeNblur', propName, values);\n }\n\n const handleChange = val => {\n setValues(val.value);\n };\n\n return (\n <NumericFormat\n valueIsNumericString\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={placeholder ?? ''}\n size='small'\n required={required}\n disabled={disabled}\n error={status === 'error'}\n label={label}\n value={values}\n onValueChange={val => {\n handleChange(val);\n }}\n onBlur={!readOnly ? decimalOnBlur : undefined}\n prefix={readOnly && formatter === 'Currency' ? theCurrSym : ''}\n suffix={readOnly && formatter === 'Percentage' ? '%' : ''}\n decimalSeparator={theCurrDec}\n thousandSeparator={showGroupSeparators ? theCurrSep : ''}\n decimalScale={readOnly && formatter === 'Currency' ? undefined : decimalPrecision}\n InputProps={{ ...readOnlyProp, inputProps: { ...testProp } }}\n customInput={TextField}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAwC5D,UAAU,aAAc,SAAQ,eAAe;IAE7C,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAwC5D,UAAU,aAAc,SAAQ,eAAe;IAE7C,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,GAAG,EAAE,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,kDAmLpD"}
|
|
@@ -93,7 +93,7 @@ export default function Dropdown(props) {
|
|
|
93
93
|
}
|
|
94
94
|
}, [theDatasource]);
|
|
95
95
|
useEffect(() => {
|
|
96
|
-
if (
|
|
96
|
+
if (listType !== 'associated' && typeof datasource === 'string') {
|
|
97
97
|
getDataPage(datasource, parameters, context).then((results) => {
|
|
98
98
|
const optionsData = [];
|
|
99
99
|
const displayColumn = getDisplayFieldsMetaData(columns);
|
|
@@ -117,15 +117,21 @@ export default function Dropdown(props) {
|
|
|
117
117
|
const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;
|
|
118
118
|
const localePath = localeContext === 'datapage' ? displayName : localeName;
|
|
119
119
|
let readOnlyProp = {};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
120
|
+
const displayFn = (displayM, val) => {
|
|
121
|
+
if (displayM === 'DISPLAY_ONLY') {
|
|
122
|
+
return (_jsx(FieldValueList, { name: hideLabel ? '' : label,
|
|
123
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
124
|
+
value: thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)) }));
|
|
125
|
+
}
|
|
126
|
+
if (displayM === 'STACKED_LARGE_VAL') {
|
|
127
|
+
return (_jsx(FieldValueList, { name: hideLabel ? '' : label,
|
|
128
|
+
// @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'
|
|
129
|
+
value: thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName)), variant: 'stacked' }));
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
};
|
|
133
|
+
if (displayMode) {
|
|
134
|
+
return displayFn(displayMode, options.find(option => option.key === value)?.value || value);
|
|
129
135
|
}
|
|
130
136
|
if (readOnly) {
|
|
131
137
|
readOnlyProp = { readOnly: true };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,WAAW,M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,cAAc,EAAE;YAClB,cAAc,CAAC,GAAG,CAAC,CAAC;SACrB;IACH,CAAC,CAAC;IAEF,mFAAmF;IACnF,qEAAqE;IACrE,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACnC,KAAC,SAAS,IACR,SAAS,QACT,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAC3C,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,QAAQ,CAAC,iBAAiB,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,CAAC,EAC5D,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAC9C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EACtD,MAAM,QACN,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,QAAQ,EAAE,YAE3C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAC5B,KAAC,QAAQ,IAAkB,KAAK,EAAE,MAAM,CAAC,GAAG,YAEzC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,yBAAyB,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,IAFpH,MAAM,CAAC,GAAG,CAGd,CACZ,CAAC,GACQ,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { TextField } from '@mui/material';\nimport MenuItem from '@mui/material/MenuItem';\nimport isDeepEqual from 'fast-deep-equal/react';\nimport Utils from '../../helpers/utils';\nimport { getDataPage } from '../../helpers/data_page';\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface IOption {\n key: string;\n value: string;\n}\n\nconst flattenParameters = (params = {}) => {\n const flatParams = {};\n Object.keys(params).forEach(key => {\n const { name, value: theVal } = params[key];\n flatParams[name] = theVal;\n });\n\n return flatParams;\n};\n\nconst preProcessColumns = columnList => {\n return columnList.map(col => {\n const tempColObj = { ...col };\n tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;\n return tempColObj;\n });\n};\n\nconst getDisplayFieldsMetaData = columnList => {\n const displayColumns = columnList.filter(col => col.display === 'true');\n const metaDataObj: any = { key: '', primary: '', secondary: [] };\n const keyCol = columnList.filter(col => col.key === 'true');\n metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';\n for (let index = 0; index < displayColumns.length; index += 1) {\n if (displayColumns[index].primary === 'true') {\n metaDataObj.primary = displayColumns[index].value;\n } else {\n metaDataObj.secondary.push(displayColumns[index].value);\n }\n }\n return metaDataObj;\n};\n\ninterface DropdownProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Dropdown here\n datasource?: any[];\n onRecordChange?: any;\n fieldMetadata?: any;\n listType: string;\n deferDatasource?: boolean;\n datasourceMetadata?: any;\n parameters?: any;\n columns: any[];\n}\n\nexport default function Dropdown(props: DropdownProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n readOnly,\n testId,\n helperText,\n displayMode,\n deferDatasource,\n datasourceMetadata,\n hideLabel,\n onRecordChange,\n fieldMetadata\n } = props;\n let { placeholder = '' } = props;\n const context = getPConnect().getContextName();\n let { listType, parameters, datasource = [], columns = [] } = props;\n placeholder = placeholder || 'Select...';\n const [options, setOptions] = useState<IOption[]>([]);\n const [theDatasource, setDatasource] = useState<any[] | null>(null);\n const helperTextToDisplay = validatemessage || helperText;\n\n const thePConn = getPConnect();\n const actionsApi = thePConn.getActionsApi();\n const propName = (thePConn.getStateProps() as any).value;\n const className = thePConn.getCaseInfo().getClassName();\n const refName = propName?.slice(propName.lastIndexOf('.') + 1);\n\n if (!isDeepEqual(datasource, theDatasource)) {\n // inbound datasource is different, so update theDatasource (to trigger useEffect)\n setDatasource(datasource);\n }\n\n // convert associated to datapage listtype and transform props\n // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList\n if (deferDatasource && datasourceMetadata?.datasource?.name) {\n listType = 'datapage';\n datasource = datasourceMetadata.datasource.name;\n const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;\n parameters = flattenParameters(dataSourceParameters);\n const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;\n const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;\n columns = [\n {\n key: 'true',\n setProperty: 'Associated property',\n value: valueProp\n },\n {\n display: 'true',\n primary: 'true',\n useForSearch: true,\n value: displayProp\n }\n ];\n }\n columns = preProcessColumns(columns);\n\n useEffect(() => {\n if (theDatasource) {\n const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly\n const optionsList = [...list];\n optionsList.unshift({\n key: placeholder,\n value: thePConn.getLocalizedValue(placeholder, '', '')\n }); // 2nd and 3rd args empty string until typedef marked correctly\n setOptions(optionsList);\n }\n }, [theDatasource]);\n\n useEffect(() => {\n if (!displayMode && listType !== 'associated' && typeof datasource === 'string') {\n getDataPage(datasource, parameters, context).then((results: any) => {\n const optionsData: any[] = [];\n const displayColumn = getDisplayFieldsMetaData(columns);\n results?.forEach(element => {\n const val = element[displayColumn.primary]?.toString();\n const obj = {\n key: element[displayColumn.key] || element.pyGUID,\n value: val\n };\n optionsData.push(obj);\n });\n setOptions(optionsData);\n });\n }\n }, []);\n\n const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;\n\n let displayName = metaData?.datasource?.propertyForDisplayText;\n displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);\n const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';\n const localeClass = localeContext === 'datapage' ? '@baseclass' : className;\n const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;\n const localePath = localeContext === 'datapage' ? displayName : localeName;\n\n let readOnlyProp = {};\n\n if (displayMode === 'DISPLAY_ONLY') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'\n value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n />\n );\n }\n\n if (displayMode === 'STACKED_LARGE_VAL') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'\n value={thePConn.getLocalizedValue(value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n variant='stacked'\n />\n );\n }\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = evt => {\n const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;\n handleEvent(actionsApi, 'changeNblur', propName, selectedValue);\n if (onRecordChange) {\n onRecordChange(evt);\n }\n };\n\n // Material UI shows a warning if the component is rendered before options are set.\n // So, hold off on rendering anything until options are available...\n return options.length === 0 ? null : (\n <TextField\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly\n size='small'\n required={required}\n disabled={disabled}\n onChange={!readOnly ? handleChange : undefined}\n error={status === 'error'}\n label={label}\n value={value === '' && !readOnly ? placeholder : value}\n select\n InputProps={{ ...readOnlyProp, ...testProp }}\n >\n {options.map((option: any) => (\n <MenuItem key={option.key} value={option.key}>\n {/* @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv' */}\n {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n </MenuItem>\n ))}\n </TextField>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/field/Dropdown/Dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,WAAW,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAQhF,MAAM,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,EAAE,EAAE;IACxC,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAChC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5C,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,UAAU,CAAC,EAAE;IACrC,OAAO,UAAU,CA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AE,EAAE,EAAE,EAAE,CAAC,EAC5D,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EAC9C,KAAK,EAAE,MAAM,KAAK,OAAO,EACzB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EACtD,MAAM,QACN,UAAU,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,QAAQ,EAAE,YAE3C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAC5B,KAAC,QAAQ,IAAkB,KAAK,EAAE,MAAM,CAAC,GAAG,YACzC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,yBAAyB,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC,IADpH,MAAM,CAAC,GAAG,CAEd,CACZ,CAAC,GACQ,CACb,CAAC;AACJ,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\nimport { TextField } from '@mui/material';\nimport MenuItem from '@mui/material/MenuItem';\nimport isDeepEqual from 'fast-deep-equal/react';\nimport Utils from '../../helpers/utils';\nimport { getDataPage } from '../../helpers/data_page';\nimport handleEvent from '../../helpers/event-utils';\nimport { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';\nimport { PConnFieldProps } from '../../../types/PConnProps';\n\ninterface IOption {\n key: string;\n value: string;\n}\n\nconst flattenParameters = (params = {}) => {\n const flatParams = {};\n Object.keys(params).forEach(key => {\n const { name, value: theVal } = params[key];\n flatParams[name] = theVal;\n });\n\n return flatParams;\n};\n\nconst preProcessColumns = columnList => {\n return columnList.map(col => {\n const tempColObj = { ...col };\n tempColObj.value = col.value && col.value.startsWith('.') ? col.value.substring(1) : col.value;\n return tempColObj;\n });\n};\n\nconst getDisplayFieldsMetaData = columnList => {\n const displayColumns = columnList.filter(col => col.display === 'true');\n const metaDataObj: any = { key: '', primary: '', secondary: [] };\n const keyCol = columnList.filter(col => col.key === 'true');\n metaDataObj.key = keyCol.length > 0 ? keyCol[0].value : 'auto';\n for (let index = 0; index < displayColumns.length; index += 1) {\n if (displayColumns[index].primary === 'true') {\n metaDataObj.primary = displayColumns[index].value;\n } else {\n metaDataObj.secondary.push(displayColumns[index].value);\n }\n }\n return metaDataObj;\n};\n\ninterface DropdownProps extends PConnFieldProps {\n // If any, enter additional props that only exist on Dropdown here\n datasource?: any[];\n onRecordChange?: any;\n fieldMetadata?: any;\n listType: string;\n deferDatasource?: boolean;\n datasourceMetadata?: any;\n parameters?: any;\n columns: any[];\n}\n\nexport default function Dropdown(props: DropdownProps) {\n // Get emitted components from map (so we can get any override that may exist)\n const FieldValueList = getComponentFromMap('FieldValueList');\n\n const {\n getPConnect,\n label,\n required,\n disabled,\n value = '',\n validatemessage,\n status,\n readOnly,\n testId,\n helperText,\n displayMode,\n deferDatasource,\n datasourceMetadata,\n hideLabel,\n onRecordChange,\n fieldMetadata\n } = props;\n let { placeholder = '' } = props;\n const context = getPConnect().getContextName();\n let { listType, parameters, datasource = [], columns = [] } = props;\n placeholder = placeholder || 'Select...';\n const [options, setOptions] = useState<IOption[]>([]);\n const [theDatasource, setDatasource] = useState<any[] | null>(null);\n const helperTextToDisplay = validatemessage || helperText;\n\n const thePConn = getPConnect();\n const actionsApi = thePConn.getActionsApi();\n const propName = (thePConn.getStateProps() as any).value;\n const className = thePConn.getCaseInfo().getClassName();\n const refName = propName?.slice(propName.lastIndexOf('.') + 1);\n\n if (!isDeepEqual(datasource, theDatasource)) {\n // inbound datasource is different, so update theDatasource (to trigger useEffect)\n setDatasource(datasource);\n }\n\n // convert associated to datapage listtype and transform props\n // Process deferDatasource when datapage name is present. WHhen tableType is promptList / localList\n if (deferDatasource && datasourceMetadata?.datasource?.name) {\n listType = 'datapage';\n datasource = datasourceMetadata.datasource.name;\n const { parameters: dataSourceParameters, propertyForDisplayText, propertyForValue } = datasourceMetadata.datasource;\n parameters = flattenParameters(dataSourceParameters);\n const displayProp = propertyForDisplayText.startsWith('@P') ? propertyForDisplayText.substring(3) : propertyForDisplayText;\n const valueProp = propertyForValue.startsWith('@P') ? propertyForValue.substring(3) : propertyForValue;\n columns = [\n {\n key: 'true',\n setProperty: 'Associated property',\n value: valueProp\n },\n {\n display: 'true',\n primary: 'true',\n useForSearch: true,\n value: displayProp\n }\n ];\n }\n columns = preProcessColumns(columns);\n\n useEffect(() => {\n if (theDatasource) {\n const list = Utils.getOptionList(props, getPConnect().getDataObject('')); // 1st arg empty string until typedef marked correctly\n const optionsList = [...list];\n optionsList.unshift({\n key: placeholder,\n value: thePConn.getLocalizedValue(placeholder, '', '')\n }); // 2nd and 3rd args empty string until typedef marked correctly\n setOptions(optionsList);\n }\n }, [theDatasource]);\n\n useEffect(() => {\n if (listType !== 'associated' && typeof datasource === 'string') {\n getDataPage(datasource, parameters, context).then((results: any) => {\n const optionsData: any[] = [];\n const displayColumn = getDisplayFieldsMetaData(columns);\n results?.forEach(element => {\n const val = element[displayColumn.primary]?.toString();\n const obj = {\n key: element[displayColumn.key] || element.pyGUID,\n value: val\n };\n optionsData.push(obj);\n });\n setOptions(optionsData);\n });\n }\n }, []);\n\n const metaData = Array.isArray(fieldMetadata) ? fieldMetadata.filter(field => field?.classID === className)[0] : fieldMetadata;\n\n let displayName = metaData?.datasource?.propertyForDisplayText;\n displayName = displayName?.slice(displayName.lastIndexOf('.') + 1);\n const localeContext = metaData?.datasource?.tableType === 'DataPage' ? 'datapage' : 'associated';\n const localeClass = localeContext === 'datapage' ? '@baseclass' : className;\n const localeName = localeContext === 'datapage' ? metaData?.datasource?.name : refName;\n const localePath = localeContext === 'datapage' ? displayName : localeName;\n\n let readOnlyProp = {};\n\n const displayFn = (displayM, val) => {\n if (displayM === 'DISPLAY_ONLY') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'\n value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n />\n );\n }\n\n if (displayM === 'STACKED_LARGE_VAL') {\n return (\n <FieldValueList\n name={hideLabel ? '' : label}\n // @ts-ignore - Property 'getLocaleRuleNameFromKeys' is private and only accessible within class 'C11nEnv'\n value={thePConn.getLocalizedValue(val, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n variant='stacked'\n />\n );\n }\n\n return null;\n };\n\n if (displayMode) {\n return displayFn(displayMode, options.find(option => option.key === value)?.value || value);\n }\n\n if (readOnly) {\n readOnlyProp = { readOnly: true };\n }\n\n let testProp = {};\n\n testProp = {\n 'data-test-id': testId\n };\n\n const handleChange = evt => {\n const selectedValue = evt.target.value === placeholder ? '' : evt.target.value;\n handleEvent(actionsApi, 'changeNblur', propName, selectedValue);\n if (onRecordChange) {\n onRecordChange(evt);\n }\n };\n\n // Material UI shows a warning if the component is rendered before options are set.\n // So, hold off on rendering anything until options are available...\n return options.length === 0 ? null : (\n <TextField\n fullWidth\n variant={readOnly ? 'standard' : 'outlined'}\n helperText={helperTextToDisplay}\n placeholder={thePConn.getLocalizedValue(placeholder, '', '')} // 2nd and 3rd args empty string until typedef marked correctly\n size='small'\n required={required}\n disabled={disabled}\n onChange={!readOnly ? handleChange : undefined}\n error={status === 'error'}\n label={label}\n value={value === '' && !readOnly ? placeholder : value}\n select\n InputProps={{ ...readOnlyProp, ...testProp }}\n >\n {options.map((option: any) => (\n <MenuItem key={option.key} value={option.key}>\n {thePConn.getLocalizedValue(option.value, localePath, thePConn.getLocaleRuleNameFromKeys(localeClass, localeContext, localeName))}\n </MenuItem>\n ))}\n </TextField>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Percentage.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Percentage/Percentage.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ5D,UAAU,eAAgB,SAAQ,eAAe;IAE/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Percentage.d.ts","sourceRoot":"","sources":["../../../../src/components/field/Percentage/Percentage.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAQ5D,UAAU,eAAgB,SAAQ,eAAe;IAE/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,KAAK,EAAE,eAAe,2CAgGxD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { NumericFormat } from 'react-number-format';
|
|
4
4
|
import { TextField } from '@mui/material';
|
|
5
5
|
import { getComponentFromMap } from '../../../bridge/helpers/sdk_component_map';
|
|
@@ -19,7 +19,10 @@ export default function Percentage(props) {
|
|
|
19
19
|
const propName = pConn.getStateProps().value;
|
|
20
20
|
const helperTextToDisplay = validatemessage || helperText;
|
|
21
21
|
const theCurrencyOptions = getCurrencyOptions(currencyISOCode);
|
|
22
|
-
const formattedValue = format(value, pConn.getComponentName()
|
|
22
|
+
const formattedValue = format(value, pConn.getComponentName()?.toLowerCase(), theCurrencyOptions);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setValues(value.toString());
|
|
25
|
+
}, [value]);
|
|
23
26
|
let readOnlyProp = {}; // Note: empty if NOT ReadOnly
|
|
24
27
|
if (readOnly) {
|
|
25
28
|
readOnlyProp = { readOnly: true };
|