aefis-core-ui 2.1.8-rc3 → 2.1.8-rc5

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.
@@ -719,7 +719,8 @@ const severityObject = {
719
719
  warning: "warning",
720
720
  error: "error",
721
721
  success: "success",
722
- hint: "info"
722
+ hint: "info",
723
+ basic: "info"
723
724
  };
724
725
  const DismissableAlert = props => {
725
726
  const [open, setOpen] = useState(true);
@@ -781,6 +782,10 @@ const Alert = /*#__PURE__*/forwardRef(function Alert(props, ref) {
781
782
  //style.color = props.variant === "dark" ? "#ffffff" : deepPurple[900];
782
783
  }
783
784
 
785
+ if (props.type === "basic") {
786
+ style.backgroundColor = "transparent";
787
+ style.color = "#757575";
788
+ }
784
789
  return /*#__PURE__*/jsx(Box$1, {
785
790
  sx: {
786
791
  width: "100%"
@@ -815,7 +820,7 @@ Alert.defaultProps = {
815
820
  };
816
821
  Alert.propTypes = {
817
822
  /** The type of alert. */
818
- type: PropTypes.oneOf(["info", "warning", "error", "success", "hint"]),
823
+ type: PropTypes.oneOf(["info", "warning", "error", "success", "hint", "basic"]),
819
824
  /** The color variant of the alert. */
820
825
  variant: PropTypes.oneOf(["dark", "light"]),
821
826
  /** The title to display in the alert. */
@@ -15065,11 +15070,15 @@ const replaceDuplicateColor = data => {
15065
15070
  return data;
15066
15071
  }
15067
15072
  };
15068
- const addPercentValue = data => {
15073
+ const getOverallTotal = data => {
15069
15074
  let overallTotal = 0;
15070
- data.map(r => {
15075
+ data == null ? void 0 : data.map(r => {
15071
15076
  overallTotal = overallTotal + r.total;
15072
15077
  });
15078
+ return overallTotal;
15079
+ };
15080
+ const addPercentValue = data => {
15081
+ const overallTotal = getOverallTotal(data);
15073
15082
  const newRubricObj = [];
15074
15083
  data.map(r => {
15075
15084
  const total = percent(overallTotal, r.total);
@@ -15155,6 +15164,11 @@ const RubricDistributionChart = props => {
15155
15164
  sx: containerSize
15156
15165
  }), rubricsDataWithPercent == null ? void 0 : rubricsDataWithPercent.map((rubric, index) => /*#__PURE__*/jsx(Box$1, {
15157
15166
  className: classes.barProgress,
15167
+ "aria-label": rubric.name,
15168
+ "aria-valuemax": getOverallTotal(rubricsDataWithPercent),
15169
+ "aria-valuenow": rubric.total || 0,
15170
+ "aria-valuemin": 0,
15171
+ role: "progressbar",
15158
15172
  style: barStyle(rubric, index === 0, isLastItemInArray(rubricsDataWithPercent, index)),
15159
15173
  children: /*#__PURE__*/jsx(Typography, {
15160
15174
  sx: {
@@ -16255,6 +16269,7 @@ const BadgeKeywordFieldReadOnly = props => {
16255
16269
  children: [/*#__PURE__*/jsx(Typography, {
16256
16270
  gutterBottom: true,
16257
16271
  variant: "subtitle2",
16272
+ component: "h2",
16258
16273
  children: props.schema.title
16259
16274
  }), /*#__PURE__*/jsx("div", {
16260
16275
  style: {
@@ -16326,6 +16341,7 @@ const ReadOnlyView = ({
16326
16341
  children: [/*#__PURE__*/jsx(Typography, {
16327
16342
  gutterBottom: true,
16328
16343
  variant: "subtitle2",
16344
+ component: "h2",
16329
16345
  children: label
16330
16346
  }), /*#__PURE__*/jsx(Typography, {
16331
16347
  variant: "h3",
@@ -16340,9 +16356,13 @@ const ReadOnlyView = ({
16340
16356
  const isEmpty = value == undefined || value === "" || Array.isArray(value) && value.length === 0;
16341
16357
  if (isEmpty) {
16342
16358
  const _emptyViewText = emptyViewText || `No data ${multiple ? "selected" : "provided"} for this field`;
16343
- return /*#__PURE__*/jsx(Alert$1, {
16344
- severity: "info",
16345
- children: _emptyViewText
16359
+ return /*#__PURE__*/jsx(Alert, {
16360
+ type: "basic",
16361
+ sx: {
16362
+ fontStyle: "italic"
16363
+ },
16364
+ description: _emptyViewText,
16365
+ showIcon: false
16346
16366
  });
16347
16367
  }
16348
16368
  if (multiple) {
@@ -16363,6 +16383,7 @@ const ReadOnlyView = ({
16363
16383
  return /*#__PURE__*/jsx(Typography, {
16364
16384
  color: "text.secondary",
16365
16385
  variant: "body1",
16386
+ component: "p",
16366
16387
  children: value
16367
16388
  });
16368
16389
  }, [value]);
@@ -16371,6 +16392,7 @@ const ReadOnlyView = ({
16371
16392
  children: [/*#__PURE__*/jsx(Typography, {
16372
16393
  gutterBottom: true,
16373
16394
  variant: "subtitle2",
16395
+ component: "h2",
16374
16396
  children: label
16375
16397
  }), renderValue()]
16376
16398
  });
@@ -16380,7 +16402,8 @@ ReadOnlyView.propTypes = {
16380
16402
  renderValue: PropTypes.func,
16381
16403
  value: PropTypes.any,
16382
16404
  emptyViewText: PropTypes.string,
16383
- multiple: PropTypes.bool
16405
+ multiple: PropTypes.bool,
16406
+ loading: PropTypes.bool
16384
16407
  };
16385
16408
 
16386
16409
  const useSelector = (selector, defaultValue) => {
@@ -18549,6 +18572,7 @@ TextWidgetReadOnly.propTypes = {
18549
18572
  value: PropTypes.any
18550
18573
  };
18551
18574
  const TextWidget = props => {
18575
+ var _props$uiSchema$uiOp;
18552
18576
  // INFO: debouncing added for performance concerns
18553
18577
  const handleChange = useDebounceCallback(e => {
18554
18578
  props.onChange(e.target.value || undefined);
@@ -18556,46 +18580,62 @@ const TextWidget = props => {
18556
18580
  const {
18557
18581
  error
18558
18582
  } = useFormControl();
18559
- return /*#__PURE__*/jsx(TextField, {
18560
- id: props.id,
18561
- error: error,
18562
- disabled: props.disabled,
18563
- label: props.schema.title,
18564
- required: props.required,
18565
- defaultValue: props.value
18566
- // value={props.value}
18567
- // INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
18568
- // Once concurrency pattern implemented with React 18, it can be
18569
- // controlled as other fields value={props.value || ""}
18570
- // onChange={(event) => props.onChange(event.target.value || null)}
18571
- ,
18572
- onChange: handleChange,
18573
- autoComplete: "off",
18574
- variant: "outlined",
18575
- InputProps: {
18576
- readOnly: props.readonly,
18577
- startAdornment: props.options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
18578
- position: "start",
18579
- style: {
18580
- fontSize: 14
18581
- },
18582
- children: props.options.prefix
18583
- }) : null,
18584
- endAdornment: props.options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
18585
- position: "end",
18586
- style: {
18587
- fontSize: 14
18588
- },
18589
- children: props.options.suffix
18590
- }) : null
18591
- },
18592
- sx: {
18593
- width: "100%"
18594
- },
18595
- type: props.schema.format,
18596
- placeholder: props.schema.placeholder
18583
+ const message = ((_props$uiSchema$uiOp = props.uiSchema["ui:options"]) == null ? void 0 : _props$uiSchema$uiOp.message) || undefined;
18584
+ const messageProps = {
18585
+ title: (message == null ? void 0 : message.title) || undefined,
18586
+ description: (message == null ? void 0 : message.description) || undefined,
18587
+ type: (message == null ? void 0 : message.type) || "info",
18588
+ canDismiss: (message == null ? void 0 : message.canDismiss) || true
18589
+ };
18590
+ return /*#__PURE__*/jsxs(Fragment, {
18591
+ children: [/*#__PURE__*/jsx(TextField, {
18592
+ id: props.id,
18593
+ error: error,
18594
+ disabled: props.disabled,
18595
+ label: props.schema.title,
18596
+ required: props.required,
18597
+ defaultValue: props.value
18598
+ // value={props.value}
18599
+ // INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
18600
+ // Once concurrency pattern implemented with React 18, it can be
18601
+ // controlled as other fields value={props.value || ""}
18602
+ // onChange={(event) => props.onChange(event.target.value || null)}
18603
+ ,
18604
+ onChange: handleChange,
18605
+ autoComplete: "off",
18606
+ variant: "outlined",
18607
+ InputProps: {
18608
+ readOnly: props.readonly,
18609
+ startAdornment: props.options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
18610
+ position: "start",
18611
+ style: {
18612
+ fontSize: 14
18613
+ },
18614
+ children: props.options.prefix
18615
+ }) : null,
18616
+ endAdornment: props.options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
18617
+ position: "end",
18618
+ style: {
18619
+ fontSize: 14
18620
+ },
18621
+ children: props.options.suffix
18622
+ }) : null
18623
+ },
18624
+ sx: {
18625
+ width: "100%"
18626
+ },
18627
+ type: props.schema.format,
18628
+ placeholder: props.schema.placeholder
18629
+ }), message && /*#__PURE__*/jsx(Alert, _extends({
18630
+ sx: {
18631
+ mt: 1
18632
+ }
18633
+ }, messageProps))]
18597
18634
  });
18598
18635
  };
18636
+ TextWidget.defaultProps = {
18637
+ uiSchema: {}
18638
+ };
18599
18639
  TextWidget.propTypes = {
18600
18640
  disabled: PropTypes.any,
18601
18641
  id: PropTypes.any,
@@ -18612,6 +18652,7 @@ TextWidget.propTypes = {
18612
18652
  placeholder: PropTypes.any,
18613
18653
  title: PropTypes.any
18614
18654
  }),
18655
+ uiSchema: PropTypes.any,
18615
18656
  value: PropTypes.any
18616
18657
  };
18617
18658
  const HOCs$1 = [...commonWidgetHOCs, withReadyOnly(TextWidgetReadOnly), withEvalDisable()];