aefis-core-ui 2.3.0-rc13 → 2.3.0-rc15

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.
@@ -10,6 +10,7 @@ import { red, orange, green, blue, grey, yellow, indigo, purple, cyan, teal, lim
10
10
  import makeStyles$1 from '@mui/styles/makeStyles';
11
11
  import withStyles from '@mui/styles/withStyles';
12
12
  import { useTheme, alpha, createTheme as createTheme$1, ThemeProvider, styled as styled$1, StyledEngineProvider } from '@mui/material/styles';
13
+ import { useFormControl } from '@mui/material/FormControl';
13
14
  import mustache from 'mustache';
14
15
  import { Box as Box$2 } from '@mui/system';
15
16
  import { Skeleton as Skeleton$4, TextField as TextField$1, Box as Box$3 } from '@mui/material/';
@@ -66,18 +67,11 @@ import Nouislider from 'nouislider-react';
66
67
  import 'lodash/camelCase';
67
68
  import debounce from 'lodash/debounce';
68
69
  import StepConnector, { stepConnectorClasses } from '@mui/material/StepConnector';
69
- import DeleteOutlineOutlinedIcon from '@mui/icons-material/DeleteOutlineOutlined';
70
- import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
71
- import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
72
- import '@mui/icons-material/MoreVert';
73
- import produce from 'immer';
74
- import { v4 } from 'uuid';
75
70
  import { MuiForm5 } from '@rjsf/material-ui';
76
71
  import isEmpty from 'lodash/isEmpty';
77
72
  import compose from 'lodash/fp/compose';
78
73
  import Chip$2 from '@mui/material/Chip';
79
74
  import TextField$2 from '@mui/material/TextField';
80
- import { useFormControl } from '@mui/material/FormControl';
81
75
  import get$1 from 'lodash/get';
82
76
  import isPlainObject from 'lodash/isPlainObject';
83
77
  import ToggleButton$1 from '@mui/material/ToggleButton';
@@ -90,7 +84,6 @@ import FilePondPluginImageExifOrientation from 'filepond-plugin-image-exif-orien
90
84
  import FilePondPluginImagePreview from 'filepond-plugin-image-preview';
91
85
  import { registerPlugin, FilePond } from 'react-filepond';
92
86
  import FilePondPluginGetFile from 'filepond-plugin-get-file';
93
- import FilePondPluginFileValidateSize from 'filepond-plugin-file-validate-size';
94
87
  import MaskedInput from 'react-text-mask';
95
88
  import StylesProvider from '@mui/styles/StylesProvider';
96
89
 
@@ -1692,12 +1685,12 @@ const LegacyButtonTheme = createTheme(theme, {
1692
1685
  }
1693
1686
  });
1694
1687
 
1695
- const _excluded$m = ["name"];
1688
+ const _excluded$k = ["name"];
1696
1689
  const Button = /*#__PURE__*/forwardRef(function Button(_ref, ref) {
1697
1690
  let {
1698
1691
  name
1699
1692
  } = _ref,
1700
- props = _objectWithoutPropertiesLoose(_ref, _excluded$m);
1693
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
1701
1694
  const isColorDefault = props.color === undefined || props.color === "default";
1702
1695
  const colorThemeName = isColorDefault ? "grey" : props.color;
1703
1696
  const theme = useTheme$1();
@@ -1790,7 +1783,7 @@ AnimatedExpandMoreIcon.propTypes = {
1790
1783
  sx: PropTypes.any
1791
1784
  };
1792
1785
 
1793
- const _excluded$l = ["name", "icon", "menuConfiguration", "color", "displayType", "variant", "onClick", "link"];
1786
+ const _excluded$j = ["name", "icon", "menuConfiguration", "color", "displayType", "variant", "onClick", "link"];
1794
1787
  const AefisButton = withStyles$1({
1795
1788
  root: {
1796
1789
  "&:focus": {
@@ -1812,7 +1805,7 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(_ref, ref) {
1812
1805
  onClick,
1813
1806
  link
1814
1807
  } = _ref,
1815
- props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
1808
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
1816
1809
  const [anchorEl, setAnchorEl] = useState(null);
1817
1810
  const handleClick = (event, link, buttonId) => {
1818
1811
  setAnchorEl(event.currentTarget);
@@ -1912,12 +1905,7 @@ MenuButton.propTypes = {
1912
1905
  /** Button variant */
1913
1906
  variant: PropTypes.oneOf(["contained", "outlined", "text"]),
1914
1907
  /** The type of the button */
1915
- menuConfiguration: PropTypes.arrayOf(PropTypes.shape({
1916
- name: PropTypes.string,
1917
- icon: PropTypes.any,
1918
- divider: PropTypes.any,
1919
- onClick: PropTypes.function
1920
- })),
1908
+ menuConfiguration: PropTypes.array,
1921
1909
  /** The function to execute when the button is clicked. */
1922
1910
  onClick: PropTypes.func
1923
1911
  };
@@ -1962,23 +1950,30 @@ const useStyles$F = makeStyles(theme => ({
1962
1950
  }));
1963
1951
  const titleProps = {
1964
1952
  color: "textPrimary",
1965
- variant: "h6",
1953
+ variant: "h3",
1966
1954
  style: {
1967
- fontSize: "1.1rem",
1955
+ fontSize: "1.2rem",
1968
1956
  fontWeight: 500,
1969
- lineHeight: 1.43,
1970
- letterSpacing: "0.01071em"
1957
+ lineHeight: 1.3,
1958
+ letterSpacing: 0.5,
1959
+ whiteSpace: "nowrap",
1960
+ overflow: "hidden",
1961
+ textOverflow: "ellipsis"
1971
1962
  }
1972
1963
  };
1973
1964
  const subtitleProps = {
1974
1965
  color: "textSecondary",
1975
- variant: "body1",
1976
1966
  style: {
1977
- fontSize: "0.775rem",
1978
- fontWeight: "bolder",
1967
+ fontSize: "0.875rem",
1968
+ fontWeight: 400,
1969
+ lineHeight: 1.4,
1970
+ letterSpacing: 0,
1979
1971
  display: "inline-flex",
1980
1972
  verticalAlign: "middle",
1981
- alignItems: "center"
1973
+ alignItems: "center",
1974
+ whiteSpace: "nowrap",
1975
+ overflow: "hidden",
1976
+ textOverflow: "ellipsis"
1982
1977
  }
1983
1978
  };
1984
1979
  const getGradientBackgroundColorArray = arrayIndex => {
@@ -2006,20 +2001,6 @@ const ContentBox = props => {
2006
2001
  return props.children ? /*#__PURE__*/React.cloneElement(props.children) : "";
2007
2002
  };
2008
2003
  titleProps.component = props.titleComponent;
2009
- if (props.wrapTitle) {
2010
- titleProps["style"] = _extends({}, titleProps.style, {
2011
- whiteSpace: "nowrap",
2012
- overflow: "hidden",
2013
- textOverflow: "ellipsis"
2014
- });
2015
- }
2016
- if (props.wrapSubtitle) {
2017
- titleProps["style"] = _extends({}, titleProps.style, {
2018
- whiteSpace: "nowrap",
2019
- overflow: "hidden",
2020
- textOverflow: "ellipsis"
2021
- });
2022
- }
2023
2004
  const headerProps = {
2024
2005
  title: props.title,
2025
2006
  disableTypography: false,
@@ -2038,7 +2019,7 @@ const ContentBox = props => {
2038
2019
  }
2039
2020
  if (typeof props.subtitle !== "string" && props.subtitle !== undefined) {
2040
2021
  headerProps.title = /*#__PURE__*/jsx(Typography, {
2041
- variant: "h6",
2022
+ variant: "h3",
2042
2023
  component: props.titleComponent,
2043
2024
  style: titleProps.style,
2044
2025
  display: "block",
@@ -2049,13 +2030,13 @@ const ContentBox = props => {
2049
2030
  headerProps.subheader = props.subtitle;
2050
2031
  }
2051
2032
  if (props.titleBadge) {
2052
- headerProps.title = /*#__PURE__*/jsx(Box$1, {
2033
+ headerProps.title = /*#__PURE__*/jsx("div", {
2053
2034
  children: /*#__PURE__*/jsx(StyledBadge$1, {
2054
2035
  badgeContent: props.titleBadge,
2055
2036
  invisible: invisible,
2056
2037
  color: "secondary",
2057
2038
  children: /*#__PURE__*/jsx(Typography, {
2058
- variant: "h6",
2039
+ variant: "h3",
2059
2040
  component: props.titleComponent,
2060
2041
  style: titleProps.style,
2061
2042
  display: "block",
@@ -2076,13 +2057,12 @@ const ContentBox = props => {
2076
2057
  variant: "body1",
2077
2058
  component: "span",
2078
2059
  noWrap: true,
2079
- color: "textSecondary",
2060
+ sx: {
2061
+ color: "text.secondary"
2062
+ },
2080
2063
  style: {
2081
- fontSize: "0.775rem",
2082
- fontWeight: "bolder",
2083
- display: "inline-flex",
2084
- verticalAlign: "middle",
2085
- alignItems: "center"
2064
+ fontSize: "0.875rem",
2065
+ letterSpacing: 0
2086
2066
  },
2087
2067
  children: props.subtitle
2088
2068
  });
@@ -2094,7 +2074,6 @@ const ContentBox = props => {
2094
2074
  const cardStyle = _extends({
2095
2075
  marginBottom: props.hasGutter ? 8 : 0,
2096
2076
  borderRadius: 16,
2097
- transition: "border 100ms ease-out",
2098
2077
  boxShadow: props.displayType === "outlined" ? "none" : "rgb(58 53 65 / 10%) 0px 2px 10px 0px"
2099
2078
  }, props.cardStyle);
2100
2079
  if (props.displayType === "outlined") {
@@ -2112,7 +2091,7 @@ const ContentBox = props => {
2112
2091
  return /*#__PURE__*/jsxs(Box$1, {
2113
2092
  sx: props.sx,
2114
2093
  style: props.containerStyle,
2115
- children: [props.header && /*#__PURE__*/jsx(Box$1, {
2094
+ children: [props.header && /*#__PURE__*/jsx("div", {
2116
2095
  className: classes.sectionHeader,
2117
2096
  children: /*#__PURE__*/jsx(Typography, {
2118
2097
  variant: "h6",
@@ -2122,7 +2101,7 @@ const ContentBox = props => {
2122
2101
  }), /*#__PURE__*/jsxs(Card, {
2123
2102
  style: cardStyle,
2124
2103
  className: tag.tag,
2125
- children: [useHeaderImage && /*#__PURE__*/jsx(Box$1, {
2104
+ children: [useHeaderImage && /*#__PURE__*/jsx("div", {
2126
2105
  style: imageDivStyle,
2127
2106
  className: classes.imageContainer,
2128
2107
  title: props.title,
@@ -2134,10 +2113,6 @@ const ContentBox = props => {
2134
2113
  image: props.image
2135
2114
  }), props.title && /*#__PURE__*/jsx(CardHeader, _extends({}, headerProps)), props.formatContent && /*#__PURE__*/jsx(CardContent, {
2136
2115
  className: !props.title ? classes.cardContentWithoutTitle : classes.cardContent,
2137
- sx: !props.children && !props.description ? {
2138
- display: "none",
2139
- visibility: "hidden"
2140
- } : undefined,
2141
2116
  children: /*#__PURE__*/jsxs(React.Fragment, {
2142
2117
  children: [props.description && /*#__PURE__*/jsx(Typography, {
2143
2118
  variant: "body2",
@@ -2172,9 +2147,7 @@ ContentBox.defaultProps = {
2172
2147
  imageHeight: 150,
2173
2148
  hasGutter: true,
2174
2149
  imageBackgroundColor: "transparent",
2175
- titleComponent: "div",
2176
- wrapTitle: false,
2177
- wrapSubtitle: false
2150
+ titleComponent: "div"
2178
2151
  };
2179
2152
  ContentBox.propTypes = {
2180
2153
  /** Content of the content box */
@@ -2189,10 +2162,6 @@ ContentBox.propTypes = {
2189
2162
  subtitle: PropTypes.any,
2190
2163
  /** Main title of the content box. Can be a string or any component. */
2191
2164
  title: PropTypes.any,
2192
- /** Wrap the title? */
2193
- wrapTitle: PropTypes.bool,
2194
- /** Wrap the subtitle? */
2195
- wrapSubtitle: PropTypes.bool,
2196
2165
  /** Add a badge to the title of the content box. */
2197
2166
  titleBadge: PropTypes.number,
2198
2167
  /** The component to use to render the title. */
@@ -2280,10 +2249,10 @@ ClickWrapper.propTypes = {
2280
2249
  const Chip = ({
2281
2250
  id,
2282
2251
  colorPalette,
2283
- size,
2252
+ size: _size2 = "medium",
2284
2253
  icon,
2285
2254
  label,
2286
- displayType,
2255
+ displayType: _displayType = "default",
2287
2256
  deleteIcon,
2288
2257
  onDelete,
2289
2258
  canDelete,
@@ -2291,7 +2260,7 @@ const Chip = ({
2291
2260
  }) => {
2292
2261
  const keyValue = useUID();
2293
2262
  const colors = _extends({}, defaultColorPalette, colorPalette);
2294
- const _size = size === "medium" || size === "large" ? "medium" : size;
2263
+ const _size = _size2 === "medium" || _size2 === "large" ? "medium" : _size2;
2295
2264
  const styles = {
2296
2265
  outlined: {
2297
2266
  borderWidth: 2,
@@ -2311,14 +2280,14 @@ const Chip = ({
2311
2280
  }
2312
2281
  };
2313
2282
  let chipStyles = styles.chip;
2314
- if (displayType === "outlined") chipStyles = styles.outlined;
2315
- if (displayType === "withOutline") chipStyles = styles.withOutline;
2283
+ if (_displayType === "outlined") chipStyles = styles.outlined;
2284
+ if (_displayType === "withOutline") chipStyles = styles.withOutline;
2316
2285
  const chipProps = {
2317
2286
  key: id || keyValue,
2318
2287
  icon,
2319
2288
  label,
2320
2289
  sx: chipStyles,
2321
- variant: displayType === "withOutline" ? "default" : displayType,
2290
+ variant: _displayType === "withOutline" ? "default" : _displayType,
2322
2291
  size: _size,
2323
2292
  deleteIcon: deleteIcon || /*#__PURE__*/jsx(ClickWrapper, {
2324
2293
  label: label,
@@ -2335,12 +2304,21 @@ const Chip = ({
2335
2304
  })
2336
2305
  })
2337
2306
  };
2338
- const Chip = () => /*#__PURE__*/jsx(Chip$1, _extends({
2339
- role: role || "presentation",
2340
- "aria-label": label
2341
- }, chipProps, canDelete && {
2342
- onDelete
2343
- }));
2307
+
2308
+ // TODO: create FormChip (or similar) and use contextful version there. Pure
2309
+ // and Contextful component should be seperated
2310
+ const formControl = useFormControl();
2311
+ const _canDelete = canDelete && !(formControl != null && formControl.disabled);
2312
+ const Chip = () => {
2313
+ return /*#__PURE__*/jsx(Chip$1, _extends({
2314
+ role: role || "presentation",
2315
+ "aria-label": label
2316
+ }, chipProps, _canDelete && {
2317
+ onDelete
2318
+ }, {
2319
+ disabled: formControl == null ? void 0 : formControl.disabled
2320
+ }));
2321
+ };
2344
2322
 
2345
2323
  /**return tooltipText ? (
2346
2324
  <Tooltip title={tooltipText}>
@@ -2380,12 +2358,6 @@ Chip.propTypes = {
2380
2358
  /** ARIA Role attribute */
2381
2359
  role: PropTypes.string
2382
2360
  };
2383
- Chip.defaultProps = {
2384
- size: "medium",
2385
- variant: "default",
2386
- canRemove: false,
2387
- displayType: "default"
2388
- };
2389
2361
 
2390
2362
  const colorPalette$v = {
2391
2363
  light: grey[200],
@@ -3463,7 +3435,7 @@ CardSectionTitle$1.propTypes = {
3463
3435
  title: PropTypes.string
3464
3436
  };
3465
3437
 
3466
- const _excluded$k = ["title", "children", "height", "titleComponent"];
3438
+ const _excluded$i = ["title", "children", "height", "titleComponent"];
3467
3439
  const CardSection$1 = _ref => {
3468
3440
  let {
3469
3441
  title,
@@ -3471,7 +3443,7 @@ const CardSection$1 = _ref => {
3471
3443
  height,
3472
3444
  titleComponent
3473
3445
  } = _ref,
3474
- props = _objectWithoutPropertiesLoose(_ref, _excluded$k);
3446
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
3475
3447
  return /*#__PURE__*/jsxs(Box$1, _extends({
3476
3448
  sx: {
3477
3449
  height: height || "inherit"
@@ -3571,7 +3543,7 @@ SvgImage.propTypes = {
3571
3543
  width: PropTypes.any
3572
3544
  };
3573
3545
 
3574
- const _excluded$j = ["source", "description", "width", "height", "decorative", "showSkeleton", "fallbackImage"],
3546
+ const _excluded$h = ["source", "description", "width", "height", "decorative", "showSkeleton", "fallbackImage"],
3575
3547
  _excluded2$1 = ["src", "extension"];
3576
3548
  const RenderImage = _ref => {
3577
3549
  let {
@@ -3583,7 +3555,7 @@ const RenderImage = _ref => {
3583
3555
  showSkeleton,
3584
3556
  fallbackImage
3585
3557
  } = _ref,
3586
- other = _objectWithoutPropertiesLoose(_ref, _excluded$j);
3558
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$h);
3587
3559
  const altText = decorative ? "" : description;
3588
3560
  const role = decorative ? "presentation" : "img";
3589
3561
  const hidden = !!decorative;
@@ -3661,7 +3633,7 @@ Image.propTypes = {
3661
3633
  extension: PropTypes.string
3662
3634
  };
3663
3635
 
3664
- const _excluded$i = ["type"];
3636
+ const _excluded$g = ["type"];
3665
3637
  const imageProps = {
3666
3638
  award: Award,
3667
3639
  building: Building,
@@ -3687,7 +3659,7 @@ const IsometricImage = _ref => {
3687
3659
  let {
3688
3660
  type
3689
3661
  } = _ref,
3690
- other = _objectWithoutPropertiesLoose(_ref, _excluded$i);
3662
+ other = _objectWithoutPropertiesLoose(_ref, _excluded$g);
3691
3663
  const image = getIsometricImage(type);
3692
3664
  return /*#__PURE__*/jsx(Image, _extends({
3693
3665
  src: image
@@ -4370,9 +4342,6 @@ const RenderCard = props => {
4370
4342
  configuration: props.actionsConfiguration,
4371
4343
  data: props.data
4372
4344
  }) : undefined,
4373
- cardStyle: props.cardStyle || undefined,
4374
- containerStyle: props.containerStyle || undefined,
4375
- sx: props.sx || undefined,
4376
4345
  children: /*#__PURE__*/jsxs(Fragment, {
4377
4346
  children: [props.description && /*#__PURE__*/jsx(CardSection, {
4378
4347
  sx: descriptionContainerStyle,
@@ -4406,10 +4375,7 @@ RenderCard.propTypes = {
4406
4375
  avatarIconColor: PropTypes.string,
4407
4376
  gradientColorHeaderImageId: PropTypes.any,
4408
4377
  autoTruncateDescription: PropTypes.bool,
4409
- avatar: PropTypes.any,
4410
- cardStyle: PropTypes.any,
4411
- containerStyle: PropTypes.any,
4412
- sx: PropTypes.object
4378
+ avatar: PropTypes.any
4413
4379
  };
4414
4380
  const BusinessObjectCard = props => {
4415
4381
  return props.displayType === "skeleton" ? /*#__PURE__*/jsx(RenderSkeleton, {
@@ -4454,22 +4420,16 @@ BusinessObjectCard.propTypes = {
4454
4420
  /** Override the avatar with provided avatar object. */
4455
4421
  avatar: PropTypes.any,
4456
4422
  /** Automatically truncate the description. For consistency, this should nearly always be set to "true" */
4457
- autoTruncateDescription: PropTypes.bool,
4458
- /** Additional styles for the card */
4459
- cardStyle: PropTypes.any,
4460
- /** Additional styles for the content box container */
4461
- containerStyle: PropTypes.any,
4462
- /** Additional styles to apply */
4463
- sx: PropTypes.object
4423
+ autoTruncateDescription: PropTypes.bool
4464
4424
  };
4465
4425
 
4466
- const _excluded$h = ["enableScrollTop", "containerProps"];
4426
+ const _excluded$f = ["enableScrollTop", "containerProps"];
4467
4427
  const SwipeableViews = _ref => {
4468
4428
  let {
4469
4429
  enableScrollTop = true,
4470
4430
  containerProps = {}
4471
4431
  } = _ref,
4472
- props = _objectWithoutPropertiesLoose(_ref, _excluded$h);
4432
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
4473
4433
  const containerRef = containerProps.ref || useRef();
4474
4434
  useEffect(() => {
4475
4435
  if (enableScrollTop) {
@@ -5108,7 +5068,7 @@ SectionTitle.propTypes = {
5108
5068
  component: PropTypes.string
5109
5069
  };
5110
5070
 
5111
- const _excluded$g = ["title", "subtitle", "children", "display", "format", "renderList", "titleComponent"];
5071
+ const _excluded$e = ["title", "subtitle", "children", "display", "format", "renderList", "titleComponent"];
5112
5072
  const Section = _ref => {
5113
5073
  let {
5114
5074
  title,
@@ -5119,7 +5079,7 @@ const Section = _ref => {
5119
5079
  renderList,
5120
5080
  titleComponent
5121
5081
  } = _ref,
5122
- props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
5082
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
5123
5083
  const containerStyle = {
5124
5084
  boxSizing: "border-box",
5125
5085
  width: "100%",
@@ -5756,7 +5716,7 @@ FullPageViewer.propTypes = {
5756
5716
  onMessage: PropTypes.func
5757
5717
  };
5758
5718
 
5759
- const _excluded$f = ["height", "children", "onScroll", "showTopFade", "showBottomFade", "component", "onScrollReachStart", "onScrollReachEnd"];
5719
+ const _excluded$d = ["height", "children", "onScroll", "showTopFade", "showBottomFade", "component", "onScrollReachStart", "onScrollReachEnd"];
5760
5720
  const useStyles$w = makeStyles(() => ({
5761
5721
  scroller: {
5762
5722
  position: "relative",
@@ -5829,7 +5789,7 @@ const ScrollingContainer = _ref => {
5829
5789
  onScrollReachStart,
5830
5790
  onScrollReachEnd
5831
5791
  } = _ref,
5832
- props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
5792
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
5833
5793
  const classes = useStyles$w();
5834
5794
  const [scrolled, setScrolled] = useState(false);
5835
5795
  const rootStyle = {
@@ -7580,7 +7540,7 @@ var dataSourceManager = {
7580
7540
  getDataSourceUrl: getDataSourceUrl
7581
7541
  };
7582
7542
 
7583
- const _excluded$e = ["clearOnChange", "minimumLength"];
7543
+ const _excluded$c = ["clearOnChange", "minimumLength"];
7584
7544
  const WAIT_INTERVAL = 1000;
7585
7545
  const ENTER_KEY = 13;
7586
7546
  const TextSearch$1 = _ref => {
@@ -7588,7 +7548,7 @@ const TextSearch$1 = _ref => {
7588
7548
  clearOnChange,
7589
7549
  minimumLength
7590
7550
  } = _ref,
7591
- props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
7551
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
7592
7552
  const [value, setValue] = useState("");
7593
7553
  const [timer, setTimer] = useState(null);
7594
7554
  const handleChange = e => {
@@ -7623,13 +7583,13 @@ const TextSearch$1 = _ref => {
7623
7583
  value: value,
7624
7584
  onKeyDown: handleKeyDown,
7625
7585
  placeholder: props.placeholder,
7626
- sx: _extends({
7586
+ sx: {
7627
7587
  input: {
7628
7588
  "&::placeholder": {
7629
7589
  opacity: 0.7
7630
7590
  }
7631
7591
  }
7632
- }, props.sx)
7592
+ }
7633
7593
  }, props, {
7634
7594
  inputProps: _extends({}, props.inputProps, {
7635
7595
  "aria-label": props.placeholder
@@ -7717,7 +7677,7 @@ const mapFilters = newFilters => {
7717
7677
  return mappedFilters;
7718
7678
  };
7719
7679
 
7720
- const _excluded$d = ["parentMenuOpen", "label", "rightIcon", "leftIcon", "children", "className", "tabIndex", "ContainerProps"];
7680
+ const _excluded$b = ["parentMenuOpen", "label", "rightIcon", "leftIcon", "children", "className", "tabIndex", "ContainerProps"];
7721
7681
  const useMenuItemStyles = makeStyles(theme => ({
7722
7682
  root: props => ({
7723
7683
  backgroundColor: props.open ? theme.palette.action.hover : "rgba(0,0,0,0)"
@@ -7738,7 +7698,7 @@ const NestedMenuItem = /*#__PURE__*/React.forwardRef(function NestedMenuItem(pro
7738
7698
  tabIndex: tabIndexProp,
7739
7699
  ContainerProps: ContainerPropsProp = {}
7740
7700
  } = props,
7741
- MenuItemProps = _objectWithoutPropertiesLoose(props, _excluded$d);
7701
+ MenuItemProps = _objectWithoutPropertiesLoose(props, _excluded$b);
7742
7702
  const {
7743
7703
  ref: containerRefProp
7744
7704
  } = ContainerPropsProp,
@@ -9000,12 +8960,12 @@ Actions.propTypes = {
9000
8960
  onAction: PropTypes.func
9001
8961
  };
9002
8962
 
9003
- const _excluded$c = ["hasFilters"];
8963
+ const _excluded$a = ["hasFilters"];
9004
8964
  const RenderFilterButton = /*#__PURE__*/React.forwardRef(function RenderFilterButton(_ref, ref) {
9005
8965
  let {
9006
8966
  hasFilters
9007
8967
  } = _ref,
9008
- props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
8968
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
9009
8969
  return /*#__PURE__*/jsx(IconButton$1, _extends({}, props, {
9010
8970
  ref: ref,
9011
8971
  children: /*#__PURE__*/jsx(Badge, {
@@ -9098,7 +9058,7 @@ DefaultIconButton.propTypes = {
9098
9058
  onClick: PropTypes.func
9099
9059
  };
9100
9060
 
9101
- const _excluded$b = ["filterSet", "onClick", "disableSetDefault", "index"];
9061
+ const _excluded$9 = ["filterSet", "onClick", "disableSetDefault", "index"];
9102
9062
  const useStyles$m = makeStyles(theme => ({
9103
9063
  operations: {
9104
9064
  display: "flex",
@@ -9170,7 +9130,7 @@ const Item$1 = /*#__PURE__*/React.forwardRef((_ref, ref) => {
9170
9130
  disableSetDefault,
9171
9131
  index
9172
9132
  } = _ref,
9173
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
9133
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
9174
9134
  const {
9175
9135
  id,
9176
9136
  disabled,
@@ -9226,7 +9186,7 @@ const renderUserDefinedFilters = ({
9226
9186
  index: index
9227
9187
  }, `user-defined-filters-${index}`));
9228
9188
 
9229
- const _excluded$a = ["filterSet", "onClick", "disableSetDefault", "index"];
9189
+ const _excluded$8 = ["filterSet", "onClick", "disableSetDefault", "index"];
9230
9190
  const useStyles$l = makeStyles(() => ({
9231
9191
  operations: {
9232
9192
  display: "flex",
@@ -9268,7 +9228,7 @@ const Item = /*#__PURE__*/React.forwardRef((_ref, ref) => {
9268
9228
  disableSetDefault,
9269
9229
  index
9270
9230
  } = _ref,
9271
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
9231
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
9272
9232
  const {
9273
9233
  id,
9274
9234
  disabled,
@@ -10422,7 +10382,7 @@ const getInfoTextByFilterAndSortingCount = (filterCount, sortCount) => {
10422
10382
  return `${appliedText} applied to the data`;
10423
10383
  };
10424
10384
 
10425
- const _excluded$9 = ["status", "data", "isFetching", "fetchNextPage", "hasNextPage", "refetch"];
10385
+ const _excluded$7 = ["status", "data", "isFetching", "fetchNextPage", "hasNextPage", "refetch"];
10426
10386
  const useDidMount = () => {
10427
10387
  const didMountRef = useRef(false);
10428
10388
  useEffect(() => {
@@ -10537,7 +10497,7 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
10537
10497
  hasNextPage,
10538
10498
  refetch
10539
10499
  } = _useDataSourceInfinit;
10540
- _objectWithoutPropertiesLoose(_useDataSourceInfinit, _excluded$9);
10500
+ _objectWithoutPropertiesLoose(_useDataSourceInfinit, _excluded$7);
10541
10501
  const isError = useIsError(status);
10542
10502
  const renderReTryButton = useCallback(status => /*#__PURE__*/jsx(Button, {
10543
10503
  onClick: () => refetch(),
@@ -10704,7 +10664,7 @@ const RichDataTable = /*#__PURE__*/forwardRef(function RichDatatable(props, ref)
10704
10664
  exportOptions: props.exportOptions,
10705
10665
  actions: props.actions && props.actions.length > 0 || props.addAction ? updateActions(props.actions, handleDrawerOpen, enableTableRowAction, selectedRowCount, Add) : undefined,
10706
10666
  onFilterClick: isFilterPanelEnabled ? handleFilterClick : undefined,
10707
- hasFilters: filterPanelState.filterCount > 0 || filterPanelState.sortCount > 0 || !!filterPanelState.searchText,
10667
+ hasFilters: filterPanelState.filterCount > 0 || filterPanelState.sortCount > 0 || filterPanelState.searchText,
10708
10668
  disableFilterButton: isFetching
10709
10669
  }, props.titleAndActionHeaderProps)), /*#__PURE__*/jsx(DataTable, _extends({}, props, {
10710
10670
  tableRef: DataTableRef,
@@ -10919,7 +10879,7 @@ const {
10919
10879
  withEvent: withBOPEvent
10920
10880
  } = createComponentEvent();
10921
10881
 
10922
- const _excluded$8 = ["onSubmit", "value", "columns", "filterPanelConfig", "multiple", "dataSource", "confirmButtonText"];
10882
+ const _excluded$6 = ["onSubmit", "value", "columns", "filterPanelConfig", "multiple", "dataSource", "confirmButtonText"];
10923
10883
  const useDialogOpenEventListener$1 = cb => useBOPEventlistener(event => {
10924
10884
  if (event.name === events.OPEN_ENHANCED_SEARCH_DIALOG) cb(event.payload);
10925
10885
  });
@@ -10933,7 +10893,7 @@ const EnhancedSearchDialog = _ref => {
10933
10893
  dataSource,
10934
10894
  confirmButtonText
10935
10895
  } = _ref,
10936
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$8);
10896
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
10937
10897
  const [selection, setSelection] = useState([]);
10938
10898
  const [open, setOpen] = useState(false);
10939
10899
  useDialogOpenEventListener$1(isOpen => setOpen(isOpen));
@@ -11050,7 +11010,7 @@ const useDependencyChange = (callback, currentState) => {
11050
11010
  }
11051
11011
  };
11052
11012
 
11053
- const _excluded$7 = ["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", "preventHorizontalExpand"];
11013
+ 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"];
11054
11014
  const useStyles$f = makeStyles(theme => ({
11055
11015
  menu: {
11056
11016
  textDecoration: "none",
@@ -11112,10 +11072,9 @@ const BusinessObjectPicker = _ref => {
11112
11072
  enableInfinteScroll,
11113
11073
  renderAddItemForm,
11114
11074
  AddItemFormModalComponent,
11115
- autoCompleteProps = {},
11116
- preventHorizontalExpand = false
11075
+ autoCompleteProps = {}
11117
11076
  } = _ref,
11118
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
11077
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
11119
11078
  const classes = useStyles$f();
11120
11079
  // TODO: implement controlled behaviour
11121
11080
  const [value, setValue] = useAutoCompleteValue(props.value, multiple);
@@ -11318,7 +11277,8 @@ const BusinessObjectPicker = _ref => {
11318
11277
  tooltipText: option.description,
11319
11278
  size: props.size === "medium" || props.size === "small" ? "small" : "large",
11320
11279
  onDelete: () => handleTagDelete(option),
11321
- canDelete: true
11280
+ canDelete: true,
11281
+ displayType: "default"
11322
11282
  })
11323
11283
  }, getKey(option))), [props.size, getKey, getLabel, handleTagDelete]);
11324
11284
  const renderTypeTags = useCallback(value => value.map(option => /*#__PURE__*/jsx(Box$1, {
@@ -11367,7 +11327,11 @@ const BusinessObjectPicker = _ref => {
11367
11327
  value: value,
11368
11328
  renderOption: renderOptionProp || (props.type ? renderBusinessObject : renderOption),
11369
11329
  noOptionsText: status === "error" ? "Error loading options" : "No options",
11370
- getOptionDisabled: optionItem => (optionItem == null ? void 0 : optionItem.__type) === "loadMore" || (optionItem == null ? void 0 : optionItem.__type) === "noOption",
11330
+ getOptionDisabled: optionItem => {
11331
+ if (props.disabled) return true;
11332
+ const type = optionItem == null ? void 0 : optionItem.__type;
11333
+ return type === "loadMore" || type === "noOption";
11334
+ },
11371
11335
  handleHomeEndKeys: true
11372
11336
  // INFO: freeSolo prevents warning:
11373
11337
  // https://stackoverflow.com/questions/61947941/material-ui-autocomplete-warning-the-value-provided-to-autocomplete-is-invalid
@@ -11377,11 +11341,6 @@ const BusinessObjectPicker = _ref => {
11377
11341
  selectOnFocus: false,
11378
11342
  renderTags: renderTags || (props.type ? renderTypeTags : renderCustomTags),
11379
11343
  renderInput: params => /*#__PURE__*/jsx(TextSearch$1, _extends({}, params, props, {
11380
- sx: _extends({}, preventHorizontalExpand && {
11381
- "&>div.MuiInputBase-root": {
11382
- flexWrap: "nowrap !important"
11383
- }
11384
- }),
11385
11344
  type: "text",
11386
11345
  inputProps: _extends({}, params.inputProps, {
11387
11346
  "data-testid": "content-input"
@@ -11400,7 +11359,7 @@ const BusinessObjectPicker = _ref => {
11400
11359
  style: {
11401
11360
  color: red[500]
11402
11361
  }
11403
- }), listSelect !== true && /*#__PURE__*/jsx(IconButton$1, {
11362
+ }), listSelect !== true && /*#__PURE__*/jsx(IconButton, {
11404
11363
  "aria-label": open ? `hide options` : "show options",
11405
11364
  size: "small",
11406
11365
  onClick: () => {
@@ -11413,7 +11372,7 @@ const BusinessObjectPicker = _ref => {
11413
11372
  [classes.expandOpen]: open
11414
11373
  })
11415
11374
  })
11416
- }), enhancedSearch && /*#__PURE__*/jsx(IconButton$1, {
11375
+ }), enhancedSearch && /*#__PURE__*/jsx(IconButton, {
11417
11376
  "aria-label": "search",
11418
11377
  size: "small",
11419
11378
  onKeyDown: handleKeyDown,
@@ -11421,6 +11380,7 @@ const BusinessObjectPicker = _ref => {
11421
11380
  name: events.OPEN_ENHANCED_SEARCH_DIALOG,
11422
11381
  payload: true
11423
11382
  }),
11383
+ disabled: props.disabled,
11424
11384
  children: /*#__PURE__*/jsx(Search, {})
11425
11385
  })]
11426
11386
  })
@@ -11443,13 +11403,14 @@ const BusinessObjectPicker = _ref => {
11443
11403
  flexDirection: "column",
11444
11404
  padding: 1
11445
11405
  },
11446
- children: /*#__PURE__*/jsx(IconButton$1, {
11406
+ children: /*#__PURE__*/jsx(IconButton, {
11447
11407
  onClick: () => {
11448
11408
  eventDispatch({
11449
11409
  name: events.OPEN_ADD_ITEM_DIALOG,
11450
11410
  payload: true
11451
11411
  });
11452
11412
  },
11413
+ disabled: props.disabled,
11453
11414
  children: /*#__PURE__*/jsx(AddIcon, {
11454
11415
  sx: {
11455
11416
  color: "grey"
@@ -11549,9 +11510,7 @@ BusinessObjectPicker.propTypes = {
11549
11510
  /** render prop to handle form content, render function provided onSubmit callback function */
11550
11511
  renderAddItemForm: PropTypes.func,
11551
11512
  /** override props of MUI's AutoComplete components */
11552
- autoCompleteProps: PropTypes.object,
11553
- /** preventHorizontalExpand */
11554
- preventHorizontalExpand: PropTypes.bool
11513
+ autoCompleteProps: PropTypes.object
11555
11514
  };
11556
11515
  BusinessObjectPicker.defaultProps = {
11557
11516
  multiple: false,
@@ -12513,7 +12472,7 @@ CurriculumChart.propTypes = {
12513
12472
  onLoad: PropTypes.func
12514
12473
  };
12515
12474
 
12516
- const _excluded$6 = ["error", "inputFormat", "value", "isControlled", "onChange", "clearable", "disabled", "required", "showButton", "minimumDate", "maximumDate", "inputEndAdornmentText"];
12475
+ const _excluded$4 = ["error", "inputFormat", "value", "isControlled", "onChange", "clearable", "disabled", "required", "showButton", "minimumDate", "maximumDate", "inputEndAdornmentText"];
12517
12476
  const MuiDatePicker = props => {
12518
12477
  const isMobile = useMediaQuery$1(theme => theme.breakpoints.down("md"));
12519
12478
  if (props.type) {
@@ -12553,7 +12512,7 @@ const DatePickerBase = _ref => {
12553
12512
  maximumDate,
12554
12513
  inputEndAdornmentText
12555
12514
  } = _ref,
12556
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
12515
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
12557
12516
  const [value, setValue] = useFormItemState(propsValue, isControlled);
12558
12517
  const handleChange = newValue => {
12559
12518
  !isControlled && setValue(newValue);
@@ -15249,485 +15208,6 @@ RubricDistributionChart.propTypes = {
15249
15208
  titleComponent: PropTypes.oneOf(["h1", "h2", "h3", "h4", "div", "p"])
15250
15209
  };
15251
15210
 
15252
- const _excluded$5 = ["rules"];
15253
- const FieldWrapper = ({
15254
- children
15255
- }) => {
15256
- return /*#__PURE__*/jsx(Box$1, {
15257
- sx: {
15258
- paddingTop: 1,
15259
- overflow: "auto"
15260
- },
15261
- children: children
15262
- });
15263
- };
15264
- const TemplateField = ({
15265
- templateSelectionCode,
15266
- templateOptions,
15267
- templateInputMap,
15268
- onChange
15269
- }) => {
15270
- const data = useMemo(() => templateOptions.map(({
15271
- label,
15272
- code: value
15273
- }) => ({
15274
- label,
15275
- value
15276
- }), [templateOptions]));
15277
- const value = useMemo(() => {
15278
- if (!templateSelectionCode) return undefined;
15279
- return {
15280
- value: templateSelectionCode,
15281
- label: templateInputMap[templateSelectionCode].label
15282
- };
15283
- }, [templateSelectionCode]);
15284
- return /*#__PURE__*/jsx(BusinessObjectPicker$1, {
15285
- multiple: false,
15286
- data: data,
15287
- value: value,
15288
- onChange: onChange,
15289
- optionTemplate: "{{label}}",
15290
- preventHorizontalExpand: true
15291
- });
15292
- };
15293
- function Row({
15294
- groupId,
15295
- index,
15296
- ruleId,
15297
- ruleIndex,
15298
- name: templateSelectionCode,
15299
- // template selection
15300
- value: ruleValue,
15301
- // rule value
15302
- template: ruleTemplate,
15303
- onRuleDelete,
15304
- onTemplateSelect,
15305
- onTemplateValueChange,
15306
- templateInputMap,
15307
- templateOptions
15308
- }) {
15309
- const handleChange = useDebounceCallback((value, template) => {
15310
- onTemplateValueChange({
15311
- value,
15312
- template,
15313
- // TODO: send these as 2nd argument
15314
- groupId,
15315
- ruleId
15316
- // TODO: fix index and ruleIndex lot of re-rendering
15317
- // index,
15318
- // ruleIndex
15319
- });
15320
- });
15321
-
15322
- const templateValueField = useMemo(() => {
15323
- if (!templateSelectionCode) return null;
15324
- const TemplateInputField = templateInputMap[templateSelectionCode].component;
15325
- return /*#__PURE__*/jsx(TemplateInputField, {
15326
- value: ruleValue,
15327
- template: ruleTemplate
15328
- // TODO: add debouncer
15329
- ,
15330
- onChange: handleChange
15331
- });
15332
-
15333
- // TODO: take out index from here together with onChange handler
15334
- // index, ruleIndex,
15335
- }, [groupId, ruleId, templateSelectionCode, ruleValue, ruleTemplate]);
15336
- return /*#__PURE__*/jsxs(Box$1, {
15337
- sx: {
15338
- display: "flex",
15339
- flexWrap: "no-wrap",
15340
- paddingTop: 1
15341
- },
15342
- children: [/*#__PURE__*/jsxs(Grid, {
15343
- sx: {
15344
- flex: 1,
15345
- backgroundColor: "#f9f9f9",
15346
- marginLeft: 1,
15347
- paddingTop: 1,
15348
- paddingLeft: 2,
15349
- paddingBottom: 1,
15350
- paddingRight: 2,
15351
- borderRadius: "8px",
15352
- marginBottom: "4px"
15353
- } // this is for grow
15354
- ,
15355
- container: true,
15356
- rowSpacing: 0.5,
15357
- columnSpacing: 2,
15358
- direction: "row",
15359
- children: [/*#__PURE__*/jsx(Grid, {
15360
- item: true,
15361
- xs: 12,
15362
- sm: 12,
15363
- md: 4,
15364
- style: {
15365
- paddingLeft: 0
15366
- },
15367
- children: /*#__PURE__*/jsx(FieldWrapper, {
15368
- children: /*#__PURE__*/jsx(TemplateField, {
15369
- templateSelectionCode: templateSelectionCode,
15370
- templateInputMap: templateInputMap,
15371
- templateOptions: templateOptions,
15372
- onChange: valueFieldCode => {
15373
- onTemplateSelect({
15374
- templateCode: (valueFieldCode == null ? void 0 : valueFieldCode.value) || null,
15375
- groupId,
15376
- ruleId,
15377
- index,
15378
- ruleIndex
15379
- });
15380
- }
15381
- })
15382
- })
15383
- }), /*#__PURE__*/jsx(Grid, {
15384
- item: true,
15385
- xs: 12,
15386
- sm: 12,
15387
- md: 8,
15388
- children: /*#__PURE__*/jsx(FieldWrapper, {
15389
- children: templateValueField
15390
- })
15391
- })]
15392
- }), /*#__PURE__*/jsx(Box$1, {
15393
- sx: {
15394
- width: "48px",
15395
- marginTop: "22px"
15396
- },
15397
- children: /*#__PURE__*/jsx(MenuButton, {
15398
- displayType: "icon",
15399
- menuConfiguration: [{
15400
- name: "Move Up",
15401
- icon: /*#__PURE__*/jsx(KeyboardArrowUpIcon, {}),
15402
- onClick: () => {}
15403
- }, {
15404
- name: "Move Down",
15405
- icon: /*#__PURE__*/jsx(KeyboardArrowDownIcon, {}),
15406
- onClick: () => {}
15407
- }, {
15408
- name: "Add Rule Below",
15409
- icon: /*#__PURE__*/jsx(AddIcon, {}),
15410
- onClick: () => {}
15411
- }, {
15412
- name: "Delete",
15413
- icon: /*#__PURE__*/jsx(DeleteOutlineOutlinedIcon, {}),
15414
- onClick: () => {
15415
- onRuleDelete({
15416
- ruleId,
15417
- index,
15418
- ruleIndex,
15419
- groupId
15420
- });
15421
- }
15422
- }]
15423
- })
15424
- })]
15425
- });
15426
- }
15427
- const RuleGroup = /*#__PURE__*/memo(_ref => {
15428
- let {
15429
- rules
15430
- } = _ref,
15431
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
15432
- return /*#__PURE__*/jsx(Box$1, {
15433
- sx: {
15434
- paddingBottom: 1
15435
- },
15436
- children: rules.map(({
15437
- id,
15438
- name,
15439
- value,
15440
- template
15441
- }, ruleIndex) => /*#__PURE__*/jsx(Row, _extends({
15442
- name: name,
15443
- value: value,
15444
- template: template,
15445
- ruleIndex: ruleIndex,
15446
- ruleId: id
15447
- }, rest), id))
15448
- });
15449
- });
15450
-
15451
- const RuleGroupFooter = /*#__PURE__*/memo(({
15452
- groupId,
15453
- onGroupDelete,
15454
- onRuleAdd
15455
- }) => /*#__PURE__*/jsx(Box$1, {
15456
- sx: {
15457
- display: "flex",
15458
- justifyContent: "end",
15459
- marginRight: 6
15460
- },
15461
- children: /*#__PURE__*/jsxs(Box$1, {
15462
- sx: {
15463
- display: "flex",
15464
- flexDirection: "row"
15465
- },
15466
- children: [/*#__PURE__*/jsx(Button
15467
- // onClick={onGroupDelete}
15468
- , {
15469
- onClick: () => onGroupDelete({
15470
- groupId
15471
- }),
15472
- startIcon: /*#__PURE__*/jsx(DeleteOutlineOutlinedIcon, {}),
15473
- children: "Delete Group"
15474
- }), /*#__PURE__*/jsx(Button, {
15475
- onClick: () => onRuleAdd({
15476
- groupId
15477
- })
15478
- // onClick={onRuleAdd}
15479
- ,
15480
- startIcon: /*#__PURE__*/jsx(AddIcon, {}),
15481
- children: "Add Rule"
15482
- })]
15483
- })
15484
- }));
15485
-
15486
- const BuilderHeader = /*#__PURE__*/memo(({
15487
- onAdd,
15488
- children
15489
- }) => /*#__PURE__*/jsxs(Box$1, {
15490
- sx: {
15491
- display: "flex"
15492
- },
15493
- children: [/*#__PURE__*/jsx(Box$1, {
15494
- sx: {
15495
- flex: 1
15496
- },
15497
- children: children
15498
- }), /*#__PURE__*/jsx(Box$1, {
15499
- sx: {
15500
- display: "flex",
15501
- justifyContent: "end",
15502
- paddingBottom: 1
15503
- },
15504
- children: /*#__PURE__*/jsx(Button, {
15505
- startIcon: /*#__PURE__*/jsx(AddIcon, {}),
15506
- onClick: onAdd,
15507
- children: "Add Group"
15508
- })
15509
- })]
15510
- }));
15511
-
15512
- const RuleGroupIndex = /*#__PURE__*/memo(({
15513
- onMovePosition,
15514
- groupId,
15515
- index,
15516
- isFirst,
15517
- isLast
15518
- }) => /*#__PURE__*/jsx(Box$1, {
15519
- sx: {
15520
- width: "40px",
15521
- height: "88px"
15522
- },
15523
- children: /*#__PURE__*/jsxs(Box$1, {
15524
- sx: {
15525
- display: "flex",
15526
- flexDirection: "column",
15527
- alignItems: "center",
15528
- position: "relative",
15529
- top: "0px",
15530
- width: "20px"
15531
- },
15532
- children: [/*#__PURE__*/jsx(IconButton$1, {
15533
- sx: {
15534
- visibility: isFirst ? "hidden" : "none"
15535
- },
15536
- "aria-label": "move up",
15537
- onClick: () => onMovePosition({
15538
- groupId,
15539
- index
15540
- }, true),
15541
- children: /*#__PURE__*/jsx(KeyboardArrowUpIcon, {
15542
- sx: {
15543
- color: "grey"
15544
- }
15545
- })
15546
- }), /*#__PURE__*/jsx(Typography, {
15547
- variant: "body1",
15548
- color: "#727373",
15549
- sx: {
15550
- fontWeight: "500"
15551
- },
15552
- children: index + 1
15553
- }), /*#__PURE__*/jsx(IconButton$1, {
15554
- "aria-label": "move down",
15555
- sx: {
15556
- visibility: isLast ? "hidden" : "none"
15557
- },
15558
- onClick: () => onMovePosition({
15559
- groupId,
15560
- index
15561
- }, false),
15562
- children: /*#__PURE__*/jsx(KeyboardArrowDownIcon, {
15563
- sx: {
15564
- color: "grey"
15565
- }
15566
- })
15567
- })]
15568
- })
15569
- }));
15570
-
15571
- const _excluded$4 = ["code"];
15572
- const TextBuilder = /*#__PURE__*/memo(({
15573
- renderHeader,
15574
- templateOptions,
15575
- value: _value = [],
15576
- onChange: _onChange = () => {},
15577
- defaultRule
15578
- }) => {
15579
- const templateInputMap = useMemo(() => templateOptions.reduce((obj, _ref) => {
15580
- let {
15581
- code
15582
- } = _ref,
15583
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
15584
- return _extends({}, obj, {
15585
- [code]: rest
15586
- });
15587
- }, {}), [templateOptions]);
15588
-
15589
- // TODO: change rows => RuleGroups
15590
- const [rows, setRows] = useState(_value);
15591
- const setMutatableRows = useCallback(setterFn => {
15592
- setRows(rows => produce(rows, setterFn));
15593
- }, []);
15594
- useEffect(() => {
15595
- _onChange(rows);
15596
- }, [rows]);
15597
- const handleAddGroup = () => {
15598
- // TODO use setMutatableRows
15599
- setRows([...rows, {
15600
- index: rows.length,
15601
- groupId: v4(),
15602
- rules: [_extends({
15603
- id: v4()
15604
- }, defaultRule)]
15605
- }]);
15606
- };
15607
- const handleGroupDelete = ({
15608
- groupId
15609
- }) => {
15610
- const newRows = rows.filter(row => row.groupId !== groupId);
15611
- setRows(newRows);
15612
- };
15613
- const handleRuleDelete = ({
15614
- index,
15615
- ruleIndex,
15616
- groupId,
15617
- ruleId
15618
- }) => {
15619
- setMutatableRows(groups => {
15620
- groups[index].rules = groups[index].rules.filter(rule => rule.id !== ruleId);
15621
- });
15622
- };
15623
-
15624
- // TODO change name
15625
- const handleRuleTemplateSelect = ({
15626
- groupId,
15627
- index,
15628
- ruleId,
15629
- ruleIndex,
15630
- templateCode
15631
- }) => {
15632
- setMutatableRows(groups => {
15633
- groups[index].rules[ruleIndex].name = templateCode || null;
15634
- groups[index].rules[ruleIndex].value = null;
15635
- groups[index].rules[ruleIndex].template = null;
15636
- });
15637
- };
15638
- const handleRuleTemplateValueChange = ({
15639
- value,
15640
- template,
15641
- groupId,
15642
- index,
15643
- ruleId,
15644
- ruleIndex
15645
- }) => {
15646
- setMutatableRows(groups => {
15647
- const rule = groups.find(group => group.groupId === groupId).rules.find(rule => rule.id === ruleId);
15648
- rule.value = value;
15649
- rule.template = template;
15650
- // groups[index].rules[ruleIndex].value = value;
15651
- // groups[index].rules[ruleIndex].template = template;
15652
- });
15653
- };
15654
-
15655
- const moveGroupPosition = ({
15656
- index
15657
- }, isUp) => {
15658
- const newRows = rows.slice();
15659
- const nextRow = isUp ? index - 1 : index + 1;
15660
- [newRows[index], newRows[nextRow]] = [newRows[nextRow], newRows[index]];
15661
- setRows(newRows);
15662
- };
15663
- const handleAddRule = ({
15664
- groupId
15665
- }) => {
15666
- // TODO use setMutatableRows
15667
- const newRules = rows.map(row => {
15668
- if (row.groupId !== groupId) return row;
15669
- return _extends({}, row, {
15670
- rules: [...row.rules, _extends({
15671
- id: v4()
15672
- }, defaultRule)]
15673
- });
15674
- });
15675
- setRows(newRules);
15676
- };
15677
- return /*#__PURE__*/jsxs(ContentBox, {
15678
- sx: {
15679
- ".MuiFormControl-root": {
15680
- background: "white"
15681
- }
15682
- },
15683
- children: [/*#__PURE__*/jsx(BuilderHeader, {
15684
- onAdd: handleAddGroup,
15685
- children: renderHeader()
15686
- }), rows.map(({
15687
- groupId,
15688
- rules
15689
- }, index) => /*#__PURE__*/jsx(ContentBox, {
15690
- displayType: "outlined",
15691
- sx: {
15692
- paddingBottom: 2
15693
- },
15694
- children: /*#__PURE__*/jsxs(Box$1, {
15695
- sx: {
15696
- display: "flex",
15697
- flexWrap: "no-wrap",
15698
- border: "1px solid transparent"
15699
- },
15700
- children: [/*#__PURE__*/jsx(RuleGroupIndex, {
15701
- onMovePosition: moveGroupPosition,
15702
- isFirst: index === 0,
15703
- isLast: index === rows.length - 1,
15704
- index: index,
15705
- groupId: groupId
15706
- }), /*#__PURE__*/jsxs(Box$1, {
15707
- sx: {
15708
- flex: 1
15709
- },
15710
- children: [/*#__PURE__*/jsx(RuleGroup, {
15711
- index: index,
15712
- rules: rules,
15713
- groupId: groupId,
15714
- templateOptions: templateOptions,
15715
- templateInputMap: templateInputMap,
15716
- onRuleDelete: handleRuleDelete,
15717
- onTemplateSelect: handleRuleTemplateSelect,
15718
- onTemplateValueChange: handleRuleTemplateValueChange
15719
- }), /*#__PURE__*/jsx(RuleGroupFooter, {
15720
- groupIndex: index,
15721
- groupId: groupId,
15722
- onGroupDelete: handleGroupDelete,
15723
- onRuleAdd: handleAddRule
15724
- })]
15725
- })]
15726
- })
15727
- }, groupId))]
15728
- });
15729
- });
15730
-
15731
15211
  const moreThan = ruleValue => ({
15732
15212
  fieldValue
15733
15213
  }) => {
@@ -17096,6 +16576,14 @@ const render = (value, formState) => {
17096
16576
  }
17097
16577
  return mustache.render(value, formState);
17098
16578
  };
16579
+ const renderUrl = (value, formState) => {
16580
+ if (value === undefined || value === null) {
16581
+ return value;
16582
+ }
16583
+ return decodeHtml$2(mustache.render(value, formState));
16584
+ };
16585
+ const useRenderUrl = template => useSelectFormState(state => renderUrl(template, state));
16586
+ const useRender = template => useSelectFormState(state => render(template, state));
17099
16587
 
17100
16588
  const useQueryTemplateParam = queryTemplate => {
17101
16589
  const selector = useCallback(state => {
@@ -17382,7 +16870,7 @@ const DateSelectReadOnly$1 = ({
17382
16870
  schema
17383
16871
  }) => {
17384
16872
  const value = useMemo(() => {
17385
- if (!(formData != null && formData.date)) return null;
16873
+ if (formData == undefined) return null;
17386
16874
  const date = new Date(formData.date);
17387
16875
  const options = _extends({}, formData.type === "y" && {
17388
16876
  year: "numeric"
@@ -17432,37 +16920,30 @@ const DateSelect = props => {
17432
16920
  rawErrors,
17433
16921
  disabled
17434
16922
  } = props;
16923
+ const [selectedDate, setSelectedDate] = useState(null);
16924
+ const [dateType, setDateType] = useState(dateTypes.day);
17435
16925
  const serverSideDateFormat = "MM-dd-yyyy";
17436
- const [{
17437
- selectedDate,
17438
- dateType
17439
- }, setFieldValue] = useState(() => {
16926
+ useEffect(() => {
17440
16927
  if (formData && typeof formData === "object" && formData.date != undefined) {
17441
- return {
17442
- selectedDate: parse$1(formData.date, serverSideDateFormat, new Date()),
17443
- dateType: findDateType(formData.type)
17444
- };
16928
+ let obj = formData;
16929
+ setDateType(findDateType(obj.type));
16930
+ setSelectedDate(parse$1(obj.date, serverSideDateFormat, new Date()));
17445
16931
  } else {
17446
- return {
17447
- selectedDate: null,
17448
- dateType: formData != null && formData.type ? findDateType(formData.type) : dateTypes.day
17449
- };
16932
+ setDateType(dateTypes.day);
16933
+ setSelectedDate(null);
17450
16934
  }
17451
- });
16935
+ }, [formData]);
17452
16936
  const handleDateTypeChange = (event, newDateType) => {
17453
- // INFO: toggle sends null value on double click
17454
- if (!newDateType) return;
17455
- let newDate = null;
17456
- if (typeof selectedDate !== "undefined" && selectedDate != null) {
17457
- newDate = format$1(selectedDate, serverSideDateFormat);
16937
+ if (newDateType != null) {
16938
+ setDateType(newDateType);
16939
+ if (typeof selectedDate !== "undefined" && selectedDate != null) {
16940
+ format$1(selectedDate, serverSideDateFormat);
16941
+ onChange({
16942
+ date: format$1(selectedDate, serverSideDateFormat),
16943
+ type: newDateType.type
16944
+ });
16945
+ }
17458
16946
  }
17459
- setFieldValue(prev => _extends({}, prev, {
17460
- dateType: newDateType
17461
- }));
17462
- onChange({
17463
- date: newDate,
17464
- type: newDateType.type
17465
- });
17466
16947
  };
17467
16948
  const handleDateChange = newDate => {
17468
16949
  if (newDate != null) {
@@ -17472,17 +16953,13 @@ const DateSelect = props => {
17472
16953
  newDate = setDate(newDate, 1);
17473
16954
  newDate = setMonth(newDate, 0);
17474
16955
  }
17475
- setFieldValue(prev => _extends({}, prev, {
17476
- selectedDate: newDate
17477
- }));
16956
+ setSelectedDate(newDate);
17478
16957
  onChange({
17479
16958
  date: format$1(newDate, serverSideDateFormat),
17480
16959
  type: dateType.type
17481
16960
  });
17482
16961
  } else {
17483
- setFieldValue(prev => _extends({}, prev, {
17484
- selectedDate: null
17485
- }));
16962
+ setSelectedDate(newDate);
17486
16963
  onChange({
17487
16964
  date: null,
17488
16965
  type: dateType.type
@@ -17552,7 +17029,7 @@ const DateSelect = props => {
17552
17029
  inputVariant: "outlined",
17553
17030
  inputFormat: dateType.format,
17554
17031
  views: dateType.views,
17555
- value: selectedDate || null,
17032
+ value: typeof selectedDate === "undefined" ? null : selectedDate,
17556
17033
  onChange: handleDateChange,
17557
17034
  disabled: disabled,
17558
17035
  renderInput: params => /*#__PURE__*/jsx(TextField, _extends({}, params, {
@@ -17562,12 +17039,7 @@ const DateSelect = props => {
17562
17039
  sx: dateInputStyles
17563
17040
  })),
17564
17041
  minDate: minDate,
17565
- maxDate: maxDate,
17566
- componentsProps: {
17567
- actionBar: {
17568
- actions: ["cancel", "clear", "accept"]
17569
- }
17570
- }
17042
+ maxDate: maxDate
17571
17043
  })
17572
17044
  })]
17573
17045
  });
@@ -17607,6 +17079,49 @@ const DisableWrapper = ({
17607
17079
  }));
17608
17080
  };
17609
17081
 
17082
+ const ImageUploadReadOnly = ({
17083
+ formData,
17084
+ schema,
17085
+ uiSchema: _uiSchema = {
17086
+ "ui:options": {}
17087
+ }
17088
+ }) => {
17089
+ const {
17090
+ downloadUrl: downloadUrlTemplate,
17091
+ extension: extensionTemplate
17092
+ } = _uiSchema["ui:options"];
17093
+ const downloadUrl = useRenderUrl(downloadUrlTemplate);
17094
+ const extension = useRender(extensionTemplate);
17095
+ return /*#__PURE__*/jsxs(Fragment, {
17096
+ children: [/*#__PURE__*/jsx(Typography, {
17097
+ gutterBottom: true,
17098
+ variant: "subtitle2",
17099
+ children: schema.title
17100
+ }), /*#__PURE__*/jsx(Paper, {
17101
+ sx: {
17102
+ height: 185,
17103
+ justifyContent: "center",
17104
+ display: "flex",
17105
+ padding: 2,
17106
+ overflow: "hidden"
17107
+ },
17108
+ variant: "outlined",
17109
+ children: /*#__PURE__*/jsx(Image, {
17110
+ src: downloadUrl,
17111
+ style: {
17112
+ height: "100%",
17113
+ width: "auto"
17114
+ },
17115
+ extension: extension
17116
+ })
17117
+ })]
17118
+ });
17119
+ };
17120
+ ImageUploadReadOnly.propTypes = {
17121
+ schema: PropTypes.any,
17122
+ renderedValues: PropTypes.any
17123
+ };
17124
+
17610
17125
  const FieldContainer = props => {
17611
17126
  return /*#__PURE__*/jsx(Box$2, _extends({}, props, {
17612
17127
  sx: _extends({}, props.sx, {
@@ -17618,30 +17133,7 @@ const FieldContainer = props => {
17618
17133
  };
17619
17134
  FieldContainer.propTypes = Box$2.propTypes;
17620
17135
 
17621
- registerPlugin(FilePondPluginFileValidateType, FilePondPluginFileValidateSize, FilePondPluginImageExifOrientation, FilePondPluginImagePreview, FilePondPluginGetFile);
17622
-
17623
- // Check enums below
17624
- // source:https://github.com/pqina/filepond-docs/blob/master/content/patterns/API/filepond-object.md#filepond-status
17625
- const FILE_STATUS = {
17626
- INIT: 1,
17627
- IDLE: 2,
17628
- PROCESSING_QUEUED: 9,
17629
- PROCESSING: 3,
17630
- PROCESSING_COMPLETE: 5,
17631
- // upload complete
17632
- PROCESSING_ERROR: 6,
17633
- PROCESSING_REVERT_ERROR: 10,
17634
- LOADING: 7,
17635
- LOAD_ERROR: 8
17636
- };
17637
- const FILE_ORIGIN = {
17638
- INPUT: 1,
17639
- // add by user
17640
- LIMBO: 2,
17641
- // temp file
17642
- LOCAL: 3 // pre-loaded files
17643
- };
17644
-
17136
+ registerPlugin(FilePondPluginFileValidateType, FilePondPluginImageExifOrientation, FilePondPluginImagePreview, FilePondPluginGetFile);
17645
17137
  const Upload = props => {
17646
17138
  const {
17647
17139
  schema,
@@ -17650,202 +17142,106 @@ const Upload = props => {
17650
17142
  "ui:options": {}
17651
17143
  },
17652
17144
  onChange,
17653
- disabled
17145
+ disabled,
17146
+ required
17654
17147
  } = props;
17655
- const emptyValue = uiSchema["ui:emptyValue"] || null;
17656
17148
  const isReadOnly = useReadOnly();
17657
17149
  const {
17150
+ documentName: documentNameTemplate,
17151
+ downloadUrl: downloadUrlTemplate,
17152
+ extension: extensionTemplate,
17658
17153
  uploadDataSource,
17154
+ mapUploadResponse,
17659
17155
  acceptedFileTypes,
17660
17156
  message,
17661
- // TODO: can be handled generic way with HOC
17662
- isImage = true,
17663
- // multiple = true, // change to false
17664
-
17665
- isPreviewHidden = false,
17666
- idTemplate,
17667
- downloadUrlTemplate,
17668
- nameTemplate,
17669
- mapUploadResponseToIdTemplate,
17670
- maxFiles = 1,
17671
- maxFileSize = null,
17672
- maxTotalFileSize = null
17157
+ isImage
17673
17158
  } = uiSchema["ui:options"];
17674
-
17675
- // TODO: implement single vs multipe mode, currently only multiple is active
17676
- // let _formData = formData; if (multiple && (formData === null ||
17677
- // formData === undefined)) { _formData = [];
17678
- // }
17679
- const _formData = formData || [];
17680
- const initialFiles = useMemo(() => {
17681
- return _formData.map(({
17682
- data
17683
- }) => {
17684
- const id = mustache.render(idTemplate, data);
17685
- const downloadUrl = downloadUrlTemplate ? decodeHtml$2(mustache.render(downloadUrlTemplate, data)) : downloadUrlTemplate;
17686
- const name = mustache.render(nameTemplate, data);
17687
- return {
17688
- // INFO: source appears in preview but also needed to identify
17689
- // the download URL. Check issue:
17690
- // https://github.com/pqina/filepond/issues/284
17691
- source: `${name} id:${id}`,
17692
- options: {
17693
- type: "local",
17694
- origin: downloadUrl,
17695
- // INFO: id is used in getFileIds function
17696
- metadata: {
17697
- url: downloadUrl,
17698
- id
17699
- }
17700
- }
17701
- };
17702
- });
17703
- }, []);
17704
17159
  const inputProps = uiSchema == null ? void 0 : uiSchema["ui:props"];
17705
- const filePondRef = useRef();
17706
- const getFileIds = () => {
17707
- var _filePondRef$current;
17708
- return ((_filePondRef$current = filePondRef.current) == null ? void 0 : _filePondRef$current.getFiles().filter(file => {
17709
- const {
17710
- origin,
17711
- status
17712
- } = file;
17713
- if (origin === FILE_ORIGIN.LOCAL) return true;
17714
- if (origin === FILE_ORIGIN.INPUT && status === FILE_STATUS.PROCESSING_COMPLETE) return true;
17715
- }).map(file => {
17716
- if (file.origin === FILE_ORIGIN.LOCAL) return file.getMetadata().id;
17717
- return file.serverId;
17718
- }).map(i => i.toString())) || [];
17719
- };
17160
+ const documentName = useRender(documentNameTemplate);
17161
+ const downloadUrl = useRenderUrl(downloadUrlTemplate);
17162
+ useRender(extensionTemplate);
17163
+ const [files, setFiles] = useState([]);
17720
17164
  const uploadUrl = useMemo(() => getDataSourceUrl(uploadDataSource), [uploadDataSource]);
17721
- const handleLoad = (source, load, error, progress, abort, headers) => {
17722
- // INFO: source appears in preview but also needed to identify
17723
- // the download URL. Check issue:
17724
- // https://github.com/pqina/filepond/issues/284
17725
- const file = initialFiles.find(item => item.source === source);
17726
- const loadUrl = file.options.origin;
17727
- fetch(loadUrl).then(res => res.blob()).then(res => {
17165
+
17166
+ // INFO: this state is needed to prevent re-load of file during submit
17167
+ const [currentFileId, setCurrentFileId] = useState();
17168
+
17169
+ // TODO: change this to useMemo with help of useLastestDeps
17170
+ useEffect(() => {
17171
+ if (formData === currentFileId) return;
17172
+ const files = [{
17173
+ source: documentName || "File",
17174
+ options: {
17175
+ type: "local",
17176
+ metadata: {
17177
+ url: downloadUrl
17178
+ }
17179
+ }
17180
+ }];
17181
+ if (formData != undefined) setFiles(files);
17182
+ }, [formData]);
17183
+ const handleLoad = (source, load, error) => {
17184
+ fetch(downloadUrl).then(res => res.blob()).then(res => {
17728
17185
  const file = res.type === "jpeg/jfif" || !res.type ? new Blob([res], {
17729
17186
  type: "image/jpeg"
17730
17187
  }) : res;
17731
- const preview = isPreviewHidden ? res : file;
17732
- load(preview);
17188
+ load(file);
17733
17189
  }).catch(error);
17734
-
17735
- // Should expose an abort method so the request can be cancelled
17736
- return {
17737
- abort: () => abort()
17738
- };
17739
17190
  };
17740
17191
  const handleUploadResponse = res => {
17741
17192
  try {
17742
17193
  const jsonRes = JSON.parse(res);
17743
- const id = mustache.render(mapUploadResponseToIdTemplate, jsonRes);
17744
- return id;
17194
+ const fileUuid = mapUploadResponse ? mustache.render(mapUploadResponse.fileUuid, jsonRes) : jsonRes.DATA.fileUuid;
17195
+ setCurrentFileId(fileUuid);
17196
+ onChange(fileUuid);
17745
17197
  } catch (err) {
17746
- var _window$logger;
17747
- (_window$logger = window.logger) == null ? void 0 : _window$logger.sendLog({
17748
- name: `Upload response could not be parsed. ${err}`,
17749
- data: res
17750
- });
17198
+ console.log(err);
17751
17199
  }
17752
17200
  };
17753
-
17754
- // TODO: move to message HOC
17201
+ const handleDelete = () => {
17202
+ setCurrentFileId();
17203
+ setFiles([]);
17204
+ onChange();
17205
+ };
17755
17206
  const messageProps = {
17756
17207
  title: (message == null ? void 0 : message.title) || undefined,
17757
17208
  description: (message == null ? void 0 : message.description) || undefined,
17758
17209
  type: (message == null ? void 0 : message.type) || "info",
17759
17210
  canDismiss: (message == null ? void 0 : message.canDismiss) || true
17760
17211
  };
17761
- const {
17762
- error
17763
- } = useNotify();
17764
- const handleFileChange = () => {
17765
- const ids = getFileIds();
17766
-
17767
- // TODO: fill the data
17768
- const value = ids.map(id => ({
17769
- value: id,
17770
- data: {}
17771
- }));
17772
- if (value.length === 0) onChange(emptyValue);else onChange(value);
17773
- };
17774
-
17775
- // TODO: move to memo component
17776
- const FileUpload = useMemo(() => {
17777
- const styles = isReadOnly ? {
17778
- // INFO: hide drop panel and drop panel
17779
- "div>div>div.filepond--drop-label": {
17780
- display: "none"
17781
- },
17782
- "button.filepond--action-remove-item": {
17783
- display: "none"
17784
- }
17785
- } : null;
17786
- const getAcceptedFileTypes = () => {
17787
- if (acceptedFileTypes) return acceptedFileTypes;
17788
- if (isImage) return ["image/*"];
17789
- return null;
17790
- };
17791
- const filePondProps = {
17792
- acceptedFileTypes: getAcceptedFileTypes(),
17793
- files: initialFiles,
17794
- // files: undefined,
17795
- allowMultiple: true,
17796
- server: {
17797
- url: uploadUrl,
17798
- process: {
17799
- method: "POST",
17800
- headers: {
17801
- Methods: "POST"
17802
- },
17803
- onload: handleUploadResponse,
17804
- onerror: e => {
17805
- var _window$logger2;
17806
- const message = `The image could not be uploaded.`;
17807
- error(message);
17808
- (_window$logger2 = window.logger) == null ? void 0 : _window$logger2.sendLog({
17809
- name: message,
17810
- data: e
17811
- });
17812
- }
17212
+ const filePondProps = {
17213
+ acceptedFileTypes: acceptedFileTypes ? acceptedFileTypes : isImage ? ["image/*"] : null,
17214
+ files,
17215
+ allowMultiple: false,
17216
+ server: {
17217
+ url: uploadUrl,
17218
+ process: {
17219
+ method: "POST",
17220
+ headers: {
17221
+ Methods: "POST"
17813
17222
  },
17814
- load: handleLoad
17223
+ onload: handleUploadResponse
17815
17224
  },
17816
- onprocessfile: () => handleFileChange(),
17817
- onremovefile: () => handleFileChange(),
17818
- maxParallelUploads: 3,
17819
- allowProcess: false,
17820
- disabled: isReadOnly,
17821
- allowDownloadByUrl: true,
17822
- maxFiles: maxFiles,
17823
- maxFileSize,
17824
- maxTotalFileSize,
17825
- // INFO: allowDrop create problem on file type validation //
17826
- // (check badge form), for preview image allowDrop: false, //
17827
- // labelIdle: "Click Here to Browse File(s)" //
17828
- allowFileTypeValidation: false
17829
- };
17830
- const overrideProps = typeof inputProps === "function" ? inputProps(filePondProps) : inputProps;
17831
- return /*#__PURE__*/jsx(Box$1, {
17832
- sx: styles,
17833
- children: /*#__PURE__*/jsx(FilePond, _extends({
17834
- ref: filePondRef
17835
- }, filePondProps, overrideProps))
17836
- });
17837
- }, []);
17838
-
17839
- // TODO: better implementation
17225
+ load: handleLoad,
17226
+ revert: handleDelete
17227
+ },
17228
+ onupdatefiles: files => {
17229
+ if (files.length === 0) {
17230
+ onChange(undefined);
17231
+ }
17232
+ setFiles(files);
17233
+ },
17234
+ allowProcess: false,
17235
+ disabled: isReadOnly,
17236
+ allowDownloadByUrl: true
17237
+ };
17238
+ const overrideProps = typeof inputProps === "function" ? inputProps(filePondProps) : inputProps;
17840
17239
  if (isReadOnly) {
17841
17240
  if (formData == undefined) return /*#__PURE__*/jsx(ReadOnlyView, {
17842
17241
  label: schema.title,
17843
17242
  emptyViewText: "No file uploaded"
17844
17243
  });
17845
- return /*#__PURE__*/jsx(ReadOnlyView, {
17846
- label: schema.title,
17847
- renderValue: () => FileUpload
17848
- });
17244
+ if (isImage) return /*#__PURE__*/jsx(ImageUploadReadOnly, _extends({}, props));
17849
17245
  }
17850
17246
  return /*#__PURE__*/jsxs(FieldContainer, {
17851
17247
  children: [/*#__PURE__*/jsxs(DisableWrapper, {
@@ -17862,7 +17258,7 @@ const Upload = props => {
17862
17258
  sx: {
17863
17259
  marginTop: 1
17864
17260
  },
17865
- children: FileUpload
17261
+ children: /*#__PURE__*/jsx(FilePond, _extends({}, filePondProps, overrideProps))
17866
17262
  })]
17867
17263
  }), message && /*#__PURE__*/jsx(Alert, _extends({}, messageProps))]
17868
17264
  });
@@ -18949,13 +18345,7 @@ const DateWidgetRaw = ({
18949
18345
  required: required,
18950
18346
  onChange: handleChange,
18951
18347
  disabled: disabled
18952
- }, uiSchema == null ? void 0 : uiSchema["ui:props"], {
18953
- componentsProps: {
18954
- actionBar: {
18955
- actions: ["cancel", "clear", "accept"]
18956
- }
18957
- }
18958
- }));
18348
+ }, uiSchema == null ? void 0 : uiSchema["ui:props"]));
18959
18349
  };
18960
18350
  DateWidgetRaw.propTypes = {
18961
18351
  onChange: PropTypes.func,
@@ -20897,5 +20287,5 @@ const DynamicFormHooks = {
20897
20287
  useReadOnly
20898
20288
  };
20899
20289
 
20900
- 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, TextBuilder, 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 };
20290
+ 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 };
20901
20291
  //# sourceMappingURL=index.modern.js.map