@reltio/components 1.4.1599 → 1.4.1601
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/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/package.json +3 -3
|
@@ -78,13 +78,13 @@ var hooks_1 = require("../../../hooks");
|
|
|
78
78
|
var FETCH_DEBOUNCE_INTERVAL = 300;
|
|
79
79
|
var PAGE_SIZE = 50;
|
|
80
80
|
var TypeaheadEditor = function (_a) {
|
|
81
|
-
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"]);
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
81
|
+
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"]);
|
|
82
|
+
var _e = (0, react_1.useState)([]), suggestions = _e[0], setSuggestions = _e[1];
|
|
83
|
+
var _f = (0, react_1.useState)(false), isPlaceholderVisible = _f[0], setPlaceholderVisibility = _f[1];
|
|
84
|
+
var _g = (0, react_1.useState)(1), pageNumber = _g[0], setPageNumber = _g[1];
|
|
85
|
+
var _h = (0, react_1.useState)(false), nextPageIsLoading = _h[0], setNextPageIsLoading = _h[1];
|
|
86
86
|
var pageSizeForRequest = max + 1;
|
|
87
|
-
var
|
|
87
|
+
var _j = (0, react_1.useState)(''), currentValue = _j[0], setCurrentValue = _j[1];
|
|
88
88
|
value = (0, ramda_1.defaultTo)(multiple ? [] : '', value);
|
|
89
89
|
var inputValue = multiple ? currentValue : value;
|
|
90
90
|
(0, hooks_1.useDidUpdateEffect)(function () {
|
|
@@ -110,7 +110,7 @@ var TypeaheadEditor = function (_a) {
|
|
|
110
110
|
]);
|
|
111
111
|
var displayedSuggestions = (0, react_1.useMemo)(function () { return suggestions.slice(0, pageNumber * max); }, [suggestions, pageNumber, max]);
|
|
112
112
|
var showMoreButton = suggestions.length > displayedSuggestions.length;
|
|
113
|
-
var
|
|
113
|
+
var _k = (0, react_1.useState)(false), hasHighlightedItem = _k[0], setHasHighlightedItem = _k[1];
|
|
114
114
|
var onInputChange = function (_a) {
|
|
115
115
|
var newValue = _a.newValue, method = _a.method;
|
|
116
116
|
switch (method) {
|
|
@@ -149,13 +149,15 @@ var TypeaheadEditor = function (_a) {
|
|
|
149
149
|
onInputChange({ method: 'enter', newValue: currentValue });
|
|
150
150
|
}
|
|
151
151
|
}, fullWidth: fullWidth }, inputProps), { autoComplete: 'nope' }), getSuggestionValue: ramda_1.identity, onSuggestionsFetchRequested: (0, ramda_1.ifElse)((0, ramda_1.propEq)('reason', 'input-changed'), debouncedFetchSuggestions, fetchSuggestions), onSuggestionsClearRequested: (0, ramda_1.pipe)((0, ramda_1.always)([]), setSuggestions, ramda_1.F, setPlaceholderVisibility, (0, ramda_1.always)(1), setPageNumber), renderInputComponent: function (_a) {
|
|
152
|
-
var _b;
|
|
152
|
+
var _b, _c;
|
|
153
153
|
var ref = _a.ref, onInputChange = _a.onChange, otherProps = __rest(_a, ["ref", "onChange"]);
|
|
154
154
|
var commonClasses = {
|
|
155
155
|
underline: (0, classnames_1.default)((_b = {}, _b[styles['input__underline']] = (0, mdm_sdk_1.isEmptyValue)(value), _b)),
|
|
156
156
|
input: (0, classnames_1.default)(styles['rawInput'], (0, ramda_1.path)(['classes', 'input'], InputProps))
|
|
157
157
|
};
|
|
158
|
-
return multiple ? (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (react_1.default.createElement(ValueChip_1.default, { key: item, label: item, onDelete: function () { return onChange((0, ramda_1.remove)(index, 1, value)); } })); }), inputComponent: react_input_autosize_1.default, classes: __assign(__assign({ root: (0, classnames_1.default)(styles['multiple-input__input'], (0, ramda_1.path)(['classes', 'root'], InputProps)) }, commonClasses), { input: (0, classnames_1.default)(styles.autosizeInput, commonClasses.input), adornedStart: styles['multiple-input__adornedStart'] }) }), value: currentValue, onChange: onInputChange, classes: { root: styles['multiple-input__root'] } }))) : (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, value: value, onChange: (0, ramda_1.pipe)((0, ramda_1.tap)(onInputChange), utils_1.getValue, onChange), InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: (0, classnames_1.default)(styles['input__root'], (0, ramda_1.path)(['classes', 'root'], InputProps)
|
|
158
|
+
return multiple ? (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, InputProps: __assign(__assign({}, InputProps), { startAdornment: value.map(function (item, index) { return (react_1.default.createElement(ValueChip_1.default, { key: item, label: item, onDelete: function () { return onChange((0, ramda_1.remove)(index, 1, value)); } })); }), inputComponent: react_input_autosize_1.default, classes: __assign(__assign({ root: (0, classnames_1.default)(styles['multiple-input__input'], (0, ramda_1.path)(['classes', 'root'], InputProps)) }, commonClasses), { input: (0, classnames_1.default)(styles.autosizeInput, commonClasses.input), adornedStart: styles['multiple-input__adornedStart'] }) }), value: currentValue, onChange: onInputChange, classes: { root: styles['multiple-input__root'] } }))) : (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { ref: inputRef, inputRef: ref, value: value, onChange: (0, ramda_1.pipe)((0, ramda_1.tap)(onInputChange), utils_1.getValue, onChange), InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: (0, classnames_1.default)(styles['input__root'], (0, ramda_1.path)(['classes', 'root'], InputProps), (_c = {},
|
|
159
|
+
_c[styles.isCrossedOut] = isCrossedOut,
|
|
160
|
+
_c)) }, commonClasses) }) })));
|
|
159
161
|
}, renderSuggestionsContainer: function (_a) {
|
|
160
162
|
var children = _a.children, _b = _a.containerProps, ref = _b.ref, restContainerProps = __rest(_b, ["ref"]);
|
|
161
163
|
return (react_1.default.createElement(Popper_1.default, { anchorEl: inputRef.current, open: Boolean(children) || isPlaceholderVisible },
|
|
@@ -181,6 +183,7 @@ TypeaheadEditor.propTypes = {
|
|
|
181
183
|
onChange: prop_types_1.default.func.isRequired,
|
|
182
184
|
getSuggestions: prop_types_1.default.func.isRequired,
|
|
183
185
|
InputProps: prop_types_1.default.object,
|
|
184
|
-
max: prop_types_1.default.number
|
|
186
|
+
max: prop_types_1.default.number,
|
|
187
|
+
isCrossedOut: prop_types_1.default.bool
|
|
185
188
|
};
|
|
186
189
|
exports.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">;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export default MultipleInput;
|
|
2
|
-
declare function MultipleInput({ values, InputProps, inputProps, classes, onChange, getValueLabel, ...otherProps }: {
|
|
2
|
+
declare function MultipleInput({ values, InputProps, inputProps, classes, isCrossedOut, onChange, getValueLabel, ...otherProps }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
values?: any[];
|
|
5
5
|
InputProps?: {};
|
|
6
6
|
inputProps?: {};
|
|
7
7
|
classes?: {};
|
|
8
|
+
isCrossedOut: any;
|
|
8
9
|
onChange?: () => void;
|
|
9
10
|
getValueLabel?: any;
|
|
10
11
|
}): JSX.Element;
|
|
@@ -21,6 +22,7 @@ declare namespace MultipleInput {
|
|
|
21
22
|
const onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
23
|
const classes: PropTypes.Requireable<object>;
|
|
23
24
|
const getValueLabel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
const isCrossedOut: PropTypes.Requireable<boolean>;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
import PropTypes from 'prop-types';
|
|
@@ -52,10 +52,11 @@ var BACKSPACE_KEY_CODE = 8;
|
|
|
52
52
|
var EMPTY_VALUES_EDIT_HINT = i18n.text('Press Enter to add. You may enter multiple values');
|
|
53
53
|
var isEmptyValue = pipe(trim, isEmpty);
|
|
54
54
|
var MultipleInput = function (_a) {
|
|
55
|
-
var _b
|
|
55
|
+
var _b;
|
|
56
|
+
var _c = _a.values, values = _c === void 0 ? [] : _c, _d = _a.InputProps, InputProps = _d === void 0 ? {} : _d, _e = _a.inputProps, inputProps = _e === void 0 ? {} : _e, _f = _a.classes, classes = _f === void 0 ? {} : _f, isCrossedOut = _a.isCrossedOut, _g = _a.onChange, onChange = _g === void 0 ? noop : _g, _h = _a.getValueLabel, getValueLabel = _h === void 0 ? identity : _h, otherProps = __rest(_a, ["values", "InputProps", "inputProps", "classes", "isCrossedOut", "onChange", "getValueLabel"]);
|
|
56
57
|
var styles = useStyles();
|
|
57
|
-
var
|
|
58
|
-
var
|
|
58
|
+
var _j = InputProps.classes || {}, root = _j.root, InputClasses = __rest(_j, ["root"]);
|
|
59
|
+
var _k = useState(''), inputValue = _k[0], setInputValue = _k[1];
|
|
59
60
|
var clearInputValue = function () { return setInputValue(''); };
|
|
60
61
|
var removeValueAt = function (index) { return onChange(remove(index, 1, values)); };
|
|
61
62
|
var appendValue = function (value) { return onChange(uniq(__spreadArray(__spreadArray([], values, true), [value], false))); };
|
|
@@ -71,14 +72,14 @@ var MultipleInput = function (_a) {
|
|
|
71
72
|
removeValueAt(-1);
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
|
-
var
|
|
75
|
+
var _l = useState(false), isFocused = _l[0], setIsFocused = _l[1];
|
|
75
76
|
var setFocused = function () { return setIsFocused(true); };
|
|
76
77
|
var setUnfocused = function () { return setIsFocused(false); };
|
|
77
78
|
var hintText = !hasValues && isFocused ? EMPTY_VALUES_EDIT_HINT : '';
|
|
78
79
|
return (React.createElement(Tooltip, { title: hintText },
|
|
79
80
|
React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { classes: {
|
|
80
81
|
root: classes.root
|
|
81
|
-
}, value: inputValue, onChange: pipe(getValue, setInputValue), InputProps: __assign(__assign({}, InputProps), { startAdornment: values.map(function (value, index) { return (React.createElement(ValueChip, { key: value, label: getValueLabel(value), onDelete: function () { return removeValueAt(index); } })); }), inputComponent: AutosizeInputWrapper, classes: __assign({ root: classnames(styles.inputRoot, root), input: classnames(styles.autosizeInput, InputClasses.input) }, InputClasses) }), inputProps: __assign(__assign({}, inputProps), { CustomInputComponent: InputProps.inputComponent }), onKeyPress: when(propEq('key', 'Enter'), appendInputValueIfNotEmpty), onKeyDown: when(propEq('keyCode', BACKSPACE_KEY_CODE), popLastValueIfInputIsEmpty), onFocus: setFocused, onBlur: pipe(appendInputValueIfNotEmpty, setUnfocused) }))));
|
|
82
|
+
}, value: inputValue, onChange: pipe(getValue, setInputValue), InputProps: __assign(__assign({}, InputProps), { startAdornment: values.map(function (value, index) { return (React.createElement(ValueChip, { key: value, label: getValueLabel(value), onDelete: function () { return removeValueAt(index); } })); }), inputComponent: AutosizeInputWrapper, classes: __assign({ root: classnames(styles.inputRoot, root, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b)), input: classnames(styles.autosizeInput, InputClasses.input) }, InputClasses) }), inputProps: __assign(__assign({}, inputProps), { CustomInputComponent: InputProps.inputComponent }), onKeyPress: when(propEq('key', 'Enter'), appendInputValueIfNotEmpty), onKeyDown: when(propEq('keyCode', BACKSPACE_KEY_CODE), popLastValueIfInputIsEmpty), onFocus: setFocused, onBlur: pipe(appendInputValueIfNotEmpty, setUnfocused) }))));
|
|
82
83
|
};
|
|
83
84
|
MultipleInput.propTypes = {
|
|
84
85
|
values: PropTypes.arrayOf(PropTypes.string),
|
|
@@ -89,6 +90,7 @@ MultipleInput.propTypes = {
|
|
|
89
90
|
inputProps: PropTypes.object,
|
|
90
91
|
onChange: PropTypes.func,
|
|
91
92
|
classes: PropTypes.object,
|
|
92
|
-
getValueLabel: PropTypes.func
|
|
93
|
+
getValueLabel: PropTypes.func,
|
|
94
|
+
isCrossedOut: PropTypes.bool
|
|
93
95
|
};
|
|
94
96
|
export default MultipleInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"inputRoot" | "autosizeInput">;
|
|
1
|
+
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"isCrossedOut" | "inputRoot" | "autosizeInput">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default MultipliableSelect;
|
|
2
|
-
declare function MultipliableSelect({ multiple, value, children, getValueLabel, getValuePlaceholder, onChange, fullWidth, TextFieldProps, MenuProps, classes, ...otherProps }: {
|
|
2
|
+
declare function MultipliableSelect({ multiple, value, children, getValueLabel, getValuePlaceholder, onChange, fullWidth, TextFieldProps, MenuProps, classes, isCrossedOut, ...otherProps }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
multiple: any;
|
|
5
5
|
value: any;
|
|
@@ -11,6 +11,7 @@ declare function MultipliableSelect({ multiple, value, children, getValueLabel,
|
|
|
11
11
|
TextFieldProps: any;
|
|
12
12
|
MenuProps: any;
|
|
13
13
|
classes: any;
|
|
14
|
+
isCrossedOut: any;
|
|
14
15
|
}): JSX.Element;
|
|
15
16
|
declare namespace MultipliableSelect {
|
|
16
17
|
namespace propTypes {
|
|
@@ -24,6 +25,7 @@ declare namespace MultipliableSelect {
|
|
|
24
25
|
const onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
26
|
const getValueLabel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
26
27
|
const getValuePlaceholder: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
const isCrossedOut: PropTypes.Requireable<boolean>;
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
import PropTypes from 'prop-types';
|
|
@@ -31,9 +31,9 @@ import ValueChip from '../ValueChip/ValueChip';
|
|
|
31
31
|
import { useStyles } from './styles';
|
|
32
32
|
var MultipliableSelect = function (_a) {
|
|
33
33
|
var _b;
|
|
34
|
-
var multiple = _a.multiple, value = _a.value, children = _a.children, _c = _a.getValueLabel, getValueLabel = _c === void 0 ? noop : _c, _d = _a.getValuePlaceholder, getValuePlaceholder = _d === void 0 ? identity : _d, _e = _a.onChange, onChange = _e === void 0 ? noop : _e, fullWidth = _a.fullWidth, TextFieldProps = _a.TextFieldProps, MenuProps = _a.MenuProps, classes = _a.classes, otherProps = __rest(_a, ["multiple", "value", "children", "getValueLabel", "getValuePlaceholder", "onChange", "fullWidth", "TextFieldProps", "MenuProps", "classes"]);
|
|
34
|
+
var multiple = _a.multiple, value = _a.value, children = _a.children, _c = _a.getValueLabel, getValueLabel = _c === void 0 ? noop : _c, _d = _a.getValuePlaceholder, getValuePlaceholder = _d === void 0 ? identity : _d, _e = _a.onChange, onChange = _e === void 0 ? noop : _e, fullWidth = _a.fullWidth, TextFieldProps = _a.TextFieldProps, MenuProps = _a.MenuProps, classes = _a.classes, isCrossedOut = _a.isCrossedOut, otherProps = __rest(_a, ["multiple", "value", "children", "getValueLabel", "getValuePlaceholder", "onChange", "fullWidth", "TextFieldProps", "MenuProps", "classes", "isCrossedOut"]);
|
|
35
35
|
var styles = useStyles();
|
|
36
|
-
return (React.createElement(TextField, __assign({ variant: "standard", select: true, fullWidth: fullWidth }, TextFieldProps, { value: defaultTo(multiple ? [] : '', value), onChange: pipe(getValue, onChange), SelectProps: __assign(__assign({}, otherProps), { MenuProps: __assign({ anchorOrigin: { vertical: 'bottom', horizontal: 'center' } }, MenuProps), classes: __assign(__assign({}, classes), { select: classnames((_b = {}, _b[styles.multiSelect] = multiple, _b), prop('root', classes), prop('select', classes)) }), multiple: multiple,
|
|
36
|
+
return (React.createElement(TextField, __assign({ variant: "standard", select: true, fullWidth: fullWidth }, TextFieldProps, { value: defaultTo(multiple ? [] : '', value), onChange: pipe(getValue, onChange), SelectProps: __assign(__assign({}, otherProps), { MenuProps: __assign({ anchorOrigin: { vertical: 'bottom', horizontal: 'center' } }, MenuProps), classes: __assign(__assign({}, classes), { select: classnames((_b = {}, _b[styles.multiSelect] = multiple, _b[styles.isCrossedOut] = isCrossedOut, _b), prop('root', classes), prop('select', classes)) }), multiple: multiple,
|
|
37
37
|
// eslint-disable-next-line react/display-name
|
|
38
38
|
renderValue: function (selected) {
|
|
39
39
|
return multiple ? (React.createElement("div", { className: styles.chips }, selected.map(function (value, index) { return (React.createElement(ValueChip, { key: value, label: getValueLabel(value) || getValuePlaceholder(value), onMouseDown: function (event) { return event.stopPropagation(); }, onDelete: function () { return onChange(remove(index, 1, selected)); } })); }))) : (getValueLabel(selected) || getValuePlaceholder(selected));
|
|
@@ -49,6 +49,7 @@ MultipliableSelect.propTypes = {
|
|
|
49
49
|
classes: PropTypes.object,
|
|
50
50
|
onChange: PropTypes.func,
|
|
51
51
|
getValueLabel: PropTypes.func,
|
|
52
|
-
getValuePlaceholder: PropTypes.func
|
|
52
|
+
getValuePlaceholder: PropTypes.func,
|
|
53
|
+
isCrossedOut: PropTypes.bool
|
|
53
54
|
};
|
|
54
55
|
export default MultipliableSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"multiSelect" | "chips">;
|
|
1
|
+
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"multiSelect" | "chips" | "isCrossedOut">;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export default SimpleInput;
|
|
2
|
-
declare function SimpleInput({ value, onChange, multiline, ...otherProps }: {
|
|
2
|
+
declare function SimpleInput({ value, onChange, multiline, InputProps, isCrossedOut, ...otherProps }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
value: any;
|
|
5
5
|
onChange?: () => void;
|
|
6
6
|
multiline: any;
|
|
7
|
+
InputProps?: {};
|
|
8
|
+
isCrossedOut: any;
|
|
7
9
|
}): JSX.Element;
|
|
8
10
|
declare namespace SimpleInput {
|
|
9
11
|
namespace propTypes {
|
|
@@ -12,6 +14,7 @@ declare namespace SimpleInput {
|
|
|
12
14
|
const multiline: PropTypes.Requireable<boolean>;
|
|
13
15
|
const InputProps: PropTypes.Requireable<object>;
|
|
14
16
|
const className: PropTypes.Requireable<string>;
|
|
17
|
+
const isCrossedOut: PropTypes.Requireable<boolean>;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
import PropTypes from 'prop-types';
|
|
@@ -22,12 +22,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import React, { useEffect, useState } from 'react';
|
|
24
24
|
import PropTypes from 'prop-types';
|
|
25
|
+
import classnames from 'classnames';
|
|
25
26
|
import { isNil, pipe, propEq, when } from 'ramda';
|
|
26
|
-
import { getValue, noop } from '../../core';
|
|
27
27
|
import TextField from '@mui/material/TextField';
|
|
28
|
+
import { getValue, noop } from '../../core';
|
|
29
|
+
import { useStyles } from './styles';
|
|
28
30
|
var SimpleInput = function (_a) {
|
|
29
|
-
var
|
|
30
|
-
var _c =
|
|
31
|
+
var _b;
|
|
32
|
+
var value = _a.value, _c = _a.onChange, onChange = _c === void 0 ? noop : _c, multiline = _a.multiline, _d = _a.InputProps, InputProps = _d === void 0 ? {} : _d, isCrossedOut = _a.isCrossedOut, otherProps = __rest(_a, ["value", "onChange", "multiline", "InputProps", "isCrossedOut"]);
|
|
33
|
+
var styles = useStyles();
|
|
34
|
+
var _e = InputProps.classes || {}, root = _e.root, InputClasses = __rest(_e, ["root"]);
|
|
35
|
+
var _f = useState(''), currentValue = _f[0], setCurrentValue = _f[1];
|
|
31
36
|
useEffect(function () {
|
|
32
37
|
setCurrentValue(isNil(value) ? '' : value);
|
|
33
38
|
}, [value]);
|
|
@@ -41,13 +46,14 @@ var SimpleInput = function (_a) {
|
|
|
41
46
|
applyCurrentValueChange();
|
|
42
47
|
}
|
|
43
48
|
};
|
|
44
|
-
return (React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { multiline: multiline, value: currentValue, onKeyPress: when(propEq('key', 'Enter'), onEnterPress), onBlur: applyCurrentValueChange, onChange: pipe(getValue, setCurrentValue) })));
|
|
49
|
+
return (React.createElement(TextField, __assign({ variant: "standard" }, otherProps, { InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: classnames(root, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b)) }, InputClasses) }), multiline: multiline, value: currentValue, onKeyPress: when(propEq('key', 'Enter'), onEnterPress), onBlur: applyCurrentValueChange, onChange: pipe(getValue, setCurrentValue) })));
|
|
45
50
|
};
|
|
46
51
|
SimpleInput.propTypes = {
|
|
47
52
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
48
53
|
onChange: PropTypes.func,
|
|
49
54
|
multiline: PropTypes.bool,
|
|
50
55
|
InputProps: PropTypes.object,
|
|
51
|
-
className: PropTypes.string
|
|
56
|
+
className: PropTypes.string,
|
|
57
|
+
isCrossedOut: PropTypes.bool
|
|
52
58
|
};
|
|
53
59
|
export default SimpleInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"isCrossedOut">;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributeValue, NestedAttributeValue, ReferenceAttributeValue, SimpleAttributeValue } from '@reltio/mdm-sdk';
|
|
3
3
|
import { AttributePagerProps } from './index';
|
|
4
|
-
|
|
5
|
-
type Props = Required<Omit<AttributePagerProps, 'values'>> & {
|
|
4
|
+
type Props = Omit<AttributePagerProps, 'values'> & {
|
|
6
5
|
values?: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue)[];
|
|
7
6
|
nonVisibleValues: AttributeValue[];
|
|
8
|
-
highlightedError?: React.ContextType<typeof ScrollToElementContext>;
|
|
9
|
-
highlightedAttribute?: React.ContextType<typeof ScrollToElementContext>;
|
|
10
7
|
};
|
|
11
8
|
declare const _default: React.MemoExoticComponent<{
|
|
12
9
|
({ max, values, attributeType, parentUri, mode, drawLines, showEmptyEditors, errorMessage, errors, paging, crosswalks, showNonOv, nonVisibleValues, highlightedError, highlightedAttribute, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: Props): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState, useContext, useMemo, memo } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { createNewAttribute, getAttributeOwnError, isComplexAttribute, isEditableMode as checkIsEditableMode, isEmptyValue } from '@reltio/mdm-sdk';
|
|
4
|
-
import { add, always, has, ifElse, min, pipe, prop, T } from 'ramda';
|
|
4
|
+
import { add, always, has, ifElse, min, pipe, prop, T, omit } from 'ramda';
|
|
5
5
|
import BranchDecorator from '../../BranchDecorator/BranchDecorator';
|
|
6
6
|
import ErrorMessage from '../../../ErrorWrapper/ErrorMessage';
|
|
7
7
|
import Title from '../../../Title/Title';
|
|
@@ -31,16 +31,20 @@ var AttributeRenderer = function (_a) {
|
|
|
31
31
|
var showEmpty = ((!hadDeletions && showEmptyEditors) || isRequired || isPinned) && isEmptyValues;
|
|
32
32
|
var emptyEditorValue = useRef(createNewAttribute({
|
|
33
33
|
parentUri: parentUri,
|
|
34
|
-
attributeType: attributeType
|
|
34
|
+
attributeType: omit(['defaultValue'], attributeType)
|
|
35
35
|
}));
|
|
36
36
|
var onAddOneMore = useCallback(function () {
|
|
37
37
|
setVisibleValuesCount(visibleValuesCount + 1);
|
|
38
|
-
var
|
|
38
|
+
var createAttribute = function (attributeType) { return ({
|
|
39
39
|
parentUri: parentUri,
|
|
40
40
|
index: visibleValuesCount,
|
|
41
41
|
attributeType: attributeType
|
|
42
|
-
};
|
|
43
|
-
|
|
42
|
+
}); };
|
|
43
|
+
if (showEmpty && !isComplexAttribute(attributeType.type)) {
|
|
44
|
+
var attributes = [createAttribute(omit(['defaultValue'], attributeType)), createAttribute(attributeType)];
|
|
45
|
+
return onAddAttributes(attributes);
|
|
46
|
+
}
|
|
47
|
+
return onAddAttributes([createAttribute(attributeType)]);
|
|
44
48
|
}, [visibleValuesCount, onAddAttributes, parentUri, attributeType, showEmpty]);
|
|
45
49
|
var onDelete = useCallback(pipe(onDeleteAttribute, T, setHadDeletions), [onDeleteAttribute, setHadDeletions]);
|
|
46
50
|
if (isEmptyValues && !showEmpty) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { RequestNextPageOfAttributeValuesPayload } from '@reltio/mdm-module';
|
|
3
3
|
import { AttributeError, AttributeType, Crosswalk, ImageAttributeValue, Mode, NestedAttributeValue, Paging, ReferenceAttributeValue, SimpleAttributeValue, AttributeItem } from '@reltio/mdm-sdk';
|
|
4
4
|
import AttributesPager from './AttributesPager';
|
|
@@ -33,7 +33,7 @@ type OwnProps = {
|
|
|
33
33
|
};
|
|
34
34
|
export type AttributePagerProps = StateProps & DispatchProps & OwnProps;
|
|
35
35
|
export { AttributesPager, CardinalityMessage };
|
|
36
|
-
declare const _default: import("react-redux").ConnectedComponent<
|
|
37
|
-
children?:
|
|
36
|
+
declare const _default: import("react-redux").ConnectedComponent<React.ComponentType<StateProps & DispatchProps & OwnProps>, (import("react-redux").Omit<React.ClassAttributes<React.Component<StateProps & DispatchProps & OwnProps, any, any>> & StateProps & DispatchProps & OwnProps, "max" | "errorMessage" | "errors" | "requestNextPageOfAttributeValues" | "onDeactivateError"> | import("react-redux").Omit<StateProps & DispatchProps & OwnProps & {
|
|
37
|
+
children?: React.ReactNode;
|
|
38
38
|
}, "max" | "errorMessage" | "errors" | "requestNextPageOfAttributeValues" | "onDeactivateError">) & OwnProps>;
|
|
39
39
|
export default _default;
|
|
@@ -92,7 +92,7 @@ var SimpleAttributeEditor = function (_a) {
|
|
|
92
92
|
var showAddButton = !!onAddOneMore && canCreate && !attributeType.singleValue;
|
|
93
93
|
var showDeleteButton = !deleted && !!onDeleteAttribute && canDelete;
|
|
94
94
|
var hasError = !!errorMessage;
|
|
95
|
-
var deletedProps = deleted ? { disabled: true } : {};
|
|
95
|
+
var deletedProps = deleted ? { disabled: true, isCrossedOut: true } : {};
|
|
96
96
|
var isProfilePerspectiveView = useContext(ProfilePerspectiveViewContext);
|
|
97
97
|
var autopopulationContextValue = useAutopopulationContextValue({
|
|
98
98
|
enabled: isProfilePerspectiveView && isDependentLookupAttrType(attributeType),
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
onChange?: (checked: boolean) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
isCrossedOut?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const BooleanRadioEditor: ({ value, onChange, className, isCrossedOut, disabled }: Props) => JSX.Element;
|
|
1
10
|
export default BooleanRadioEditor;
|
|
2
|
-
declare function BooleanRadioEditor({ value, onChange, className }: {
|
|
3
|
-
value: any;
|
|
4
|
-
onChange: any;
|
|
5
|
-
className: any;
|
|
6
|
-
}): JSX.Element;
|
|
7
|
-
declare namespace BooleanRadioEditor {
|
|
8
|
-
namespace propTypes {
|
|
9
|
-
const value: PropTypes.Requireable<boolean>;
|
|
10
|
-
const onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
const className: PropTypes.Requireable<string>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import BooleanEditor from '../BooleanEditor/BooleanEditor';
|
|
2
|
-
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
1
|
import React from 'react';
|
|
5
2
|
import i18n from 'ui-i18n';
|
|
3
|
+
import classnames from 'classnames';
|
|
6
4
|
import { isNil, not, pipe } from 'ramda';
|
|
5
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
6
|
+
import BooleanEditor from '../BooleanEditor/BooleanEditor';
|
|
7
7
|
import { useStyles } from './styles';
|
|
8
8
|
var BooleanRadioEditor = function (_a) {
|
|
9
|
-
var
|
|
9
|
+
var _b;
|
|
10
|
+
var value = _a.value, onChange = _a.onChange, className = _a.className, isCrossedOut = _a.isCrossedOut, disabled = _a.disabled;
|
|
10
11
|
var styles = useStyles();
|
|
11
12
|
return (React.createElement("div", { className: className },
|
|
12
|
-
React.createElement(
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
BooleanRadioEditor.propTypes = {
|
|
16
|
-
value: PropTypes.bool,
|
|
17
|
-
onChange: PropTypes.func,
|
|
18
|
-
className: PropTypes.string
|
|
13
|
+
React.createElement("div", { className: classnames(styles.editors, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b)) },
|
|
14
|
+
React.createElement(FormControlLabel, { classes: { label: styles.label }, control: React.createElement(BooleanEditor, { classes: { root: styles.checkboxPrimary }, color: "primary", value: !isNil(value) && !!value, onChange: onChange, disabled: disabled }), label: i18n.text('Yes') }),
|
|
15
|
+
React.createElement(FormControlLabel, { classes: { label: styles.label }, control: React.createElement(BooleanEditor, { classes: { root: styles.checkboxPrimary }, color: "primary", value: !isNil(value) && !value, onChange: onChange && pipe(not, onChange), disabled: disabled }), label: i18n.text('No') }))));
|
|
19
16
|
};
|
|
20
17
|
export default BooleanRadioEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"label" | "
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"label" | "editors" | "isCrossedOut" | "checkboxPrimary">;
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { makeStyles } from '@mui/styles';
|
|
2
2
|
export var useStyles = makeStyles(function (theme) { return ({
|
|
3
|
-
|
|
3
|
+
editors: {
|
|
4
|
+
width: 'fit-content'
|
|
5
|
+
},
|
|
6
|
+
checkboxPrimary: {
|
|
4
7
|
color: theme.palette.divider
|
|
5
8
|
},
|
|
6
9
|
label: {
|
|
7
10
|
color: theme.palette.text.secondary
|
|
11
|
+
},
|
|
12
|
+
isCrossedOut: {
|
|
13
|
+
position: 'relative',
|
|
14
|
+
'&:before': {
|
|
15
|
+
content: "''",
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
height: '1px',
|
|
18
|
+
background: theme.palette.text.secondary,
|
|
19
|
+
top: '50%',
|
|
20
|
+
left: '-3px',
|
|
21
|
+
right: '13px'
|
|
22
|
+
}
|
|
8
23
|
}
|
|
9
24
|
}); });
|
|
@@ -6,6 +6,7 @@ type DateEditorProps = Omit<DatePickerProps<Moment>, 'value' | 'minDate' | 'maxD
|
|
|
6
6
|
maxDate?: Date | number;
|
|
7
7
|
value?: Date | number;
|
|
8
8
|
onChange: (value: Date) => void;
|
|
9
|
+
isCrossedOut?: boolean;
|
|
9
10
|
};
|
|
10
|
-
declare const DateEditor: ({ value, minDate, maxDate, format, label, onChange, slotProps, ...otherProps }: DateEditorProps) => JSX.Element;
|
|
11
|
+
declare const DateEditor: ({ value, minDate, maxDate, format, label, onChange, slotProps, isCrossedOut, ...otherProps }: DateEditorProps) => JSX.Element;
|
|
11
12
|
export default DateEditor;
|
|
@@ -22,17 +22,18 @@ 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
|
-
import { isNil, pipe, when, both } from 'ramda';
|
|
28
28
|
import { debounce, utils } from '@reltio/mdm-sdk';
|
|
29
29
|
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
30
30
|
import { DEFAULT_MAX_DATE, DEFAULT_MIN_DATE } from '../constants';
|
|
31
31
|
import { useStyles } from './styles';
|
|
32
32
|
var DateEditor = function (_a) {
|
|
33
|
-
var
|
|
33
|
+
var _b;
|
|
34
|
+
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, format = _a.format, label = _a.label, onChange = _a.onChange, slotProps = _a.slotProps, isCrossedOut = _a.isCrossedOut, otherProps = __rest(_a, ["value", "minDate", "maxDate", "format", "label", "onChange", "slotProps", "isCrossedOut"]);
|
|
34
35
|
var styles = useStyles();
|
|
35
|
-
var
|
|
36
|
+
var _e = React.useState(null), error = _e[0], setError = _e[1];
|
|
36
37
|
var errorMessage = useMemo(function () {
|
|
37
38
|
switch (error) {
|
|
38
39
|
case 'maxDate':
|
|
@@ -57,7 +58,7 @@ var DateEditor = function (_a) {
|
|
|
57
58
|
helperText: errorMessage,
|
|
58
59
|
InputProps: {
|
|
59
60
|
classes: {
|
|
60
|
-
root: styles.inputRoot
|
|
61
|
+
root: classnames(styles.inputRoot, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b))
|
|
61
62
|
},
|
|
62
63
|
disableUnderline: isNil(editorValue)
|
|
63
64
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"inputRoot" | "adornedEnd">;
|
|
1
|
+
export declare const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"isCrossedOut" | "inputRoot" | "adornedEnd">;
|
|
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24
|
+
import classnames from 'classnames';
|
|
24
25
|
import { components } from 'react-select';
|
|
25
26
|
import PropTypes from 'prop-types';
|
|
26
27
|
import { debounce, LookupValueType } from '@reltio/mdm-sdk';
|
|
@@ -41,7 +42,12 @@ import useAutopopulation from './useAutopopulation';
|
|
|
41
42
|
import useSavingFocus from './useSavingFocus';
|
|
42
43
|
import LoadMoreButton from '../../commonReactSelectComponents/LoadMoreButton';
|
|
43
44
|
import { useDidUpdateEffect } from '../../../hooks';
|
|
44
|
-
var Input = function (props) {
|
|
45
|
+
var Input = function (props) {
|
|
46
|
+
var _a;
|
|
47
|
+
var styles = useStyles();
|
|
48
|
+
var isCrossedOut = props.selectProps.isCrossedOut;
|
|
49
|
+
return (React.createElement(components.Input, __assign({}, props, { inputClassName: classnames((_a = {}, _a[styles.isCrossedOut] = isCrossedOut, _a)), isHidden: false })));
|
|
50
|
+
};
|
|
45
51
|
var SelectComponents = {
|
|
46
52
|
IndicatorSeparator: EmptyStub,
|
|
47
53
|
LoadingIndicator: EmptyStub,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"option" | "placeholder" | "clearIndicator" | "dropdownIndicator">;
|
|
1
|
+
export const useStyles: (props?: any) => import("@mui/styles").ClassNameMap<"option" | "placeholder" | "isCrossedOut" | "clearIndicator" | "dropdownIndicator">;
|
|
@@ -6,6 +6,7 @@ type TimestampEditorProps = Omit<DateTimePickerProps<Moment>, 'value' | 'minDate
|
|
|
6
6
|
maxDate?: Date | number;
|
|
7
7
|
value?: Date | number;
|
|
8
8
|
onChange: (value: Date) => void;
|
|
9
|
+
isCrossedOut?: boolean;
|
|
9
10
|
};
|
|
10
|
-
declare const TimestampEditor: ({ value, minDate, maxDate, label, slotProps, onChange, format, ...otherProps }: TimestampEditorProps) => JSX.Element;
|
|
11
|
+
declare const TimestampEditor: ({ value, minDate, maxDate, label, slotProps, onChange, format, isCrossedOut, ...otherProps }: TimestampEditorProps) => JSX.Element;
|
|
11
12
|
export default TimestampEditor;
|
|
@@ -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">;
|