aefis-core-ui 2.1.13 → 2.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.modern.js +1277 -225
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -9,7 +9,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
9
9
|
import { red, orange, green, blue, grey, yellow, indigo, purple, cyan, teal, lime, blueGrey, amber, lightBlue, deepOrange } from '@mui/material/colors';
|
|
10
10
|
import makeStyles$1 from '@mui/styles/makeStyles';
|
|
11
11
|
import withStyles from '@mui/styles/withStyles';
|
|
12
|
-
import { useTheme, alpha, createTheme as createTheme$1, ThemeProvider, styled as styled$1 } from '@mui/material/styles';
|
|
12
|
+
import { useTheme, alpha, createTheme as createTheme$1, ThemeProvider, styled as styled$1, StyledEngineProvider } from '@mui/material/styles';
|
|
13
13
|
import mustache from 'mustache';
|
|
14
14
|
import { Box as Box$2 } from '@mui/system';
|
|
15
15
|
import { Skeleton as Skeleton$4, TextField as TextField$1, Box as Box$3 } from '@mui/material/';
|
|
@@ -40,12 +40,12 @@ import { capitalCase, camelCase, snakeCase, pascalCase } from 'change-case';
|
|
|
40
40
|
import cx from 'classnames';
|
|
41
41
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
42
42
|
import CircularProgress$1 from '@mui/material/CircularProgress';
|
|
43
|
-
import { useQuery, useInfiniteQuery, useQueryClient, useMutation } from 'react-query';
|
|
43
|
+
import { useQuery, useInfiniteQuery, useQueryClient, useMutation, QueryClient, QueryClientProvider } from 'react-query';
|
|
44
44
|
import axios from 'axios';
|
|
45
45
|
import _ from 'lodash';
|
|
46
46
|
import qs from 'query-string';
|
|
47
47
|
import SortIcon from '@mui/icons-material/Sort';
|
|
48
|
-
import { useSnackbar } from 'notistack';
|
|
48
|
+
import { useSnackbar, SnackbarProvider } from 'notistack';
|
|
49
49
|
import useMediaQuery$1 from '@mui/material/useMediaQuery';
|
|
50
50
|
import Typography$1 from '@mui/material/Typography';
|
|
51
51
|
import Tooltip$2 from '@mui/material/Tooltip';
|
|
@@ -75,7 +75,7 @@ import get$1 from 'lodash/get';
|
|
|
75
75
|
import isPlainObject from 'lodash/isPlainObject';
|
|
76
76
|
import isEmpty from 'lodash/isEmpty';
|
|
77
77
|
import ToggleButton$1 from '@mui/material/ToggleButton';
|
|
78
|
-
import { parse as parse$1, format, setDate, setMonth } from 'date-fns';
|
|
78
|
+
import { parse as parse$1, format as format$1, setDate, setMonth } from 'date-fns';
|
|
79
79
|
import { MobileDatePicker as MobileDatePicker$1 } from '@mui/x-date-pickers/MobileDatePicker';
|
|
80
80
|
import { LocalizationProvider as LocalizationProvider$1 } from '@mui/x-date-pickers/LocalizationProvider';
|
|
81
81
|
import 'filepond-plugin-get-file/dist/filepond-plugin-get-file.css';
|
|
@@ -85,6 +85,7 @@ import FilePondPluginImagePreview from 'filepond-plugin-image-preview';
|
|
|
85
85
|
import { registerPlugin, FilePond } from 'react-filepond';
|
|
86
86
|
import FilePondPluginGetFile from 'filepond-plugin-get-file';
|
|
87
87
|
import MaskedInput from 'react-text-mask';
|
|
88
|
+
import StylesProvider from '@mui/styles/StylesProvider';
|
|
88
89
|
|
|
89
90
|
function _extends() {
|
|
90
91
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -617,7 +618,7 @@ ActionMenu.propTypes = {
|
|
|
617
618
|
data: PropTypes.any.isRequired
|
|
618
619
|
};
|
|
619
620
|
|
|
620
|
-
// Copyright (c)
|
|
621
|
+
// Copyright (c) 2023 HelioCampus Inc., all rights reserved.
|
|
621
622
|
const RenderIconButton = props => {
|
|
622
623
|
return props.disabled ? /*#__PURE__*/jsx(IconButton$1, {
|
|
623
624
|
"aria-label": props.name,
|
|
@@ -1123,12 +1124,6 @@ const useStyles$H = makeStyles$1(theme => ({
|
|
|
1123
1124
|
color: "#ffffff"
|
|
1124
1125
|
}
|
|
1125
1126
|
}));
|
|
1126
|
-
({
|
|
1127
|
-
success: /*#__PURE__*/jsx(Check, {}),
|
|
1128
|
-
info: /*#__PURE__*/jsx(InfoOutlined, {}),
|
|
1129
|
-
warning: /*#__PURE__*/jsx(WarningOutlined, {}),
|
|
1130
|
-
error: /*#__PURE__*/jsx(ErrorOutlined, {})
|
|
1131
|
-
});
|
|
1132
1127
|
|
|
1133
1128
|
/** Simple component to display a box with or without an avatar along with title and subtitle text. */
|
|
1134
1129
|
|
|
@@ -1680,12 +1675,12 @@ const LegacyButtonTheme = createTheme(theme, {
|
|
|
1680
1675
|
}
|
|
1681
1676
|
});
|
|
1682
1677
|
|
|
1683
|
-
const _excluded$
|
|
1678
|
+
const _excluded$k = ["name"];
|
|
1684
1679
|
const Button = /*#__PURE__*/forwardRef(function Button(_ref, ref) {
|
|
1685
1680
|
let {
|
|
1686
1681
|
name
|
|
1687
1682
|
} = _ref,
|
|
1688
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1683
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
|
|
1689
1684
|
const isColorDefault = props.color === undefined || props.color === "default";
|
|
1690
1685
|
const colorThemeName = isColorDefault ? "grey" : props.color;
|
|
1691
1686
|
const theme = useTheme$1();
|
|
@@ -1778,7 +1773,7 @@ AnimatedExpandMoreIcon.propTypes = {
|
|
|
1778
1773
|
sx: PropTypes.any
|
|
1779
1774
|
};
|
|
1780
1775
|
|
|
1781
|
-
const _excluded$
|
|
1776
|
+
const _excluded$j = ["name", "icon", "menuConfiguration", "color", "displayType", "variant", "onClick", "link"];
|
|
1782
1777
|
const AefisButton = withStyles$1({
|
|
1783
1778
|
root: {
|
|
1784
1779
|
"&:focus": {
|
|
@@ -1800,7 +1795,7 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, ref) {
|
|
|
1800
1795
|
onClick,
|
|
1801
1796
|
link
|
|
1802
1797
|
} = _ref,
|
|
1803
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
1798
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
|
|
1804
1799
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
1805
1800
|
const handleClick = (event, link, buttonId) => {
|
|
1806
1801
|
setAnchorEl(event.currentTarget);
|
|
@@ -2248,7 +2243,6 @@ const Chip = ({
|
|
|
2248
2243
|
icon,
|
|
2249
2244
|
label,
|
|
2250
2245
|
displayType,
|
|
2251
|
-
tooltipText,
|
|
2252
2246
|
deleteIcon,
|
|
2253
2247
|
onDelete,
|
|
2254
2248
|
canDelete,
|
|
@@ -3428,7 +3422,7 @@ CardSectionTitle$1.propTypes = {
|
|
|
3428
3422
|
title: PropTypes.string
|
|
3429
3423
|
};
|
|
3430
3424
|
|
|
3431
|
-
const _excluded$
|
|
3425
|
+
const _excluded$i = ["title", "children", "height", "titleComponent"];
|
|
3432
3426
|
const CardSection$1 = _ref => {
|
|
3433
3427
|
let {
|
|
3434
3428
|
title,
|
|
@@ -3436,7 +3430,7 @@ const CardSection$1 = _ref => {
|
|
|
3436
3430
|
height,
|
|
3437
3431
|
titleComponent
|
|
3438
3432
|
} = _ref,
|
|
3439
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3433
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
|
3440
3434
|
return /*#__PURE__*/jsxs(Box$1, _extends({
|
|
3441
3435
|
sx: {
|
|
3442
3436
|
height: height || "inherit"
|
|
@@ -3536,7 +3530,7 @@ SvgImage.propTypes = {
|
|
|
3536
3530
|
width: PropTypes.any
|
|
3537
3531
|
};
|
|
3538
3532
|
|
|
3539
|
-
const _excluded$
|
|
3533
|
+
const _excluded$h = ["source", "description", "width", "height", "decorative", "showSkeleton", "fallbackImage"],
|
|
3540
3534
|
_excluded2$1 = ["src", "extension"];
|
|
3541
3535
|
const RenderImage = _ref => {
|
|
3542
3536
|
let {
|
|
@@ -3548,7 +3542,7 @@ const RenderImage = _ref => {
|
|
|
3548
3542
|
showSkeleton,
|
|
3549
3543
|
fallbackImage
|
|
3550
3544
|
} = _ref,
|
|
3551
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3545
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded$h);
|
|
3552
3546
|
const altText = decorative ? "" : description;
|
|
3553
3547
|
const role = decorative ? "presentation" : "img";
|
|
3554
3548
|
const hidden = !!decorative;
|
|
@@ -3626,7 +3620,7 @@ Image.propTypes = {
|
|
|
3626
3620
|
extension: PropTypes.string
|
|
3627
3621
|
};
|
|
3628
3622
|
|
|
3629
|
-
const _excluded$
|
|
3623
|
+
const _excluded$g = ["type"];
|
|
3630
3624
|
const imageProps = {
|
|
3631
3625
|
award: Award,
|
|
3632
3626
|
building: Building,
|
|
@@ -3652,7 +3646,7 @@ const IsometricImage = _ref => {
|
|
|
3652
3646
|
let {
|
|
3653
3647
|
type
|
|
3654
3648
|
} = _ref,
|
|
3655
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3649
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
|
3656
3650
|
const image = getIsometricImage(type);
|
|
3657
3651
|
return /*#__PURE__*/jsx(Image, _extends({
|
|
3658
3652
|
src: image
|
|
@@ -4416,13 +4410,13 @@ BusinessObjectCard.propTypes = {
|
|
|
4416
4410
|
autoTruncateDescription: PropTypes.bool
|
|
4417
4411
|
};
|
|
4418
4412
|
|
|
4419
|
-
const _excluded$
|
|
4413
|
+
const _excluded$f = ["enableScrollTop", "containerProps"];
|
|
4420
4414
|
const SwipeableViews = _ref => {
|
|
4421
4415
|
let {
|
|
4422
4416
|
enableScrollTop = true,
|
|
4423
4417
|
containerProps = {}
|
|
4424
4418
|
} = _ref,
|
|
4425
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4419
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
|
|
4426
4420
|
const containerRef = containerProps.ref || useRef();
|
|
4427
4421
|
useEffect(() => {
|
|
4428
4422
|
if (enableScrollTop) {
|
|
@@ -5060,7 +5054,7 @@ SectionTitle.propTypes = {
|
|
|
5060
5054
|
component: PropTypes.string
|
|
5061
5055
|
};
|
|
5062
5056
|
|
|
5063
|
-
const _excluded$
|
|
5057
|
+
const _excluded$e = ["title", "subtitle", "children", "display", "format", "renderList", "titleComponent"];
|
|
5064
5058
|
const Section = _ref => {
|
|
5065
5059
|
let {
|
|
5066
5060
|
title,
|
|
@@ -5071,7 +5065,7 @@ const Section = _ref => {
|
|
|
5071
5065
|
renderList,
|
|
5072
5066
|
titleComponent
|
|
5073
5067
|
} = _ref,
|
|
5074
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5068
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
5075
5069
|
const containerStyle = {
|
|
5076
5070
|
boxSizing: "border-box",
|
|
5077
5071
|
width: "100%",
|
|
@@ -5707,7 +5701,7 @@ FullPageViewer.propTypes = {
|
|
|
5707
5701
|
onMessage: PropTypes.func
|
|
5708
5702
|
};
|
|
5709
5703
|
|
|
5710
|
-
const _excluded$
|
|
5704
|
+
const _excluded$d = ["height", "children", "onScroll", "showTopFade", "showBottomFade", "component", "onScrollReachStart", "onScrollReachEnd"];
|
|
5711
5705
|
const useStyles$w = makeStyles(() => ({
|
|
5712
5706
|
scroller: {
|
|
5713
5707
|
position: "relative",
|
|
@@ -5780,7 +5774,7 @@ const ScrollingContainer = _ref => {
|
|
|
5780
5774
|
onScrollReachStart,
|
|
5781
5775
|
onScrollReachEnd
|
|
5782
5776
|
} = _ref,
|
|
5783
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
5777
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
5784
5778
|
const classes = useStyles$w();
|
|
5785
5779
|
const [scrolled, setScrolled] = useState(false);
|
|
5786
5780
|
const rootStyle = {
|
|
@@ -7536,7 +7530,7 @@ var dataSourceManager = {
|
|
|
7536
7530
|
getDataSourceUrl: getDataSourceUrl
|
|
7537
7531
|
};
|
|
7538
7532
|
|
|
7539
|
-
const _excluded$
|
|
7533
|
+
const _excluded$c = ["clearOnChange", "minimumLength"];
|
|
7540
7534
|
const WAIT_INTERVAL = 1000;
|
|
7541
7535
|
const ENTER_KEY = 13;
|
|
7542
7536
|
const TextSearch$1 = _ref => {
|
|
@@ -7544,7 +7538,7 @@ const TextSearch$1 = _ref => {
|
|
|
7544
7538
|
clearOnChange,
|
|
7545
7539
|
minimumLength
|
|
7546
7540
|
} = _ref,
|
|
7547
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
7541
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
7548
7542
|
const [value, setValue] = useState("");
|
|
7549
7543
|
const [timer, setTimer] = useState(null);
|
|
7550
7544
|
const handleChange = e => {
|
|
@@ -7736,7 +7730,7 @@ const mapFilters = newFilters => {
|
|
|
7736
7730
|
return mappedFilters;
|
|
7737
7731
|
};
|
|
7738
7732
|
|
|
7739
|
-
const _excluded$
|
|
7733
|
+
const _excluded$b = ["parentMenuOpen", "label", "rightIcon", "leftIcon", "children", "className", "tabIndex", "ContainerProps"];
|
|
7740
7734
|
const useMenuItemStyles = makeStyles(theme => ({
|
|
7741
7735
|
root: props => ({
|
|
7742
7736
|
backgroundColor: props.open ? theme.palette.action.hover : "rgba(0,0,0,0)"
|
|
@@ -7757,7 +7751,7 @@ const NestedMenuItem = /*#__PURE__*/React.forwardRef(function NestedMenuItem(pro
|
|
|
7757
7751
|
tabIndex: tabIndexProp,
|
|
7758
7752
|
ContainerProps: ContainerPropsProp = {}
|
|
7759
7753
|
} = props,
|
|
7760
|
-
MenuItemProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
7754
|
+
MenuItemProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
7761
7755
|
const {
|
|
7762
7756
|
ref: containerRefProp
|
|
7763
7757
|
} = ContainerPropsProp,
|
|
@@ -9033,12 +9027,12 @@ Actions.propTypes = {
|
|
|
9033
9027
|
onAction: PropTypes.func
|
|
9034
9028
|
};
|
|
9035
9029
|
|
|
9036
|
-
const _excluded$
|
|
9030
|
+
const _excluded$a = ["hasFilters"];
|
|
9037
9031
|
const RenderFilterButton = /*#__PURE__*/React.forwardRef(function RenderFilterButton(_ref, ref) {
|
|
9038
9032
|
let {
|
|
9039
9033
|
hasFilters
|
|
9040
9034
|
} = _ref,
|
|
9041
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
9035
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
|
9042
9036
|
return /*#__PURE__*/jsx(IconButton$1, _extends({}, props, {
|
|
9043
9037
|
ref: ref,
|
|
9044
9038
|
children: /*#__PURE__*/jsx(Badge, {
|
|
@@ -9131,7 +9125,7 @@ DefaultIconButton.propTypes = {
|
|
|
9131
9125
|
onClick: PropTypes.func
|
|
9132
9126
|
};
|
|
9133
9127
|
|
|
9134
|
-
const _excluded$
|
|
9128
|
+
const _excluded$9 = ["filterSet", "onClick", "disableSetDefault", "index"];
|
|
9135
9129
|
const useStyles$m = makeStyles(theme => ({
|
|
9136
9130
|
operations: {
|
|
9137
9131
|
display: "flex",
|
|
@@ -9203,7 +9197,7 @@ const Item$1 = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
9203
9197
|
disableSetDefault,
|
|
9204
9198
|
index
|
|
9205
9199
|
} = _ref,
|
|
9206
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
9200
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
9207
9201
|
const {
|
|
9208
9202
|
id,
|
|
9209
9203
|
disabled,
|
|
@@ -9259,7 +9253,7 @@ const renderUserDefinedFilters = ({
|
|
|
9259
9253
|
index: index
|
|
9260
9254
|
}, `user-defined-filters-${index}`));
|
|
9261
9255
|
|
|
9262
|
-
const _excluded$
|
|
9256
|
+
const _excluded$8 = ["filterSet", "onClick", "disableSetDefault", "index"];
|
|
9263
9257
|
const useStyles$l = makeStyles(() => ({
|
|
9264
9258
|
operations: {
|
|
9265
9259
|
display: "flex",
|
|
@@ -9301,7 +9295,7 @@ const Item = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
9301
9295
|
disableSetDefault,
|
|
9302
9296
|
index
|
|
9303
9297
|
} = _ref,
|
|
9304
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
9298
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
9305
9299
|
const {
|
|
9306
9300
|
id,
|
|
9307
9301
|
disabled,
|
|
@@ -10453,7 +10447,7 @@ const getInfoTextByFilterAndSortingCount = (filterCount, sortCount) => {
|
|
|
10453
10447
|
return `${appliedText} applied to the data`;
|
|
10454
10448
|
};
|
|
10455
10449
|
|
|
10456
|
-
const _excluded$
|
|
10450
|
+
const _excluded$7 = ["status", "data", "isFetching", "fetchNextPage", "hasNextPage", "refetch"];
|
|
10457
10451
|
const useDidMount = () => {
|
|
10458
10452
|
const didMountRef = useRef(false);
|
|
10459
10453
|
useEffect(() => {
|
|
@@ -10568,7 +10562,7 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
|
|
|
10568
10562
|
hasNextPage,
|
|
10569
10563
|
refetch
|
|
10570
10564
|
} = _useDataSourceInfinit;
|
|
10571
|
-
_objectWithoutPropertiesLoose(_useDataSourceInfinit, _excluded$
|
|
10565
|
+
_objectWithoutPropertiesLoose(_useDataSourceInfinit, _excluded$7);
|
|
10572
10566
|
const isError = useIsError(status);
|
|
10573
10567
|
const renderReTryButton = useCallback(status => /*#__PURE__*/jsx(Button, {
|
|
10574
10568
|
onClick: () => refetch(),
|
|
@@ -10941,7 +10935,7 @@ const {
|
|
|
10941
10935
|
withEvent: withBOPEvent
|
|
10942
10936
|
} = createComponentEvent();
|
|
10943
10937
|
|
|
10944
|
-
const _excluded$
|
|
10938
|
+
const _excluded$6 = ["onSubmit", "value", "columns", "filterPanelConfig", "multiple", "dataSource", "confirmButtonText"];
|
|
10945
10939
|
const useDialogOpenEventListener$1 = cb => useBOPEventlistener(event => {
|
|
10946
10940
|
if (event.name === events.OPEN_ENHANCED_SEARCH_DIALOG) cb(event.payload);
|
|
10947
10941
|
});
|
|
@@ -10955,7 +10949,7 @@ const EnhancedSearchDialog = _ref => {
|
|
|
10955
10949
|
dataSource,
|
|
10956
10950
|
confirmButtonText
|
|
10957
10951
|
} = _ref,
|
|
10958
|
-
rest = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
10952
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
10959
10953
|
const [selection, setSelection] = useState([]);
|
|
10960
10954
|
const [open, setOpen] = useState(false);
|
|
10961
10955
|
useDialogOpenEventListener$1(isOpen => setOpen(isOpen));
|
|
@@ -11072,7 +11066,7 @@ const useDependencyChange = (callback, currentState) => {
|
|
|
11072
11066
|
}
|
|
11073
11067
|
};
|
|
11074
11068
|
|
|
11075
|
-
const _excluded$
|
|
11069
|
+
const _excluded$5 = ["visibleValues", "multiple", "dataSource", "optionTemplate", "getOptionLabel", "renderTags", "renderOption", "freeSolo", "newItemTemplate", "loadOnOpen", "openOnFocus", "enhancedSearch", "disableCloseOnSelect", "listSelect", "onAdd", "pageSize", "groupName", "idTemplate", "group", "shouldResetOnParametersChange", "queryParamNames", "enableInfinteScroll", "renderAddItemForm", "AddItemFormModalComponent", "autoCompleteProps"];
|
|
11076
11070
|
const useStyles$f = makeStyles(theme => ({
|
|
11077
11071
|
menu: {
|
|
11078
11072
|
textDecoration: "none",
|
|
@@ -11135,7 +11129,7 @@ const BusinessObjectPicker = _ref => {
|
|
|
11135
11129
|
AddItemFormModalComponent,
|
|
11136
11130
|
autoCompleteProps = {}
|
|
11137
11131
|
} = _ref,
|
|
11138
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
11132
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
11139
11133
|
const classes = useStyles$f();
|
|
11140
11134
|
// TODO: implement controlled behaviour
|
|
11141
11135
|
const [value, setValue] = useAutoCompleteValue(props.value, multiple);
|
|
@@ -12521,7 +12515,7 @@ CurriculumChart.propTypes = {
|
|
|
12521
12515
|
onLoad: PropTypes.func
|
|
12522
12516
|
};
|
|
12523
12517
|
|
|
12524
|
-
const _excluded$
|
|
12518
|
+
const _excluded$4 = ["error", "inputFormat", "value", "isControlled", "onChange", "clearable", "disabled", "required", "showButton", "minimumDate", "maximumDate", "inputEndAdornmentText"];
|
|
12525
12519
|
const MuiDatePicker = props => {
|
|
12526
12520
|
const isMobile = useMediaQuery$1(theme => theme.breakpoints.down("md"));
|
|
12527
12521
|
if (props.type) {
|
|
@@ -12561,7 +12555,7 @@ const DatePickerBase = _ref => {
|
|
|
12561
12555
|
maximumDate,
|
|
12562
12556
|
inputEndAdornmentText
|
|
12563
12557
|
} = _ref,
|
|
12564
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
12558
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
12565
12559
|
const [value, setValue] = useFormItemState(propsValue, isControlled);
|
|
12566
12560
|
const handleChange = newValue => {
|
|
12567
12561
|
!isControlled && setValue(newValue);
|
|
@@ -15801,8 +15795,8 @@ ToggleButtonWidget.propTypes = {
|
|
|
15801
15795
|
label: PropTypes.any
|
|
15802
15796
|
};
|
|
15803
15797
|
ToggleButtonWidget.defaultProps = {};
|
|
15804
|
-
const HOCs$
|
|
15805
|
-
var ToggleButtonWidget$1 = compose(HOCs$
|
|
15798
|
+
const HOCs$e = [...commonWidgetHOCs];
|
|
15799
|
+
var ToggleButtonWidget$1 = compose(HOCs$e)(ToggleButtonWidget);
|
|
15806
15800
|
|
|
15807
15801
|
const DefaultReadOnly = props => {
|
|
15808
15802
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -15854,7 +15848,7 @@ const withReadyOnly = (ReadOnlyComponent = DefaultReadOnly, options = {
|
|
|
15854
15848
|
};
|
|
15855
15849
|
};
|
|
15856
15850
|
|
|
15857
|
-
const _excluded$
|
|
15851
|
+
const _excluded$3 = ["value", "inputValue", "onChange", "options", "defaultValue", "onCreateOption", "onDebouncedInputChange", "loading", "status", "optionKey", "createOptionItem", "loadingCreateOption", "onOpen", "createOptionStatus", "disableArrowIcon", "searchCharacterLimit"];
|
|
15858
15852
|
const useStyles$2 = makeStyles(theme => ({
|
|
15859
15853
|
expand: {
|
|
15860
15854
|
transform: "rotate(180deg)",
|
|
@@ -15914,7 +15908,7 @@ const AutoCompleteBase = /*#__PURE__*/forwardRef(function AutoCompleteBase(props
|
|
|
15914
15908
|
disableArrowIcon,
|
|
15915
15909
|
searchCharacterLimit = 0
|
|
15916
15910
|
} = props,
|
|
15917
|
-
restOfProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
15911
|
+
restOfProps = _objectWithoutPropertiesLoose(props, _excluded$3);
|
|
15918
15912
|
const classes = useStyles$2();
|
|
15919
15913
|
const [value, setValue] = useState(defaultValue || valueProp || []);
|
|
15920
15914
|
const [inputValue, setInputValue] = useState(inputValueProp);
|
|
@@ -16360,8 +16354,8 @@ BadgeKeywordField.propTypes = {
|
|
|
16360
16354
|
isReadOnly: PropTypes.bool,
|
|
16361
16355
|
disabled: PropTypes.bool
|
|
16362
16356
|
};
|
|
16363
|
-
const HOCs$
|
|
16364
|
-
var BadgeKeywordField$1 = compose(HOCs$
|
|
16357
|
+
const HOCs$d = [...commonFieldHOCs, withReadyOnly(BadgeKeywordFieldReadOnly)];
|
|
16358
|
+
var BadgeKeywordField$1 = compose(HOCs$d)(BadgeKeywordField);
|
|
16365
16359
|
|
|
16366
16360
|
const ReadOnlyView = ({
|
|
16367
16361
|
label,
|
|
@@ -16561,10 +16555,10 @@ BusinessObjectPickerField.propTypes = {
|
|
|
16561
16555
|
onChange: PropTypes.func
|
|
16562
16556
|
};
|
|
16563
16557
|
BusinessObjectPickerField.defaultProps = {};
|
|
16564
|
-
const HOCs$
|
|
16565
|
-
var BusinessObjectPickerField$1 = compose(HOCs$
|
|
16558
|
+
const HOCs$c = [...commonFieldHOCs, withReadyOnly(BusinessObjectPickerFieldReadOnly)];
|
|
16559
|
+
var BusinessObjectPickerField$1 = compose(HOCs$c)(BusinessObjectPickerField);
|
|
16566
16560
|
|
|
16567
|
-
const _excluded$
|
|
16561
|
+
const _excluded$2 = ["minimumDate", "maximumDate"],
|
|
16568
16562
|
_excluded2 = ["minimumDate", "maximumDate"];
|
|
16569
16563
|
const getDate$1 = dateStr => {
|
|
16570
16564
|
try {
|
|
@@ -16660,7 +16654,7 @@ const DateRangeField = ({
|
|
|
16660
16654
|
minimumDate: startDateMinDate,
|
|
16661
16655
|
maximumDate: startDateMaxDate
|
|
16662
16656
|
} = _ref,
|
|
16663
|
-
startDateProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
16657
|
+
startDateProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
16664
16658
|
const _ref2 = (uiSchema == null ? void 0 : uiSchema["ui:endDateProps"]) || {},
|
|
16665
16659
|
{
|
|
16666
16660
|
minimumDate: endDateMinDate,
|
|
@@ -16710,8 +16704,8 @@ DateRangeField.propTypes = {
|
|
|
16710
16704
|
required: PropTypes.bool,
|
|
16711
16705
|
value: PropTypes.any
|
|
16712
16706
|
};
|
|
16713
|
-
const HOCs$
|
|
16714
|
-
var DateRangeField$1 = compose(HOCs$
|
|
16707
|
+
const HOCs$b = [...commonFieldHOCs, withReadyOnly(DateSelectReadOnly$2)];
|
|
16708
|
+
var DateRangeField$1 = compose(HOCs$b)(DateRangeField);
|
|
16715
16709
|
|
|
16716
16710
|
const useReadOnly = uiSchema => {
|
|
16717
16711
|
const code = uiSchema == null ? void 0 : uiSchema["eval:readonly"];
|
|
@@ -16834,9 +16828,9 @@ const DateSelect = props => {
|
|
|
16834
16828
|
if (newDateType != null) {
|
|
16835
16829
|
setDateType(newDateType);
|
|
16836
16830
|
if (typeof selectedDate !== "undefined" && selectedDate != null) {
|
|
16837
|
-
format(selectedDate, serverSideDateFormat);
|
|
16831
|
+
format$1(selectedDate, serverSideDateFormat);
|
|
16838
16832
|
onChange({
|
|
16839
|
-
date: format(selectedDate, serverSideDateFormat),
|
|
16833
|
+
date: format$1(selectedDate, serverSideDateFormat),
|
|
16840
16834
|
type: newDateType.type
|
|
16841
16835
|
});
|
|
16842
16836
|
}
|
|
@@ -16852,7 +16846,7 @@ const DateSelect = props => {
|
|
|
16852
16846
|
}
|
|
16853
16847
|
setSelectedDate(newDate);
|
|
16854
16848
|
onChange({
|
|
16855
|
-
date: format(newDate, serverSideDateFormat),
|
|
16849
|
+
date: format$1(newDate, serverSideDateFormat),
|
|
16856
16850
|
type: dateType.type
|
|
16857
16851
|
});
|
|
16858
16852
|
} else {
|
|
@@ -17173,8 +17167,8 @@ Upload.propTypes = {
|
|
|
17173
17167
|
acceptedFileTypes: PropTypes.array
|
|
17174
17168
|
};
|
|
17175
17169
|
|
|
17176
|
-
const HOCs$
|
|
17177
|
-
var UploadField = compose(HOCs$
|
|
17170
|
+
const HOCs$a = [...commonFieldHOCs];
|
|
17171
|
+
var UploadField = compose(HOCs$a)(Upload);
|
|
17178
17172
|
|
|
17179
17173
|
const renderUserIcon = userType => {
|
|
17180
17174
|
let iconButton;
|
|
@@ -17530,8 +17524,8 @@ const LinkUserFieldReadOnly = props => {
|
|
|
17530
17524
|
})]
|
|
17531
17525
|
});
|
|
17532
17526
|
};
|
|
17533
|
-
const HOCs$
|
|
17534
|
-
var LinkUserField$1 = compose(HOCs$
|
|
17527
|
+
const HOCs$9 = [...commonFieldHOCs, withReadyOnly(LinkUserFieldReadOnly)];
|
|
17528
|
+
var LinkUserField$1 = compose(HOCs$9)(LinkUserField);
|
|
17535
17529
|
|
|
17536
17530
|
const withEvalDisable = () => Component => {
|
|
17537
17531
|
const MemoizedComponent = /*#__PURE__*/React.memo(Component);
|
|
@@ -17850,8 +17844,8 @@ SelectField.propTypes = {
|
|
|
17850
17844
|
value: PropTypes.any,
|
|
17851
17845
|
disabled: PropTypes.any
|
|
17852
17846
|
};
|
|
17853
|
-
const HOCs$
|
|
17854
|
-
var SelectField$1 = compose(HOCs$
|
|
17847
|
+
const HOCs$8 = [...commonWidgetHOCs, withEvalDisable()];
|
|
17848
|
+
var SelectField$1 = compose(HOCs$8)(SelectField);
|
|
17855
17849
|
|
|
17856
17850
|
// TODO: refactor usage of readonly
|
|
17857
17851
|
// use the similar usage on each implementation
|
|
@@ -18072,8 +18066,8 @@ ArrayTemplateWithReadOnly.propTypes = {
|
|
|
18072
18066
|
items: PropTypes.any,
|
|
18073
18067
|
schema: PropTypes.any
|
|
18074
18068
|
};
|
|
18075
|
-
const HOCs$
|
|
18076
|
-
var ArrayFieldTemplate$1 = compose(HOCs$
|
|
18069
|
+
const HOCs$7 = [withReadyOnly(ArrayTemplateWithReadOnly)];
|
|
18070
|
+
var ArrayFieldTemplate$1 = compose(HOCs$7)(ArrayFieldTemplate);
|
|
18077
18071
|
|
|
18078
18072
|
// export default withReadyOnly(ArrayFieldTemplate, ArrayTemplateWithReadOnly);
|
|
18079
18073
|
|
|
@@ -18243,8 +18237,8 @@ DateWidgetRaw.propTypes = {
|
|
|
18243
18237
|
required: PropTypes.bool,
|
|
18244
18238
|
value: PropTypes.any
|
|
18245
18239
|
};
|
|
18246
|
-
const HOCs$
|
|
18247
|
-
const DateWidget = compose(HOCs$
|
|
18240
|
+
const HOCs$6 = [...commonWidgetHOCs, withReadyOnly(DateSelectReadOnly)];
|
|
18241
|
+
const DateWidget = compose(HOCs$6)(DateWidgetRaw);
|
|
18248
18242
|
|
|
18249
18243
|
const getError$1 = errors => {
|
|
18250
18244
|
if (errors) {
|
|
@@ -18261,9 +18255,9 @@ const getError$1 = errors => {
|
|
|
18261
18255
|
return null;
|
|
18262
18256
|
};
|
|
18263
18257
|
|
|
18264
|
-
const _excluded = ["inputRef"];
|
|
18258
|
+
const _excluded$1 = ["inputRef"];
|
|
18265
18259
|
const TextMaskCustom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
18266
|
-
const other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
18260
|
+
const other = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
18267
18261
|
const placeholderChar = "\u2000";
|
|
18268
18262
|
const pipe = (conformedValue, config) => {
|
|
18269
18263
|
var indexes = [1, 2, 3, 6, 7, 8, 10, 11, 12, 13];
|
|
@@ -18368,8 +18362,1176 @@ const PhoneWidgetReadOnly = props => {
|
|
|
18368
18362
|
})]
|
|
18369
18363
|
});
|
|
18370
18364
|
};
|
|
18371
|
-
const HOCs$
|
|
18372
|
-
var PhoneWidget$1 = compose(HOCs$
|
|
18365
|
+
const HOCs$5 = [...commonWidgetHOCs, withReadyOnly(PhoneWidgetReadOnly)];
|
|
18366
|
+
var PhoneWidget$1 = compose(HOCs$5)(PhoneWidget);
|
|
18367
|
+
|
|
18368
|
+
/**
|
|
18369
|
+
* react-number-format - 5.1.3
|
|
18370
|
+
* Author : Sudhanshu Yadav
|
|
18371
|
+
* Copyright (c) 2016, 2023 to Sudhanshu Yadav, released under the MIT license.
|
|
18372
|
+
* https://github.com/s-yadav/react-number-format
|
|
18373
|
+
*/
|
|
18374
|
+
|
|
18375
|
+
/******************************************************************************
|
|
18376
|
+
Copyright (c) Microsoft Corporation.
|
|
18377
|
+
|
|
18378
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
18379
|
+
purpose with or without fee is hereby granted.
|
|
18380
|
+
|
|
18381
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
18382
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
18383
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18384
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18385
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18386
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18387
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
18388
|
+
***************************************************************************** */
|
|
18389
|
+
|
|
18390
|
+
function __rest(s, e) {
|
|
18391
|
+
var t = {};
|
|
18392
|
+
for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
18393
|
+
{ t[p] = s[p]; } }
|
|
18394
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18395
|
+
{ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18396
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18397
|
+
{ t[p[i]] = s[p[i]]; }
|
|
18398
|
+
} }
|
|
18399
|
+
return t;
|
|
18400
|
+
}
|
|
18401
|
+
|
|
18402
|
+
var SourceType;
|
|
18403
|
+
(function (SourceType) {
|
|
18404
|
+
SourceType["event"] = "event";
|
|
18405
|
+
SourceType["props"] = "prop";
|
|
18406
|
+
})(SourceType || (SourceType = {}));
|
|
18407
|
+
|
|
18408
|
+
// basic noop function
|
|
18409
|
+
function noop() { }
|
|
18410
|
+
function charIsNumber(char) {
|
|
18411
|
+
return !!(char || '').match(/\d/);
|
|
18412
|
+
}
|
|
18413
|
+
function isNil(val) {
|
|
18414
|
+
return val === null || val === undefined;
|
|
18415
|
+
}
|
|
18416
|
+
function isNanValue(val) {
|
|
18417
|
+
return typeof val === 'number' && isNaN(val);
|
|
18418
|
+
}
|
|
18419
|
+
function escapeRegExp(str) {
|
|
18420
|
+
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&');
|
|
18421
|
+
}
|
|
18422
|
+
function getThousandsGroupRegex(thousandsGroupStyle) {
|
|
18423
|
+
switch (thousandsGroupStyle) {
|
|
18424
|
+
case 'lakh':
|
|
18425
|
+
return /(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;
|
|
18426
|
+
case 'wan':
|
|
18427
|
+
return /(\d)(?=(\d{4})+(?!\d))/g;
|
|
18428
|
+
case 'thousand':
|
|
18429
|
+
default:
|
|
18430
|
+
return /(\d)(?=(\d{3})+(?!\d))/g;
|
|
18431
|
+
}
|
|
18432
|
+
}
|
|
18433
|
+
function applyThousandSeparator(str, thousandSeparator, thousandsGroupStyle) {
|
|
18434
|
+
var thousandsGroupRegex = getThousandsGroupRegex(thousandsGroupStyle);
|
|
18435
|
+
var index = str.search(/[1-9]/);
|
|
18436
|
+
index = index === -1 ? str.length : index;
|
|
18437
|
+
return (str.substring(0, index) +
|
|
18438
|
+
str.substring(index, str.length).replace(thousandsGroupRegex, '$1' + thousandSeparator));
|
|
18439
|
+
}
|
|
18440
|
+
function usePersistentCallback(cb) {
|
|
18441
|
+
var callbackRef = useRef(cb);
|
|
18442
|
+
// keep the callback ref upto date
|
|
18443
|
+
callbackRef.current = cb;
|
|
18444
|
+
/**
|
|
18445
|
+
* initialize a persistent callback which never changes
|
|
18446
|
+
* through out the component lifecycle
|
|
18447
|
+
*/
|
|
18448
|
+
var persistentCbRef = useRef(function () {
|
|
18449
|
+
var args = [], len = arguments.length;
|
|
18450
|
+
while ( len-- ) args[ len ] = arguments[ len ];
|
|
18451
|
+
|
|
18452
|
+
return callbackRef.current.apply(callbackRef, args);
|
|
18453
|
+
});
|
|
18454
|
+
return persistentCbRef.current;
|
|
18455
|
+
}
|
|
18456
|
+
//spilt a float number into different parts beforeDecimal, afterDecimal, and negation
|
|
18457
|
+
function splitDecimal(numStr, allowNegative) {
|
|
18458
|
+
if ( allowNegative === void 0 ) allowNegative = true;
|
|
18459
|
+
|
|
18460
|
+
var hasNegation = numStr[0] === '-';
|
|
18461
|
+
var addNegation = hasNegation && allowNegative;
|
|
18462
|
+
numStr = numStr.replace('-', '');
|
|
18463
|
+
var parts = numStr.split('.');
|
|
18464
|
+
var beforeDecimal = parts[0];
|
|
18465
|
+
var afterDecimal = parts[1] || '';
|
|
18466
|
+
return {
|
|
18467
|
+
beforeDecimal: beforeDecimal,
|
|
18468
|
+
afterDecimal: afterDecimal,
|
|
18469
|
+
hasNegation: hasNegation,
|
|
18470
|
+
addNegation: addNegation,
|
|
18471
|
+
};
|
|
18472
|
+
}
|
|
18473
|
+
function fixLeadingZero(numStr) {
|
|
18474
|
+
if (!numStr)
|
|
18475
|
+
{ return numStr; }
|
|
18476
|
+
var isNegative = numStr[0] === '-';
|
|
18477
|
+
if (isNegative)
|
|
18478
|
+
{ numStr = numStr.substring(1, numStr.length); }
|
|
18479
|
+
var parts = numStr.split('.');
|
|
18480
|
+
var beforeDecimal = parts[0].replace(/^0+/, '') || '0';
|
|
18481
|
+
var afterDecimal = parts[1] || '';
|
|
18482
|
+
return ("" + (isNegative ? '-' : '') + beforeDecimal + (afterDecimal ? ("." + afterDecimal) : ''));
|
|
18483
|
+
}
|
|
18484
|
+
/**
|
|
18485
|
+
* limit decimal numbers to given scale
|
|
18486
|
+
* Not used .fixedTo because that will break with big numbers
|
|
18487
|
+
*/
|
|
18488
|
+
function limitToScale(numStr, scale, fixedDecimalScale) {
|
|
18489
|
+
var str = '';
|
|
18490
|
+
var filler = fixedDecimalScale ? '0' : '';
|
|
18491
|
+
for (var i = 0; i <= scale - 1; i++) {
|
|
18492
|
+
str += numStr[i] || filler;
|
|
18493
|
+
}
|
|
18494
|
+
return str;
|
|
18495
|
+
}
|
|
18496
|
+
function repeat(str, count) {
|
|
18497
|
+
return Array(count + 1).join(str);
|
|
18498
|
+
}
|
|
18499
|
+
function toNumericString(num) {
|
|
18500
|
+
var _num = num + ''; // typecast number to string
|
|
18501
|
+
// store the sign and remove it from the number.
|
|
18502
|
+
var sign = _num[0] === '-' ? '-' : '';
|
|
18503
|
+
if (sign)
|
|
18504
|
+
{ _num = _num.substring(1); }
|
|
18505
|
+
// split the number into cofficient and exponent
|
|
18506
|
+
var ref = _num.split(/[eE]/g);
|
|
18507
|
+
var coefficient = ref[0];
|
|
18508
|
+
var exponent = ref[1];
|
|
18509
|
+
// covert exponent to number;
|
|
18510
|
+
exponent = Number(exponent);
|
|
18511
|
+
// if there is no exponent part or its 0, return the coffiecient with sign
|
|
18512
|
+
if (!exponent)
|
|
18513
|
+
{ return sign + coefficient; }
|
|
18514
|
+
coefficient = coefficient.replace('.', '');
|
|
18515
|
+
/**
|
|
18516
|
+
* for scientific notation the current decimal index will be after first number (index 0)
|
|
18517
|
+
* So effective decimal index will always be 1 + exponent value
|
|
18518
|
+
*/
|
|
18519
|
+
var decimalIndex = 1 + exponent;
|
|
18520
|
+
var coffiecientLn = coefficient.length;
|
|
18521
|
+
if (decimalIndex < 0) {
|
|
18522
|
+
// if decimal index is less then 0 add preceding 0s
|
|
18523
|
+
// add 1 as join will have
|
|
18524
|
+
coefficient = '0.' + repeat('0', Math.abs(decimalIndex)) + coefficient;
|
|
18525
|
+
}
|
|
18526
|
+
else if (decimalIndex >= coffiecientLn) {
|
|
18527
|
+
// if decimal index is less then 0 add leading 0s
|
|
18528
|
+
coefficient = coefficient + repeat('0', decimalIndex - coffiecientLn);
|
|
18529
|
+
}
|
|
18530
|
+
else {
|
|
18531
|
+
// else add decimal point at proper index
|
|
18532
|
+
coefficient =
|
|
18533
|
+
(coefficient.substring(0, decimalIndex) || '0') + '.' + coefficient.substring(decimalIndex);
|
|
18534
|
+
}
|
|
18535
|
+
return sign + coefficient;
|
|
18536
|
+
}
|
|
18537
|
+
/**
|
|
18538
|
+
* This method is required to round prop value to given scale.
|
|
18539
|
+
* Not used .round or .fixedTo because that will break with big numbers
|
|
18540
|
+
*/
|
|
18541
|
+
function roundToPrecision(numStr, scale, fixedDecimalScale) {
|
|
18542
|
+
//if number is empty don't do anything return empty string
|
|
18543
|
+
if (['', '-'].indexOf(numStr) !== -1)
|
|
18544
|
+
{ return numStr; }
|
|
18545
|
+
var shouldHaveDecimalSeparator = (numStr.indexOf('.') !== -1 || fixedDecimalScale) && scale;
|
|
18546
|
+
var ref = splitDecimal(numStr);
|
|
18547
|
+
var beforeDecimal = ref.beforeDecimal;
|
|
18548
|
+
var afterDecimal = ref.afterDecimal;
|
|
18549
|
+
var hasNegation = ref.hasNegation;
|
|
18550
|
+
var floatValue = parseFloat(("0." + (afterDecimal || '0')));
|
|
18551
|
+
var floatValueStr = afterDecimal.length <= scale ? ("0." + afterDecimal) : floatValue.toFixed(scale);
|
|
18552
|
+
var roundedDecimalParts = floatValueStr.split('.');
|
|
18553
|
+
var intPart = beforeDecimal
|
|
18554
|
+
.split('')
|
|
18555
|
+
.reverse()
|
|
18556
|
+
.reduce(function (roundedStr, current, idx) {
|
|
18557
|
+
if (roundedStr.length > idx) {
|
|
18558
|
+
return ((Number(roundedStr[0]) + Number(current)).toString() +
|
|
18559
|
+
roundedStr.substring(1, roundedStr.length));
|
|
18560
|
+
}
|
|
18561
|
+
return current + roundedStr;
|
|
18562
|
+
}, roundedDecimalParts[0]);
|
|
18563
|
+
var decimalPart = limitToScale(roundedDecimalParts[1] || '', scale, fixedDecimalScale);
|
|
18564
|
+
var negation = hasNegation ? '-' : '';
|
|
18565
|
+
var decimalSeparator = shouldHaveDecimalSeparator ? '.' : '';
|
|
18566
|
+
return ("" + negation + intPart + decimalSeparator + decimalPart);
|
|
18567
|
+
}
|
|
18568
|
+
/** set the caret positon in an input field **/
|
|
18569
|
+
function setCaretPosition(el, caretPos) {
|
|
18570
|
+
el.value = el.value;
|
|
18571
|
+
// ^ this is used to not only get 'focus', but
|
|
18572
|
+
// to make sure we don't have it everything -selected-
|
|
18573
|
+
// (it causes an issue in chrome, and having it doesn't hurt any other browser)
|
|
18574
|
+
if (el !== null) {
|
|
18575
|
+
/* @ts-ignore */
|
|
18576
|
+
if (el.createTextRange) {
|
|
18577
|
+
/* @ts-ignore */
|
|
18578
|
+
var range = el.createTextRange();
|
|
18579
|
+
range.move('character', caretPos);
|
|
18580
|
+
range.select();
|
|
18581
|
+
return true;
|
|
18582
|
+
}
|
|
18583
|
+
// (el.selectionStart === 0 added for Firefox bug)
|
|
18584
|
+
if (el.selectionStart || el.selectionStart === 0) {
|
|
18585
|
+
el.focus();
|
|
18586
|
+
el.setSelectionRange(caretPos, caretPos);
|
|
18587
|
+
return true;
|
|
18588
|
+
}
|
|
18589
|
+
// fail city, fortunately this never happens (as far as I've tested) :)
|
|
18590
|
+
el.focus();
|
|
18591
|
+
return false;
|
|
18592
|
+
}
|
|
18593
|
+
}
|
|
18594
|
+
function findChangeRange(prevValue, newValue) {
|
|
18595
|
+
var i = 0, j = 0;
|
|
18596
|
+
var prevLength = prevValue.length;
|
|
18597
|
+
var newLength = newValue.length;
|
|
18598
|
+
while (prevValue[i] === newValue[i] && i < prevLength)
|
|
18599
|
+
{ i++; }
|
|
18600
|
+
//check what has been changed from last
|
|
18601
|
+
while (prevValue[prevLength - 1 - j] === newValue[newLength - 1 - j] &&
|
|
18602
|
+
newLength - j > i &&
|
|
18603
|
+
prevLength - j > i) {
|
|
18604
|
+
j++;
|
|
18605
|
+
}
|
|
18606
|
+
return {
|
|
18607
|
+
from: { start: i, end: prevLength - j },
|
|
18608
|
+
to: { start: i, end: newLength - j },
|
|
18609
|
+
};
|
|
18610
|
+
}
|
|
18611
|
+
/*
|
|
18612
|
+
Returns a number whose value is limited to the given range
|
|
18613
|
+
*/
|
|
18614
|
+
function clamp(num, min, max) {
|
|
18615
|
+
return Math.min(Math.max(num, min), max);
|
|
18616
|
+
}
|
|
18617
|
+
function geInputCaretPosition(el) {
|
|
18618
|
+
/*Max of selectionStart and selectionEnd is taken for the patch of pixel and other mobile device caret bug*/
|
|
18619
|
+
return Math.max(el.selectionStart, el.selectionEnd);
|
|
18620
|
+
}
|
|
18621
|
+
function addInputMode() {
|
|
18622
|
+
return (typeof navigator !== 'undefined' &&
|
|
18623
|
+
!(navigator.platform && /iPhone|iPod/.test(navigator.platform)));
|
|
18624
|
+
}
|
|
18625
|
+
function getDefaultChangeMeta(value) {
|
|
18626
|
+
return {
|
|
18627
|
+
from: {
|
|
18628
|
+
start: 0,
|
|
18629
|
+
end: 0,
|
|
18630
|
+
},
|
|
18631
|
+
to: {
|
|
18632
|
+
start: 0,
|
|
18633
|
+
end: value.length,
|
|
18634
|
+
},
|
|
18635
|
+
lastValue: '',
|
|
18636
|
+
};
|
|
18637
|
+
}
|
|
18638
|
+
function getCaretPosition(newFormattedValue, lastFormattedValue, curValue, curCaretPos, boundary, isValidInputCharacter) {
|
|
18639
|
+
/**
|
|
18640
|
+
* if something got inserted on empty value, add the formatted character before the current value,
|
|
18641
|
+
* This is to avoid the case where typed character is present on format characters
|
|
18642
|
+
*/
|
|
18643
|
+
var firstAllowedPosition = boundary.findIndex(function (b) { return b; });
|
|
18644
|
+
var prefixFormat = newFormattedValue.slice(0, firstAllowedPosition);
|
|
18645
|
+
if (!lastFormattedValue && !curValue.startsWith(prefixFormat)) {
|
|
18646
|
+
curValue = prefixFormat + curValue;
|
|
18647
|
+
curCaretPos = curCaretPos + prefixFormat.length;
|
|
18648
|
+
}
|
|
18649
|
+
var curValLn = curValue.length;
|
|
18650
|
+
var formattedValueLn = newFormattedValue.length;
|
|
18651
|
+
// create index map
|
|
18652
|
+
var addedIndexMap = {};
|
|
18653
|
+
var indexMap = new Array(curValLn);
|
|
18654
|
+
for (var i = 0; i < curValLn; i++) {
|
|
18655
|
+
indexMap[i] = -1;
|
|
18656
|
+
for (var j = 0, jLn = formattedValueLn; j < jLn; j++) {
|
|
18657
|
+
if (curValue[i] === newFormattedValue[j] && addedIndexMap[j] !== true) {
|
|
18658
|
+
indexMap[i] = j;
|
|
18659
|
+
addedIndexMap[j] = true;
|
|
18660
|
+
break;
|
|
18661
|
+
}
|
|
18662
|
+
}
|
|
18663
|
+
}
|
|
18664
|
+
/**
|
|
18665
|
+
* For current caret position find closest characters (left and right side)
|
|
18666
|
+
* which are properly mapped to formatted value.
|
|
18667
|
+
* The idea is that the new caret position will exist always in the boundary of
|
|
18668
|
+
* that mapped index
|
|
18669
|
+
*/
|
|
18670
|
+
var pos = curCaretPos;
|
|
18671
|
+
while (pos < curValLn && (indexMap[pos] === -1 || !isValidInputCharacter(curValue[pos]))) {
|
|
18672
|
+
pos++;
|
|
18673
|
+
}
|
|
18674
|
+
// if the caret position is on last keep the endIndex as last for formatted value
|
|
18675
|
+
var endIndex = pos === curValLn || indexMap[pos] === -1 ? formattedValueLn : indexMap[pos];
|
|
18676
|
+
pos = curCaretPos - 1;
|
|
18677
|
+
while (pos > 0 && indexMap[pos] === -1)
|
|
18678
|
+
{ pos--; }
|
|
18679
|
+
var startIndex = pos === -1 || indexMap[pos] === -1 ? 0 : indexMap[pos] + 1;
|
|
18680
|
+
/**
|
|
18681
|
+
* case where a char is added on suffix and removed from middle, example 2sq345 becoming $2,345 sq
|
|
18682
|
+
* there is still a mapping but the order of start index and end index is changed
|
|
18683
|
+
*/
|
|
18684
|
+
if (startIndex > endIndex)
|
|
18685
|
+
{ return endIndex; }
|
|
18686
|
+
/**
|
|
18687
|
+
* given the current caret position if it closer to startIndex
|
|
18688
|
+
* keep the new caret position on start index or keep it closer to endIndex
|
|
18689
|
+
*/
|
|
18690
|
+
return curCaretPos - startIndex < endIndex - curCaretPos ? startIndex : endIndex;
|
|
18691
|
+
}
|
|
18692
|
+
/* This keeps the caret within typing area so people can't type in between prefix or suffix or format characters */
|
|
18693
|
+
function getCaretPosInBoundary(value, caretPos, boundary, direction) {
|
|
18694
|
+
var valLn = value.length;
|
|
18695
|
+
// clamp caret position to [0, value.length]
|
|
18696
|
+
caretPos = clamp(caretPos, 0, valLn);
|
|
18697
|
+
if (direction === 'left') {
|
|
18698
|
+
while (caretPos >= 0 && !boundary[caretPos])
|
|
18699
|
+
{ caretPos--; }
|
|
18700
|
+
// if we don't find any suitable caret position on left, set it on first allowed position
|
|
18701
|
+
if (caretPos === -1)
|
|
18702
|
+
{ caretPos = boundary.indexOf(true); }
|
|
18703
|
+
}
|
|
18704
|
+
else {
|
|
18705
|
+
while (caretPos <= valLn && !boundary[caretPos])
|
|
18706
|
+
{ caretPos++; }
|
|
18707
|
+
// if we don't find any suitable caret position on right, set it on last allowed position
|
|
18708
|
+
if (caretPos > valLn)
|
|
18709
|
+
{ caretPos = boundary.lastIndexOf(true); }
|
|
18710
|
+
}
|
|
18711
|
+
// if we still don't find caret position, set it at the end of value
|
|
18712
|
+
if (caretPos === -1)
|
|
18713
|
+
{ caretPos = valLn; }
|
|
18714
|
+
return caretPos;
|
|
18715
|
+
}
|
|
18716
|
+
function caretUnknownFormatBoundary(formattedValue) {
|
|
18717
|
+
var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
|
|
18718
|
+
for (var i = 0, ln = boundaryAry.length; i < ln; i++) {
|
|
18719
|
+
// consider caret to be in boundary if it is before or after numeric value
|
|
18720
|
+
boundaryAry[i] = Boolean(charIsNumber(formattedValue[i]) || charIsNumber(formattedValue[i - 1]));
|
|
18721
|
+
}
|
|
18722
|
+
return boundaryAry;
|
|
18723
|
+
}
|
|
18724
|
+
function useInternalValues(value, defaultValue, valueIsNumericString, format, removeFormatting, onValueChange) {
|
|
18725
|
+
if ( onValueChange === void 0 ) onValueChange = noop;
|
|
18726
|
+
|
|
18727
|
+
var propValues = useRef();
|
|
18728
|
+
var getValues = usePersistentCallback(function (value) {
|
|
18729
|
+
var formattedValue, numAsString;
|
|
18730
|
+
if (isNil(value) || isNanValue(value)) {
|
|
18731
|
+
numAsString = '';
|
|
18732
|
+
formattedValue = '';
|
|
18733
|
+
}
|
|
18734
|
+
else if (typeof value === 'number' || valueIsNumericString) {
|
|
18735
|
+
numAsString = typeof value === 'number' ? toNumericString(value) : value;
|
|
18736
|
+
formattedValue = format(numAsString);
|
|
18737
|
+
}
|
|
18738
|
+
else {
|
|
18739
|
+
numAsString = removeFormatting(value, undefined);
|
|
18740
|
+
formattedValue = value;
|
|
18741
|
+
}
|
|
18742
|
+
return { formattedValue: formattedValue, numAsString: numAsString };
|
|
18743
|
+
});
|
|
18744
|
+
var ref = useState(function () {
|
|
18745
|
+
return getValues(defaultValue);
|
|
18746
|
+
});
|
|
18747
|
+
var values = ref[0];
|
|
18748
|
+
var setValues = ref[1];
|
|
18749
|
+
var _onValueChange = function (values, sourceInfo) {
|
|
18750
|
+
setValues({
|
|
18751
|
+
formattedValue: values.formattedValue,
|
|
18752
|
+
numAsString: values.value,
|
|
18753
|
+
});
|
|
18754
|
+
onValueChange(values, sourceInfo);
|
|
18755
|
+
};
|
|
18756
|
+
useMemo(function () {
|
|
18757
|
+
//if element is moved to uncontrolled mode, don't reset the value
|
|
18758
|
+
if (!isNil(value)) {
|
|
18759
|
+
propValues.current = getValues(value);
|
|
18760
|
+
setValues(propValues.current);
|
|
18761
|
+
}
|
|
18762
|
+
else {
|
|
18763
|
+
propValues.current = undefined;
|
|
18764
|
+
}
|
|
18765
|
+
}, [value, getValues]);
|
|
18766
|
+
return [values, _onValueChange];
|
|
18767
|
+
}
|
|
18768
|
+
|
|
18769
|
+
function defaultRemoveFormatting(value) {
|
|
18770
|
+
return value.replace(/[^0-9]/g, '');
|
|
18771
|
+
}
|
|
18772
|
+
function defaultFormat(value) {
|
|
18773
|
+
return value;
|
|
18774
|
+
}
|
|
18775
|
+
function NumberFormatBase(props) {
|
|
18776
|
+
var type = props.type; if ( type === void 0 ) type = 'text';
|
|
18777
|
+
var displayType = props.displayType; if ( displayType === void 0 ) displayType = 'input';
|
|
18778
|
+
var customInput = props.customInput;
|
|
18779
|
+
var renderText = props.renderText;
|
|
18780
|
+
var getInputRef = props.getInputRef;
|
|
18781
|
+
var format = props.format; if ( format === void 0 ) format = defaultFormat;
|
|
18782
|
+
var removeFormatting = props.removeFormatting; if ( removeFormatting === void 0 ) removeFormatting = defaultRemoveFormatting;
|
|
18783
|
+
var defaultValue = props.defaultValue;
|
|
18784
|
+
var valueIsNumericString = props.valueIsNumericString;
|
|
18785
|
+
var onValueChange = props.onValueChange;
|
|
18786
|
+
var isAllowed = props.isAllowed;
|
|
18787
|
+
var onChange = props.onChange; if ( onChange === void 0 ) onChange = noop;
|
|
18788
|
+
var onKeyDown = props.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = noop;
|
|
18789
|
+
var onMouseUp = props.onMouseUp; if ( onMouseUp === void 0 ) onMouseUp = noop;
|
|
18790
|
+
var onFocus = props.onFocus; if ( onFocus === void 0 ) onFocus = noop;
|
|
18791
|
+
var onBlur = props.onBlur; if ( onBlur === void 0 ) onBlur = noop;
|
|
18792
|
+
var propValue = props.value;
|
|
18793
|
+
var getCaretBoundary = props.getCaretBoundary; if ( getCaretBoundary === void 0 ) getCaretBoundary = caretUnknownFormatBoundary;
|
|
18794
|
+
var isValidInputCharacter = props.isValidInputCharacter; if ( isValidInputCharacter === void 0 ) isValidInputCharacter = charIsNumber;
|
|
18795
|
+
var otherProps = __rest(props, ["type", "displayType", "customInput", "renderText", "getInputRef", "format", "removeFormatting", "defaultValue", "valueIsNumericString", "onValueChange", "isAllowed", "onChange", "onKeyDown", "onMouseUp", "onFocus", "onBlur", "value", "getCaretBoundary", "isValidInputCharacter"]);
|
|
18796
|
+
var ref = useInternalValues(propValue, defaultValue, Boolean(valueIsNumericString), format, removeFormatting, onValueChange);
|
|
18797
|
+
var ref_0 = ref[0];
|
|
18798
|
+
var formattedValue = ref_0.formattedValue;
|
|
18799
|
+
var numAsString = ref_0.numAsString;
|
|
18800
|
+
var onFormattedValueChange = ref[1];
|
|
18801
|
+
var lastUpdatedValue = useRef();
|
|
18802
|
+
var _onValueChange = function (values, source) {
|
|
18803
|
+
lastUpdatedValue.current = values.formattedValue;
|
|
18804
|
+
onFormattedValueChange(values, source);
|
|
18805
|
+
};
|
|
18806
|
+
// check if there is any change in the value due to props change
|
|
18807
|
+
useEffect(function () {
|
|
18808
|
+
var newFormattedValue = format(numAsString);
|
|
18809
|
+
// if the formatted value is not synced to parent, or if the formatted value is different
|
|
18810
|
+
if (lastUpdatedValue.current === undefined || newFormattedValue !== lastUpdatedValue.current) {
|
|
18811
|
+
var input = focusedElm.current;
|
|
18812
|
+
// formatting can remove some of the number chars, so we need to fine number string again
|
|
18813
|
+
var _numAsString = removeFormatting(newFormattedValue, undefined);
|
|
18814
|
+
updateValue({
|
|
18815
|
+
formattedValue: newFormattedValue,
|
|
18816
|
+
numAsString: _numAsString,
|
|
18817
|
+
input: input,
|
|
18818
|
+
setCaretPosition: true,
|
|
18819
|
+
source: SourceType.props,
|
|
18820
|
+
event: undefined,
|
|
18821
|
+
});
|
|
18822
|
+
}
|
|
18823
|
+
});
|
|
18824
|
+
var ref$1 = useState(false);
|
|
18825
|
+
var mounted = ref$1[0];
|
|
18826
|
+
var setMounted = ref$1[1];
|
|
18827
|
+
var focusedElm = useRef(null);
|
|
18828
|
+
var timeout = useRef({
|
|
18829
|
+
setCaretTimeout: null,
|
|
18830
|
+
focusTimeout: null,
|
|
18831
|
+
});
|
|
18832
|
+
useEffect(function () {
|
|
18833
|
+
setMounted(true);
|
|
18834
|
+
return function () {
|
|
18835
|
+
clearTimeout(timeout.current.setCaretTimeout);
|
|
18836
|
+
clearTimeout(timeout.current.focusTimeout);
|
|
18837
|
+
};
|
|
18838
|
+
}, []);
|
|
18839
|
+
var _format = format;
|
|
18840
|
+
var getValueObject = function (formattedValue, numAsString) {
|
|
18841
|
+
var floatValue = parseFloat(numAsString);
|
|
18842
|
+
return {
|
|
18843
|
+
formattedValue: formattedValue,
|
|
18844
|
+
value: numAsString,
|
|
18845
|
+
floatValue: isNaN(floatValue) ? undefined : floatValue,
|
|
18846
|
+
};
|
|
18847
|
+
};
|
|
18848
|
+
var setPatchedCaretPosition = function (el, caretPos, currentValue) {
|
|
18849
|
+
/* setting caret position within timeout of 0ms is required for mobile chrome,
|
|
18850
|
+
otherwise browser resets the caret position after we set it
|
|
18851
|
+
We are also setting it without timeout so that in normal browser we don't see the flickering */
|
|
18852
|
+
setCaretPosition(el, caretPos);
|
|
18853
|
+
timeout.current.setCaretTimeout = setTimeout(function () {
|
|
18854
|
+
if (el.value === currentValue)
|
|
18855
|
+
{ setCaretPosition(el, caretPos); }
|
|
18856
|
+
}, 0);
|
|
18857
|
+
};
|
|
18858
|
+
/* This keeps the caret within typing area so people can't type in between prefix or suffix */
|
|
18859
|
+
var correctCaretPosition = function (value, caretPos, direction) {
|
|
18860
|
+
return getCaretPosInBoundary(value, caretPos, getCaretBoundary(value), direction);
|
|
18861
|
+
};
|
|
18862
|
+
var getNewCaretPosition = function (inputValue, newFormattedValue, caretPos) {
|
|
18863
|
+
var caretBoundary = getCaretBoundary(newFormattedValue);
|
|
18864
|
+
var updatedCaretPos = getCaretPosition(newFormattedValue, formattedValue, inputValue, caretPos, caretBoundary, isValidInputCharacter);
|
|
18865
|
+
//correct caret position if its outside of editable area
|
|
18866
|
+
updatedCaretPos = getCaretPosInBoundary(newFormattedValue, updatedCaretPos, caretBoundary);
|
|
18867
|
+
return updatedCaretPos;
|
|
18868
|
+
};
|
|
18869
|
+
var updateValue = function (params) {
|
|
18870
|
+
var newFormattedValue = params.formattedValue; if ( newFormattedValue === void 0 ) newFormattedValue = '';
|
|
18871
|
+
var input = params.input;
|
|
18872
|
+
var setCaretPosition = params.setCaretPosition; if ( setCaretPosition === void 0 ) setCaretPosition = true;
|
|
18873
|
+
var source = params.source;
|
|
18874
|
+
var event = params.event;
|
|
18875
|
+
var numAsString = params.numAsString;
|
|
18876
|
+
var caretPos = params.caretPos;
|
|
18877
|
+
if (input) {
|
|
18878
|
+
//calculate caret position if not defined
|
|
18879
|
+
if (caretPos === undefined && setCaretPosition) {
|
|
18880
|
+
var inputValue = params.inputValue || input.value;
|
|
18881
|
+
var currentCaretPosition = geInputCaretPosition(input);
|
|
18882
|
+
/**
|
|
18883
|
+
* set the value imperatively, this is required for IE fix
|
|
18884
|
+
* This is also required as if new caret position is beyond the previous value.
|
|
18885
|
+
* Caret position will not be set correctly
|
|
18886
|
+
*/
|
|
18887
|
+
input.value = newFormattedValue;
|
|
18888
|
+
//get the caret position
|
|
18889
|
+
caretPos = getNewCaretPosition(inputValue, newFormattedValue, currentCaretPosition);
|
|
18890
|
+
}
|
|
18891
|
+
/**
|
|
18892
|
+
* set the value imperatively, as we set the caret position as well imperatively.
|
|
18893
|
+
* This is to keep value and caret position in sync
|
|
18894
|
+
*/
|
|
18895
|
+
input.value = newFormattedValue;
|
|
18896
|
+
//set caret position, and value imperatively when element is provided
|
|
18897
|
+
if (setCaretPosition && caretPos !== undefined) {
|
|
18898
|
+
//set caret position
|
|
18899
|
+
setPatchedCaretPosition(input, caretPos, newFormattedValue);
|
|
18900
|
+
}
|
|
18901
|
+
}
|
|
18902
|
+
if (newFormattedValue !== formattedValue) {
|
|
18903
|
+
// trigger onValueChange synchronously, so parent is updated along with the number format. Fix for #277, #287
|
|
18904
|
+
_onValueChange(getValueObject(newFormattedValue, numAsString), { event: event, source: source });
|
|
18905
|
+
}
|
|
18906
|
+
};
|
|
18907
|
+
var formatInputValue = function (inputValue, event, source) {
|
|
18908
|
+
var changeRange = findChangeRange(formattedValue, inputValue);
|
|
18909
|
+
var changeMeta = Object.assign(Object.assign({}, changeRange), { lastValue: formattedValue });
|
|
18910
|
+
var _numAsString = removeFormatting(inputValue, changeMeta);
|
|
18911
|
+
var _formattedValue = _format(_numAsString);
|
|
18912
|
+
// formatting can remove some of the number chars, so we need to fine number string again
|
|
18913
|
+
_numAsString = removeFormatting(_formattedValue, undefined);
|
|
18914
|
+
if (isAllowed && !isAllowed(getValueObject(_formattedValue, _numAsString))) {
|
|
18915
|
+
//reset the caret position
|
|
18916
|
+
var input = event.target;
|
|
18917
|
+
var currentCaretPosition = geInputCaretPosition(input);
|
|
18918
|
+
var caretPos = getNewCaretPosition(inputValue, formattedValue, currentCaretPosition);
|
|
18919
|
+
setPatchedCaretPosition(input, caretPos, formattedValue);
|
|
18920
|
+
return false;
|
|
18921
|
+
}
|
|
18922
|
+
updateValue({
|
|
18923
|
+
formattedValue: _formattedValue,
|
|
18924
|
+
numAsString: _numAsString,
|
|
18925
|
+
inputValue: inputValue,
|
|
18926
|
+
event: event,
|
|
18927
|
+
source: source,
|
|
18928
|
+
setCaretPosition: true,
|
|
18929
|
+
input: event.target,
|
|
18930
|
+
});
|
|
18931
|
+
return true;
|
|
18932
|
+
};
|
|
18933
|
+
var _onChange = function (e) {
|
|
18934
|
+
var el = e.target;
|
|
18935
|
+
var inputValue = el.value;
|
|
18936
|
+
var changed = formatInputValue(inputValue, e, SourceType.event);
|
|
18937
|
+
if (changed)
|
|
18938
|
+
{ onChange(e); }
|
|
18939
|
+
};
|
|
18940
|
+
var _onKeyDown = function (e) {
|
|
18941
|
+
var el = e.target;
|
|
18942
|
+
var key = e.key;
|
|
18943
|
+
var selectionStart = el.selectionStart;
|
|
18944
|
+
var selectionEnd = el.selectionEnd;
|
|
18945
|
+
var value = el.value; if ( value === void 0 ) value = '';
|
|
18946
|
+
var expectedCaretPosition;
|
|
18947
|
+
//Handle backspace and delete against non numerical/decimal characters or arrow keys
|
|
18948
|
+
if (key === 'ArrowLeft' || key === 'Backspace') {
|
|
18949
|
+
expectedCaretPosition = Math.max(selectionStart - 1, 0);
|
|
18950
|
+
}
|
|
18951
|
+
else if (key === 'ArrowRight') {
|
|
18952
|
+
expectedCaretPosition = Math.min(selectionStart + 1, value.length);
|
|
18953
|
+
}
|
|
18954
|
+
else if (key === 'Delete') {
|
|
18955
|
+
expectedCaretPosition = selectionStart;
|
|
18956
|
+
}
|
|
18957
|
+
//if expectedCaretPosition is not set it means we don't want to Handle keyDown
|
|
18958
|
+
// also if multiple characters are selected don't handle
|
|
18959
|
+
if (expectedCaretPosition === undefined || selectionStart !== selectionEnd) {
|
|
18960
|
+
onKeyDown(e);
|
|
18961
|
+
return;
|
|
18962
|
+
}
|
|
18963
|
+
var newCaretPosition = expectedCaretPosition;
|
|
18964
|
+
if (key === 'ArrowLeft' || key === 'ArrowRight') {
|
|
18965
|
+
var direction = key === 'ArrowLeft' ? 'left' : 'right';
|
|
18966
|
+
newCaretPosition = correctCaretPosition(value, expectedCaretPosition, direction);
|
|
18967
|
+
}
|
|
18968
|
+
else if (key === 'Delete' && !isValidInputCharacter(value[expectedCaretPosition])) {
|
|
18969
|
+
// in case of delete go to closest caret boundary on the right side
|
|
18970
|
+
newCaretPosition = correctCaretPosition(value, expectedCaretPosition, 'right');
|
|
18971
|
+
}
|
|
18972
|
+
else if (key === 'Backspace' && !isValidInputCharacter(value[expectedCaretPosition])) {
|
|
18973
|
+
// in case of backspace go to closest caret boundary on the left side
|
|
18974
|
+
newCaretPosition = correctCaretPosition(value, expectedCaretPosition, 'left');
|
|
18975
|
+
}
|
|
18976
|
+
if (newCaretPosition !== expectedCaretPosition) {
|
|
18977
|
+
setPatchedCaretPosition(el, newCaretPosition, value);
|
|
18978
|
+
}
|
|
18979
|
+
/* NOTE: this is just required for unit test as we need to get the newCaretPosition,
|
|
18980
|
+
Remove this when you find different solution */
|
|
18981
|
+
/* @ts-ignore */
|
|
18982
|
+
if (e.isUnitTestRun) {
|
|
18983
|
+
setPatchedCaretPosition(el, newCaretPosition, value);
|
|
18984
|
+
}
|
|
18985
|
+
onKeyDown(e);
|
|
18986
|
+
};
|
|
18987
|
+
/** required to handle the caret position when click anywhere within the input **/
|
|
18988
|
+
var _onMouseUp = function (e) {
|
|
18989
|
+
var el = e.target;
|
|
18990
|
+
/**
|
|
18991
|
+
* NOTE: we have to give default value for value as in case when custom input is provided
|
|
18992
|
+
* value can come as undefined when nothing is provided on value prop.
|
|
18993
|
+
*/
|
|
18994
|
+
var selectionStart = el.selectionStart;
|
|
18995
|
+
var selectionEnd = el.selectionEnd;
|
|
18996
|
+
var value = el.value; if ( value === void 0 ) value = '';
|
|
18997
|
+
if (selectionStart === selectionEnd) {
|
|
18998
|
+
var caretPosition = correctCaretPosition(value, selectionStart);
|
|
18999
|
+
if (caretPosition !== selectionStart) {
|
|
19000
|
+
setPatchedCaretPosition(el, caretPosition, value);
|
|
19001
|
+
}
|
|
19002
|
+
}
|
|
19003
|
+
onMouseUp(e);
|
|
19004
|
+
};
|
|
19005
|
+
var _onFocus = function (e) {
|
|
19006
|
+
// Workaround Chrome and Safari bug https://bugs.chromium.org/p/chromium/issues/detail?id=779328
|
|
19007
|
+
// (onFocus event target selectionStart is always 0 before setTimeout)
|
|
19008
|
+
if (e.persist)
|
|
19009
|
+
{ e.persist(); }
|
|
19010
|
+
var el = e.target;
|
|
19011
|
+
focusedElm.current = el;
|
|
19012
|
+
timeout.current.focusTimeout = setTimeout(function () {
|
|
19013
|
+
var selectionStart = el.selectionStart;
|
|
19014
|
+
var selectionEnd = el.selectionEnd;
|
|
19015
|
+
var value = el.value; if ( value === void 0 ) value = '';
|
|
19016
|
+
var caretPosition = correctCaretPosition(value, selectionStart);
|
|
19017
|
+
//setPatchedCaretPosition only when everything is not selected on focus (while tabbing into the field)
|
|
19018
|
+
if (caretPosition !== selectionStart &&
|
|
19019
|
+
!(selectionStart === 0 && selectionEnd === value.length)) {
|
|
19020
|
+
setPatchedCaretPosition(el, caretPosition, value);
|
|
19021
|
+
}
|
|
19022
|
+
onFocus(e);
|
|
19023
|
+
}, 0);
|
|
19024
|
+
};
|
|
19025
|
+
var _onBlur = function (e) {
|
|
19026
|
+
focusedElm.current = null;
|
|
19027
|
+
clearTimeout(timeout.current.focusTimeout);
|
|
19028
|
+
clearTimeout(timeout.current.setCaretTimeout);
|
|
19029
|
+
onBlur(e);
|
|
19030
|
+
};
|
|
19031
|
+
// add input mode on element based on format prop and device once the component is mounted
|
|
19032
|
+
var inputMode = mounted && addInputMode() ? 'numeric' : undefined;
|
|
19033
|
+
var inputProps = Object.assign({ inputMode: inputMode }, otherProps, {
|
|
19034
|
+
type: type,
|
|
19035
|
+
value: formattedValue,
|
|
19036
|
+
onChange: _onChange,
|
|
19037
|
+
onKeyDown: _onKeyDown,
|
|
19038
|
+
onMouseUp: _onMouseUp,
|
|
19039
|
+
onFocus: _onFocus,
|
|
19040
|
+
onBlur: _onBlur,
|
|
19041
|
+
});
|
|
19042
|
+
if (displayType === 'text') {
|
|
19043
|
+
return renderText ? (React.createElement(React.Fragment, null, renderText(formattedValue, otherProps) || null)) : (React.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue));
|
|
19044
|
+
}
|
|
19045
|
+
else if (customInput) {
|
|
19046
|
+
var CustomInput = customInput;
|
|
19047
|
+
/* @ts-ignore */
|
|
19048
|
+
return React.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
|
|
19049
|
+
}
|
|
19050
|
+
return React.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
|
|
19051
|
+
}
|
|
19052
|
+
|
|
19053
|
+
function format(numStr, props) {
|
|
19054
|
+
var decimalScale = props.decimalScale;
|
|
19055
|
+
var fixedDecimalScale = props.fixedDecimalScale;
|
|
19056
|
+
var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
|
|
19057
|
+
var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
|
|
19058
|
+
var allowNegative = props.allowNegative; if ( allowNegative === void 0 ) allowNegative = true;
|
|
19059
|
+
var thousandsGroupStyle = props.thousandsGroupStyle; if ( thousandsGroupStyle === void 0 ) thousandsGroupStyle = 'thousand';
|
|
19060
|
+
// don't apply formatting on empty string or '-'
|
|
19061
|
+
if (numStr === '' || numStr === '-') {
|
|
19062
|
+
return numStr;
|
|
19063
|
+
}
|
|
19064
|
+
var ref = getSeparators(props);
|
|
19065
|
+
var thousandSeparator = ref.thousandSeparator;
|
|
19066
|
+
var decimalSeparator = ref.decimalSeparator;
|
|
19067
|
+
/**
|
|
19068
|
+
* Keep the decimal separator
|
|
19069
|
+
* when decimalScale is not defined or non zero and the numStr has decimal in it
|
|
19070
|
+
* Or if decimalScale is > 0 and fixeDecimalScale is true (even if numStr has no decimal)
|
|
19071
|
+
*/
|
|
19072
|
+
var hasDecimalSeparator = (decimalScale !== 0 && numStr.indexOf('.') !== -1) || (decimalScale && fixedDecimalScale);
|
|
19073
|
+
var ref$1 = splitDecimal(numStr, allowNegative);
|
|
19074
|
+
var beforeDecimal = ref$1.beforeDecimal;
|
|
19075
|
+
var afterDecimal = ref$1.afterDecimal;
|
|
19076
|
+
var addNegation = ref$1.addNegation; // eslint-disable-line prefer-const
|
|
19077
|
+
//apply decimal precision if its defined
|
|
19078
|
+
if (decimalScale !== undefined) {
|
|
19079
|
+
afterDecimal = limitToScale(afterDecimal, decimalScale, !!fixedDecimalScale);
|
|
19080
|
+
}
|
|
19081
|
+
if (thousandSeparator) {
|
|
19082
|
+
beforeDecimal = applyThousandSeparator(beforeDecimal, thousandSeparator, thousandsGroupStyle);
|
|
19083
|
+
}
|
|
19084
|
+
//add prefix and suffix when there is a number present
|
|
19085
|
+
if (prefix)
|
|
19086
|
+
{ beforeDecimal = prefix + beforeDecimal; }
|
|
19087
|
+
if (suffix)
|
|
19088
|
+
{ afterDecimal = afterDecimal + suffix; }
|
|
19089
|
+
//restore negation sign
|
|
19090
|
+
if (addNegation)
|
|
19091
|
+
{ beforeDecimal = '-' + beforeDecimal; }
|
|
19092
|
+
numStr = beforeDecimal + ((hasDecimalSeparator && decimalSeparator) || '') + afterDecimal;
|
|
19093
|
+
return numStr;
|
|
19094
|
+
}
|
|
19095
|
+
function getSeparators(props) {
|
|
19096
|
+
var decimalSeparator = props.decimalSeparator; if ( decimalSeparator === void 0 ) decimalSeparator = '.';
|
|
19097
|
+
var thousandSeparator = props.thousandSeparator;
|
|
19098
|
+
var allowedDecimalSeparators = props.allowedDecimalSeparators;
|
|
19099
|
+
if (thousandSeparator === true) {
|
|
19100
|
+
thousandSeparator = ',';
|
|
19101
|
+
}
|
|
19102
|
+
if (!allowedDecimalSeparators) {
|
|
19103
|
+
allowedDecimalSeparators = [decimalSeparator, '.'];
|
|
19104
|
+
}
|
|
19105
|
+
return {
|
|
19106
|
+
decimalSeparator: decimalSeparator,
|
|
19107
|
+
thousandSeparator: thousandSeparator,
|
|
19108
|
+
allowedDecimalSeparators: allowedDecimalSeparators,
|
|
19109
|
+
};
|
|
19110
|
+
}
|
|
19111
|
+
function handleNegation(value, allowNegative) {
|
|
19112
|
+
if ( value === void 0 ) value = '';
|
|
19113
|
+
|
|
19114
|
+
var negationRegex = new RegExp('(-)');
|
|
19115
|
+
var doubleNegationRegex = new RegExp('(-)(.)*(-)');
|
|
19116
|
+
// Check number has '-' value
|
|
19117
|
+
var hasNegation = negationRegex.test(value);
|
|
19118
|
+
// Check number has 2 or more '-' values
|
|
19119
|
+
var removeNegation = doubleNegationRegex.test(value);
|
|
19120
|
+
//remove negation
|
|
19121
|
+
value = value.replace(/-/g, '');
|
|
19122
|
+
if (hasNegation && !removeNegation && allowNegative) {
|
|
19123
|
+
value = '-' + value;
|
|
19124
|
+
}
|
|
19125
|
+
return value;
|
|
19126
|
+
}
|
|
19127
|
+
function getNumberRegex(decimalSeparator, global) {
|
|
19128
|
+
return new RegExp(("(^-)|[0-9]|" + (escapeRegExp(decimalSeparator))), global ? 'g' : undefined);
|
|
19129
|
+
}
|
|
19130
|
+
function removeFormatting(value, changeMeta, props) {
|
|
19131
|
+
if ( changeMeta === void 0 ) changeMeta = getDefaultChangeMeta(value);
|
|
19132
|
+
|
|
19133
|
+
var allowNegative = props.allowNegative; if ( allowNegative === void 0 ) allowNegative = true;
|
|
19134
|
+
var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
|
|
19135
|
+
var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
|
|
19136
|
+
var decimalScale = props.decimalScale;
|
|
19137
|
+
var from = changeMeta.from;
|
|
19138
|
+
var to = changeMeta.to;
|
|
19139
|
+
var start = to.start;
|
|
19140
|
+
var end = to.end;
|
|
19141
|
+
var ref = getSeparators(props);
|
|
19142
|
+
var allowedDecimalSeparators = ref.allowedDecimalSeparators;
|
|
19143
|
+
var decimalSeparator = ref.decimalSeparator;
|
|
19144
|
+
var isBeforeDecimalSeparator = value[end] === decimalSeparator;
|
|
19145
|
+
/** Check for any allowed decimal separator is added in the numeric format and replace it with decimal separator */
|
|
19146
|
+
if (end - start === 1 && allowedDecimalSeparators.indexOf(value[start]) !== -1) {
|
|
19147
|
+
var separator = decimalScale === 0 ? '' : decimalSeparator;
|
|
19148
|
+
value = value.substring(0, start) + separator + value.substring(start + 1, value.length);
|
|
19149
|
+
}
|
|
19150
|
+
var hasNegation = false;
|
|
19151
|
+
/**
|
|
19152
|
+
* if prefix starts with - the number hast to have two - at the start
|
|
19153
|
+
* if suffix starts with - and the value length is same as suffix length, then the - sign is from the suffix
|
|
19154
|
+
* In other cases, if the value starts with - then it is a negation
|
|
19155
|
+
*/
|
|
19156
|
+
if (prefix.startsWith('-'))
|
|
19157
|
+
{ hasNegation = value.startsWith('--'); }
|
|
19158
|
+
else if (suffix.startsWith('-') && value.length === suffix.length)
|
|
19159
|
+
{ hasNegation = false; }
|
|
19160
|
+
else if (value[0] === '-')
|
|
19161
|
+
{ hasNegation = true; }
|
|
19162
|
+
// remove negation from start to simplify prefix logic as negation comes before prefix
|
|
19163
|
+
if (hasNegation) {
|
|
19164
|
+
value = value.substring(1);
|
|
19165
|
+
// account for the removal of the negation for start and end index
|
|
19166
|
+
start -= 1;
|
|
19167
|
+
end -= 1;
|
|
19168
|
+
}
|
|
19169
|
+
/**
|
|
19170
|
+
* remove prefix
|
|
19171
|
+
* Remove whole prefix part if its present on the value
|
|
19172
|
+
* If the prefix is partially deleted (in which case change start index will be less the prefix length)
|
|
19173
|
+
* Remove only partial part of prefix.
|
|
19174
|
+
*/
|
|
19175
|
+
var startIndex = 0;
|
|
19176
|
+
if (value.startsWith(prefix))
|
|
19177
|
+
{ startIndex += prefix.length; }
|
|
19178
|
+
else if (start < prefix.length)
|
|
19179
|
+
{ startIndex = start; }
|
|
19180
|
+
value = value.substring(startIndex);
|
|
19181
|
+
// account for deleted prefix for end index
|
|
19182
|
+
end -= startIndex;
|
|
19183
|
+
/**
|
|
19184
|
+
* Remove suffix
|
|
19185
|
+
* Remove whole suffix part if its present on the value
|
|
19186
|
+
* If the suffix is partially deleted (in which case change end index will be greater than the suffixStartIndex)
|
|
19187
|
+
* remove the partial part of suffix
|
|
19188
|
+
*/
|
|
19189
|
+
var endIndex = value.length;
|
|
19190
|
+
var suffixStartIndex = value.length - suffix.length;
|
|
19191
|
+
if (value.endsWith(suffix))
|
|
19192
|
+
{ endIndex = suffixStartIndex; }
|
|
19193
|
+
else if (end > value.length - suffix.length)
|
|
19194
|
+
{ endIndex = end; }
|
|
19195
|
+
value = value.substring(0, endIndex);
|
|
19196
|
+
// add the negation back and handle for double negation
|
|
19197
|
+
value = handleNegation(hasNegation ? ("-" + value) : value, allowNegative);
|
|
19198
|
+
// remove non numeric characters
|
|
19199
|
+
value = (value.match(getNumberRegex(decimalSeparator, true)) || []).join('');
|
|
19200
|
+
// replace the decimalSeparator with ., and only keep the first separator, ignore following ones
|
|
19201
|
+
var firstIndex = value.indexOf(decimalSeparator);
|
|
19202
|
+
value = value.replace(new RegExp(escapeRegExp(decimalSeparator), 'g'), function (match, index) {
|
|
19203
|
+
return index === firstIndex ? '.' : '';
|
|
19204
|
+
});
|
|
19205
|
+
//check if beforeDecimal got deleted and there is nothing after decimal,
|
|
19206
|
+
//clear all numbers in such case while keeping the - sign
|
|
19207
|
+
var ref$1 = splitDecimal(value, allowNegative);
|
|
19208
|
+
var beforeDecimal = ref$1.beforeDecimal;
|
|
19209
|
+
var afterDecimal = ref$1.afterDecimal;
|
|
19210
|
+
var addNegation = ref$1.addNegation; // eslint-disable-line prefer-const
|
|
19211
|
+
//clear only if something got deleted before decimal (cursor is before decimal)
|
|
19212
|
+
if (to.end - to.start < from.end - from.start &&
|
|
19213
|
+
beforeDecimal === '' &&
|
|
19214
|
+
isBeforeDecimalSeparator &&
|
|
19215
|
+
!parseFloat(afterDecimal)) {
|
|
19216
|
+
value = addNegation ? '-' : '';
|
|
19217
|
+
}
|
|
19218
|
+
return value;
|
|
19219
|
+
}
|
|
19220
|
+
function getCaretBoundary(formattedValue, props) {
|
|
19221
|
+
var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
|
|
19222
|
+
var suffix = props.suffix; if ( suffix === void 0 ) suffix = '';
|
|
19223
|
+
var boundaryAry = Array.from({ length: formattedValue.length + 1 }).map(function () { return true; });
|
|
19224
|
+
var hasNegation = formattedValue[0] === '-';
|
|
19225
|
+
// fill for prefix and negation
|
|
19226
|
+
boundaryAry.fill(false, 0, prefix.length + (hasNegation ? 1 : 0));
|
|
19227
|
+
// fill for suffix
|
|
19228
|
+
var valLn = formattedValue.length;
|
|
19229
|
+
boundaryAry.fill(false, valLn - suffix.length + 1, valLn + 1);
|
|
19230
|
+
return boundaryAry;
|
|
19231
|
+
}
|
|
19232
|
+
function validateProps(props) {
|
|
19233
|
+
var ref = getSeparators(props);
|
|
19234
|
+
var thousandSeparator = ref.thousandSeparator;
|
|
19235
|
+
var decimalSeparator = ref.decimalSeparator;
|
|
19236
|
+
if (thousandSeparator === decimalSeparator) {
|
|
19237
|
+
throw new Error(("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: " + thousandSeparator + " (thousandSeparator = {true} is same as thousandSeparator = \",\")\n decimalSeparator: " + decimalSeparator + " (default value for decimalSeparator is .)\n "));
|
|
19238
|
+
}
|
|
19239
|
+
}
|
|
19240
|
+
function useNumericFormat(props) {
|
|
19241
|
+
var decimalSeparator = props.decimalSeparator; if ( decimalSeparator === void 0 ) decimalSeparator = '.';
|
|
19242
|
+
var allowLeadingZeros = props.allowLeadingZeros;
|
|
19243
|
+
var onKeyDown = props.onKeyDown; if ( onKeyDown === void 0 ) onKeyDown = noop;
|
|
19244
|
+
var onBlur = props.onBlur; if ( onBlur === void 0 ) onBlur = noop;
|
|
19245
|
+
var thousandSeparator = props.thousandSeparator;
|
|
19246
|
+
var decimalScale = props.decimalScale;
|
|
19247
|
+
var fixedDecimalScale = props.fixedDecimalScale;
|
|
19248
|
+
var prefix = props.prefix; if ( prefix === void 0 ) prefix = '';
|
|
19249
|
+
var defaultValue = props.defaultValue;
|
|
19250
|
+
var value = props.value;
|
|
19251
|
+
var valueIsNumericString = props.valueIsNumericString;
|
|
19252
|
+
var onValueChange = props.onValueChange;
|
|
19253
|
+
var restProps = __rest(props, ["decimalSeparator", "allowedDecimalSeparators", "thousandsGroupStyle", "suffix", "allowNegative", "allowLeadingZeros", "onKeyDown", "onBlur", "thousandSeparator", "decimalScale", "fixedDecimalScale", "prefix", "defaultValue", "value", "valueIsNumericString", "onValueChange"]);
|
|
19254
|
+
// validate props
|
|
19255
|
+
validateProps(props);
|
|
19256
|
+
var _format = function (numStr) { return format(numStr, props); };
|
|
19257
|
+
var _removeFormatting = function (inputValue, changeMeta) { return removeFormatting(inputValue, changeMeta, props); };
|
|
19258
|
+
var _valueIsNumericString = valueIsNumericString;
|
|
19259
|
+
if (!isNil(value)) {
|
|
19260
|
+
_valueIsNumericString = valueIsNumericString !== null && valueIsNumericString !== void 0 ? valueIsNumericString : typeof value === 'number';
|
|
19261
|
+
}
|
|
19262
|
+
else if (!isNil(defaultValue)) {
|
|
19263
|
+
_valueIsNumericString = valueIsNumericString !== null && valueIsNumericString !== void 0 ? valueIsNumericString : typeof defaultValue === 'number';
|
|
19264
|
+
}
|
|
19265
|
+
var roundIncomingValueToPrecision = function (value) {
|
|
19266
|
+
if (isNil(value) || isNanValue(value))
|
|
19267
|
+
{ return value; }
|
|
19268
|
+
if (typeof value === 'number') {
|
|
19269
|
+
value = toNumericString(value);
|
|
19270
|
+
}
|
|
19271
|
+
/**
|
|
19272
|
+
* only round numeric or float string values coming through props,
|
|
19273
|
+
* we don't need to do it for onChange events, as we want to prevent typing there
|
|
19274
|
+
*/
|
|
19275
|
+
if (_valueIsNumericString && typeof decimalScale === 'number') {
|
|
19276
|
+
return roundToPrecision(value, decimalScale, Boolean(fixedDecimalScale));
|
|
19277
|
+
}
|
|
19278
|
+
return value;
|
|
19279
|
+
};
|
|
19280
|
+
var ref = useInternalValues(roundIncomingValueToPrecision(value), roundIncomingValueToPrecision(defaultValue), Boolean(_valueIsNumericString), _format, _removeFormatting, onValueChange);
|
|
19281
|
+
var ref_0 = ref[0];
|
|
19282
|
+
var numAsString = ref_0.numAsString;
|
|
19283
|
+
var formattedValue = ref_0.formattedValue;
|
|
19284
|
+
var _onValueChange = ref[1];
|
|
19285
|
+
var _onKeyDown = function (e) {
|
|
19286
|
+
var el = e.target;
|
|
19287
|
+
var key = e.key;
|
|
19288
|
+
var selectionStart = el.selectionStart;
|
|
19289
|
+
var selectionEnd = el.selectionEnd;
|
|
19290
|
+
var value = el.value; if ( value === void 0 ) value = '';
|
|
19291
|
+
// if multiple characters are selected and user hits backspace, no need to handle anything manually
|
|
19292
|
+
if (selectionStart !== selectionEnd) {
|
|
19293
|
+
onKeyDown(e);
|
|
19294
|
+
return;
|
|
19295
|
+
}
|
|
19296
|
+
// if user hits backspace, while the cursor is before prefix, and the input has negation, remove the negation
|
|
19297
|
+
if (key === 'Backspace' && value[0] === '-' && selectionStart === prefix.length + 1) {
|
|
19298
|
+
// bring the cursor to after negation
|
|
19299
|
+
setCaretPosition(el, 1);
|
|
19300
|
+
}
|
|
19301
|
+
// don't allow user to delete decimal separator when decimalScale and fixedDecimalScale is set
|
|
19302
|
+
var ref = getSeparators(props);
|
|
19303
|
+
var decimalSeparator = ref.decimalSeparator;
|
|
19304
|
+
var allowedDecimalSeparators = ref.allowedDecimalSeparators;
|
|
19305
|
+
if (key === 'Backspace' &&
|
|
19306
|
+
value[selectionStart - 1] === decimalSeparator &&
|
|
19307
|
+
decimalScale &&
|
|
19308
|
+
fixedDecimalScale) {
|
|
19309
|
+
setCaretPosition(el, selectionStart - 1);
|
|
19310
|
+
e.preventDefault();
|
|
19311
|
+
}
|
|
19312
|
+
// if user presses the allowed decimal separator before the separator, move the cursor after the separator
|
|
19313
|
+
if ((allowedDecimalSeparators === null || allowedDecimalSeparators === void 0 ? void 0 : allowedDecimalSeparators.includes(key)) && value[selectionStart] === decimalSeparator) {
|
|
19314
|
+
setCaretPosition(el, selectionStart + 1);
|
|
19315
|
+
}
|
|
19316
|
+
var _thousandSeparator = thousandSeparator === true ? ',' : thousandSeparator;
|
|
19317
|
+
// move cursor when delete or backspace is pressed before/after thousand separator
|
|
19318
|
+
if (key === 'Backspace' && value[selectionStart - 1] === _thousandSeparator) {
|
|
19319
|
+
setCaretPosition(el, selectionStart - 1);
|
|
19320
|
+
}
|
|
19321
|
+
if (key === 'Delete' && value[selectionStart] === _thousandSeparator) {
|
|
19322
|
+
setCaretPosition(el, selectionStart + 1);
|
|
19323
|
+
}
|
|
19324
|
+
onKeyDown(e);
|
|
19325
|
+
};
|
|
19326
|
+
var _onBlur = function (e) {
|
|
19327
|
+
var _value = numAsString;
|
|
19328
|
+
// if there no no numeric value, clear the input
|
|
19329
|
+
if (!_value.match(/\d/g)) {
|
|
19330
|
+
_value = '';
|
|
19331
|
+
}
|
|
19332
|
+
// clear leading 0s
|
|
19333
|
+
if (!allowLeadingZeros) {
|
|
19334
|
+
_value = fixLeadingZero(_value);
|
|
19335
|
+
}
|
|
19336
|
+
// apply fixedDecimalScale on blur event
|
|
19337
|
+
if (fixedDecimalScale && decimalScale) {
|
|
19338
|
+
_value = roundToPrecision(_value, decimalScale, fixedDecimalScale);
|
|
19339
|
+
}
|
|
19340
|
+
if (_value !== numAsString) {
|
|
19341
|
+
var formattedValue = format(_value, props);
|
|
19342
|
+
_onValueChange({
|
|
19343
|
+
formattedValue: formattedValue,
|
|
19344
|
+
value: _value,
|
|
19345
|
+
floatValue: parseFloat(_value),
|
|
19346
|
+
}, {
|
|
19347
|
+
event: e,
|
|
19348
|
+
source: SourceType.event,
|
|
19349
|
+
});
|
|
19350
|
+
}
|
|
19351
|
+
onBlur(e);
|
|
19352
|
+
};
|
|
19353
|
+
var isValidInputCharacter = function (inputChar) {
|
|
19354
|
+
if (inputChar === decimalSeparator)
|
|
19355
|
+
{ return true; }
|
|
19356
|
+
return charIsNumber(inputChar);
|
|
19357
|
+
};
|
|
19358
|
+
return Object.assign(Object.assign({}, restProps), { value: formattedValue, valueIsNumericString: false, isValidInputCharacter: isValidInputCharacter, onValueChange: _onValueChange, format: _format, removeFormatting: _removeFormatting, getCaretBoundary: function (formattedValue) { return getCaretBoundary(formattedValue, props); }, onKeyDown: _onKeyDown, onBlur: _onBlur });
|
|
19359
|
+
}
|
|
19360
|
+
function NumericFormat(props) {
|
|
19361
|
+
var numericFormatProps = useNumericFormat(props);
|
|
19362
|
+
return React.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
|
|
19363
|
+
}
|
|
19364
|
+
|
|
19365
|
+
const TextWidgetBase = ({
|
|
19366
|
+
id,
|
|
19367
|
+
onChange,
|
|
19368
|
+
readonly,
|
|
19369
|
+
options: _options = {},
|
|
19370
|
+
disabled,
|
|
19371
|
+
required,
|
|
19372
|
+
value,
|
|
19373
|
+
uiSchema: _uiSchema = {},
|
|
19374
|
+
schema: _schema = {},
|
|
19375
|
+
overrideProps: _overrideProps = i => i
|
|
19376
|
+
}) => {
|
|
19377
|
+
var _uiSchema$uiOptions;
|
|
19378
|
+
// INFO: debouncing added for performance concerns
|
|
19379
|
+
const handleChange = useDebounceCallback(e => {
|
|
19380
|
+
onChange(e.target.value || undefined);
|
|
19381
|
+
}, 100);
|
|
19382
|
+
const {
|
|
19383
|
+
error
|
|
19384
|
+
} = useFormControl();
|
|
19385
|
+
const message = ((_uiSchema$uiOptions = _uiSchema["ui:options"]) == null ? void 0 : _uiSchema$uiOptions.message) || undefined;
|
|
19386
|
+
const messageProps = {
|
|
19387
|
+
title: (message == null ? void 0 : message.title) || undefined,
|
|
19388
|
+
description: (message == null ? void 0 : message.description) || undefined,
|
|
19389
|
+
type: (message == null ? void 0 : message.type) || "info",
|
|
19390
|
+
canDismiss: (message == null ? void 0 : message.canDismiss) || true
|
|
19391
|
+
};
|
|
19392
|
+
const {
|
|
19393
|
+
format: type,
|
|
19394
|
+
placeholder,
|
|
19395
|
+
title: label
|
|
19396
|
+
} = _schema;
|
|
19397
|
+
const InputProps = {
|
|
19398
|
+
readOnly: readonly,
|
|
19399
|
+
startAdornment: _options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
19400
|
+
position: "start",
|
|
19401
|
+
style: {
|
|
19402
|
+
fontSize: 14
|
|
19403
|
+
},
|
|
19404
|
+
children: _options.prefix
|
|
19405
|
+
}) : null,
|
|
19406
|
+
endAdornment: _options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
19407
|
+
position: "end",
|
|
19408
|
+
style: {
|
|
19409
|
+
fontSize: 14
|
|
19410
|
+
},
|
|
19411
|
+
children: _options.suffix
|
|
19412
|
+
}) : null
|
|
19413
|
+
};
|
|
19414
|
+
const componentProps = _extends({
|
|
19415
|
+
id,
|
|
19416
|
+
error,
|
|
19417
|
+
disabled,
|
|
19418
|
+
label,
|
|
19419
|
+
placeholder,
|
|
19420
|
+
required,
|
|
19421
|
+
// INFO: for performance concerns, textfield is NOT controlled field.
|
|
19422
|
+
// This will prevent his field to be changed outside of once concurrency
|
|
19423
|
+
// pattern implemented with React 18, it can be controlled as other
|
|
19424
|
+
// fields value={props.value || ""} onChange={(event) =>
|
|
19425
|
+
// props.onChange(event.target.value || null)} value: props.value,
|
|
19426
|
+
defaultValue: value,
|
|
19427
|
+
onChange: handleChange,
|
|
19428
|
+
autoComplete: "off",
|
|
19429
|
+
variant: "outlined",
|
|
19430
|
+
InputProps,
|
|
19431
|
+
sx: {
|
|
19432
|
+
width: "100%"
|
|
19433
|
+
},
|
|
19434
|
+
type
|
|
19435
|
+
}, _uiSchema["ui:props"]);
|
|
19436
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
19437
|
+
children: [/*#__PURE__*/jsx(TextField, _extends({}, _overrideProps(componentProps))), message && /*#__PURE__*/jsx(Alert, _extends({
|
|
19438
|
+
sx: {
|
|
19439
|
+
mt: 1
|
|
19440
|
+
}
|
|
19441
|
+
}, messageProps))]
|
|
19442
|
+
});
|
|
19443
|
+
};
|
|
19444
|
+
TextWidgetBase.propTypes = {
|
|
19445
|
+
disabled: PropTypes.any,
|
|
19446
|
+
id: PropTypes.any,
|
|
19447
|
+
onChange: PropTypes.func,
|
|
19448
|
+
options: PropTypes.shape({
|
|
19449
|
+
prefix: PropTypes.any,
|
|
19450
|
+
suffix: PropTypes.any
|
|
19451
|
+
}),
|
|
19452
|
+
rawErrors: PropTypes.array,
|
|
19453
|
+
readonly: PropTypes.any,
|
|
19454
|
+
required: PropTypes.bool,
|
|
19455
|
+
schema: PropTypes.shape({
|
|
19456
|
+
format: PropTypes.any,
|
|
19457
|
+
placeholder: PropTypes.any,
|
|
19458
|
+
title: PropTypes.any
|
|
19459
|
+
}),
|
|
19460
|
+
uiSchema: PropTypes.any,
|
|
19461
|
+
value: PropTypes.any,
|
|
19462
|
+
overrideProps: PropTypes.func
|
|
19463
|
+
};
|
|
19464
|
+
|
|
19465
|
+
const _excluded = ["onChange"];
|
|
19466
|
+
const TextWidgetReadOnly$1 = props => /*#__PURE__*/jsx(ReadOnlyView, {
|
|
19467
|
+
label: props.schema.title,
|
|
19468
|
+
value: props.value
|
|
19469
|
+
});
|
|
19470
|
+
TextWidgetReadOnly$1.propTypes = {
|
|
19471
|
+
schema: PropTypes.any,
|
|
19472
|
+
value: PropTypes.any
|
|
19473
|
+
};
|
|
19474
|
+
const CurrencyWidget = props => {
|
|
19475
|
+
var _options$prefix;
|
|
19476
|
+
const {
|
|
19477
|
+
options
|
|
19478
|
+
} = props;
|
|
19479
|
+
const prefix = (_options$prefix = options.prefix) != null ? _options$prefix : "$";
|
|
19480
|
+
const {
|
|
19481
|
+
options: {
|
|
19482
|
+
// INFO: default values
|
|
19483
|
+
decimalScale = 2,
|
|
19484
|
+
thousandSeparator = ",",
|
|
19485
|
+
decimalSeparator = ".",
|
|
19486
|
+
allowNegative = true
|
|
19487
|
+
}
|
|
19488
|
+
} = props;
|
|
19489
|
+
const NumberFormatCustom = useMemo(() => {
|
|
19490
|
+
return /*#__PURE__*/React.forwardRef(function NumberFormatCustom(props, ref) {
|
|
19491
|
+
const {
|
|
19492
|
+
onChange
|
|
19493
|
+
} = props,
|
|
19494
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
19495
|
+
return /*#__PURE__*/jsx(NumericFormat, _extends({}, rest, {
|
|
19496
|
+
getInputRef: ref,
|
|
19497
|
+
onValueChange: values => {
|
|
19498
|
+
onChange({
|
|
19499
|
+
target: {
|
|
19500
|
+
name: props.name,
|
|
19501
|
+
value: values.value
|
|
19502
|
+
}
|
|
19503
|
+
});
|
|
19504
|
+
},
|
|
19505
|
+
decimalScale: decimalScale,
|
|
19506
|
+
fixedDecimalScale: decimalScale,
|
|
19507
|
+
thousandSeparator: thousandSeparator,
|
|
19508
|
+
decimalSeparator: decimalSeparator,
|
|
19509
|
+
allowNegative: allowNegative,
|
|
19510
|
+
placeholder: props.placeholder
|
|
19511
|
+
}));
|
|
19512
|
+
});
|
|
19513
|
+
}, [decimalScale, thousandSeparator, decimalSeparator, allowNegative]);
|
|
19514
|
+
const overrideProps = _props => {
|
|
19515
|
+
return _extends({}, _props, {
|
|
19516
|
+
InputProps: _extends({}, props.InputProps, {
|
|
19517
|
+
inputComponent: NumberFormatCustom,
|
|
19518
|
+
startAdornment: prefix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
19519
|
+
position: "start",
|
|
19520
|
+
style: {
|
|
19521
|
+
fontSize: 14
|
|
19522
|
+
},
|
|
19523
|
+
children: options.prefix
|
|
19524
|
+
}) : null
|
|
19525
|
+
})
|
|
19526
|
+
});
|
|
19527
|
+
};
|
|
19528
|
+
return /*#__PURE__*/jsx(TextWidgetBase, _extends({}, props, {
|
|
19529
|
+
overrideProps: overrideProps
|
|
19530
|
+
}));
|
|
19531
|
+
};
|
|
19532
|
+
CurrencyWidget.propTypes = TextWidgetBase.propTypes;
|
|
19533
|
+
const HOCs$4 = [...commonWidgetHOCs, withReadyOnly(TextWidgetReadOnly$1), withEvalDisable()];
|
|
19534
|
+
var CurrencyWidget$1 = compose(HOCs$4)(CurrencyWidget);
|
|
18373
19535
|
|
|
18374
19536
|
const decodeHtml = html => {
|
|
18375
19537
|
const textarea = document.createElement("textarea");
|
|
@@ -18531,69 +19693,20 @@ const TextareaWidgetReadOnly = props => /*#__PURE__*/jsx(ReadOnlyView, {
|
|
|
18531
19693
|
label: props.schema.title,
|
|
18532
19694
|
value: props.value
|
|
18533
19695
|
});
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
|
|
18537
|
-
props.onChange(e.target.value || undefined);
|
|
18538
|
-
}, 100);
|
|
18539
|
-
const {
|
|
18540
|
-
error
|
|
18541
|
-
} = useFormControl();
|
|
18542
|
-
return /*#__PURE__*/jsx(TextField, {
|
|
18543
|
-
id: props.id,
|
|
18544
|
-
error: error,
|
|
18545
|
-
disabled: props.disabled,
|
|
18546
|
-
label: props.schema.title,
|
|
18547
|
-
required: props.required,
|
|
18548
|
-
defaultValue: props.value
|
|
18549
|
-
// INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
|
|
18550
|
-
// Once concurrency pattern implemented with React 18, it can be
|
|
18551
|
-
// controlled as other fields value={props.value || ""}
|
|
18552
|
-
// onChange={(event) => props.onChange(event.target.value || null)}
|
|
18553
|
-
,
|
|
18554
|
-
onChange: handleChange,
|
|
18555
|
-
autoComplete: "off",
|
|
18556
|
-
variant: "outlined",
|
|
18557
|
-
InputProps: {
|
|
18558
|
-
startAdornment: props.schema.prefix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
18559
|
-
position: "start",
|
|
18560
|
-
style: {
|
|
18561
|
-
fontSize: 12
|
|
18562
|
-
},
|
|
18563
|
-
children: props.schema.prefix
|
|
18564
|
-
}) : null,
|
|
18565
|
-
endAdornment: props.schema.suffix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
18566
|
-
position: "end",
|
|
18567
|
-
style: {
|
|
18568
|
-
fontSize: 12
|
|
18569
|
-
},
|
|
18570
|
-
children: props.schema.suffix
|
|
18571
|
-
}) : null
|
|
18572
|
-
},
|
|
18573
|
-
sx: {
|
|
18574
|
-
width: "100%"
|
|
18575
|
-
},
|
|
18576
|
-
type: props.schema.format,
|
|
18577
|
-
placeholder: props.schema.placeholder,
|
|
18578
|
-
multiline: true,
|
|
18579
|
-
rows: 5
|
|
18580
|
-
});
|
|
19696
|
+
TextareaWidgetReadOnly.propTypes = {
|
|
19697
|
+
schema: PropTypes.any,
|
|
19698
|
+
value: PropTypes.any
|
|
18581
19699
|
};
|
|
18582
|
-
TextareaWidget
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
prefix: PropTypes.any,
|
|
18593
|
-
suffix: PropTypes.any,
|
|
18594
|
-
title: PropTypes.any
|
|
18595
|
-
}),
|
|
18596
|
-
value: PropTypes.string
|
|
19700
|
+
const TextareaWidget = props => {
|
|
19701
|
+
const overrideProps = useCallback(rest => {
|
|
19702
|
+
return _extends({}, rest, {
|
|
19703
|
+
multiline: true,
|
|
19704
|
+
rows: 5
|
|
19705
|
+
});
|
|
19706
|
+
}, []);
|
|
19707
|
+
return /*#__PURE__*/jsx(TextWidgetBase, _extends({}, props, {
|
|
19708
|
+
overrideProps: overrideProps
|
|
19709
|
+
}));
|
|
18597
19710
|
};
|
|
18598
19711
|
const HOCs$2 = [...commonWidgetHOCs, withReadyOnly(TextareaWidgetReadOnly)];
|
|
18599
19712
|
var TextareaWidget$1 = compose(HOCs$2)(TextareaWidget);
|
|
@@ -18606,92 +19719,9 @@ TextWidgetReadOnly.propTypes = {
|
|
|
18606
19719
|
schema: PropTypes.any,
|
|
18607
19720
|
value: PropTypes.any
|
|
18608
19721
|
};
|
|
18609
|
-
const TextWidget = props => {
|
|
18610
|
-
var _props$uiSchema$uiOp;
|
|
18611
|
-
// INFO: debouncing added for performance concerns
|
|
18612
|
-
const handleChange = useDebounceCallback(e => {
|
|
18613
|
-
props.onChange(e.target.value || undefined);
|
|
18614
|
-
}, 100);
|
|
18615
|
-
const {
|
|
18616
|
-
error
|
|
18617
|
-
} = useFormControl();
|
|
18618
|
-
const message = ((_props$uiSchema$uiOp = props.uiSchema["ui:options"]) == null ? void 0 : _props$uiSchema$uiOp.message) || undefined;
|
|
18619
|
-
const messageProps = {
|
|
18620
|
-
title: (message == null ? void 0 : message.title) || undefined,
|
|
18621
|
-
description: (message == null ? void 0 : message.description) || undefined,
|
|
18622
|
-
type: (message == null ? void 0 : message.type) || "info",
|
|
18623
|
-
canDismiss: (message == null ? void 0 : message.canDismiss) || true
|
|
18624
|
-
};
|
|
18625
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
18626
|
-
children: [/*#__PURE__*/jsx(TextField, {
|
|
18627
|
-
id: props.id,
|
|
18628
|
-
error: error,
|
|
18629
|
-
disabled: props.disabled,
|
|
18630
|
-
label: props.schema.title,
|
|
18631
|
-
required: props.required,
|
|
18632
|
-
defaultValue: props.value
|
|
18633
|
-
// value={props.value}
|
|
18634
|
-
// INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
|
|
18635
|
-
// Once concurrency pattern implemented with React 18, it can be
|
|
18636
|
-
// controlled as other fields value={props.value || ""}
|
|
18637
|
-
// onChange={(event) => props.onChange(event.target.value || null)}
|
|
18638
|
-
,
|
|
18639
|
-
onChange: handleChange,
|
|
18640
|
-
autoComplete: "off",
|
|
18641
|
-
variant: "outlined",
|
|
18642
|
-
InputProps: {
|
|
18643
|
-
readOnly: props.readonly,
|
|
18644
|
-
startAdornment: props.options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
18645
|
-
position: "start",
|
|
18646
|
-
style: {
|
|
18647
|
-
fontSize: 14
|
|
18648
|
-
},
|
|
18649
|
-
children: props.options.prefix
|
|
18650
|
-
}) : null,
|
|
18651
|
-
endAdornment: props.options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
|
|
18652
|
-
position: "end",
|
|
18653
|
-
style: {
|
|
18654
|
-
fontSize: 14
|
|
18655
|
-
},
|
|
18656
|
-
children: props.options.suffix
|
|
18657
|
-
}) : null
|
|
18658
|
-
},
|
|
18659
|
-
sx: {
|
|
18660
|
-
width: "100%"
|
|
18661
|
-
},
|
|
18662
|
-
type: props.schema.format,
|
|
18663
|
-
placeholder: props.schema.placeholder
|
|
18664
|
-
}), message && /*#__PURE__*/jsx(Alert, _extends({
|
|
18665
|
-
sx: {
|
|
18666
|
-
mt: 1
|
|
18667
|
-
}
|
|
18668
|
-
}, messageProps))]
|
|
18669
|
-
});
|
|
18670
|
-
};
|
|
18671
|
-
TextWidget.defaultProps = {
|
|
18672
|
-
uiSchema: {}
|
|
18673
|
-
};
|
|
18674
|
-
TextWidget.propTypes = {
|
|
18675
|
-
disabled: PropTypes.any,
|
|
18676
|
-
id: PropTypes.any,
|
|
18677
|
-
onChange: PropTypes.func,
|
|
18678
|
-
options: PropTypes.shape({
|
|
18679
|
-
prefix: PropTypes.any,
|
|
18680
|
-
suffix: PropTypes.any
|
|
18681
|
-
}),
|
|
18682
|
-
rawErrors: PropTypes.array,
|
|
18683
|
-
readonly: PropTypes.any,
|
|
18684
|
-
required: PropTypes.bool,
|
|
18685
|
-
schema: PropTypes.shape({
|
|
18686
|
-
format: PropTypes.any,
|
|
18687
|
-
placeholder: PropTypes.any,
|
|
18688
|
-
title: PropTypes.any
|
|
18689
|
-
}),
|
|
18690
|
-
uiSchema: PropTypes.any,
|
|
18691
|
-
value: PropTypes.any
|
|
18692
|
-
};
|
|
18693
19722
|
const HOCs$1 = [...commonWidgetHOCs, withReadyOnly(TextWidgetReadOnly), withEvalDisable()];
|
|
18694
|
-
|
|
19723
|
+
const TextWidget = compose(HOCs$1)(TextWidgetBase);
|
|
19724
|
+
TextWidget.PropTypes = TextWidgetBase.PropTypes;
|
|
18695
19725
|
|
|
18696
19726
|
const getError = errors => {
|
|
18697
19727
|
if (errors) {
|
|
@@ -18832,11 +19862,12 @@ const defaultWidgets = {
|
|
|
18832
19862
|
toggleButton: ToggleButtonWidget$1,
|
|
18833
19863
|
select: SelectWidget$1,
|
|
18834
19864
|
LinkedSelects: SelectWidget$1,
|
|
18835
|
-
TextWidget: TextWidget
|
|
19865
|
+
TextWidget: TextWidget,
|
|
18836
19866
|
TextareaWidget: TextareaWidget$1,
|
|
18837
19867
|
PhoneWidget: PhoneWidget$1,
|
|
18838
19868
|
ValidateWidget: ValidateWidget$1,
|
|
18839
|
-
DateWidget
|
|
19869
|
+
DateWidget,
|
|
19870
|
+
CurrencyWidget: CurrencyWidget$1
|
|
18840
19871
|
// CheckboxWidget
|
|
18841
19872
|
};
|
|
18842
19873
|
|
|
@@ -19050,11 +20081,32 @@ DynamicForm.propTypes = {
|
|
|
19050
20081
|
const HOCs = [withFormStore, withSubmitListener];
|
|
19051
20082
|
var DynamicForm$1 = compose(HOCs)(DynamicForm);
|
|
19052
20083
|
|
|
20084
|
+
const CoreProvider = ({
|
|
20085
|
+
children,
|
|
20086
|
+
theme
|
|
20087
|
+
}) => {
|
|
20088
|
+
const queryClient = new QueryClient();
|
|
20089
|
+
return /*#__PURE__*/jsx(QueryClientProvider, {
|
|
20090
|
+
client: queryClient,
|
|
20091
|
+
children: /*#__PURE__*/jsx(StylesProvider, {
|
|
20092
|
+
children: /*#__PURE__*/jsx(StyledEngineProvider, {
|
|
20093
|
+
injectFirst: true,
|
|
20094
|
+
children: /*#__PURE__*/jsx(ThemeProvider, {
|
|
20095
|
+
theme: theme,
|
|
20096
|
+
children: /*#__PURE__*/jsx(SnackbarProvider, {
|
|
20097
|
+
children: children
|
|
20098
|
+
})
|
|
20099
|
+
})
|
|
20100
|
+
})
|
|
20101
|
+
})
|
|
20102
|
+
});
|
|
20103
|
+
};
|
|
20104
|
+
|
|
19053
20105
|
const DynamicFormHooks = {
|
|
19054
20106
|
useSelectFormState,
|
|
19055
20107
|
useSetFormState,
|
|
19056
20108
|
useReadOnly
|
|
19057
20109
|
};
|
|
19058
20110
|
|
|
19059
|
-
export { Actions$1 as Actions, Alert, AvatarBox, AvatarTitle, BusinessObject, BusinessObjectCard, EmptyCardSection as BusinessObjectCardEmptySection, CardSection as BusinessObjectCardSection, CardSectionTitle as BusinessObjectCardSectionTitle, BusinessObjectPanel, Header$1 as BusinessObjectPanelHeader, Section as BusinessObjectPanelSection, SectionTitle as BusinessObjectPanelSectionTitle, BusinessObjectPicker$1 as BusinessObjectPicker, BusinessObjectStatus, BusinessObjectStatusButton, BusinessObjectTable, Button, Chip, ContentBox, CurriculumChart, DataTable, DatePickerBase as DatePicker, DisplayInFrame, DocViewer, Drawer, DynamicForm$1 as DynamicForm, BusinessObjectPickerField$1 as DynamicFormBusinessObjectPickerField, DynamicFormHooks, EditableText, FilterPanel, FilterChips$1 as FilterPanelFilterChips, mapFilters as FilterPanelMapFilters, FullPageViewer, Icon$1 as Icon, Image, IsometricImage, List, ListItem, ListItemGroup, MenuButton, ModalDialog, Notification, OutcomeSpace, PanelDrawer, ProgressChart, RichDataTable, RubricDistributionChart, RubricLegend, RubricScoreSlider, ScrollToTopButton, ScrollingContainer, SkeletonContent, StatBoxes, StatusMessage, SvgImage, SwipeableTabPanel, Content as SwipeableTabPanelContent, Timeline, TitleAndActionHeader, TitleAndDescription, UserAvatar, WizardPanel, businessObjectColor, businessObjectConfiguration, businessObjectIcon, createComponentEvent, createEvent, createComponentStore as createStore, dataSourceManager, filterSortData, getBaseUrl, getConfiguration, getDataSourceUrl, http, outcomeSpaceColor, outcomeSpaceTypeFromSource, registerDataSource, registerDataSources, setDataSourceConfiguration, template, useComponentWillMount, useDataSourceInfiniteQuery, useDataSourceMutation, useDataSourceQuery, useDataSourceUrl, useDebounceCallback, useNotify, useRefDimensions, withStatusButtonDataSource };
|
|
20111
|
+
export { Actions$1 as Actions, Alert, AvatarBox, AvatarTitle, BusinessObject, BusinessObjectCard, EmptyCardSection as BusinessObjectCardEmptySection, CardSection as BusinessObjectCardSection, CardSectionTitle as BusinessObjectCardSectionTitle, BusinessObjectPanel, Header$1 as BusinessObjectPanelHeader, Section as BusinessObjectPanelSection, SectionTitle as BusinessObjectPanelSectionTitle, BusinessObjectPicker$1 as BusinessObjectPicker, BusinessObjectStatus, BusinessObjectStatusButton, BusinessObjectTable, Button, Chip, ContentBox, CoreProvider, CurriculumChart, DataTable, DatePickerBase as DatePicker, DisplayInFrame, DocViewer, Drawer, DynamicForm$1 as DynamicForm, BusinessObjectPickerField$1 as DynamicFormBusinessObjectPickerField, DynamicFormHooks, EditableText, FilterPanel, FilterChips$1 as FilterPanelFilterChips, mapFilters as FilterPanelMapFilters, FullPageViewer, Icon$1 as Icon, Image, IsometricImage, List, ListItem, ListItemGroup, MenuButton, ModalDialog, Notification, OutcomeSpace, PanelDrawer, ProgressChart, RichDataTable, RubricDistributionChart, RubricLegend, RubricScoreSlider, ScrollToTopButton, ScrollingContainer, SkeletonContent, StatBoxes, StatusMessage, SvgImage, SwipeableTabPanel, Content as SwipeableTabPanelContent, Timeline, TitleAndActionHeader, TitleAndDescription, UserAvatar, WizardPanel, businessObjectColor, businessObjectConfiguration, businessObjectIcon, createComponentEvent, createEvent, createComponentStore as createStore, dataSourceManager, filterSortData, getBaseUrl, getConfiguration, getDataSourceUrl, http, outcomeSpaceColor, outcomeSpaceTypeFromSource, registerDataSource, registerDataSources, setDataSourceConfiguration, template, useComponentWillMount, useDataSourceInfiniteQuery, useDataSourceMutation, useDataSourceQuery, useDataSourceUrl, useDebounceCallback, useNotify, useRefDimensions, withStatusButtonDataSource };
|
|
19060
20112
|
//# sourceMappingURL=index.modern.js.map
|