aefis-core-ui 2.1.8-rc4 → 2.1.10

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. */
@@ -15273,6 +15278,20 @@ const isNotNegativeNumber = () => fieldValue => {
15273
15278
  if (isValid && parseFloat(fieldValue) < 0) return "should be positive number";
15274
15279
  if (!isValid) return "should be number";
15275
15280
  };
15281
+ const characterLimitLessThan = ruleValue => fieldValue => {
15282
+ // INFO: fasly values ("", undefined, null) are assumed to be to be 0
15283
+ if (!fieldValue) return;
15284
+ const isValid = fieldValue.length < ruleValue;
15285
+ if (!isValid) return `should not exceed ${ruleValue - 1} characters`;
15286
+ };
15287
+ const characterLimitMoreThan = ruleValue => fieldValue => {
15288
+ const message = `should be more than ${ruleValue} characters`;
15289
+
15290
+ // INFO: fasly values ("", undefined, null) are assumed to be to be 0
15291
+ if (!fieldValue) return message;
15292
+ const isValid = fieldValue.length > ruleValue;
15293
+ if (!isValid) return message;
15294
+ };
15276
15295
  const Rules = {
15277
15296
  moreThan,
15278
15297
  moreThanOrEqual,
@@ -15284,7 +15303,9 @@ const Rules = {
15284
15303
  required,
15285
15304
  isInvalidDate,
15286
15305
  isNumber,
15287
- isNotNegativeNumber
15306
+ isNotNegativeNumber,
15307
+ characterLimitLessThan,
15308
+ characterLimitMoreThan
15288
15309
  };
15289
15310
 
15290
15311
  const configurationParameters = {};
@@ -16264,6 +16285,7 @@ const BadgeKeywordFieldReadOnly = props => {
16264
16285
  children: [/*#__PURE__*/jsx(Typography, {
16265
16286
  gutterBottom: true,
16266
16287
  variant: "subtitle2",
16288
+ component: "h2",
16267
16289
  children: props.schema.title
16268
16290
  }), /*#__PURE__*/jsx("div", {
16269
16291
  style: {
@@ -16335,6 +16357,7 @@ const ReadOnlyView = ({
16335
16357
  children: [/*#__PURE__*/jsx(Typography, {
16336
16358
  gutterBottom: true,
16337
16359
  variant: "subtitle2",
16360
+ component: "h2",
16338
16361
  children: label
16339
16362
  }), /*#__PURE__*/jsx(Typography, {
16340
16363
  variant: "h3",
@@ -16349,9 +16372,13 @@ const ReadOnlyView = ({
16349
16372
  const isEmpty = value == undefined || value === "" || Array.isArray(value) && value.length === 0;
16350
16373
  if (isEmpty) {
16351
16374
  const _emptyViewText = emptyViewText || `No data ${multiple ? "selected" : "provided"} for this field`;
16352
- return /*#__PURE__*/jsx(Alert$1, {
16353
- severity: "info",
16354
- children: _emptyViewText
16375
+ return /*#__PURE__*/jsx(Alert, {
16376
+ type: "basic",
16377
+ sx: {
16378
+ fontStyle: "italic"
16379
+ },
16380
+ description: _emptyViewText,
16381
+ showIcon: false
16355
16382
  });
16356
16383
  }
16357
16384
  if (multiple) {
@@ -16372,6 +16399,7 @@ const ReadOnlyView = ({
16372
16399
  return /*#__PURE__*/jsx(Typography, {
16373
16400
  color: "text.secondary",
16374
16401
  variant: "body1",
16402
+ component: "p",
16375
16403
  children: value
16376
16404
  });
16377
16405
  }, [value]);
@@ -16380,6 +16408,7 @@ const ReadOnlyView = ({
16380
16408
  children: [/*#__PURE__*/jsx(Typography, {
16381
16409
  gutterBottom: true,
16382
16410
  variant: "subtitle2",
16411
+ component: "h2",
16383
16412
  children: label
16384
16413
  }), renderValue()]
16385
16414
  });
@@ -16389,7 +16418,8 @@ ReadOnlyView.propTypes = {
16389
16418
  renderValue: PropTypes.func,
16390
16419
  value: PropTypes.any,
16391
16420
  emptyViewText: PropTypes.string,
16392
- multiple: PropTypes.bool
16421
+ multiple: PropTypes.bool,
16422
+ loading: PropTypes.bool
16393
16423
  };
16394
16424
 
16395
16425
  const useSelector = (selector, defaultValue) => {
@@ -18558,6 +18588,7 @@ TextWidgetReadOnly.propTypes = {
18558
18588
  value: PropTypes.any
18559
18589
  };
18560
18590
  const TextWidget = props => {
18591
+ var _props$uiSchema$uiOp;
18561
18592
  // INFO: debouncing added for performance concerns
18562
18593
  const handleChange = useDebounceCallback(e => {
18563
18594
  props.onChange(e.target.value || undefined);
@@ -18565,46 +18596,62 @@ const TextWidget = props => {
18565
18596
  const {
18566
18597
  error
18567
18598
  } = useFormControl();
18568
- return /*#__PURE__*/jsx(TextField, {
18569
- id: props.id,
18570
- error: error,
18571
- disabled: props.disabled,
18572
- label: props.schema.title,
18573
- required: props.required,
18574
- defaultValue: props.value
18575
- // value={props.value}
18576
- // INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
18577
- // Once concurrency pattern implemented with React 18, it can be
18578
- // controlled as other fields value={props.value || ""}
18579
- // onChange={(event) => props.onChange(event.target.value || null)}
18580
- ,
18581
- onChange: handleChange,
18582
- autoComplete: "off",
18583
- variant: "outlined",
18584
- InputProps: {
18585
- readOnly: props.readonly,
18586
- startAdornment: props.options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
18587
- position: "start",
18588
- style: {
18589
- fontSize: 14
18590
- },
18591
- children: props.options.prefix
18592
- }) : null,
18593
- endAdornment: props.options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
18594
- position: "end",
18595
- style: {
18596
- fontSize: 14
18597
- },
18598
- children: props.options.suffix
18599
- }) : null
18600
- },
18601
- sx: {
18602
- width: "100%"
18603
- },
18604
- type: props.schema.format,
18605
- placeholder: props.schema.placeholder
18599
+ const message = ((_props$uiSchema$uiOp = props.uiSchema["ui:options"]) == null ? void 0 : _props$uiSchema$uiOp.message) || undefined;
18600
+ const messageProps = {
18601
+ title: (message == null ? void 0 : message.title) || undefined,
18602
+ description: (message == null ? void 0 : message.description) || undefined,
18603
+ type: (message == null ? void 0 : message.type) || "info",
18604
+ canDismiss: (message == null ? void 0 : message.canDismiss) || true
18605
+ };
18606
+ return /*#__PURE__*/jsxs(Fragment, {
18607
+ children: [/*#__PURE__*/jsx(TextField, {
18608
+ id: props.id,
18609
+ error: error,
18610
+ disabled: props.disabled,
18611
+ label: props.schema.title,
18612
+ required: props.required,
18613
+ defaultValue: props.value
18614
+ // value={props.value}
18615
+ // INFO: for performance concerns, textfield is NOT controlled field. This will prevent his field to be changed outside of
18616
+ // Once concurrency pattern implemented with React 18, it can be
18617
+ // controlled as other fields value={props.value || ""}
18618
+ // onChange={(event) => props.onChange(event.target.value || null)}
18619
+ ,
18620
+ onChange: handleChange,
18621
+ autoComplete: "off",
18622
+ variant: "outlined",
18623
+ InputProps: {
18624
+ readOnly: props.readonly,
18625
+ startAdornment: props.options.prefix ? /*#__PURE__*/jsx(InputAdornment, {
18626
+ position: "start",
18627
+ style: {
18628
+ fontSize: 14
18629
+ },
18630
+ children: props.options.prefix
18631
+ }) : null,
18632
+ endAdornment: props.options.suffix ? /*#__PURE__*/jsx(InputAdornment, {
18633
+ position: "end",
18634
+ style: {
18635
+ fontSize: 14
18636
+ },
18637
+ children: props.options.suffix
18638
+ }) : null
18639
+ },
18640
+ sx: {
18641
+ width: "100%"
18642
+ },
18643
+ type: props.schema.format,
18644
+ placeholder: props.schema.placeholder
18645
+ }), message && /*#__PURE__*/jsx(Alert, _extends({
18646
+ sx: {
18647
+ mt: 1
18648
+ }
18649
+ }, messageProps))]
18606
18650
  });
18607
18651
  };
18652
+ TextWidget.defaultProps = {
18653
+ uiSchema: {}
18654
+ };
18608
18655
  TextWidget.propTypes = {
18609
18656
  disabled: PropTypes.any,
18610
18657
  id: PropTypes.any,
@@ -18621,6 +18668,7 @@ TextWidget.propTypes = {
18621
18668
  placeholder: PropTypes.any,
18622
18669
  title: PropTypes.any
18623
18670
  }),
18671
+ uiSchema: PropTypes.any,
18624
18672
  value: PropTypes.any
18625
18673
  };
18626
18674
  const HOCs$1 = [...commonWidgetHOCs, withReadyOnly(TextWidgetReadOnly), withEvalDisable()];