aefis-core-ui 2.1.14 → 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.
@@ -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';
@@ -1675,12 +1675,12 @@ const LegacyButtonTheme = createTheme(theme, {
1675
1675
  }
1676
1676
  });
1677
1677
 
1678
- const _excluded$j = ["name"];
1678
+ const _excluded$k = ["name"];
1679
1679
  const Button = /*#__PURE__*/forwardRef(function Button(_ref, ref) {
1680
1680
  let {
1681
1681
  name
1682
1682
  } = _ref,
1683
- props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
1683
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
1684
1684
  const isColorDefault = props.color === undefined || props.color === "default";
1685
1685
  const colorThemeName = isColorDefault ? "grey" : props.color;
1686
1686
  const theme = useTheme$1();
@@ -1773,7 +1773,7 @@ AnimatedExpandMoreIcon.propTypes = {
1773
1773
  sx: PropTypes.any
1774
1774
  };
1775
1775
 
1776
- const _excluded$i = ["name", "icon", "menuConfiguration", "color", "displayType", "variant", "onClick", "link"];
1776
+ const _excluded$j = ["name", "icon", "menuConfiguration", "color", "displayType", "variant", "onClick", "link"];
1777
1777
  const AefisButton = withStyles$1({
1778
1778
  root: {
1779
1779
  "&:focus": {
@@ -1795,7 +1795,7 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, ref) {
1795
1795
  onClick,
1796
1796
  link
1797
1797
  } = _ref,
1798
- props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
1798
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
1799
1799
  const [anchorEl, setAnchorEl] = useState(null);
1800
1800
  const handleClick = (event, link, buttonId) => {
1801
1801
  setAnchorEl(event.currentTarget);
@@ -3422,7 +3422,7 @@ CardSectionTitle$1.propTypes = {
3422
3422
  title: PropTypes.string
3423
3423
  };
3424
3424
 
3425
- const _excluded$h = ["title", "children", "height", "titleComponent"];
3425
+ const _excluded$i = ["title", "children", "height", "titleComponent"];
3426
3426
  const CardSection$1 = _ref => {
3427
3427
  let {
3428
3428
  title,
@@ -3430,7 +3430,7 @@ const CardSection$1 = _ref => {
3430
3430
  height,
3431
3431
  titleComponent
3432
3432
  } = _ref,
3433
- props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
3433
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
3434
3434
  return /*#__PURE__*/jsxs(Box$1, _extends({
3435
3435
  sx: {
3436
3436
  height: height || "inherit"
@@ -3530,7 +3530,7 @@ SvgImage.propTypes = {
3530
3530
  width: PropTypes.any
3531
3531
  };
3532
3532
 
3533
- const _excluded$g = ["source", "description", "width", "height", "decorative", "showSkeleton", "fallbackImage"],
3533
+ const _excluded$h = ["source", "description", "width", "height", "decorative", "showSkeleton", "fallbackImage"],
3534
3534
  _excluded2$1 = ["src", "extension"];
3535
3535
  const RenderImage = _ref => {
3536
3536
  let {
@@ -3542,7 +3542,7 @@ const RenderImage = _ref => {
3542
3542
  showSkeleton,
3543
3543
  fallbackImage
3544
3544
  } = _ref,
3545
- other = _objectWithoutPropertiesLoose(_ref, _excluded$g);
3545
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$h);
3546
3546
  const altText = decorative ? "" : description;
3547
3547
  const role = decorative ? "presentation" : "img";
3548
3548
  const hidden = !!decorative;
@@ -3620,7 +3620,7 @@ Image.propTypes = {
3620
3620
  extension: PropTypes.string
3621
3621
  };
3622
3622
 
3623
- const _excluded$f = ["type"];
3623
+ const _excluded$g = ["type"];
3624
3624
  const imageProps = {
3625
3625
  award: Award,
3626
3626
  building: Building,
@@ -3646,7 +3646,7 @@ const IsometricImage = _ref => {
3646
3646
  let {
3647
3647
  type
3648
3648
  } = _ref,
3649
- other = _objectWithoutPropertiesLoose(_ref, _excluded$f);
3649
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$g);
3650
3650
  const image = getIsometricImage(type);
3651
3651
  return /*#__PURE__*/jsx(Image, _extends({
3652
3652
  src: image
@@ -4410,13 +4410,13 @@ BusinessObjectCard.propTypes = {
4410
4410
  autoTruncateDescription: PropTypes.bool
4411
4411
  };
4412
4412
 
4413
- const _excluded$e = ["enableScrollTop", "containerProps"];
4413
+ const _excluded$f = ["enableScrollTop", "containerProps"];
4414
4414
  const SwipeableViews = _ref => {
4415
4415
  let {
4416
4416
  enableScrollTop = true,
4417
4417
  containerProps = {}
4418
4418
  } = _ref,
4419
- props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
4419
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
4420
4420
  const containerRef = containerProps.ref || useRef();
4421
4421
  useEffect(() => {
4422
4422
  if (enableScrollTop) {
@@ -5054,7 +5054,7 @@ SectionTitle.propTypes = {
5054
5054
  component: PropTypes.string
5055
5055
  };
5056
5056
 
5057
- const _excluded$d = ["title", "subtitle", "children", "display", "format", "renderList", "titleComponent"];
5057
+ const _excluded$e = ["title", "subtitle", "children", "display", "format", "renderList", "titleComponent"];
5058
5058
  const Section = _ref => {
5059
5059
  let {
5060
5060
  title,
@@ -5065,7 +5065,7 @@ const Section = _ref => {
5065
5065
  renderList,
5066
5066
  titleComponent
5067
5067
  } = _ref,
5068
- props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
5068
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
5069
5069
  const containerStyle = {
5070
5070
  boxSizing: "border-box",
5071
5071
  width: "100%",
@@ -5701,7 +5701,7 @@ FullPageViewer.propTypes = {
5701
5701
  onMessage: PropTypes.func
5702
5702
  };
5703
5703
 
5704
- const _excluded$c = ["height", "children", "onScroll", "showTopFade", "showBottomFade", "component", "onScrollReachStart", "onScrollReachEnd"];
5704
+ const _excluded$d = ["height", "children", "onScroll", "showTopFade", "showBottomFade", "component", "onScrollReachStart", "onScrollReachEnd"];
5705
5705
  const useStyles$w = makeStyles(() => ({
5706
5706
  scroller: {
5707
5707
  position: "relative",
@@ -5774,7 +5774,7 @@ const ScrollingContainer = _ref => {
5774
5774
  onScrollReachStart,
5775
5775
  onScrollReachEnd
5776
5776
  } = _ref,
5777
- props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
5777
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
5778
5778
  const classes = useStyles$w();
5779
5779
  const [scrolled, setScrolled] = useState(false);
5780
5780
  const rootStyle = {
@@ -7530,7 +7530,7 @@ var dataSourceManager = {
7530
7530
  getDataSourceUrl: getDataSourceUrl
7531
7531
  };
7532
7532
 
7533
- const _excluded$b = ["clearOnChange", "minimumLength"];
7533
+ const _excluded$c = ["clearOnChange", "minimumLength"];
7534
7534
  const WAIT_INTERVAL = 1000;
7535
7535
  const ENTER_KEY = 13;
7536
7536
  const TextSearch$1 = _ref => {
@@ -7538,7 +7538,7 @@ const TextSearch$1 = _ref => {
7538
7538
  clearOnChange,
7539
7539
  minimumLength
7540
7540
  } = _ref,
7541
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
7541
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
7542
7542
  const [value, setValue] = useState("");
7543
7543
  const [timer, setTimer] = useState(null);
7544
7544
  const handleChange = e => {
@@ -7730,7 +7730,7 @@ const mapFilters = newFilters => {
7730
7730
  return mappedFilters;
7731
7731
  };
7732
7732
 
7733
- const _excluded$a = ["parentMenuOpen", "label", "rightIcon", "leftIcon", "children", "className", "tabIndex", "ContainerProps"];
7733
+ const _excluded$b = ["parentMenuOpen", "label", "rightIcon", "leftIcon", "children", "className", "tabIndex", "ContainerProps"];
7734
7734
  const useMenuItemStyles = makeStyles(theme => ({
7735
7735
  root: props => ({
7736
7736
  backgroundColor: props.open ? theme.palette.action.hover : "rgba(0,0,0,0)"
@@ -7751,7 +7751,7 @@ const NestedMenuItem = /*#__PURE__*/React.forwardRef(function NestedMenuItem(pro
7751
7751
  tabIndex: tabIndexProp,
7752
7752
  ContainerProps: ContainerPropsProp = {}
7753
7753
  } = props,
7754
- MenuItemProps = _objectWithoutPropertiesLoose(props, _excluded$a);
7754
+ MenuItemProps = _objectWithoutPropertiesLoose(props, _excluded$b);
7755
7755
  const {
7756
7756
  ref: containerRefProp
7757
7757
  } = ContainerPropsProp,
@@ -9027,12 +9027,12 @@ Actions.propTypes = {
9027
9027
  onAction: PropTypes.func
9028
9028
  };
9029
9029
 
9030
- const _excluded$9 = ["hasFilters"];
9030
+ const _excluded$a = ["hasFilters"];
9031
9031
  const RenderFilterButton = /*#__PURE__*/React.forwardRef(function RenderFilterButton(_ref, ref) {
9032
9032
  let {
9033
9033
  hasFilters
9034
9034
  } = _ref,
9035
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
9035
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
9036
9036
  return /*#__PURE__*/jsx(IconButton$1, _extends({}, props, {
9037
9037
  ref: ref,
9038
9038
  children: /*#__PURE__*/jsx(Badge, {
@@ -9125,7 +9125,7 @@ DefaultIconButton.propTypes = {
9125
9125
  onClick: PropTypes.func
9126
9126
  };
9127
9127
 
9128
- const _excluded$8 = ["filterSet", "onClick", "disableSetDefault", "index"];
9128
+ const _excluded$9 = ["filterSet", "onClick", "disableSetDefault", "index"];
9129
9129
  const useStyles$m = makeStyles(theme => ({
9130
9130
  operations: {
9131
9131
  display: "flex",
@@ -9197,7 +9197,7 @@ const Item$1 = /*#__PURE__*/React.forwardRef((_ref, ref) => {
9197
9197
  disableSetDefault,
9198
9198
  index
9199
9199
  } = _ref,
9200
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
9200
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
9201
9201
  const {
9202
9202
  id,
9203
9203
  disabled,
@@ -9253,7 +9253,7 @@ const renderUserDefinedFilters = ({
9253
9253
  index: index
9254
9254
  }, `user-defined-filters-${index}`));
9255
9255
 
9256
- const _excluded$7 = ["filterSet", "onClick", "disableSetDefault", "index"];
9256
+ const _excluded$8 = ["filterSet", "onClick", "disableSetDefault", "index"];
9257
9257
  const useStyles$l = makeStyles(() => ({
9258
9258
  operations: {
9259
9259
  display: "flex",
@@ -9295,7 +9295,7 @@ const Item = /*#__PURE__*/React.forwardRef((_ref, ref) => {
9295
9295
  disableSetDefault,
9296
9296
  index
9297
9297
  } = _ref,
9298
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
9298
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
9299
9299
  const {
9300
9300
  id,
9301
9301
  disabled,
@@ -10447,7 +10447,7 @@ const getInfoTextByFilterAndSortingCount = (filterCount, sortCount) => {
10447
10447
  return `${appliedText} applied to the data`;
10448
10448
  };
10449
10449
 
10450
- const _excluded$6 = ["status", "data", "isFetching", "fetchNextPage", "hasNextPage", "refetch"];
10450
+ const _excluded$7 = ["status", "data", "isFetching", "fetchNextPage", "hasNextPage", "refetch"];
10451
10451
  const useDidMount = () => {
10452
10452
  const didMountRef = useRef(false);
10453
10453
  useEffect(() => {
@@ -10562,7 +10562,7 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
10562
10562
  hasNextPage,
10563
10563
  refetch
10564
10564
  } = _useDataSourceInfinit;
10565
- _objectWithoutPropertiesLoose(_useDataSourceInfinit, _excluded$6);
10565
+ _objectWithoutPropertiesLoose(_useDataSourceInfinit, _excluded$7);
10566
10566
  const isError = useIsError(status);
10567
10567
  const renderReTryButton = useCallback(status => /*#__PURE__*/jsx(Button, {
10568
10568
  onClick: () => refetch(),
@@ -10935,7 +10935,7 @@ const {
10935
10935
  withEvent: withBOPEvent
10936
10936
  } = createComponentEvent();
10937
10937
 
10938
- const _excluded$5 = ["onSubmit", "value", "columns", "filterPanelConfig", "multiple", "dataSource", "confirmButtonText"];
10938
+ const _excluded$6 = ["onSubmit", "value", "columns", "filterPanelConfig", "multiple", "dataSource", "confirmButtonText"];
10939
10939
  const useDialogOpenEventListener$1 = cb => useBOPEventlistener(event => {
10940
10940
  if (event.name === events.OPEN_ENHANCED_SEARCH_DIALOG) cb(event.payload);
10941
10941
  });
@@ -10949,7 +10949,7 @@ const EnhancedSearchDialog = _ref => {
10949
10949
  dataSource,
10950
10950
  confirmButtonText
10951
10951
  } = _ref,
10952
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
10952
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
10953
10953
  const [selection, setSelection] = useState([]);
10954
10954
  const [open, setOpen] = useState(false);
10955
10955
  useDialogOpenEventListener$1(isOpen => setOpen(isOpen));
@@ -11066,7 +11066,7 @@ const useDependencyChange = (callback, currentState) => {
11066
11066
  }
11067
11067
  };
11068
11068
 
11069
- const _excluded$4 = ["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"];
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"];
11070
11070
  const useStyles$f = makeStyles(theme => ({
11071
11071
  menu: {
11072
11072
  textDecoration: "none",
@@ -11129,7 +11129,7 @@ const BusinessObjectPicker = _ref => {
11129
11129
  AddItemFormModalComponent,
11130
11130
  autoCompleteProps = {}
11131
11131
  } = _ref,
11132
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
11132
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
11133
11133
  const classes = useStyles$f();
11134
11134
  // TODO: implement controlled behaviour
11135
11135
  const [value, setValue] = useAutoCompleteValue(props.value, multiple);
@@ -12515,7 +12515,7 @@ CurriculumChart.propTypes = {
12515
12515
  onLoad: PropTypes.func
12516
12516
  };
12517
12517
 
12518
- const _excluded$3 = ["error", "inputFormat", "value", "isControlled", "onChange", "clearable", "disabled", "required", "showButton", "minimumDate", "maximumDate", "inputEndAdornmentText"];
12518
+ const _excluded$4 = ["error", "inputFormat", "value", "isControlled", "onChange", "clearable", "disabled", "required", "showButton", "minimumDate", "maximumDate", "inputEndAdornmentText"];
12519
12519
  const MuiDatePicker = props => {
12520
12520
  const isMobile = useMediaQuery$1(theme => theme.breakpoints.down("md"));
12521
12521
  if (props.type) {
@@ -12555,7 +12555,7 @@ const DatePickerBase = _ref => {
12555
12555
  maximumDate,
12556
12556
  inputEndAdornmentText
12557
12557
  } = _ref,
12558
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
12558
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
12559
12559
  const [value, setValue] = useFormItemState(propsValue, isControlled);
12560
12560
  const handleChange = newValue => {
12561
12561
  !isControlled && setValue(newValue);
@@ -15795,8 +15795,8 @@ ToggleButtonWidget.propTypes = {
15795
15795
  label: PropTypes.any
15796
15796
  };
15797
15797
  ToggleButtonWidget.defaultProps = {};
15798
- const HOCs$d = [...commonWidgetHOCs];
15799
- var ToggleButtonWidget$1 = compose(HOCs$d)(ToggleButtonWidget);
15798
+ const HOCs$e = [...commonWidgetHOCs];
15799
+ var ToggleButtonWidget$1 = compose(HOCs$e)(ToggleButtonWidget);
15800
15800
 
15801
15801
  const DefaultReadOnly = props => {
15802
15802
  return /*#__PURE__*/jsxs(Fragment, {
@@ -15848,7 +15848,7 @@ const withReadyOnly = (ReadOnlyComponent = DefaultReadOnly, options = {
15848
15848
  };
15849
15849
  };
15850
15850
 
15851
- const _excluded$2 = ["value", "inputValue", "onChange", "options", "defaultValue", "onCreateOption", "onDebouncedInputChange", "loading", "status", "optionKey", "createOptionItem", "loadingCreateOption", "onOpen", "createOptionStatus", "disableArrowIcon", "searchCharacterLimit"];
15851
+ const _excluded$3 = ["value", "inputValue", "onChange", "options", "defaultValue", "onCreateOption", "onDebouncedInputChange", "loading", "status", "optionKey", "createOptionItem", "loadingCreateOption", "onOpen", "createOptionStatus", "disableArrowIcon", "searchCharacterLimit"];
15852
15852
  const useStyles$2 = makeStyles(theme => ({
15853
15853
  expand: {
15854
15854
  transform: "rotate(180deg)",
@@ -15908,7 +15908,7 @@ const AutoCompleteBase = /*#__PURE__*/forwardRef(function AutoCompleteBase(props
15908
15908
  disableArrowIcon,
15909
15909
  searchCharacterLimit = 0
15910
15910
  } = props,
15911
- restOfProps = _objectWithoutPropertiesLoose(props, _excluded$2);
15911
+ restOfProps = _objectWithoutPropertiesLoose(props, _excluded$3);
15912
15912
  const classes = useStyles$2();
15913
15913
  const [value, setValue] = useState(defaultValue || valueProp || []);
15914
15914
  const [inputValue, setInputValue] = useState(inputValueProp);
@@ -16354,8 +16354,8 @@ BadgeKeywordField.propTypes = {
16354
16354
  isReadOnly: PropTypes.bool,
16355
16355
  disabled: PropTypes.bool
16356
16356
  };
16357
- const HOCs$c = [...commonFieldHOCs, withReadyOnly(BadgeKeywordFieldReadOnly)];
16358
- var BadgeKeywordField$1 = compose(HOCs$c)(BadgeKeywordField);
16357
+ const HOCs$d = [...commonFieldHOCs, withReadyOnly(BadgeKeywordFieldReadOnly)];
16358
+ var BadgeKeywordField$1 = compose(HOCs$d)(BadgeKeywordField);
16359
16359
 
16360
16360
  const ReadOnlyView = ({
16361
16361
  label,
@@ -16555,10 +16555,10 @@ BusinessObjectPickerField.propTypes = {
16555
16555
  onChange: PropTypes.func
16556
16556
  };
16557
16557
  BusinessObjectPickerField.defaultProps = {};
16558
- const HOCs$b = [...commonFieldHOCs, withReadyOnly(BusinessObjectPickerFieldReadOnly)];
16559
- var BusinessObjectPickerField$1 = compose(HOCs$b)(BusinessObjectPickerField);
16558
+ const HOCs$c = [...commonFieldHOCs, withReadyOnly(BusinessObjectPickerFieldReadOnly)];
16559
+ var BusinessObjectPickerField$1 = compose(HOCs$c)(BusinessObjectPickerField);
16560
16560
 
16561
- const _excluded$1 = ["minimumDate", "maximumDate"],
16561
+ const _excluded$2 = ["minimumDate", "maximumDate"],
16562
16562
  _excluded2 = ["minimumDate", "maximumDate"];
16563
16563
  const getDate$1 = dateStr => {
16564
16564
  try {
@@ -16654,7 +16654,7 @@ const DateRangeField = ({
16654
16654
  minimumDate: startDateMinDate,
16655
16655
  maximumDate: startDateMaxDate
16656
16656
  } = _ref,
16657
- startDateProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
16657
+ startDateProps = _objectWithoutPropertiesLoose(_ref, _excluded$2);
16658
16658
  const _ref2 = (uiSchema == null ? void 0 : uiSchema["ui:endDateProps"]) || {},
16659
16659
  {
16660
16660
  minimumDate: endDateMinDate,
@@ -16704,8 +16704,8 @@ DateRangeField.propTypes = {
16704
16704
  required: PropTypes.bool,
16705
16705
  value: PropTypes.any
16706
16706
  };
16707
- const HOCs$a = [...commonFieldHOCs, withReadyOnly(DateSelectReadOnly$2)];
16708
- var DateRangeField$1 = compose(HOCs$a)(DateRangeField);
16707
+ const HOCs$b = [...commonFieldHOCs, withReadyOnly(DateSelectReadOnly$2)];
16708
+ var DateRangeField$1 = compose(HOCs$b)(DateRangeField);
16709
16709
 
16710
16710
  const useReadOnly = uiSchema => {
16711
16711
  const code = uiSchema == null ? void 0 : uiSchema["eval:readonly"];
@@ -16828,9 +16828,9 @@ const DateSelect = props => {
16828
16828
  if (newDateType != null) {
16829
16829
  setDateType(newDateType);
16830
16830
  if (typeof selectedDate !== "undefined" && selectedDate != null) {
16831
- format(selectedDate, serverSideDateFormat);
16831
+ format$1(selectedDate, serverSideDateFormat);
16832
16832
  onChange({
16833
- date: format(selectedDate, serverSideDateFormat),
16833
+ date: format$1(selectedDate, serverSideDateFormat),
16834
16834
  type: newDateType.type
16835
16835
  });
16836
16836
  }
@@ -16846,7 +16846,7 @@ const DateSelect = props => {
16846
16846
  }
16847
16847
  setSelectedDate(newDate);
16848
16848
  onChange({
16849
- date: format(newDate, serverSideDateFormat),
16849
+ date: format$1(newDate, serverSideDateFormat),
16850
16850
  type: dateType.type
16851
16851
  });
16852
16852
  } else {
@@ -17167,8 +17167,8 @@ Upload.propTypes = {
17167
17167
  acceptedFileTypes: PropTypes.array
17168
17168
  };
17169
17169
 
17170
- const HOCs$9 = [...commonFieldHOCs];
17171
- var UploadField = compose(HOCs$9)(Upload);
17170
+ const HOCs$a = [...commonFieldHOCs];
17171
+ var UploadField = compose(HOCs$a)(Upload);
17172
17172
 
17173
17173
  const renderUserIcon = userType => {
17174
17174
  let iconButton;
@@ -17524,8 +17524,8 @@ const LinkUserFieldReadOnly = props => {
17524
17524
  })]
17525
17525
  });
17526
17526
  };
17527
- const HOCs$8 = [...commonFieldHOCs, withReadyOnly(LinkUserFieldReadOnly)];
17528
- var LinkUserField$1 = compose(HOCs$8)(LinkUserField);
17527
+ const HOCs$9 = [...commonFieldHOCs, withReadyOnly(LinkUserFieldReadOnly)];
17528
+ var LinkUserField$1 = compose(HOCs$9)(LinkUserField);
17529
17529
 
17530
17530
  const withEvalDisable = () => Component => {
17531
17531
  const MemoizedComponent = /*#__PURE__*/React.memo(Component);
@@ -17844,8 +17844,8 @@ SelectField.propTypes = {
17844
17844
  value: PropTypes.any,
17845
17845
  disabled: PropTypes.any
17846
17846
  };
17847
- const HOCs$7 = [...commonWidgetHOCs, withEvalDisable()];
17848
- var SelectField$1 = compose(HOCs$7)(SelectField);
17847
+ const HOCs$8 = [...commonWidgetHOCs, withEvalDisable()];
17848
+ var SelectField$1 = compose(HOCs$8)(SelectField);
17849
17849
 
17850
17850
  // TODO: refactor usage of readonly
17851
17851
  // use the similar usage on each implementation
@@ -18066,8 +18066,8 @@ ArrayTemplateWithReadOnly.propTypes = {
18066
18066
  items: PropTypes.any,
18067
18067
  schema: PropTypes.any
18068
18068
  };
18069
- const HOCs$6 = [withReadyOnly(ArrayTemplateWithReadOnly)];
18070
- var ArrayFieldTemplate$1 = compose(HOCs$6)(ArrayFieldTemplate);
18069
+ const HOCs$7 = [withReadyOnly(ArrayTemplateWithReadOnly)];
18070
+ var ArrayFieldTemplate$1 = compose(HOCs$7)(ArrayFieldTemplate);
18071
18071
 
18072
18072
  // export default withReadyOnly(ArrayFieldTemplate, ArrayTemplateWithReadOnly);
18073
18073
 
@@ -18237,8 +18237,8 @@ DateWidgetRaw.propTypes = {
18237
18237
  required: PropTypes.bool,
18238
18238
  value: PropTypes.any
18239
18239
  };
18240
- const HOCs$5 = [...commonWidgetHOCs, withReadyOnly(DateSelectReadOnly)];
18241
- const DateWidget = compose(HOCs$5)(DateWidgetRaw);
18240
+ const HOCs$6 = [...commonWidgetHOCs, withReadyOnly(DateSelectReadOnly)];
18241
+ const DateWidget = compose(HOCs$6)(DateWidgetRaw);
18242
18242
 
18243
18243
  const getError$1 = errors => {
18244
18244
  if (errors) {
@@ -18255,9 +18255,9 @@ const getError$1 = errors => {
18255
18255
  return null;
18256
18256
  };
18257
18257
 
18258
- const _excluded = ["inputRef"];
18258
+ const _excluded$1 = ["inputRef"];
18259
18259
  const TextMaskCustom = /*#__PURE__*/forwardRef((props, ref) => {
18260
- const other = _objectWithoutPropertiesLoose(props, _excluded);
18260
+ const other = _objectWithoutPropertiesLoose(props, _excluded$1);
18261
18261
  const placeholderChar = "\u2000";
18262
18262
  const pipe = (conformedValue, config) => {
18263
18263
  var indexes = [1, 2, 3, 6, 7, 8, 10, 11, 12, 13];
@@ -18362,8 +18362,1176 @@ const PhoneWidgetReadOnly = props => {
18362
18362
  })]
18363
18363
  });
18364
18364
  };
18365
- const HOCs$4 = [...commonWidgetHOCs, withReadyOnly(PhoneWidgetReadOnly)];
18366
- var PhoneWidget$1 = compose(HOCs$4)(PhoneWidget);
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);
18367
19535
 
18368
19536
  const decodeHtml = html => {
18369
19537
  const textarea = document.createElement("textarea");
@@ -18525,69 +19693,20 @@ const TextareaWidgetReadOnly = props => /*#__PURE__*/jsx(ReadOnlyView, {
18525
19693
  label: props.schema.title,
18526
19694
  value: props.value
18527
19695
  });
18528
- const TextareaWidget = props => {
18529
- // INFO: debouncing added for performance concerns
18530
- const handleChange = useDebounceCallback(e => {
18531
- props.onChange(e.target.value || undefined);
18532
- }, 100);
18533
- const {
18534
- error
18535
- } = useFormControl();
18536
- return /*#__PURE__*/jsx(TextField, {
18537
- id: props.id,
18538
- error: error,
18539
- disabled: props.disabled,
18540
- label: props.schema.title,
18541
- required: props.required,
18542
- defaultValue: props.value
18543
- // INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
18544
- // Once concurrency pattern implemented with React 18, it can be
18545
- // controlled as other fields value={props.value || ""}
18546
- // onChange={(event) => props.onChange(event.target.value || null)}
18547
- ,
18548
- onChange: handleChange,
18549
- autoComplete: "off",
18550
- variant: "outlined",
18551
- InputProps: {
18552
- startAdornment: props.schema.prefix ? /*#__PURE__*/jsx(InputAdornment, {
18553
- position: "start",
18554
- style: {
18555
- fontSize: 12
18556
- },
18557
- children: props.schema.prefix
18558
- }) : null,
18559
- endAdornment: props.schema.suffix ? /*#__PURE__*/jsx(InputAdornment, {
18560
- position: "end",
18561
- style: {
18562
- fontSize: 12
18563
- },
18564
- children: props.schema.suffix
18565
- }) : null
18566
- },
18567
- sx: {
18568
- width: "100%"
18569
- },
18570
- type: props.schema.format,
18571
- placeholder: props.schema.placeholder,
18572
- multiline: true,
18573
- rows: 5
18574
- });
19696
+ TextareaWidgetReadOnly.propTypes = {
19697
+ schema: PropTypes.any,
19698
+ value: PropTypes.any
18575
19699
  };
18576
- TextareaWidget.propTypes = {
18577
- id: PropTypes.any,
18578
- onChange: PropTypes.func,
18579
- rawErrors: PropTypes.array,
18580
- disabled: PropTypes.bool,
18581
- required: PropTypes.any,
18582
- schema: PropTypes.shape({
18583
- disabled: PropTypes.any,
18584
- format: PropTypes.any,
18585
- placeholder: PropTypes.any,
18586
- prefix: PropTypes.any,
18587
- suffix: PropTypes.any,
18588
- title: PropTypes.any
18589
- }),
18590
- 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
+ }));
18591
19710
  };
18592
19711
  const HOCs$2 = [...commonWidgetHOCs, withReadyOnly(TextareaWidgetReadOnly)];
18593
19712
  var TextareaWidget$1 = compose(HOCs$2)(TextareaWidget);
@@ -18600,92 +19719,9 @@ TextWidgetReadOnly.propTypes = {
18600
19719
  schema: PropTypes.any,
18601
19720
  value: PropTypes.any
18602
19721
  };
18603
- const TextWidget = props => {
18604
- var _props$uiSchema$uiOp;
18605
- // INFO: debouncing added for performance concerns
18606
- const handleChange = useDebounceCallback(e => {
18607
- props.onChange(e.target.value || undefined);
18608
- }, 100);
18609
- const {
18610
- error
18611
- } = useFormControl();
18612
- const message = ((_props$uiSchema$uiOp = props.uiSchema["ui:options"]) == null ? void 0 : _props$uiSchema$uiOp.message) || undefined;
18613
- const messageProps = {
18614
- title: (message == null ? void 0 : message.title) || undefined,
18615
- description: (message == null ? void 0 : message.description) || undefined,
18616
- type: (message == null ? void 0 : message.type) || "info",
18617
- canDismiss: (message == null ? void 0 : message.canDismiss) || true
18618
- };
18619
- return /*#__PURE__*/jsxs(Fragment, {
18620
- children: [/*#__PURE__*/jsx(TextField, {
18621
- id: props.id,
18622
- error: error,
18623
- disabled: props.disabled,
18624
- label: props.schema.title,
18625
- required: props.required,
18626
- defaultValue: props.value
18627
- // value={props.value}
18628
- // INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
18629
- // Once concurrency pattern implemented with React 18, it can be
18630
- // controlled as other fields value={props.value || ""}
18631
- // onChange={(event) => props.onChange(event.target.value || null)}
18632
- ,
18633
- onChange: handleChange,
18634
- autoComplete: "off",
18635
- variant: "outlined",
18636
- InputProps: {
18637
- readOnly: props.readonly,
18638
- startAdornment: props.options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
18639
- position: "start",
18640
- style: {
18641
- fontSize: 14
18642
- },
18643
- children: props.options.prefix
18644
- }) : null,
18645
- endAdornment: props.options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
18646
- position: "end",
18647
- style: {
18648
- fontSize: 14
18649
- },
18650
- children: props.options.suffix
18651
- }) : null
18652
- },
18653
- sx: {
18654
- width: "100%"
18655
- },
18656
- type: props.schema.format,
18657
- placeholder: props.schema.placeholder
18658
- }), message && /*#__PURE__*/jsx(Alert, _extends({
18659
- sx: {
18660
- mt: 1
18661
- }
18662
- }, messageProps))]
18663
- });
18664
- };
18665
- TextWidget.defaultProps = {
18666
- uiSchema: {}
18667
- };
18668
- TextWidget.propTypes = {
18669
- disabled: PropTypes.any,
18670
- id: PropTypes.any,
18671
- onChange: PropTypes.func,
18672
- options: PropTypes.shape({
18673
- prefix: PropTypes.any,
18674
- suffix: PropTypes.any
18675
- }),
18676
- rawErrors: PropTypes.array,
18677
- readonly: PropTypes.any,
18678
- required: PropTypes.bool,
18679
- schema: PropTypes.shape({
18680
- format: PropTypes.any,
18681
- placeholder: PropTypes.any,
18682
- title: PropTypes.any
18683
- }),
18684
- uiSchema: PropTypes.any,
18685
- value: PropTypes.any
18686
- };
18687
19722
  const HOCs$1 = [...commonWidgetHOCs, withReadyOnly(TextWidgetReadOnly), withEvalDisable()];
18688
- var TextWidget$1 = compose(HOCs$1)(TextWidget);
19723
+ const TextWidget = compose(HOCs$1)(TextWidgetBase);
19724
+ TextWidget.PropTypes = TextWidgetBase.PropTypes;
18689
19725
 
18690
19726
  const getError = errors => {
18691
19727
  if (errors) {
@@ -18826,11 +19862,12 @@ const defaultWidgets = {
18826
19862
  toggleButton: ToggleButtonWidget$1,
18827
19863
  select: SelectWidget$1,
18828
19864
  LinkedSelects: SelectWidget$1,
18829
- TextWidget: TextWidget$1,
19865
+ TextWidget: TextWidget,
18830
19866
  TextareaWidget: TextareaWidget$1,
18831
19867
  PhoneWidget: PhoneWidget$1,
18832
19868
  ValidateWidget: ValidateWidget$1,
18833
- DateWidget
19869
+ DateWidget,
19870
+ CurrencyWidget: CurrencyWidget$1
18834
19871
  // CheckboxWidget
18835
19872
  };
18836
19873