@reltio/components 1.4.2287 → 1.4.2289

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.
@@ -4,6 +4,7 @@ type Props = {
4
4
  values: DateValues;
5
5
  onChange: (values: DateValues) => void;
6
6
  onFocus?: () => void;
7
+ maxDate?: Date;
7
8
  };
8
- export declare const CustomDateRangeEditor: ({ values, onChange, onFocus }: Props) => React.JSX.Element;
9
+ export declare const CustomDateRangeEditor: ({ values, onChange, onFocus, maxDate }: Props) => React.JSX.Element;
9
10
  export {};
@@ -15,7 +15,7 @@ var formatValue = function (value, placeholder) {
15
15
  : "".concat(formatDataTypeValue({ dataTypeDefinition: { type: DataTypes.TYPE_ACTIVENESS_DATE } }, value));
16
16
  };
17
17
  export var CustomDateRangeEditor = function (_a) {
18
- var values = _a.values, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? identity : _b;
18
+ var values = _a.values, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? identity : _b, maxDate = _a.maxDate;
19
19
  var placeholder = localeFormat;
20
20
  var inputRef = useRef(null);
21
21
  var _c = useState(false), open = _c[0], setOpen = _c[1];
@@ -50,5 +50,5 @@ export var CustomDateRangeEditor = function (_a) {
50
50
  vertical: 'top',
51
51
  horizontal: 'right'
52
52
  }, elevation: 2 },
53
- React.createElement(DateRangePicker, { values: values, onApply: onApply, type: DataTypes.TYPE_ACTIVENESS_DATE }))));
53
+ React.createElement(DateRangePicker, { values: values, onApply: onApply, type: DataTypes.TYPE_ACTIVENESS_DATE, maxDate: maxDate }))));
54
54
  };
@@ -17,6 +17,7 @@ export var useStyles = makeStyles({
17
17
  backgroundColor: 'rgba(0, 0, 0, 0.03)'
18
18
  },
19
19
  inputUnit: {
20
- width: '100%'
20
+ width: '100%',
21
+ minWidth: 110
21
22
  }
22
23
  });
@@ -4,6 +4,7 @@ type Props = {
4
4
  value: DateRangeFilter;
5
5
  dateRangeTypes?: DateRangeTypes[];
6
6
  onChange: (range: DateRangeFilter) => void;
7
+ maxDate?: Date;
7
8
  };
8
- export declare const DateRangeSelector: ({ value, onChange, dateRangeTypes }: Props) => React.JSX.Element;
9
+ export declare const DateRangeSelector: ({ value, onChange, dateRangeTypes, maxDate }: Props) => React.JSX.Element;
9
10
  export {};
@@ -26,7 +26,7 @@ import { useStyles } from './styles';
26
26
  var emptyDates = [null, null];
27
27
  var emptyInterval = [null, 'minutes'];
28
28
  export var DateRangeSelector = function (_a) {
29
- var value = _a.value, onChange = _a.onChange, dateRangeTypes = _a.dateRangeTypes;
29
+ var value = _a.value, onChange = _a.onChange, dateRangeTypes = _a.dateRangeTypes, maxDate = _a.maxDate;
30
30
  var styles = useStyles();
31
31
  var getInitPeriodByType = function (type) {
32
32
  if ((value === null || value === void 0 ? void 0 : value.type) === type) {
@@ -101,7 +101,7 @@ export var DateRangeSelector = function (_a) {
101
101
  {
102
102
  label: i18n.text('Date range'),
103
103
  type: DateRangeTypes.BETWEEN,
104
- editor: (React.createElement(CustomDateRangeEditor, { values: datesInterval, onChange: changePeriod, onFocus: function () { return changeType(DateRangeTypes.BETWEEN); } })),
104
+ editor: (React.createElement(CustomDateRangeEditor, { values: datesInterval, onChange: changePeriod, onFocus: function () { return changeType(DateRangeTypes.BETWEEN); }, maxDate: maxDate })),
105
105
  className: styles.dateOption
106
106
  }
107
107
  ];
@@ -3,12 +3,17 @@ type AddError = (error: {
3
3
  title: string;
4
4
  message: string;
5
5
  }) => void;
6
+ type Classes = {
7
+ errorBlock?: string;
8
+ errorMessage?: string;
9
+ };
6
10
  type Props = {
7
11
  showErrorFromStore?: boolean;
12
+ classes?: Classes;
8
13
  [key: string]: unknown;
9
14
  };
10
15
  export declare const ErrorPopup: {
11
- ({ showErrorFromStore, ...props }: Props): React.JSX.Element;
16
+ ({ showErrorFromStore, classes, ...props }: Props): React.JSX.Element;
12
17
  addError: AddError;
13
18
  };
14
19
  export {};
@@ -22,16 +22,14 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import React, { useEffect } from 'react';
24
24
  import classnames from 'classnames';
25
- import { path } from 'ramda';
26
25
  import i18n from 'ui-i18n';
27
26
  import Portal from '@mui/material/Portal';
28
27
  import RCErrorPopup from 'react-components/dist/ErrorPopup/ErrorPopup';
29
28
  import { useMdmAction, useMdmAutoCloseInterval, useMdmUiError } from '../contexts/MdmModuleContext';
30
- import { useStyles } from './styles';
29
+ import styles from './ErrorPopup.module.css';
31
30
  var addError = RCErrorPopup.addError;
32
31
  export var ErrorPopup = function (_a) {
33
- var showErrorFromStore = _a.showErrorFromStore, props = __rest(_a, ["showErrorFromStore"]);
34
- var styles = useStyles();
32
+ var showErrorFromStore = _a.showErrorFromStore, classes = _a.classes, props = __rest(_a, ["showErrorFromStore", "classes"]);
35
33
  var errorSet = useMdmAction('errorSet');
36
34
  var autoCloseInterval = useMdmAutoCloseInterval();
37
35
  var uiError = useMdmUiError();
@@ -42,6 +40,9 @@ export var ErrorPopup = function (_a) {
42
40
  }
43
41
  }, [errorSet, uiError, showErrorFromStore]);
44
42
  return (React.createElement(Portal, { container: document.body },
45
- React.createElement(RCErrorPopup, __assign({ classes: { errorBlock: classnames(styles.errorBlock, path(['classes', 'errorBlock'], props)) }, autoCloseInterval: autoCloseInterval }, props))));
43
+ React.createElement(RCErrorPopup, __assign({ autoCloseInterval: autoCloseInterval }, props, { classes: {
44
+ errorBlock: classnames(styles.errorBlock, classes === null || classes === void 0 ? void 0 : classes.errorBlock),
45
+ errorMessage: classnames(styles.errorMessage, classes === null || classes === void 0 ? void 0 : classes.errorMessage)
46
+ } }))));
46
47
  };
47
48
  ErrorPopup.addError = addError;
@@ -0,0 +1,9 @@
1
+ const styles = {"errorBlock":"ErrorPopup-errorBlock--c0C9V","errorMessage":"ErrorPopup-errorMessage--dKa8w"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ErrorPopup-errorBlock--c0C9V{font-family:Roboto,Helvetica,Arial,sans-serif;left:0;margin:0 auto;max-width:1280px;min-height:58px;right:0;width:calc(100% - 64px);z-index:10000}.ErrorPopup-errorMessage--dKa8w{white-space:pre-line}`;
7
+ head.appendChild(style);
8
+ }
9
+ export default styles;
@@ -4,6 +4,7 @@ type Props = {
4
4
  values: DateValues;
5
5
  onChange: (values: DateValues) => void;
6
6
  onFocus?: () => void;
7
+ maxDate?: Date;
7
8
  };
8
- export declare const CustomDateRangeEditor: ({ values, onChange, onFocus }: Props) => React.JSX.Element;
9
+ export declare const CustomDateRangeEditor: ({ values, onChange, onFocus, maxDate }: Props) => React.JSX.Element;
9
10
  export {};
@@ -44,7 +44,7 @@ var formatValue = function (value, placeholder) {
44
44
  : "".concat((0, mdm_sdk_1.formatDataTypeValue)({ dataTypeDefinition: { type: mdm_sdk_1.DataTypes.TYPE_ACTIVENESS_DATE } }, value));
45
45
  };
46
46
  var CustomDateRangeEditor = function (_a) {
47
- var values = _a.values, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? ramda_1.identity : _b;
47
+ var values = _a.values, onChange = _a.onChange, _b = _a.onFocus, onFocus = _b === void 0 ? ramda_1.identity : _b, maxDate = _a.maxDate;
48
48
  var placeholder = localeFormat;
49
49
  var inputRef = (0, react_1.useRef)(null);
50
50
  var _c = (0, react_1.useState)(false), open = _c[0], setOpen = _c[1];
@@ -79,6 +79,6 @@ var CustomDateRangeEditor = function (_a) {
79
79
  vertical: 'top',
80
80
  horizontal: 'right'
81
81
  }, elevation: 2 },
82
- react_1.default.createElement(DateRangePicker_1.DateRangePicker, { values: values, onApply: onApply, type: mdm_sdk_1.DataTypes.TYPE_ACTIVENESS_DATE }))));
82
+ react_1.default.createElement(DateRangePicker_1.DateRangePicker, { values: values, onApply: onApply, type: mdm_sdk_1.DataTypes.TYPE_ACTIVENESS_DATE, maxDate: maxDate }))));
83
83
  };
84
84
  exports.CustomDateRangeEditor = CustomDateRangeEditor;
@@ -20,6 +20,7 @@ exports.useStyles = (0, styles_1.makeStyles)({
20
20
  backgroundColor: 'rgba(0, 0, 0, 0.03)'
21
21
  },
22
22
  inputUnit: {
23
- width: '100%'
23
+ width: '100%',
24
+ minWidth: 110
24
25
  }
25
26
  });
@@ -4,6 +4,7 @@ type Props = {
4
4
  value: DateRangeFilter;
5
5
  dateRangeTypes?: DateRangeTypes[];
6
6
  onChange: (range: DateRangeFilter) => void;
7
+ maxDate?: Date;
7
8
  };
8
- export declare const DateRangeSelector: ({ value, onChange, dateRangeTypes }: Props) => React.JSX.Element;
9
+ export declare const DateRangeSelector: ({ value, onChange, dateRangeTypes, maxDate }: Props) => React.JSX.Element;
9
10
  export {};
@@ -55,7 +55,7 @@ var styles_1 = require("./styles");
55
55
  var emptyDates = [null, null];
56
56
  var emptyInterval = [null, 'minutes'];
57
57
  var DateRangeSelector = function (_a) {
58
- var value = _a.value, onChange = _a.onChange, dateRangeTypes = _a.dateRangeTypes;
58
+ var value = _a.value, onChange = _a.onChange, dateRangeTypes = _a.dateRangeTypes, maxDate = _a.maxDate;
59
59
  var styles = (0, styles_1.useStyles)();
60
60
  var getInitPeriodByType = function (type) {
61
61
  if ((value === null || value === void 0 ? void 0 : value.type) === type) {
@@ -130,7 +130,7 @@ var DateRangeSelector = function (_a) {
130
130
  {
131
131
  label: ui_i18n_1.default.text('Date range'),
132
132
  type: mdm_sdk_1.DateRangeTypes.BETWEEN,
133
- editor: (react_1.default.createElement(CustomDateRangeEditor_1.CustomDateRangeEditor, { values: datesInterval, onChange: changePeriod, onFocus: function () { return changeType(mdm_sdk_1.DateRangeTypes.BETWEEN); } })),
133
+ editor: (react_1.default.createElement(CustomDateRangeEditor_1.CustomDateRangeEditor, { values: datesInterval, onChange: changePeriod, onFocus: function () { return changeType(mdm_sdk_1.DateRangeTypes.BETWEEN); }, maxDate: maxDate })),
134
134
  className: styles.dateOption
135
135
  }
136
136
  ];
@@ -3,12 +3,17 @@ type AddError = (error: {
3
3
  title: string;
4
4
  message: string;
5
5
  }) => void;
6
+ type Classes = {
7
+ errorBlock?: string;
8
+ errorMessage?: string;
9
+ };
6
10
  type Props = {
7
11
  showErrorFromStore?: boolean;
12
+ classes?: Classes;
8
13
  [key: string]: unknown;
9
14
  };
10
15
  export declare const ErrorPopup: {
11
- ({ showErrorFromStore, ...props }: Props): React.JSX.Element;
16
+ ({ showErrorFromStore, classes, ...props }: Props): React.JSX.Element;
12
17
  addError: AddError;
13
18
  };
14
19
  export {};
@@ -51,16 +51,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
51
51
  exports.ErrorPopup = void 0;
52
52
  var react_1 = __importStar(require("react"));
53
53
  var classnames_1 = __importDefault(require("classnames"));
54
- var ramda_1 = require("ramda");
55
54
  var ui_i18n_1 = __importDefault(require("ui-i18n"));
56
55
  var Portal_1 = __importDefault(require("@mui/material/Portal"));
57
56
  var ErrorPopup_1 = __importDefault(require("react-components/dist/ErrorPopup/ErrorPopup"));
58
57
  var MdmModuleContext_1 = require("../contexts/MdmModuleContext");
59
- var styles_1 = require("./styles");
58
+ var ErrorPopup_module_css_1 = __importDefault(require("./ErrorPopup.module.css"));
60
59
  var addError = ErrorPopup_1.default.addError;
61
60
  var ErrorPopup = function (_a) {
62
- var showErrorFromStore = _a.showErrorFromStore, props = __rest(_a, ["showErrorFromStore"]);
63
- var styles = (0, styles_1.useStyles)();
61
+ var showErrorFromStore = _a.showErrorFromStore, classes = _a.classes, props = __rest(_a, ["showErrorFromStore", "classes"]);
64
62
  var errorSet = (0, MdmModuleContext_1.useMdmAction)('errorSet');
65
63
  var autoCloseInterval = (0, MdmModuleContext_1.useMdmAutoCloseInterval)();
66
64
  var uiError = (0, MdmModuleContext_1.useMdmUiError)();
@@ -71,7 +69,10 @@ var ErrorPopup = function (_a) {
71
69
  }
72
70
  }, [errorSet, uiError, showErrorFromStore]);
73
71
  return (react_1.default.createElement(Portal_1.default, { container: document.body },
74
- react_1.default.createElement(ErrorPopup_1.default, __assign({ classes: { errorBlock: (0, classnames_1.default)(styles.errorBlock, (0, ramda_1.path)(['classes', 'errorBlock'], props)) }, autoCloseInterval: autoCloseInterval }, props))));
72
+ react_1.default.createElement(ErrorPopup_1.default, __assign({ autoCloseInterval: autoCloseInterval }, props, { classes: {
73
+ errorBlock: (0, classnames_1.default)(ErrorPopup_module_css_1.default.errorBlock, classes === null || classes === void 0 ? void 0 : classes.errorBlock),
74
+ errorMessage: (0, classnames_1.default)(ErrorPopup_module_css_1.default.errorMessage, classes === null || classes === void 0 ? void 0 : classes.errorMessage)
75
+ } }))));
75
76
  };
76
77
  exports.ErrorPopup = ErrorPopup;
77
78
  exports.ErrorPopup.addError = addError;
@@ -0,0 +1,9 @@
1
+ const styles = {"errorBlock":"ErrorPopup-errorBlock--c0C9V","errorMessage":"ErrorPopup-errorMessage--dKa8w"};
2
+ if (typeof document !== 'undefined') {
3
+ const head = document.head || document.getElementsByTagName('head')[0]
4
+ const style = document.createElement('style');
5
+ style.type = 'text/css'
6
+ style.innerHTML = `.ErrorPopup-errorBlock--c0C9V{font-family:Roboto,Helvetica,Arial,sans-serif;left:0;margin:0 auto;max-width:1280px;min-height:58px;right:0;width:calc(100% - 64px);z-index:10000}.ErrorPopup-errorMessage--dKa8w{white-space:pre-line}`;
7
+ head.appendChild(style);
8
+ }
9
+ module.exports = styles;
@@ -3,4 +3,5 @@ import { RequestStates } from '../../types';
3
3
  export declare const useTenantOptionalParameters: (tenant?: string, apiPath?: string) => {
4
4
  optionalParameters: TenantOptionalParameters;
5
5
  requestState: RequestStates;
6
+ reload: () => void;
6
7
  };
@@ -32,13 +32,14 @@ var useTenantOptionalParameters = function (tenant, apiPath) {
32
32
  setOptionalParameters(null);
33
33
  setRequestState(types_1.RequestStates.ERROR);
34
34
  });
35
- }, [apiPath, tenant]);
35
+ }, [apiPath, tenant, safePromise]);
36
36
  (0, react_1.useEffect)(function () {
37
37
  loadOptionalParameters();
38
38
  }, [loadOptionalParameters]);
39
39
  return (0, react_1.useMemo)(function () { return ({
40
40
  optionalParameters: optionalParameters,
41
- requestState: requestState
42
- }); }, [optionalParameters, requestState]);
41
+ requestState: requestState,
42
+ reload: loadOptionalParameters
43
+ }); }, [optionalParameters, requestState, loadOptionalParameters]);
43
44
  };
44
45
  exports.useTenantOptionalParameters = useTenantOptionalParameters;
@@ -3,4 +3,5 @@ import { RequestStates } from '../../types';
3
3
  export declare const useTenantOptionalParameters: (tenant?: string, apiPath?: string) => {
4
4
  optionalParameters: TenantOptionalParameters;
5
5
  requestState: RequestStates;
6
+ reload: () => void;
6
7
  };
@@ -29,12 +29,13 @@ export var useTenantOptionalParameters = function (tenant, apiPath) {
29
29
  setOptionalParameters(null);
30
30
  setRequestState(RequestStates.ERROR);
31
31
  });
32
- }, [apiPath, tenant]);
32
+ }, [apiPath, tenant, safePromise]);
33
33
  useEffect(function () {
34
34
  loadOptionalParameters();
35
35
  }, [loadOptionalParameters]);
36
36
  return useMemo(function () { return ({
37
37
  optionalParameters: optionalParameters,
38
- requestState: requestState
39
- }); }, [optionalParameters, requestState]);
38
+ requestState: requestState,
39
+ reload: loadOptionalParameters
40
+ }); }, [optionalParameters, requestState, loadOptionalParameters]);
40
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2287",
3
+ "version": "1.4.2289",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -11,7 +11,7 @@
11
11
  "@fluentui/react-context-selector": "^9.1.26",
12
12
  "@googlemaps/markerclusterer": "^2.5.3",
13
13
  "@react-sigma/core": "3.4.0",
14
- "@reltio/mdm-sdk": "^1.4.2059",
14
+ "@reltio/mdm-sdk": "^1.4.2060",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"errorBlock">;
@@ -1,13 +0,0 @@
1
- import { makeStyles } from '@mui/styles';
2
- export var useStyles = makeStyles(function () { return ({
3
- errorBlock: {
4
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
5
- minHeight: '58px',
6
- left: 0,
7
- right: 0,
8
- width: 'calc(100% - 64px)',
9
- maxWidth: '1280px',
10
- margin: '0 auto',
11
- zIndex: 10000
12
- }
13
- }); });
@@ -1 +0,0 @@
1
- export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"errorBlock">;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useStyles = void 0;
4
- var styles_1 = require("@mui/styles");
5
- exports.useStyles = (0, styles_1.makeStyles)(function () { return ({
6
- errorBlock: {
7
- fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
8
- minHeight: '58px',
9
- left: 0,
10
- right: 0,
11
- width: 'calc(100% - 64px)',
12
- maxWidth: '1280px',
13
- margin: '0 auto',
14
- zIndex: 10000
15
- }
16
- }); });