@reltio/components 1.4.1676 → 1.4.1678

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.
@@ -30,7 +30,6 @@ exports.AttributesErrorsPanel = void 0;
30
30
  var react_1 = __importStar(require("react"));
31
31
  var classnames_1 = __importDefault(require("classnames"));
32
32
  var ui_i18n_1 = __importDefault(require("ui-i18n"));
33
- var ramda_1 = require("ramda");
34
33
  var Warning_1 = __importDefault(require("@mui/icons-material/Warning"));
35
34
  var Error_1 = __importDefault(require("@mui/icons-material/Error"));
36
35
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
@@ -42,7 +41,7 @@ var AttributesErrorsPanel = function (_a) {
42
41
  var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b;
43
42
  var styles = (0, styles_1.default)();
44
43
  var cachedErrors = (0, useCachedErrors_1.useCachedErrors)(attributesWithErrors);
45
- var _c = (0, react_1.useMemo)(function () { return (0, ramda_1.partition)(mdm_sdk_1.isCriticalError, cachedErrors); }, [cachedErrors]), errors = _c[0], warnings = _c[1];
44
+ var _c = (0, react_1.useMemo)(function () { return (0, mdm_sdk_1.splitErrorsBySeverity)(cachedErrors); }, [cachedErrors]), errors = _c[0], warnings = _c[1];
46
45
  var _d = (0, react_1.useState)(null), expandedPanelId = _d[0], setExpandedPanelId = _d[1];
47
46
  var panels = (0, react_1.useMemo)(function () {
48
47
  return [
@@ -1,13 +1,18 @@
1
1
  /// <reference types="react" />
2
+ import Step from '@mui/material/Step';
3
+ type Step = {
4
+ label: string;
5
+ enabled?: boolean;
6
+ hasError?: boolean;
7
+ hasWarning?: boolean;
8
+ };
2
9
  type Props = {
3
10
  activeStep: number;
4
- steps: Array<{
5
- label: string;
6
- enabled?: boolean;
7
- }>;
11
+ steps: Step[];
8
12
  isPending?: boolean;
13
+ shouldCompleteSteps?: boolean;
9
14
  onConfirm?: () => void;
10
15
  onChangeStep: (step: number) => void;
11
16
  };
12
- declare const StepNavigation: ({ activeStep, steps, isPending, onConfirm, onChangeStep }: Props) => JSX.Element;
17
+ declare const StepNavigation: ({ activeStep, steps, isPending, shouldCompleteSteps, onConfirm, onChangeStep }: Props) => JSX.Element;
13
18
  export default StepNavigation;
@@ -9,11 +9,12 @@ var ramda_1 = require("ramda");
9
9
  var Stepper_1 = __importDefault(require("@mui/material/Stepper"));
10
10
  var Step_1 = __importDefault(require("@mui/material/Step"));
11
11
  var StepButton_1 = __importDefault(require("@mui/material/StepButton"));
12
+ var StepLabel_1 = __importDefault(require("@mui/material/StepLabel"));
12
13
  var Button_1 = __importDefault(require("@mui/material/Button"));
13
14
  var ProgressButton_1 = __importDefault(require("./ProgressButton"));
14
15
  var styles_1 = require("./styles");
15
16
  var StepNavigation = function (_a) {
16
- var activeStep = _a.activeStep, steps = _a.steps, _b = _a.isPending, isPending = _b === void 0 ? false : _b, onConfirm = _a.onConfirm, onChangeStep = _a.onChangeStep;
17
+ var activeStep = _a.activeStep, steps = _a.steps, _b = _a.isPending, isPending = _b === void 0 ? false : _b, _c = _a.shouldCompleteSteps, shouldCompleteSteps = _c === void 0 ? true : _c, onConfirm = _a.onConfirm, onChangeStep = _a.onChangeStep;
17
18
  var styles = (0, styles_1.useStyles)();
18
19
  var isLastStep = activeStep === steps.length - 1;
19
20
  var setActiveStep = function (step) {
@@ -49,11 +50,12 @@ var StepNavigation = function (_a) {
49
50
  return (react_1.default.createElement("div", { className: styles.container },
50
51
  react_1.default.createElement("div", { className: styles.placeholder }),
51
52
  react_1.default.createElement(Stepper_1.default, { nonLinear: true, activeStep: activeStep, className: styles.stepper }, steps.map(function (_a, index) {
52
- var label = _a.label, _b = _a.enabled, enabled = _b === void 0 ? true : _b;
53
+ var label = _a.label, _b = _a.enabled, enabled = _b === void 0 ? true : _b, hasError = _a.hasError, hasWarning = _a.hasWarning;
53
54
  var disabledStep = !enabled || isPending;
54
- var completedStep = !disabledStep && index < activeStep;
55
+ var completedStep = shouldCompleteSteps && !disabledStep && index < activeStep;
55
56
  return (react_1.default.createElement(Step_1.default, { key: label, completed: completedStep, disabled: disabledStep },
56
- react_1.default.createElement(StepButton_1.default, { className: styles.stepButton, onClick: function () { return setActiveStep(index); }, "data-reltio-id": "reltio-search-bulk-update-".concat(index) }, label)));
57
+ react_1.default.createElement(StepButton_1.default, { className: styles.stepButton, onClick: function () { return setActiveStep(index); }, "data-reltio-id": "reltio-search-bulk-update-".concat(index) },
58
+ react_1.default.createElement(StepLabel_1.default, { error: hasError || hasWarning, classes: { error: hasError ? styles.errorLabel : styles.warningLabel } }, label))));
57
59
  })),
58
60
  react_1.default.createElement("div", { className: styles.buttons },
59
61
  activeStep > 0 && (react_1.default.createElement(Button_1.default, { variant: "outlined", className: styles.backButton, onClick: function () { return onBack(activeStep); }, disabled: isPending, "data-reltio-id": "reltio-search-bulk-update-back" }, ui_i18n_1.default.text('Back'))),
@@ -1,2 +1,2 @@
1
- declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"progress" | "container" | "placeholder" | "buttons" | "stepper" | "stepButton" | "backButton" | "progressButtonWrapper">;
1
+ declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"progress" | "container" | "placeholder" | "buttons" | "stepper" | "stepButton" | "backButton" | "progressButtonWrapper" | "errorLabel" | "warningLabel">;
2
2
  export { useStyles };
@@ -39,6 +39,12 @@ var useStyles = (0, styles_1.makeStyles)(function () { return ({
39
39
  position: 'absolute',
40
40
  left: 'calc(50% - 12px)',
41
41
  top: 'calc(50% - 12px)'
42
+ },
43
+ errorLabel: {
44
+ color: '#dd2c00 !important'
45
+ },
46
+ warningLabel: {
47
+ color: '#f9a825 !important'
42
48
  }
43
49
  }); });
44
50
  exports.useStyles = useStyles;
@@ -1,10 +1,9 @@
1
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import i18n from 'ui-i18n';
4
- import { partition } from 'ramda';
5
4
  import ErrorIcon from '@mui/icons-material/Warning';
6
5
  import WarningIcon from '@mui/icons-material/Error';
7
- import { isCriticalError } from '@reltio/mdm-sdk';
6
+ import { splitErrorsBySeverity } from '@reltio/mdm-sdk';
8
7
  import { useCachedErrors } from './useCachedErrors';
9
8
  import { ErrorsPanel } from './ErrorsPanel/ErrorsPanel';
10
9
  import { Error } from './ErrorsPanel/Error';
@@ -13,7 +12,7 @@ export var AttributesErrorsPanel = function (_a) {
13
12
  var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b;
14
13
  var styles = useStyles();
15
14
  var cachedErrors = useCachedErrors(attributesWithErrors);
16
- var _c = useMemo(function () { return partition(isCriticalError, cachedErrors); }, [cachedErrors]), errors = _c[0], warnings = _c[1];
15
+ var _c = useMemo(function () { return splitErrorsBySeverity(cachedErrors); }, [cachedErrors]), errors = _c[0], warnings = _c[1];
17
16
  var _d = useState(null), expandedPanelId = _d[0], setExpandedPanelId = _d[1];
18
17
  var panels = useMemo(function () {
19
18
  return [
@@ -1,13 +1,18 @@
1
1
  /// <reference types="react" />
2
+ import Step from '@mui/material/Step';
3
+ type Step = {
4
+ label: string;
5
+ enabled?: boolean;
6
+ hasError?: boolean;
7
+ hasWarning?: boolean;
8
+ };
2
9
  type Props = {
3
10
  activeStep: number;
4
- steps: Array<{
5
- label: string;
6
- enabled?: boolean;
7
- }>;
11
+ steps: Step[];
8
12
  isPending?: boolean;
13
+ shouldCompleteSteps?: boolean;
9
14
  onConfirm?: () => void;
10
15
  onChangeStep: (step: number) => void;
11
16
  };
12
- declare const StepNavigation: ({ activeStep, steps, isPending, onConfirm, onChangeStep }: Props) => JSX.Element;
17
+ declare const StepNavigation: ({ activeStep, steps, isPending, shouldCompleteSteps, onConfirm, onChangeStep }: Props) => JSX.Element;
13
18
  export default StepNavigation;
@@ -4,11 +4,12 @@ import { any, drop, propOr } from 'ramda';
4
4
  import Stepper from '@mui/material/Stepper';
5
5
  import Step from '@mui/material/Step';
6
6
  import StepButton from '@mui/material/StepButton';
7
+ import StepLabel from '@mui/material/StepLabel';
7
8
  import Button from '@mui/material/Button';
8
9
  import ProgressButton from './ProgressButton';
9
10
  import { useStyles } from './styles';
10
11
  var StepNavigation = function (_a) {
11
- var activeStep = _a.activeStep, steps = _a.steps, _b = _a.isPending, isPending = _b === void 0 ? false : _b, onConfirm = _a.onConfirm, onChangeStep = _a.onChangeStep;
12
+ var activeStep = _a.activeStep, steps = _a.steps, _b = _a.isPending, isPending = _b === void 0 ? false : _b, _c = _a.shouldCompleteSteps, shouldCompleteSteps = _c === void 0 ? true : _c, onConfirm = _a.onConfirm, onChangeStep = _a.onChangeStep;
12
13
  var styles = useStyles();
13
14
  var isLastStep = activeStep === steps.length - 1;
14
15
  var setActiveStep = function (step) {
@@ -44,11 +45,12 @@ var StepNavigation = function (_a) {
44
45
  return (React.createElement("div", { className: styles.container },
45
46
  React.createElement("div", { className: styles.placeholder }),
46
47
  React.createElement(Stepper, { nonLinear: true, activeStep: activeStep, className: styles.stepper }, steps.map(function (_a, index) {
47
- var label = _a.label, _b = _a.enabled, enabled = _b === void 0 ? true : _b;
48
+ var label = _a.label, _b = _a.enabled, enabled = _b === void 0 ? true : _b, hasError = _a.hasError, hasWarning = _a.hasWarning;
48
49
  var disabledStep = !enabled || isPending;
49
- var completedStep = !disabledStep && index < activeStep;
50
+ var completedStep = shouldCompleteSteps && !disabledStep && index < activeStep;
50
51
  return (React.createElement(Step, { key: label, completed: completedStep, disabled: disabledStep },
51
- React.createElement(StepButton, { className: styles.stepButton, onClick: function () { return setActiveStep(index); }, "data-reltio-id": "reltio-search-bulk-update-".concat(index) }, label)));
52
+ React.createElement(StepButton, { className: styles.stepButton, onClick: function () { return setActiveStep(index); }, "data-reltio-id": "reltio-search-bulk-update-".concat(index) },
53
+ React.createElement(StepLabel, { error: hasError || hasWarning, classes: { error: hasError ? styles.errorLabel : styles.warningLabel } }, label))));
52
54
  })),
53
55
  React.createElement("div", { className: styles.buttons },
54
56
  activeStep > 0 && (React.createElement(Button, { variant: "outlined", className: styles.backButton, onClick: function () { return onBack(activeStep); }, disabled: isPending, "data-reltio-id": "reltio-search-bulk-update-back" }, i18n.text('Back'))),
@@ -1,2 +1,2 @@
1
- declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"progress" | "container" | "placeholder" | "buttons" | "stepper" | "stepButton" | "backButton" | "progressButtonWrapper">;
1
+ declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"progress" | "container" | "placeholder" | "buttons" | "stepper" | "stepButton" | "backButton" | "progressButtonWrapper" | "errorLabel" | "warningLabel">;
2
2
  export { useStyles };
@@ -36,6 +36,12 @@ var useStyles = makeStyles(function () { return ({
36
36
  position: 'absolute',
37
37
  left: 'calc(50% - 12px)',
38
38
  top: 'calc(50% - 12px)'
39
+ },
40
+ errorLabel: {
41
+ color: '#dd2c00 !important'
42
+ },
43
+ warningLabel: {
44
+ color: '#f9a825 !important'
39
45
  }
40
46
  }); });
41
47
  export { useStyles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1676",
3
+ "version": "1.4.1678",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -8,7 +8,7 @@
8
8
  "@date-io/moment": "^1.3.5",
9
9
  "@fluentui/react-context-selector": "^9.1.26",
10
10
  "@react-google-maps/api": "2.7.0",
11
- "@reltio/mdm-sdk": "^1.4.1676",
11
+ "@reltio/mdm-sdk": "^1.4.1678",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",