@reltio/components 1.4.1598 → 1.4.1600
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/MultipleInput/MultipleInput.d.ts +3 -1
- package/cjs/components/MultipleInput/MultipleInput.js +8 -6
- package/cjs/components/MultipleInput/styles.d.ts +1 -1
- package/cjs/components/MultipleInput/styles.js +3 -0
- package/cjs/components/MultipliableSelect/MultipliableSelect.d.ts +3 -1
- package/cjs/components/MultipliableSelect/MultipliableSelect.js +4 -3
- package/cjs/components/MultipliableSelect/styles.d.ts +1 -1
- package/cjs/components/MultipliableSelect/styles.js +3 -0
- package/cjs/components/SimpleInput/SimpleInput.d.ts +4 -1
- package/cjs/components/SimpleInput/SimpleInput.js +11 -5
- package/cjs/components/SimpleInput/styles.d.ts +1 -0
- package/cjs/components/SimpleInput/styles.js +9 -0
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +1 -4
- package/cjs/components/attributes/editMode/AttributesPager/AttributeRenderer.js +8 -4
- package/cjs/components/attributes/editMode/AttributesPager/index.d.ts +3 -3
- package/cjs/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +1 -1
- package/cjs/components/editors/BooleanRadioEditor/BooleanRadioEditor.d.ts +9 -13
- package/cjs/components/editors/BooleanRadioEditor/BooleanRadioEditor.js +8 -11
- package/cjs/components/editors/BooleanRadioEditor/styles.d.ts +1 -1
- package/cjs/components/editors/BooleanRadioEditor/styles.js +16 -1
- package/cjs/components/editors/DateEditor/DateEditor.d.ts +2 -1
- package/cjs/components/editors/DateEditor/DateEditor.js +11 -10
- package/cjs/components/editors/DateEditor/styles.d.ts +1 -1
- package/cjs/components/editors/DateEditor/styles.js +3 -0
- package/cjs/components/editors/DependentLookupEditor/DependentLookupEditor.js +7 -1
- package/cjs/components/editors/DependentLookupEditor/styles.d.ts +1 -1
- package/cjs/components/editors/DependentLookupEditor/styles.js +3 -0
- package/cjs/components/editors/TimestampEditor/TimestampEditor.d.ts +2 -1
- package/cjs/components/editors/TimestampEditor/TimestampEditor.js +11 -10
- package/cjs/components/editors/TimestampEditor/styles.d.ts +1 -1
- package/cjs/components/editors/TimestampEditor/styles.js +3 -0
- package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +3 -1
- package/cjs/components/editors/TypeaheadEditor/TypeaheadEditor.js +13 -10
- package/cjs/components/editors/TypeaheadEditor/styles.d.ts +1 -1
- package/cjs/components/editors/TypeaheadEditor/styles.js +3 -0
- package/cjs/hooks/useLayoutResetter.js +1 -2
- package/cjs/hooks/useSnackbar.js +3 -3
- package/esm/components/MultipleInput/MultipleInput.d.ts +3 -1
- package/esm/components/MultipleInput/MultipleInput.js +8 -6
- package/esm/components/MultipleInput/styles.d.ts +1 -1
- package/esm/components/MultipleInput/styles.js +3 -0
- package/esm/components/MultipliableSelect/MultipliableSelect.d.ts +3 -1
- package/esm/components/MultipliableSelect/MultipliableSelect.js +4 -3
- package/esm/components/MultipliableSelect/styles.d.ts +1 -1
- package/esm/components/MultipliableSelect/styles.js +3 -0
- package/esm/components/SimpleInput/SimpleInput.d.ts +4 -1
- package/esm/components/SimpleInput/SimpleInput.js +11 -5
- package/esm/components/SimpleInput/styles.d.ts +1 -0
- package/esm/components/SimpleInput/styles.js +6 -0
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +1 -4
- package/esm/components/attributes/editMode/AttributesPager/AttributeRenderer.js +9 -5
- package/esm/components/attributes/editMode/AttributesPager/index.d.ts +3 -3
- package/esm/components/attributes/editMode/SimpleAttributeEditor/SimpleAttributeEditor.js +1 -1
- package/esm/components/editors/BooleanRadioEditor/BooleanRadioEditor.d.ts +9 -13
- package/esm/components/editors/BooleanRadioEditor/BooleanRadioEditor.js +8 -11
- package/esm/components/editors/BooleanRadioEditor/styles.d.ts +1 -1
- package/esm/components/editors/BooleanRadioEditor/styles.js +16 -1
- package/esm/components/editors/DateEditor/DateEditor.d.ts +2 -1
- package/esm/components/editors/DateEditor/DateEditor.js +6 -5
- package/esm/components/editors/DateEditor/styles.d.ts +1 -1
- package/esm/components/editors/DateEditor/styles.js +3 -0
- package/esm/components/editors/DependentLookupEditor/DependentLookupEditor.js +7 -1
- package/esm/components/editors/DependentLookupEditor/styles.d.ts +1 -1
- package/esm/components/editors/DependentLookupEditor/styles.js +3 -0
- package/esm/components/editors/TimestampEditor/TimestampEditor.d.ts +2 -1
- package/esm/components/editors/TimestampEditor/TimestampEditor.js +6 -5
- package/esm/components/editors/TimestampEditor/styles.d.ts +1 -1
- package/esm/components/editors/TimestampEditor/styles.js +3 -0
- package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.d.ts +3 -1
- package/esm/components/editors/TypeaheadEditor/TypeaheadEditor.js +13 -10
- package/esm/components/editors/TypeaheadEditor/styles.d.ts +1 -1
- package/esm/components/editors/TypeaheadEditor/styles.js +3 -0
- package/esm/hooks/useLayoutResetter.js +1 -2
- package/esm/hooks/useSnackbar.js +3 -3
- package/package.json +3 -3
|
@@ -22,18 +22,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import React, { useMemo } from 'react';
|
|
24
24
|
import i18n from 'ui-i18n';
|
|
25
|
-
import
|
|
25
|
+
import classnames from 'classnames';
|
|
26
|
+
import { mergeDeepLeft, isNil, pipe, when, both } from 'ramda';
|
|
26
27
|
import moment from 'moment';
|
|
27
28
|
import { getLocaleFormat, utils } from '@reltio/mdm-sdk';
|
|
28
|
-
import { both, isNil, pipe, when } from 'ramda';
|
|
29
29
|
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
30
30
|
import { renderTimeViewClock } from '@mui/x-date-pickers/timeViewRenderers';
|
|
31
31
|
import { DEFAULT_MAX_DATE, DEFAULT_MIN_DATE } from '../constants';
|
|
32
32
|
import { useStyles } from './styles';
|
|
33
33
|
var TimestampEditor = function (_a) {
|
|
34
|
-
var
|
|
34
|
+
var _b;
|
|
35
|
+
var value = _a.value, _c = _a.minDate, minDate = _c === void 0 ? DEFAULT_MIN_DATE : _c, _d = _a.maxDate, maxDate = _d === void 0 ? DEFAULT_MAX_DATE : _d, label = _a.label, slotProps = _a.slotProps, onChange = _a.onChange, format = _a.format, isCrossedOut = _a.isCrossedOut, otherProps = __rest(_a, ["value", "minDate", "maxDate", "label", "slotProps", "onChange", "format", "isCrossedOut"]);
|
|
35
36
|
var styles = useStyles();
|
|
36
|
-
var
|
|
37
|
+
var _e = React.useState(null), error = _e[0], setError = _e[1];
|
|
37
38
|
var errorMessage = useMemo(function () {
|
|
38
39
|
switch (error) {
|
|
39
40
|
case 'maxDate':
|
|
@@ -58,7 +59,7 @@ var TimestampEditor = function (_a) {
|
|
|
58
59
|
helperText: errorMessage,
|
|
59
60
|
InputProps: {
|
|
60
61
|
classes: {
|
|
61
|
-
root: styles.inputRoot
|
|
62
|
+
root: classnames(styles.inputRoot, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b))
|
|
62
63
|
},
|
|
63
64
|
disableUnderline: isNil(editorValue)
|
|
64
65
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"underline" | "inputRoot" | "adornedEnd" | "iconButtonRoot" | "inputLabel">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"underline" | "isCrossedOut" | "inputRoot" | "adornedEnd" | "iconButtonRoot" | "inputLabel">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default TypeaheadEditor;
|
|
2
|
-
declare function TypeaheadEditor({ value, max, getSuggestions, onChange, multiple, fullWidth, InputProps, ...inputProps }: {
|
|
2
|
+
declare function TypeaheadEditor({ value, max, getSuggestions, onChange, multiple, fullWidth, InputProps, isCrossedOut, ...inputProps }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
value: any;
|
|
5
5
|
max?: number;
|
|
@@ -8,6 +8,7 @@ declare function TypeaheadEditor({ value, max, getSuggestions, onChange, multipl
|
|
|
8
8
|
multiple: any;
|
|
9
9
|
fullWidth: any;
|
|
10
10
|
InputProps?: {};
|
|
11
|
+
isCrossedOut?: boolean;
|
|
11
12
|
}): JSX.Element;
|
|
12
13
|
declare namespace TypeaheadEditor {
|
|
13
14
|
namespace propTypes {
|
|
@@ -19,6 +20,7 @@ declare namespace TypeaheadEditor {
|
|
|
19
20
|
const getSuggestions: PropTypes.Validator<(...args: any[]) => any>;
|
|
20
21
|
const InputProps: PropTypes.Requireable<object>;
|
|
21
22
|
const max: PropTypes.Requireable<number>;
|
|
23
|
+
const isCrossedOut: PropTypes.Requireable<boolean>;
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
import PropTypes from 'prop-types';
|
|
@@ -50,13 +50,13 @@ import { useDidUpdateEffect } from '../../../hooks';
|
|
|
50
50
|
var FETCH_DEBOUNCE_INTERVAL = 300;
|
|
51
51
|
var PAGE_SIZE = 50;
|
|
52
52
|
var TypeaheadEditor = function (_a) {
|
|
53
|
-
var value = _a.value, _b = _a.max, max = _b === void 0 ? PAGE_SIZE : _b, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _c = _a.InputProps, InputProps = _c === void 0 ? {} : _c, inputProps = __rest(_a, ["value", "max", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps"]);
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
53
|
+
var value = _a.value, _b = _a.max, max = _b === void 0 ? PAGE_SIZE : _b, getSuggestions = _a.getSuggestions, onChange = _a.onChange, multiple = _a.multiple, fullWidth = _a.fullWidth, _c = _a.InputProps, InputProps = _c === void 0 ? {} : _c, _d = _a.isCrossedOut, isCrossedOut = _d === void 0 ? false : _d, inputProps = __rest(_a, ["value", "max", "getSuggestions", "onChange", "multiple", "fullWidth", "InputProps", "isCrossedOut"]);
|
|
54
|
+
var _e = useState([]), suggestions = _e[0], setSuggestions = _e[1];
|
|
55
|
+
var _f = useState(false), isPlaceholderVisible = _f[0], setPlaceholderVisibility = _f[1];
|
|
56
|
+
var _g = useState(1), pageNumber = _g[0], setPageNumber = _g[1];
|
|
57
|
+
var _h = useState(false), nextPageIsLoading = _h[0], setNextPageIsLoading = _h[1];
|
|
58
58
|
var pageSizeForRequest = max + 1;
|
|
59
|
-
var
|
|
59
|
+
var _j = useState(''), currentValue = _j[0], setCurrentValue = _j[1];
|
|
60
60
|
value = defaultTo(multiple ? [] : '', value);
|
|
61
61
|
var inputValue = multiple ? currentValue : value;
|
|
62
62
|
useDidUpdateEffect(function () {
|
|
@@ -82,7 +82,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
82
82
|
]);
|
|
83
83
|
var displayedSuggestions = useMemo(function () { return suggestions.slice(0, pageNumber * max); }, [suggestions, pageNumber, max]);
|
|
84
84
|
var showMoreButton = suggestions.length > displayedSuggestions.length;
|
|
85
|
-
var
|
|
85
|
+
var _k = useState(false), hasHighlightedItem = _k[0], setHasHighlightedItem = _k[1];
|
|
86
86
|
var onInputChange = function (_a) {
|
|
87
87
|
var newValue = _a.newValue, method = _a.method;
|
|
88
88
|
switch (method) {
|
|
@@ -121,13 +121,15 @@ var TypeaheadEditor = function (_a) {
|
|
|
121
121
|
onInputChange({ method: 'enter', newValue: currentValue });
|
|
122
122
|
}
|
|
123
123
|
}, fullWidth: fullWidth }, inputProps), { autoComplete: 'nope' }), getSuggestionValue: identity, onSuggestionsFetchRequested: ifElse(propEq('reason', 'input-changed'), debouncedFetchSuggestions, fetchSuggestions), onSuggestionsClearRequested: pipe(always([]), setSuggestions, F, setPlaceholderVisibility, always(1), setPageNumber), renderInputComponent: function (_a) {
|
|
124
|
-
var _b;
|
|
124
|
+
var _b, _c;
|
|
125
125
|
var ref = _a.ref, onInputChange = _a.onChange, otherProps = __rest(_a, ["ref", "onChange"]);
|
|
126
126
|
var commonClasses = {
|
|
127
127
|
underline: classnames((_b = {}, _b[styles['input__underline']] = isEmptyValue(value), _b)),
|
|
128
128
|
input: classnames(styles['rawInput'], path(['classes', 'input'], InputProps))
|
|
129
129
|
};
|
|
130
|
-
return multiple ? (React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (React.createElement(ValueChip, { key: item, label: item, onDelete: function () { return onChange(remove(index, 1, value)); } })); }), inputComponent: AutosizeInput, classes: __assign(__assign({ root: classnames(styles['multiple-input__input'], path(['classes', 'root'], InputProps)) }, commonClasses), { input: classnames(styles.autosizeInput, commonClasses.input), adornedStart: styles['multiple-input__adornedStart'] }) }), value: currentValue, onChange: onInputChange, classes: { root: styles['multiple-input__root'] } }))) : (React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, value: value, onChange: pipe(tap(onInputChange), getValue, onChange), InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: classnames(styles['input__root'], path(['classes', 'root'], InputProps)
|
|
130
|
+
return multiple ? (React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (React.createElement(ValueChip, { key: item, label: item, onDelete: function () { return onChange(remove(index, 1, value)); } })); }), inputComponent: AutosizeInput, classes: __assign(__assign({ root: classnames(styles['multiple-input__input'], path(['classes', 'root'], InputProps)) }, commonClasses), { input: classnames(styles.autosizeInput, commonClasses.input), adornedStart: styles['multiple-input__adornedStart'] }) }), value: currentValue, onChange: onInputChange, classes: { root: styles['multiple-input__root'] } }))) : (React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, value: value, onChange: pipe(tap(onInputChange), getValue, onChange), InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: classnames(styles['input__root'], path(['classes', 'root'], InputProps), (_c = {},
|
|
131
|
+
_c[styles.isCrossedOut] = isCrossedOut,
|
|
132
|
+
_c)) }, commonClasses) }) })));
|
|
131
133
|
}, renderSuggestionsContainer: function (_a) {
|
|
132
134
|
var children = _a.children, _b = _a.containerProps, ref = _b.ref, restContainerProps = __rest(_b, ["ref"]);
|
|
133
135
|
return (React.createElement(Popper, { anchorEl: inputRef.current, open: Boolean(children) || isPlaceholderVisible },
|
|
@@ -153,6 +155,7 @@ TypeaheadEditor.propTypes = {
|
|
|
153
155
|
onChange: PropTypes.func.isRequired,
|
|
154
156
|
getSuggestions: PropTypes.func.isRequired,
|
|
155
157
|
InputProps: PropTypes.object,
|
|
156
|
-
max: PropTypes.number
|
|
158
|
+
max: PropTypes.number,
|
|
159
|
+
isCrossedOut: PropTypes.bool
|
|
157
160
|
};
|
|
158
161
|
export default TypeaheadEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"autosizeInput" | "typeahead__suggestions-placeholder" | "typeahead__suggestions-container--open" | "typeahead__suggestions-list" | "typeahead__suggestions-menuItem" | "input__root" | "rawInput" | "multiple-input__root" | "multiple-input__input" | "multiple-input__adornedStart" | "input__underline" | "typeahead__suggestions-container" | "menuItem--item">;
|
|
1
|
+
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"isCrossedOut" | "autosizeInput" | "typeahead__suggestions-placeholder" | "typeahead__suggestions-container--open" | "typeahead__suggestions-list" | "typeahead__suggestions-menuItem" | "input__root" | "rawInput" | "multiple-input__root" | "multiple-input__input" | "multiple-input__adornedStart" | "input__underline" | "typeahead__suggestions-container" | "menuItem--item">;
|
|
@@ -10,8 +10,7 @@ export var useLayoutResetter = function (_a) {
|
|
|
10
10
|
onDismissClick: onResetUndo,
|
|
11
11
|
showDismiss: true,
|
|
12
12
|
autoHideDuration: 5000,
|
|
13
|
-
dismissTitle: i18n.text('Undo')
|
|
14
|
-
anchorOrigin: { vertical: 'bottom', horizontal: 'center' }
|
|
13
|
+
dismissTitle: i18n.text('Undo')
|
|
15
14
|
}), SnackbarRenderer = _b.SnackbarRenderer, showSnackbarMessage = _b.showSnackbarMessage;
|
|
16
15
|
return { SnackbarRenderer: SnackbarRenderer, resetLayout: resetLayout };
|
|
17
16
|
};
|
package/esm/hooks/useSnackbar.js
CHANGED
|
@@ -7,9 +7,9 @@ import Snackbar from '@mui/material/Snackbar';
|
|
|
7
7
|
import { noop } from '../core';
|
|
8
8
|
var FIVE_MINUTES = 5 * 60 * 1000;
|
|
9
9
|
export var useSnackbar = function (_a) {
|
|
10
|
-
var _b = _a === void 0 ? {} : _a,
|
|
11
|
-
var
|
|
12
|
-
var
|
|
10
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.anchorOrigin, anchorOrigin = _c === void 0 ? { vertical: 'bottom', horizontal: 'center' } : _c, showDismiss = _b.showDismiss, _d = _b.dismissTitle, dismissTitle = _d === void 0 ? i18n.text('Dismiss') : _d, _e = _b.autoHideDuration, autoHideDuration = _e === void 0 ? FIVE_MINUTES : _e, _f = _b.onDismissClick, onDismissClick = _f === void 0 ? noop : _f;
|
|
11
|
+
var _g = useState(false), isOpenSnackbar = _g[0], setIsOpenSnackbar = _g[1];
|
|
12
|
+
var _h = useState(''), snackbarMessage = _h[0], setSnackbarMessage = _h[1];
|
|
13
13
|
var closeSnackbar = useCallback(function () {
|
|
14
14
|
setIsOpenSnackbar(false);
|
|
15
15
|
setSnackbarMessage('');
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1600",
|
|
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.1600",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1600",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|