@reltio/components 1.4.887 → 1.4.892
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.
- package/cjs/components/ConfigureColumnsPopup/ConfigureColumnsPopup.js +17 -14
- package/cjs/components/EntityTypesSelector/styles.d.ts +1 -1
- package/cjs/components/ErrorPopup/ErrorPopup.d.ts +4 -0
- package/cjs/components/ErrorPopup/ErrorPopup.js +37 -2
- package/cjs/components/ErrorWrapper/styles.d.ts +1 -1
- package/cjs/components/MatchRulesBlock/MatchRulesBlock.d.ts +5 -2
- package/cjs/components/MatchRulesBlock/MatchRulesBlock.js +2 -11
- package/cjs/components/ProfileCard/ProfileCard.d.ts +11 -19
- package/cjs/components/ProfileCard/ProfileCard.js +3 -12
- package/cjs/components/ProfileCard/styles.d.ts +1 -1
- package/cjs/components/ProfileMatchCard/ProfileMatchCard.d.ts +13 -0
- package/cjs/components/ProfileMatchCard/ProfileMatchCard.js +21 -0
- package/cjs/components/ProfileMatchCard/styles.d.ts +1 -0
- package/cjs/components/ProfileMatchCard/styles.js +28 -0
- package/cjs/components/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.js +1 -4
- package/cjs/components/editors/DateEditor/DateEditor.d.ts +14 -21
- package/cjs/components/editors/DateEditor/DateEditor.js +10 -19
- package/cjs/components/editors/DateEditor/styles.d.ts +1 -1
- package/cjs/components/editors/DateRangeEditor/styles.d.ts +1 -1
- package/cjs/components/editors/TimestampEditor/TimestampEditor.d.ts +18 -21
- package/cjs/components/editors/TimestampEditor/TimestampEditor.js +9 -19
- package/cjs/components/editors/TimestampEditor/styles.d.ts +1 -1
- package/cjs/components/index.d.ts +1 -0
- package/cjs/components/index.js +3 -1
- package/cjs/components/workflow/components/DueDateField/styles.d.ts +1 -1
- package/cjs/constants/prop-types.d.ts +0 -1
- package/cjs/constants/prop-types.js +1 -3
- package/cjs/hooks/helpers/pagingSimulator.d.ts +12 -0
- package/cjs/hooks/helpers/pagingSimulator.js +86 -0
- package/cjs/hooks/index.d.ts +2 -0
- package/cjs/hooks/index.js +5 -1
- package/cjs/hooks/useMatchesLoader.d.ts +27 -0
- package/cjs/hooks/useMatchesLoader.js +106 -0
- package/cjs/hooks/usePagingSimulator.d.ts +10 -0
- package/cjs/hooks/usePagingSimulator.js +10 -0
- package/esm/components/ConfigureColumnsPopup/ConfigureColumnsPopup.js +17 -14
- package/esm/components/EntityTypesSelector/styles.d.ts +1 -1
- package/esm/components/ErrorPopup/ErrorPopup.d.ts +4 -0
- package/esm/components/ErrorPopup/ErrorPopup.js +19 -3
- package/esm/components/ErrorWrapper/styles.d.ts +1 -1
- package/esm/components/MatchRulesBlock/MatchRulesBlock.d.ts +5 -2
- package/esm/components/MatchRulesBlock/MatchRulesBlock.js +3 -12
- package/esm/components/ProfileCard/ProfileCard.d.ts +11 -19
- package/esm/components/ProfileCard/ProfileCard.js +4 -13
- package/esm/components/ProfileCard/styles.d.ts +1 -1
- package/esm/components/ProfileMatchCard/ProfileMatchCard.d.ts +13 -0
- package/esm/components/ProfileMatchCard/ProfileMatchCard.js +14 -0
- package/esm/components/ProfileMatchCard/styles.d.ts +1 -0
- package/esm/components/ProfileMatchCard/styles.js +25 -0
- package/esm/components/crosswalks/CrosswalkDateEditor/CrosswalkDateEditor.js +1 -4
- package/esm/components/editors/DateEditor/DateEditor.d.ts +14 -21
- package/esm/components/editors/DateEditor/DateEditor.js +10 -19
- package/esm/components/editors/DateEditor/styles.d.ts +1 -1
- package/esm/components/editors/DateRangeEditor/styles.d.ts +1 -1
- package/esm/components/editors/TimestampEditor/TimestampEditor.d.ts +18 -21
- package/esm/components/editors/TimestampEditor/TimestampEditor.js +9 -19
- package/esm/components/editors/TimestampEditor/styles.d.ts +1 -1
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +1 -0
- package/esm/components/workflow/components/DueDateField/styles.d.ts +1 -1
- package/esm/constants/prop-types.d.ts +0 -1
- package/esm/constants/prop-types.js +1 -2
- package/esm/hooks/helpers/pagingSimulator.d.ts +12 -0
- package/esm/hooks/helpers/pagingSimulator.js +82 -0
- package/esm/hooks/index.d.ts +2 -0
- package/esm/hooks/index.js +2 -0
- package/esm/hooks/useMatchesLoader.d.ts +27 -0
- package/esm/hooks/useMatchesLoader.js +99 -0
- package/esm/hooks/usePagingSimulator.d.ts +10 -0
- package/esm/hooks/usePagingSimulator.js +6 -0
- package/package.json +10 -3
|
@@ -20,28 +20,27 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import
|
|
23
|
+
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
24
|
+
import { debounce, utils } from '@reltio/mdm-sdk';
|
|
25
|
+
import classnames from 'classnames';
|
|
26
|
+
import moment from 'moment';
|
|
27
|
+
import { invoker, isNil, pipe, when } from 'ramda';
|
|
24
28
|
import React, { useState } from 'react';
|
|
25
29
|
import i18n from 'ui-i18n';
|
|
26
|
-
import moment from 'moment';
|
|
27
|
-
import classnames from 'classnames';
|
|
28
|
-
import { pipe, when, isNil, invoker } from 'ramda';
|
|
29
|
-
import { utils, debounce } from '@reltio/mdm-sdk';
|
|
30
|
-
import { KeyboardDatePicker } from '@material-ui/pickers';
|
|
31
|
-
import { InputVariant } from '../../../constants/prop-types';
|
|
32
30
|
import CalendarIcon from '../../../icons/Calendar';
|
|
31
|
+
import { noop } from '../../../core';
|
|
33
32
|
import { useStyles } from './styles';
|
|
34
33
|
var format = moment.localeData().longDateFormat('L');
|
|
35
34
|
var DateEditor = function (_a) {
|
|
36
35
|
var _b, _c;
|
|
37
36
|
var _d;
|
|
38
|
-
var _e = _a.value, value = _e === void 0 ? null : _e, label = _a.label, _f = _a.variant, variant = _f === void 0 ? 'filled' : _f, onChange = _a.onChange, _g = _a.InputProps, InputProps = _g === void 0 ? {} : _g, _h = _a.InputLabelProps, InputLabelProps = _h === void 0 ? {} : _h, otherProps = __rest(_a, ["value", "label", "variant", "onChange", "InputProps", "InputLabelProps"]);
|
|
37
|
+
var _e = _a.value, value = _e === void 0 ? null : _e, label = _a.label, _f = _a.variant, variant = _f === void 0 ? 'filled' : _f, onChange = _a.onChange, _g = _a.InputProps, InputProps = _g === void 0 ? {} : _g, _h = _a.InputLabelProps, InputLabelProps = _h === void 0 ? {} : _h, _j = _a.onBlur, onBlur = _j === void 0 ? noop : _j, _k = _a.onFocus, onFocus = _k === void 0 ? noop : _k, otherProps = __rest(_a, ["value", "label", "variant", "onChange", "InputProps", "InputLabelProps", "onBlur", "onFocus"]);
|
|
39
38
|
var styles = useStyles();
|
|
40
|
-
var
|
|
41
|
-
return (React.createElement(KeyboardDatePicker, __assign({ format: format, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, autoOk: true, InputAdornmentProps: { position: 'end', classes: { positionEnd: styles.adornmentPositionEnd } }, KeyboardButtonProps: {
|
|
39
|
+
var _l = useState(false), isCalendarOpen = _l[0], setIsCalendarOpen = _l[1];
|
|
40
|
+
return (React.createElement(KeyboardDatePicker, __assign({ format: format, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, autoOk: true, onBlur: onBlur, onFocus: onFocus, InputAdornmentProps: { position: 'end', classes: { positionEnd: styles.adornmentPositionEnd } }, KeyboardButtonProps: {
|
|
42
41
|
classes: { root: styles.iconButtonRoot },
|
|
43
42
|
onKeyPress: invoker(0, 'stopPropagation')
|
|
44
|
-
}, keyboardIcon: React.createElement(CalendarIcon, { className: styles.icon }), onChange: debounce(when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, utils.dates.clearDateTime, onChange)), 0), label: label, "aria-label": label, value: value, placeholder: i18n.text(format),
|
|
43
|
+
}, keyboardIcon: React.createElement(CalendarIcon, { className: styles.icon }), onChange: debounce(when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, utils.dates.clearDateTime, onChange)), 0), label: label, "aria-label": label, value: value, placeholder: i18n.text(format), onClose: function () { return setIsCalendarOpen(false); }, onOpen: function () { return setIsCalendarOpen(true); }, InputProps: __assign({ classes: {
|
|
45
44
|
root: styles.inputRoot,
|
|
46
45
|
underline: classnames((_b = {}, _b[styles.underline] = isCalendarOpen, _b)),
|
|
47
46
|
adornedEnd: styles.adornedEnd
|
|
@@ -56,12 +55,4 @@ var DateEditor = function (_a) {
|
|
|
56
55
|
}
|
|
57
56
|
}, InputLabelProps: __assign({ classes: __assign({ root: classnames((_c = {}, _c[styles.inputLabel] = isCalendarOpen, _c), (_d = InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.classes) === null || _d === void 0 ? void 0 : _d.root) }, InputLabelProps === null || InputLabelProps === void 0 ? void 0 : InputLabelProps.classes), shrink: !isNil(label) }, InputLabelProps) }, otherProps)));
|
|
58
57
|
};
|
|
59
|
-
DateEditor.propTypes = {
|
|
60
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
61
|
-
label: PropTypes.string,
|
|
62
|
-
variant: InputVariant,
|
|
63
|
-
InputProps: PropTypes.object,
|
|
64
|
-
InputLabelProps: PropTypes.object,
|
|
65
|
-
onChange: PropTypes.func.isRequired
|
|
66
|
-
};
|
|
67
58
|
export default DateEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "icon" | "adornedEnd" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "icon" | "adornedEnd" | "iconButtonRoot" | "inputLabel" | "inputRoot" | "adornmentPositionEnd">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "dropdownIndicator" | "adornedEnd" | "
|
|
1
|
+
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "dropdownIndicator" | "adornedEnd" | "inputLabel" | "inputRoot" | "paper" | "menuItem" | "menuText">;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputLabelProps } from '@material-ui/core/InputLabel';
|
|
3
|
+
import { TextFieldProps } from '@material-ui/core/TextField';
|
|
4
|
+
import { Moment } from 'moment';
|
|
5
|
+
import { KeyboardDateTimePickerProps } from '@material-ui/pickers/DateTimePicker';
|
|
6
|
+
declare type TimestampEditorProps = {
|
|
7
|
+
value: number | Date;
|
|
8
|
+
label?: string;
|
|
9
|
+
variant: TextFieldProps['variant'];
|
|
10
|
+
InputProps: TextFieldProps['InputProps'];
|
|
11
|
+
format?: string;
|
|
12
|
+
InputLabelProps?: Partial<InputLabelProps>;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
onFocus?: () => void;
|
|
15
|
+
onChange: (value: number | Date) => void;
|
|
16
|
+
onAccept: (value: number | Date | Moment) => void;
|
|
17
|
+
} & Omit<KeyboardDateTimePickerProps, 'value' | 'label' | 'variant' | 'size' | 'hiddenLabel' | 'onBlur' | 'onFocus' | 'onChange' | 'onAccept'>;
|
|
18
|
+
declare const TimestampEditor: ({ value, label, variant, onChange, InputProps, format, ...otherProps }: TimestampEditorProps) => JSX.Element;
|
|
1
19
|
export default TimestampEditor;
|
|
2
|
-
declare function TimestampEditor({ value, label, variant, onChange, InputProps, format, ...otherProps }: {
|
|
3
|
-
[x: string]: any;
|
|
4
|
-
value?: any;
|
|
5
|
-
label: any;
|
|
6
|
-
variant?: string;
|
|
7
|
-
onChange: any;
|
|
8
|
-
InputProps: any;
|
|
9
|
-
format: any;
|
|
10
|
-
}): JSX.Element;
|
|
11
|
-
declare namespace TimestampEditor {
|
|
12
|
-
namespace propTypes {
|
|
13
|
-
export const value: PropTypes.Requireable<number | Date>;
|
|
14
|
-
export const format: PropTypes.Requireable<string>;
|
|
15
|
-
export const label: PropTypes.Requireable<string>;
|
|
16
|
-
export { InputVariant as variant };
|
|
17
|
-
export const InputProps: PropTypes.Requireable<object>;
|
|
18
|
-
export const onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
import PropTypes from "prop-types";
|
|
22
|
-
import { InputVariant } from "../../../constants/prop-types";
|
|
@@ -20,17 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import PropTypes from 'prop-types';
|
|
24
|
-
import React, { useState } from 'react';
|
|
25
|
-
import i18n from 'ui-i18n';
|
|
26
|
-
import moment from 'moment';
|
|
27
|
-
import classnames from 'classnames';
|
|
28
|
-
import { pipe, when, isNil, invoker } from 'ramda';
|
|
29
|
-
import { makeMaskFromFormat, maskedDateFormatter } from '@material-ui/pickers/_helpers/text-field-helper';
|
|
30
|
-
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
31
23
|
import DateRangeIcon from '@material-ui/icons/DateRange';
|
|
24
|
+
import { KeyboardDateTimePicker } from '@material-ui/pickers';
|
|
25
|
+
import { makeMaskFromFormat, maskedDateFormatter } from '@material-ui/pickers/_helpers/text-field-helper';
|
|
32
26
|
import { utils } from '@reltio/mdm-sdk';
|
|
33
|
-
import
|
|
27
|
+
import classnames from 'classnames';
|
|
28
|
+
import moment from 'moment';
|
|
29
|
+
import { invoker, isNil, pipe, when } from 'ramda';
|
|
30
|
+
import React, { useState } from 'react';
|
|
31
|
+
import i18n from 'ui-i18n';
|
|
34
32
|
import { useStyles } from './styles';
|
|
35
33
|
var dateFormat = moment.localeData().longDateFormat('L');
|
|
36
34
|
var timeFormat = moment.localeData().longDateFormat('LTS');
|
|
@@ -42,10 +40,10 @@ var TimestampEditor = function (_a) {
|
|
|
42
40
|
var _e = useState(false), isCalendarOpen = _e[0], setIsCalendarOpen = _e[1];
|
|
43
41
|
var timestampFormat = format || dateFormat + " " + timeFormat;
|
|
44
42
|
var isAmPmFormat = timestampFormat && timestampFormat.toLowerCase().includes('a');
|
|
45
|
-
return (React.createElement(KeyboardDateTimePicker, __assign({ format: timestampFormat, rifmFormatter: isAmPmFormat ? makeAmPmFormatter(timestampFormat) : undefined, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, views: ['year', 'date', 'hours', 'minutes'
|
|
43
|
+
return (React.createElement(KeyboardDateTimePicker, __assign({ format: timestampFormat, rifmFormatter: isAmPmFormat ? makeAmPmFormatter(timestampFormat) : undefined, variant: "inline", invalidDateMessage: i18n.text('Invalid Date Format'), maxDateMessage: i18n.text('Date should not be after maximal date'), minDateMessage: i18n.text('Date should not be before minimal date'), inputVariant: variant, views: ['year', 'date', 'hours', 'minutes'], autoOk: true, InputAdornmentProps: { position: 'end' }, KeyboardButtonProps: {
|
|
46
44
|
classes: { root: styles.iconButtonRoot },
|
|
47
45
|
onKeyPress: invoker(0, 'stopPropagation')
|
|
48
|
-
}, keyboardIcon: React.createElement(DateRangeIcon, null), onChange: when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, onChange)), label: label, "aria-label": label, value: value, placeholder: i18n.text((dateFormat + " HH:MM").toUpperCase()), ampm: false,
|
|
46
|
+
}, keyboardIcon: React.createElement(DateRangeIcon, null), onChange: when(utils.dates.isValidMomentDateOrNull, pipe(utils.dates.momentToDate, onChange)), label: label, "aria-label": label, value: value, placeholder: i18n.text((dateFormat + " HH:MM").toUpperCase()), ampm: false, onClose: function () { return setIsCalendarOpen(false); }, onOpen: function () { return setIsCalendarOpen(true); }, InputProps: __assign({ classes: {
|
|
49
47
|
root: styles.inputRoot,
|
|
50
48
|
underline: classnames((_b = {}, _b[styles.underline] = isCalendarOpen, _b)),
|
|
51
49
|
adornedEnd: styles.adornedEnd
|
|
@@ -65,12 +63,4 @@ var TimestampEditor = function (_a) {
|
|
|
65
63
|
shrink: !isNil(label)
|
|
66
64
|
} }, otherProps)));
|
|
67
65
|
};
|
|
68
|
-
TimestampEditor.propTypes = {
|
|
69
|
-
value: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]),
|
|
70
|
-
format: PropTypes.string,
|
|
71
|
-
label: PropTypes.string,
|
|
72
|
-
variant: InputVariant,
|
|
73
|
-
InputProps: PropTypes.object,
|
|
74
|
-
onChange: PropTypes.func.isRequired
|
|
75
|
-
};
|
|
76
66
|
export default TimestampEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "adornedEnd" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"underline" | "adornedEnd" | "iconButtonRoot" | "inputLabel" | "inputRoot">;
|
package/esm/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"dueDate" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"dueDate" | "inputLabel" | "dueDateInput">;
|
|
@@ -44,7 +44,6 @@ export const ColumnFilterType: PropTypes.Requireable<PropTypes.InferProps<{
|
|
|
44
44
|
}>)[])[]>;
|
|
45
45
|
filter: PropTypes.Requireable<string>;
|
|
46
46
|
}>>;
|
|
47
|
-
export const InputVariant: PropTypes.Requireable<string>;
|
|
48
47
|
export const ColumnsDataType: PropTypes.Requireable<PropTypes.InferProps<{
|
|
49
48
|
id: PropTypes.Requireable<string>;
|
|
50
49
|
label: PropTypes.Requireable<string>;
|
|
@@ -34,7 +34,6 @@ var ColumnFilterType = PropTypes.shape({
|
|
|
34
34
|
value: PropTypes.oneOfType([FilterValueType, PropTypes.arrayOf(FilterValueType)]),
|
|
35
35
|
filter: PropTypes.string
|
|
36
36
|
});
|
|
37
|
-
var InputVariant = PropTypes.oneOf(['standard', 'outlined', 'filled']);
|
|
38
37
|
var PlainColumnsDataType = PropTypes.arrayOf(PropTypes.shape({
|
|
39
38
|
id: PropTypes.string,
|
|
40
39
|
label: PropTypes.string,
|
|
@@ -62,4 +61,4 @@ var QueryBuilderAttributeType = PropTypes.shape({
|
|
|
62
61
|
filter: PropTypes.string,
|
|
63
62
|
operator: PropTypes.string
|
|
64
63
|
});
|
|
65
|
-
export { NumberFormatType, SelectValueType, DropDownEntryType, DropDownGroupEntryType, ColumnDataType, SortingType, ColumnFilterType,
|
|
64
|
+
export { NumberFormatType, SelectValueType, DropDownEntryType, DropDownGroupEntryType, ColumnDataType, SortingType, ColumnFilterType, ColumnsDataType, GroupedColumnsDataType, QueryBuilderAttributeDataType, QueryBuilderAttributeType };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare type RequestProps = {
|
|
2
|
+
max: number;
|
|
3
|
+
offset: number;
|
|
4
|
+
force?: boolean;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const createPagingSimulator: (request: any) => ({ max, offset, force, ...requestParams }: RequestProps) => Promise<{
|
|
8
|
+
response: any[];
|
|
9
|
+
total: number;
|
|
10
|
+
originalResponse: any[];
|
|
11
|
+
}>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
38
|
+
var t = {};
|
|
39
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
40
|
+
t[p] = s[p];
|
|
41
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
42
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
43
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
44
|
+
t[p[i]] = s[p[i]];
|
|
45
|
+
}
|
|
46
|
+
return t;
|
|
47
|
+
};
|
|
48
|
+
import { equals } from 'ramda';
|
|
49
|
+
export var createPagingSimulator = function (request) {
|
|
50
|
+
var previousValues = {};
|
|
51
|
+
var requestResponse = [];
|
|
52
|
+
return function (_a) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var shouldSendRequest, previousValuesKeys, _i, previousValuesKeys_1, key;
|
|
54
|
+
var max = _a.max, offset = _a.offset, force = _a.force, requestParams = __rest(_a, ["max", "offset", "force"]);
|
|
55
|
+
return __generator(this, function (_b) {
|
|
56
|
+
switch (_b.label) {
|
|
57
|
+
case 0:
|
|
58
|
+
shouldSendRequest = force;
|
|
59
|
+
previousValuesKeys = Object.keys(previousValues);
|
|
60
|
+
shouldSendRequest = shouldSendRequest || !equals(Object.keys(requestParams), previousValuesKeys);
|
|
61
|
+
if (!shouldSendRequest) {
|
|
62
|
+
for (_i = 0, previousValuesKeys_1 = previousValuesKeys; _i < previousValuesKeys_1.length; _i++) {
|
|
63
|
+
key = previousValuesKeys_1[_i];
|
|
64
|
+
shouldSendRequest = shouldSendRequest || !equals(previousValues[key], requestParams[key]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (!shouldSendRequest) return [3 /*break*/, 2];
|
|
68
|
+
return [4 /*yield*/, request(requestParams)];
|
|
69
|
+
case 1:
|
|
70
|
+
// eslint-disable-next-line no-unused-vars
|
|
71
|
+
requestResponse = _b.sent();
|
|
72
|
+
previousValues = requestParams;
|
|
73
|
+
_b.label = 2;
|
|
74
|
+
case 2: return [2 /*return*/, {
|
|
75
|
+
response: requestResponse.slice(offset, offset + max),
|
|
76
|
+
total: requestResponse.length,
|
|
77
|
+
originalResponse: requestResponse
|
|
78
|
+
}];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}); };
|
|
82
|
+
};
|
package/esm/hooks/index.d.ts
CHANGED
|
@@ -11,3 +11,5 @@ export { useSavedState } from './useSavedState';
|
|
|
11
11
|
export { useUsers } from './useUsers';
|
|
12
12
|
export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
|
|
13
13
|
export { useConfigPermissions } from './useConfigPermissions';
|
|
14
|
+
export { useMatchesLoader } from './useMatchesLoader';
|
|
15
|
+
export { usePagingSimulator } from './usePagingSimulator';
|
package/esm/hooks/index.js
CHANGED
|
@@ -11,3 +11,5 @@ export { useSavedState } from './useSavedState';
|
|
|
11
11
|
export { useUsers } from './useUsers';
|
|
12
12
|
export { useWhyDidYouUpdate } from './useWhyDidYouUpdate';
|
|
13
13
|
export { useConfigPermissions } from './useConfigPermissions';
|
|
14
|
+
export { useMatchesLoader } from './useMatchesLoader';
|
|
15
|
+
export { usePagingSimulator } from './usePagingSimulator';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Entity, PotentialMatch } from '@reltio/mdm-sdk';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
entity: Entity;
|
|
5
|
+
filter: string;
|
|
6
|
+
onFinishLoading?: () => void;
|
|
7
|
+
onStartLoading?: () => void;
|
|
8
|
+
options: {
|
|
9
|
+
showTransitiveMatches?: boolean;
|
|
10
|
+
showInactiveEntities?: boolean;
|
|
11
|
+
};
|
|
12
|
+
page: number;
|
|
13
|
+
rowsPerPage: number;
|
|
14
|
+
sorting?: {
|
|
15
|
+
order: string;
|
|
16
|
+
field: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const useMatchesLoader: ({ enabled, entity, filter, onFinishLoading, onStartLoading, options, page, rowsPerPage, sorting }: Props) => {
|
|
20
|
+
total: number;
|
|
21
|
+
matches: PotentialMatch[];
|
|
22
|
+
entitiesMap: {
|
|
23
|
+
[key: string]: Pick<Entity, "uri" | "type" | "label">;
|
|
24
|
+
};
|
|
25
|
+
loadMatches: () => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { useSelector } from 'react-redux';
|
|
3
|
+
import mdmModule from '@reltio/mdm-module';
|
|
4
|
+
import { ActivityFilters, collectAllTransitiveEntitiesUris, getEntitiesMap, getMatchesForDataTenantEntity, getMatchesFromDataTenants, getTransitiveMatches, isDataTenantEntity, withDtssPotentialItems } from '@reltio/mdm-sdk';
|
|
5
|
+
import { usePagingSimulator } from './usePagingSimulator';
|
|
6
|
+
import { useSafePromise } from './useSafePromise';
|
|
7
|
+
import { prop } from 'ramda';
|
|
8
|
+
export var useMatchesLoader = function (_a) {
|
|
9
|
+
var enabled = _a.enabled, entity = _a.entity, filter = _a.filter, onFinishLoading = _a.onFinishLoading, onStartLoading = _a.onStartLoading, options = _a.options, page = _a.page, rowsPerPage = _a.rowsPerPage, sorting = _a.sorting;
|
|
10
|
+
var _b = sorting || {}, order = _b.order, field = _b.field;
|
|
11
|
+
var _c = useState(0), total = _c[0], setTotal = _c[1];
|
|
12
|
+
var _d = useState([]), matches = _d[0], setMatches = _d[1];
|
|
13
|
+
var _e = useState({}), entitiesMap = _e[0], setEntitiesMap = _e[1];
|
|
14
|
+
var tenant = useSelector(mdmModule.selectors.getTenant);
|
|
15
|
+
var dtssPath = useSelector(mdmModule.selectors.getDtssPath);
|
|
16
|
+
var dataTenants = useSelector(mdmModule.selectors.getDataTenants);
|
|
17
|
+
var dtssParams = useMemo(function () { return ({
|
|
18
|
+
dtssPath: dtssPath,
|
|
19
|
+
dataTenants: dataTenants,
|
|
20
|
+
entity: entity,
|
|
21
|
+
customerTenant: tenant,
|
|
22
|
+
dtssRequest: getMatchesFromDataTenants
|
|
23
|
+
}); }, [dtssPath, dataTenants, entity, tenant]);
|
|
24
|
+
//eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
var getTransitiveMatchesWithDtss = useCallback(withDtssPotentialItems(dtssParams, getTransitiveMatches), [
|
|
26
|
+
dtssParams
|
|
27
|
+
]);
|
|
28
|
+
var getTransitiveMatchesWithPaging = usePagingSimulator(getTransitiveMatchesWithDtss);
|
|
29
|
+
var getPagedMatchesForDataTenantEntity = usePagingSimulator(getMatchesForDataTenantEntity);
|
|
30
|
+
var entityUri = prop('uri', entity);
|
|
31
|
+
var safePromise = useSafePromise();
|
|
32
|
+
var getMatches = useCallback(function (force) {
|
|
33
|
+
if (force === void 0) { force = false; }
|
|
34
|
+
if (!enabled) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
onStartLoading === null || onStartLoading === void 0 ? void 0 : onStartLoading();
|
|
38
|
+
safePromise(isDataTenantEntity(entity)
|
|
39
|
+
? getPagedMatchesForDataTenantEntity({
|
|
40
|
+
dtssPath: dtssPath,
|
|
41
|
+
entity: entity,
|
|
42
|
+
customerTenant: tenant,
|
|
43
|
+
offset: page * rowsPerPage,
|
|
44
|
+
max: rowsPerPage,
|
|
45
|
+
force: force
|
|
46
|
+
})
|
|
47
|
+
: getTransitiveMatchesWithPaging({
|
|
48
|
+
entityUri: entityUri,
|
|
49
|
+
offset: page * rowsPerPage,
|
|
50
|
+
max: rowsPerPage,
|
|
51
|
+
filter: filter,
|
|
52
|
+
sort: field,
|
|
53
|
+
order: order,
|
|
54
|
+
force: force,
|
|
55
|
+
deep: options.showTransitiveMatches ? undefined : 1,
|
|
56
|
+
activeness: options.showInactiveEntities ? ActivityFilters.ALL : ActivityFilters.ACTIVE_ONLY
|
|
57
|
+
}))
|
|
58
|
+
.then(function (result) {
|
|
59
|
+
var response = result.response, total = result.total, originalResponse = result.originalResponse;
|
|
60
|
+
setTotal(total);
|
|
61
|
+
setMatches(response);
|
|
62
|
+
var matchUris = collectAllTransitiveEntitiesUris(originalResponse);
|
|
63
|
+
if (matchUris.length > 0) {
|
|
64
|
+
setEntitiesMap(getEntitiesMap(originalResponse));
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
.finally(function () {
|
|
68
|
+
onFinishLoading === null || onFinishLoading === void 0 ? void 0 : onFinishLoading();
|
|
69
|
+
});
|
|
70
|
+
}, [
|
|
71
|
+
dtssPath,
|
|
72
|
+
enabled,
|
|
73
|
+
entityUri,
|
|
74
|
+
field,
|
|
75
|
+
filter,
|
|
76
|
+
getPagedMatchesForDataTenantEntity,
|
|
77
|
+
getTransitiveMatchesWithPaging,
|
|
78
|
+
onFinishLoading,
|
|
79
|
+
onStartLoading,
|
|
80
|
+
options,
|
|
81
|
+
order,
|
|
82
|
+
page,
|
|
83
|
+
rowsPerPage,
|
|
84
|
+
safePromise,
|
|
85
|
+
tenant
|
|
86
|
+
]); // eslint-disable-line
|
|
87
|
+
useEffect(function () {
|
|
88
|
+
getMatches();
|
|
89
|
+
}, [getMatches]);
|
|
90
|
+
var loadMatches = useCallback(function () {
|
|
91
|
+
getMatches(true);
|
|
92
|
+
}, [getMatches]);
|
|
93
|
+
return {
|
|
94
|
+
total: total,
|
|
95
|
+
matches: matches,
|
|
96
|
+
entitiesMap: entitiesMap,
|
|
97
|
+
loadMatches: loadMatches
|
|
98
|
+
};
|
|
99
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const usePagingSimulator: (request: any) => ({ max, offset, force, ...requestParams }: {
|
|
2
|
+
[key: string]: unknown;
|
|
3
|
+
max: number;
|
|
4
|
+
offset: number;
|
|
5
|
+
force?: boolean;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
response: any[];
|
|
8
|
+
total: number;
|
|
9
|
+
originalResponse: any[];
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { createPagingSimulator } from './helpers/pagingSimulator';
|
|
3
|
+
export var usePagingSimulator = function (request) {
|
|
4
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5
|
+
return useCallback(createPagingSimulator(request), [request]);
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.892",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@date-io/moment": "^1.3.5",
|
|
9
9
|
"@react-google-maps/api": "^2.7.0",
|
|
10
|
-
"@reltio/mdm-module": "^1.4.
|
|
11
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
10
|
+
"@reltio/mdm-module": "^1.4.892",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.892",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
|
+
"d3-cloud": "^1.2.5",
|
|
14
|
+
"d3-geo": "^2.0.1",
|
|
15
|
+
"d3-hierarchy": "^2.0.0",
|
|
16
|
+
"d3-scale": "^3.3.0",
|
|
13
17
|
"frontend-collective-react-dnd-scrollzone": "^1.0.2",
|
|
14
18
|
"nanoid": "^2.0.0",
|
|
15
19
|
"prop-types": "^15.6.2",
|
|
16
20
|
"ramda": "^0.27.0",
|
|
17
21
|
"react-autosuggest": "^9.4.3",
|
|
22
|
+
"react-components": "git+ssh://git@bitbucket.org/reltio-ondemand/react-components.git#v3.5.4",
|
|
18
23
|
"react-dnd": "^9.4.0",
|
|
19
24
|
"react-dnd-html5-backend": "^10.0.2",
|
|
20
25
|
"react-grid-layout": "^1.1.1",
|
|
@@ -26,8 +31,10 @@
|
|
|
26
31
|
"react-resize-detector": "^4.2.0",
|
|
27
32
|
"react-select": "^3.0.4",
|
|
28
33
|
"react-simple-maps": "^2.3.0",
|
|
34
|
+
"react-split-pane": "^0.1.89",
|
|
29
35
|
"react-virtualized": "^9.21.2",
|
|
30
36
|
"react-window": "^1.8.5",
|
|
37
|
+
"recharts": "^1.8.5",
|
|
31
38
|
"ui-i18n": "bitbucket:reltio-ondemand/ui-i18n#v1.3.0"
|
|
32
39
|
},
|
|
33
40
|
"peerDependencies": {
|