@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
|
@@ -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';
|
|
@@ -80,10 +80,11 @@ var BACKSPACE_KEY_CODE = 8;
|
|
|
80
80
|
var EMPTY_VALUES_EDIT_HINT = ui_i18n_1.default.text('Press Enter to add. You may enter multiple values');
|
|
81
81
|
var isEmptyValue = (0, ramda_1.pipe)(ramda_1.trim, ramda_1.isEmpty);
|
|
82
82
|
var MultipleInput = function (_a) {
|
|
83
|
-
var _b
|
|
83
|
+
var _b;
|
|
84
|
+
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 ? utils_1.noop : _g, _h = _a.getValueLabel, getValueLabel = _h === void 0 ? ramda_1.identity : _h, otherProps = __rest(_a, ["values", "InputProps", "inputProps", "classes", "isCrossedOut", "onChange", "getValueLabel"]);
|
|
84
85
|
var styles = (0, styles_1.useStyles)();
|
|
85
|
-
var
|
|
86
|
-
var
|
|
86
|
+
var _j = InputProps.classes || {}, root = _j.root, InputClasses = __rest(_j, ["root"]);
|
|
87
|
+
var _k = (0, react_1.useState)(''), inputValue = _k[0], setInputValue = _k[1];
|
|
87
88
|
var clearInputValue = function () { return setInputValue(''); };
|
|
88
89
|
var removeValueAt = function (index) { return onChange((0, ramda_1.remove)(index, 1, values)); };
|
|
89
90
|
var appendValue = function (value) { return onChange((0, ramda_1.uniq)(__spreadArray(__spreadArray([], values, true), [value], false))); };
|
|
@@ -99,14 +100,14 @@ var MultipleInput = function (_a) {
|
|
|
99
100
|
removeValueAt(-1);
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
|
-
var
|
|
103
|
+
var _l = (0, react_1.useState)(false), isFocused = _l[0], setIsFocused = _l[1];
|
|
103
104
|
var setFocused = function () { return setIsFocused(true); };
|
|
104
105
|
var setUnfocused = function () { return setIsFocused(false); };
|
|
105
106
|
var hintText = !hasValues && isFocused ? EMPTY_VALUES_EDIT_HINT : '';
|
|
106
107
|
return (react_1.default.createElement(Tooltip_1.default, { title: hintText },
|
|
107
108
|
react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { classes: {
|
|
108
109
|
root: classes.root
|
|
109
|
-
}, value: inputValue, onChange: (0, ramda_1.pipe)(utils_1.getValue, setInputValue), InputProps: __assign(__assign({}, InputProps), { startAdornment: values.map(function (value, index) { return (react_1.default.createElement(ValueChip_1.default, { key: value, label: getValueLabel(value), onDelete: function () { return removeValueAt(index); } })); }), inputComponent: AutosizeInputWrapper, classes: __assign({ root: (0, classnames_1.default)(styles.inputRoot, root), input: (0, classnames_1.default)(styles.autosizeInput, InputClasses.input) }, InputClasses) }), inputProps: __assign(__assign({}, inputProps), { CustomInputComponent: InputProps.inputComponent }), onKeyPress: (0, ramda_1.when)((0, ramda_1.propEq)('key', 'Enter'), appendInputValueIfNotEmpty), onKeyDown: (0, ramda_1.when)((0, ramda_1.propEq)('keyCode', BACKSPACE_KEY_CODE), popLastValueIfInputIsEmpty), onFocus: setFocused, onBlur: (0, ramda_1.pipe)(appendInputValueIfNotEmpty, setUnfocused) }))));
|
|
110
|
+
}, value: inputValue, onChange: (0, ramda_1.pipe)(utils_1.getValue, setInputValue), InputProps: __assign(__assign({}, InputProps), { startAdornment: values.map(function (value, index) { return (react_1.default.createElement(ValueChip_1.default, { key: value, label: getValueLabel(value), onDelete: function () { return removeValueAt(index); } })); }), inputComponent: AutosizeInputWrapper, classes: __assign({ root: (0, classnames_1.default)(styles.inputRoot, root, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b)), input: (0, classnames_1.default)(styles.autosizeInput, InputClasses.input) }, InputClasses) }), inputProps: __assign(__assign({}, inputProps), { CustomInputComponent: InputProps.inputComponent }), onKeyPress: (0, ramda_1.when)((0, ramda_1.propEq)('key', 'Enter'), appendInputValueIfNotEmpty), onKeyDown: (0, ramda_1.when)((0, ramda_1.propEq)('keyCode', BACKSPACE_KEY_CODE), popLastValueIfInputIsEmpty), onFocus: setFocused, onBlur: (0, ramda_1.pipe)(appendInputValueIfNotEmpty, setUnfocused) }))));
|
|
110
111
|
};
|
|
111
112
|
MultipleInput.propTypes = {
|
|
112
113
|
values: prop_types_1.default.arrayOf(prop_types_1.default.string),
|
|
@@ -117,6 +118,7 @@ MultipleInput.propTypes = {
|
|
|
117
118
|
inputProps: prop_types_1.default.object,
|
|
118
119
|
onChange: prop_types_1.default.func,
|
|
119
120
|
classes: prop_types_1.default.object,
|
|
120
|
-
getValueLabel: prop_types_1.default.func
|
|
121
|
+
getValueLabel: prop_types_1.default.func,
|
|
122
|
+
isCrossedOut: prop_types_1.default.bool
|
|
121
123
|
};
|
|
122
124
|
exports.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';
|
|
@@ -36,9 +36,9 @@ var ValueChip_1 = __importDefault(require("../ValueChip/ValueChip"));
|
|
|
36
36
|
var styles_1 = require("./styles");
|
|
37
37
|
var MultipliableSelect = function (_a) {
|
|
38
38
|
var _b;
|
|
39
|
-
var multiple = _a.multiple, value = _a.value, children = _a.children, _c = _a.getValueLabel, getValueLabel = _c === void 0 ? utils_1.noop : _c, _d = _a.getValuePlaceholder, getValuePlaceholder = _d === void 0 ? ramda_1.identity : _d, _e = _a.onChange, onChange = _e === void 0 ? utils_1.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"]);
|
|
39
|
+
var multiple = _a.multiple, value = _a.value, children = _a.children, _c = _a.getValueLabel, getValueLabel = _c === void 0 ? utils_1.noop : _c, _d = _a.getValuePlaceholder, getValuePlaceholder = _d === void 0 ? ramda_1.identity : _d, _e = _a.onChange, onChange = _e === void 0 ? utils_1.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"]);
|
|
40
40
|
var styles = (0, styles_1.useStyles)();
|
|
41
|
-
return (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard", select: true, fullWidth: fullWidth }, TextFieldProps, { value: (0, ramda_1.defaultTo)(multiple ? [] : '', value), onChange: (0, ramda_1.pipe)(utils_1.getValue, onChange), SelectProps: __assign(__assign({}, otherProps), { MenuProps: __assign({ anchorOrigin: { vertical: 'bottom', horizontal: 'center' } }, MenuProps), classes: __assign(__assign({}, classes), { select: (0, classnames_1.default)((_b = {}, _b[styles.multiSelect] = multiple, _b), (0, ramda_1.prop)('root', classes), (0, ramda_1.prop)('select', classes)) }), multiple: multiple,
|
|
41
|
+
return (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard", select: true, fullWidth: fullWidth }, TextFieldProps, { value: (0, ramda_1.defaultTo)(multiple ? [] : '', value), onChange: (0, ramda_1.pipe)(utils_1.getValue, onChange), SelectProps: __assign(__assign({}, otherProps), { MenuProps: __assign({ anchorOrigin: { vertical: 'bottom', horizontal: 'center' } }, MenuProps), classes: __assign(__assign({}, classes), { select: (0, classnames_1.default)((_b = {}, _b[styles.multiSelect] = multiple, _b[styles.isCrossedOut] = isCrossedOut, _b), (0, ramda_1.prop)('root', classes), (0, ramda_1.prop)('select', classes)) }), multiple: multiple,
|
|
42
42
|
// eslint-disable-next-line react/display-name
|
|
43
43
|
renderValue: function (selected) {
|
|
44
44
|
return multiple ? (react_1.default.createElement("div", { className: styles.chips }, selected.map(function (value, index) { return (react_1.default.createElement(ValueChip_1.default, { key: value, label: getValueLabel(value) || getValuePlaceholder(value), onMouseDown: function (event) { return event.stopPropagation(); }, onDelete: function () { return onChange((0, ramda_1.remove)(index, 1, selected)); } })); }))) : (getValueLabel(selected) || getValuePlaceholder(selected));
|
|
@@ -54,6 +54,7 @@ MultipliableSelect.propTypes = {
|
|
|
54
54
|
classes: prop_types_1.default.object,
|
|
55
55
|
onChange: prop_types_1.default.func,
|
|
56
56
|
getValueLabel: prop_types_1.default.func,
|
|
57
|
-
getValuePlaceholder: prop_types_1.default.func
|
|
57
|
+
getValuePlaceholder: prop_types_1.default.func,
|
|
58
|
+
isCrossedOut: prop_types_1.default.bool
|
|
58
59
|
};
|
|
59
60
|
exports.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';
|
|
@@ -50,12 +50,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
var react_1 = __importStar(require("react"));
|
|
52
52
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
53
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
53
54
|
var ramda_1 = require("ramda");
|
|
54
|
-
var core_1 = require("../../core");
|
|
55
55
|
var TextField_1 = __importDefault(require("@mui/material/TextField"));
|
|
56
|
+
var core_1 = require("../../core");
|
|
57
|
+
var styles_1 = require("./styles");
|
|
56
58
|
var SimpleInput = function (_a) {
|
|
57
|
-
var
|
|
58
|
-
var _c =
|
|
59
|
+
var _b;
|
|
60
|
+
var value = _a.value, _c = _a.onChange, onChange = _c === void 0 ? core_1.noop : _c, multiline = _a.multiline, _d = _a.InputProps, InputProps = _d === void 0 ? {} : _d, isCrossedOut = _a.isCrossedOut, otherProps = __rest(_a, ["value", "onChange", "multiline", "InputProps", "isCrossedOut"]);
|
|
61
|
+
var styles = (0, styles_1.useStyles)();
|
|
62
|
+
var _e = InputProps.classes || {}, root = _e.root, InputClasses = __rest(_e, ["root"]);
|
|
63
|
+
var _f = (0, react_1.useState)(''), currentValue = _f[0], setCurrentValue = _f[1];
|
|
59
64
|
(0, react_1.useEffect)(function () {
|
|
60
65
|
setCurrentValue((0, ramda_1.isNil)(value) ? '' : value);
|
|
61
66
|
}, [value]);
|
|
@@ -69,13 +74,14 @@ var SimpleInput = function (_a) {
|
|
|
69
74
|
applyCurrentValueChange();
|
|
70
75
|
}
|
|
71
76
|
};
|
|
72
|
-
return (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { multiline: multiline, value: currentValue, onKeyPress: (0, ramda_1.when)((0, ramda_1.propEq)('key', 'Enter'), onEnterPress), onBlur: applyCurrentValueChange, onChange: (0, ramda_1.pipe)(core_1.getValue, setCurrentValue) })));
|
|
77
|
+
return (react_1.default.createElement(TextField_1.default, __assign({ variant: "standard" }, otherProps, { InputProps: __assign(__assign({}, InputProps), { classes: __assign({ root: (0, classnames_1.default)(root, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b)) }, InputClasses) }), multiline: multiline, value: currentValue, onKeyPress: (0, ramda_1.when)((0, ramda_1.propEq)('key', 'Enter'), onEnterPress), onBlur: applyCurrentValueChange, onChange: (0, ramda_1.pipe)(core_1.getValue, setCurrentValue) })));
|
|
73
78
|
};
|
|
74
79
|
SimpleInput.propTypes = {
|
|
75
80
|
value: prop_types_1.default.oneOfType([prop_types_1.default.string, prop_types_1.default.number]),
|
|
76
81
|
onChange: prop_types_1.default.func,
|
|
77
82
|
multiline: prop_types_1.default.bool,
|
|
78
83
|
InputProps: prop_types_1.default.object,
|
|
79
|
-
className: prop_types_1.default.string
|
|
84
|
+
className: prop_types_1.default.string,
|
|
85
|
+
isCrossedOut: prop_types_1.default.bool
|
|
80
86
|
};
|
|
81
87
|
exports.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;
|
|
@@ -59,16 +59,20 @@ var AttributeRenderer = function (_a) {
|
|
|
59
59
|
var showEmpty = ((!hadDeletions && showEmptyEditors) || isRequired || isPinned) && isEmptyValues;
|
|
60
60
|
var emptyEditorValue = (0, react_1.useRef)((0, mdm_sdk_1.createNewAttribute)({
|
|
61
61
|
parentUri: parentUri,
|
|
62
|
-
attributeType: attributeType
|
|
62
|
+
attributeType: (0, ramda_1.omit)(['defaultValue'], attributeType)
|
|
63
63
|
}));
|
|
64
64
|
var onAddOneMore = (0, react_1.useCallback)(function () {
|
|
65
65
|
setVisibleValuesCount(visibleValuesCount + 1);
|
|
66
|
-
var
|
|
66
|
+
var createAttribute = function (attributeType) { return ({
|
|
67
67
|
parentUri: parentUri,
|
|
68
68
|
index: visibleValuesCount,
|
|
69
69
|
attributeType: attributeType
|
|
70
|
-
};
|
|
71
|
-
|
|
70
|
+
}); };
|
|
71
|
+
if (showEmpty && !(0, mdm_sdk_1.isComplexAttribute)(attributeType.type)) {
|
|
72
|
+
var attributes = [createAttribute((0, ramda_1.omit)(['defaultValue'], attributeType)), createAttribute(attributeType)];
|
|
73
|
+
return onAddAttributes(attributes);
|
|
74
|
+
}
|
|
75
|
+
return onAddAttributes([createAttribute(attributeType)]);
|
|
72
76
|
}, [visibleValuesCount, onAddAttributes, parentUri, attributeType, showEmpty]);
|
|
73
77
|
var onDelete = (0, react_1.useCallback)((0, ramda_1.pipe)(onDeleteAttribute, ramda_1.T, setHadDeletions), [onDeleteAttribute, setHadDeletions]);
|
|
74
78
|
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;
|
|
@@ -120,7 +120,7 @@ var SimpleAttributeEditor = function (_a) {
|
|
|
120
120
|
var showAddButton = !!onAddOneMore && canCreate && !attributeType.singleValue;
|
|
121
121
|
var showDeleteButton = !deleted && !!onDeleteAttribute && canDelete;
|
|
122
122
|
var hasError = !!errorMessage;
|
|
123
|
-
var deletedProps = deleted ? { disabled: true } : {};
|
|
123
|
+
var deletedProps = deleted ? { disabled: true, isCrossedOut: true } : {};
|
|
124
124
|
var isProfilePerspectiveView = (0, react_1.useContext)(contexts_1.ProfilePerspectiveViewContext);
|
|
125
125
|
var autopopulationContextValue = (0, useAutopopulationContextValue_1.useAutopopulationContextValue)({
|
|
126
126
|
enabled: isProfilePerspectiveView && (0, mdm_sdk_1.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';
|
|
@@ -3,23 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var BooleanEditor_1 = __importDefault(require("../BooleanEditor/BooleanEditor"));
|
|
7
|
-
var FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
|
|
8
|
-
var prop_types_1 = __importDefault(require("prop-types"));
|
|
9
6
|
var react_1 = __importDefault(require("react"));
|
|
10
7
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
8
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
11
9
|
var ramda_1 = require("ramda");
|
|
10
|
+
var FormControlLabel_1 = __importDefault(require("@mui/material/FormControlLabel"));
|
|
11
|
+
var BooleanEditor_1 = __importDefault(require("../BooleanEditor/BooleanEditor"));
|
|
12
12
|
var styles_1 = require("./styles");
|
|
13
13
|
var BooleanRadioEditor = function (_a) {
|
|
14
|
-
var
|
|
14
|
+
var _b;
|
|
15
|
+
var value = _a.value, onChange = _a.onChange, className = _a.className, isCrossedOut = _a.isCrossedOut, disabled = _a.disabled;
|
|
15
16
|
var styles = (0, styles_1.useStyles)();
|
|
16
17
|
return (react_1.default.createElement("div", { className: className },
|
|
17
|
-
react_1.default.createElement(
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
BooleanRadioEditor.propTypes = {
|
|
21
|
-
value: prop_types_1.default.bool,
|
|
22
|
-
onChange: prop_types_1.default.func,
|
|
23
|
-
className: prop_types_1.default.string
|
|
18
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)(styles.editors, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b)) },
|
|
19
|
+
react_1.default.createElement(FormControlLabel_1.default, { classes: { label: styles.label }, control: react_1.default.createElement(BooleanEditor_1.default, { classes: { root: styles.checkboxPrimary }, color: "primary", value: !(0, ramda_1.isNil)(value) && !!value, onChange: onChange, disabled: disabled }), label: ui_i18n_1.default.text('Yes') }),
|
|
20
|
+
react_1.default.createElement(FormControlLabel_1.default, { classes: { label: styles.label }, control: react_1.default.createElement(BooleanEditor_1.default, { classes: { root: styles.checkboxPrimary }, color: "primary", value: !(0, ramda_1.isNil)(value) && !value, onChange: onChange && (0, ramda_1.pipe)(ramda_1.not, onChange), disabled: disabled }), label: ui_i18n_1.default.text('No') }))));
|
|
24
21
|
};
|
|
25
22
|
exports.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">;
|
|
@@ -3,10 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useStyles = void 0;
|
|
4
4
|
var styles_1 = require("@mui/styles");
|
|
5
5
|
exports.useStyles = (0, styles_1.makeStyles)(function (theme) { return ({
|
|
6
|
-
|
|
6
|
+
editors: {
|
|
7
|
+
width: 'fit-content'
|
|
8
|
+
},
|
|
9
|
+
checkboxPrimary: {
|
|
7
10
|
color: theme.palette.divider
|
|
8
11
|
},
|
|
9
12
|
label: {
|
|
10
13
|
color: theme.palette.text.secondary
|
|
14
|
+
},
|
|
15
|
+
isCrossedOut: {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
'&:before': {
|
|
18
|
+
content: "''",
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
height: '1px',
|
|
21
|
+
background: theme.palette.text.secondary,
|
|
22
|
+
top: '50%',
|
|
23
|
+
left: '-3px',
|
|
24
|
+
right: '13px'
|
|
25
|
+
}
|
|
11
26
|
}
|
|
12
27
|
}); });
|
|
@@ -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;
|
|
@@ -50,17 +50,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
var react_1 = __importStar(require("react"));
|
|
52
52
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
53
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
53
54
|
var ramda_1 = require("ramda");
|
|
54
55
|
var moment_1 = __importDefault(require("moment"));
|
|
55
|
-
var ramda_2 = require("ramda");
|
|
56
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
57
57
|
var DatePicker_1 = require("@mui/x-date-pickers/DatePicker");
|
|
58
58
|
var constants_1 = require("../constants");
|
|
59
59
|
var styles_1 = require("./styles");
|
|
60
60
|
var DateEditor = function (_a) {
|
|
61
|
-
var
|
|
61
|
+
var _b;
|
|
62
|
+
var value = _a.value, _c = _a.minDate, minDate = _c === void 0 ? constants_1.DEFAULT_MIN_DATE : _c, _d = _a.maxDate, maxDate = _d === void 0 ? constants_1.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"]);
|
|
62
63
|
var styles = (0, styles_1.useStyles)();
|
|
63
|
-
var
|
|
64
|
+
var _e = react_1.default.useState(null), error = _e[0], setError = _e[1];
|
|
64
65
|
var errorMessage = (0, react_1.useMemo)(function () {
|
|
65
66
|
switch (error) {
|
|
66
67
|
case 'maxDate':
|
|
@@ -73,9 +74,9 @@ var DateEditor = function (_a) {
|
|
|
73
74
|
return '';
|
|
74
75
|
}
|
|
75
76
|
}, [error]);
|
|
76
|
-
var editorValue = (0,
|
|
77
|
-
var editorMinDate = (0,
|
|
78
|
-
var editorMaxDate = (0,
|
|
77
|
+
var editorValue = (0, ramda_1.isNil)(value) ? null : (0, moment_1.default)(value);
|
|
78
|
+
var editorMinDate = (0, ramda_1.isNil)(minDate) ? null : (0, moment_1.default)(minDate);
|
|
79
|
+
var editorMaxDate = (0, ramda_1.isNil)(maxDate) ? null : (0, moment_1.default)(maxDate);
|
|
79
80
|
var dateFormat = format || moment_1.default.localeData().longDateFormat('L');
|
|
80
81
|
// TODO: Fix types for InputProps/InputLabelProps in slotProps.textField
|
|
81
82
|
var editorSlotProps = (0, ramda_1.mergeDeepLeft)(slotProps, {
|
|
@@ -85,12 +86,12 @@ var DateEditor = function (_a) {
|
|
|
85
86
|
helperText: errorMessage,
|
|
86
87
|
InputProps: {
|
|
87
88
|
classes: {
|
|
88
|
-
root: styles.inputRoot
|
|
89
|
+
root: (0, classnames_1.default)(styles.inputRoot, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b))
|
|
89
90
|
},
|
|
90
|
-
disableUnderline: (0,
|
|
91
|
+
disableUnderline: (0, ramda_1.isNil)(editorValue)
|
|
91
92
|
},
|
|
92
93
|
InputLabelProps: {
|
|
93
|
-
shrink: !(0,
|
|
94
|
+
shrink: !(0, ramda_1.isNil)(label)
|
|
94
95
|
}
|
|
95
96
|
},
|
|
96
97
|
popper: {
|
|
@@ -101,6 +102,6 @@ var DateEditor = function (_a) {
|
|
|
101
102
|
className: styles.adornedEnd
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
|
-
return (react_1.default.createElement(DatePicker_1.DatePicker, __assign({ format: dateFormat, slotProps: editorSlotProps, views: ['year', 'month', 'day'], label: label, value: editorValue, minDate: editorMinDate, maxDate: editorMaxDate, onError: function (newError) { return setError(newError); }, onChange: (0, mdm_sdk_1.debounce)((0,
|
|
105
|
+
return (react_1.default.createElement(DatePicker_1.DatePicker, __assign({ format: dateFormat, slotProps: editorSlotProps, views: ['year', 'month', 'day'], label: label, value: editorValue, minDate: editorMinDate, maxDate: editorMaxDate, onError: function (newError) { return setError(newError); }, onChange: (0, mdm_sdk_1.debounce)((0, ramda_1.when)((0, ramda_1.both)(mdm_sdk_1.utils.dates.isValidMomentDateOrNull, mdm_sdk_1.utils.dates.isDateInRange(minDate, maxDate)), (0, ramda_1.pipe)(mdm_sdk_1.utils.dates.momentToDate, mdm_sdk_1.utils.dates.clearDateTime, onChange)), 0) }, otherProps)));
|
|
105
106
|
};
|
|
106
107
|
exports.default = DateEditor;
|
|
@@ -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">;
|
|
@@ -50,6 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
exports.DEBOUNCE_INTERVAL = void 0;
|
|
52
52
|
var react_1 = __importStar(require("react"));
|
|
53
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
53
54
|
var react_select_1 = require("react-select");
|
|
54
55
|
var prop_types_1 = __importDefault(require("prop-types"));
|
|
55
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
@@ -70,7 +71,12 @@ var useAutopopulation_1 = __importDefault(require("./useAutopopulation"));
|
|
|
70
71
|
var useSavingFocus_1 = __importDefault(require("./useSavingFocus"));
|
|
71
72
|
var LoadMoreButton_1 = __importDefault(require("../../commonReactSelectComponents/LoadMoreButton"));
|
|
72
73
|
var hooks_1 = require("../../../hooks");
|
|
73
|
-
var Input = function (props) {
|
|
74
|
+
var Input = function (props) {
|
|
75
|
+
var _a;
|
|
76
|
+
var styles = (0, styles_1.useStyles)();
|
|
77
|
+
var isCrossedOut = props.selectProps.isCrossedOut;
|
|
78
|
+
return (react_1.default.createElement(react_select_1.components.Input, __assign({}, props, { inputClassName: (0, classnames_1.default)((_a = {}, _a[styles.isCrossedOut] = isCrossedOut, _a)), isHidden: false })));
|
|
79
|
+
};
|
|
74
80
|
var SelectComponents = {
|
|
75
81
|
IndicatorSeparator: utils_1.EmptyStub,
|
|
76
82
|
LoadingIndicator: utils_1.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;
|
|
@@ -50,18 +50,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
51
|
var react_1 = __importStar(require("react"));
|
|
52
52
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
53
|
+
var classnames_1 = __importDefault(require("classnames"));
|
|
53
54
|
var ramda_1 = require("ramda");
|
|
54
55
|
var moment_1 = __importDefault(require("moment"));
|
|
55
56
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
56
|
-
var ramda_2 = require("ramda");
|
|
57
57
|
var DateTimePicker_1 = require("@mui/x-date-pickers/DateTimePicker");
|
|
58
58
|
var timeViewRenderers_1 = require("@mui/x-date-pickers/timeViewRenderers");
|
|
59
59
|
var constants_1 = require("../constants");
|
|
60
60
|
var styles_1 = require("./styles");
|
|
61
61
|
var TimestampEditor = function (_a) {
|
|
62
|
-
var
|
|
62
|
+
var _b;
|
|
63
|
+
var value = _a.value, _c = _a.minDate, minDate = _c === void 0 ? constants_1.DEFAULT_MIN_DATE : _c, _d = _a.maxDate, maxDate = _d === void 0 ? constants_1.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"]);
|
|
63
64
|
var styles = (0, styles_1.useStyles)();
|
|
64
|
-
var
|
|
65
|
+
var _e = react_1.default.useState(null), error = _e[0], setError = _e[1];
|
|
65
66
|
var errorMessage = (0, react_1.useMemo)(function () {
|
|
66
67
|
switch (error) {
|
|
67
68
|
case 'maxDate':
|
|
@@ -74,9 +75,9 @@ var TimestampEditor = function (_a) {
|
|
|
74
75
|
return '';
|
|
75
76
|
}
|
|
76
77
|
}, [error]);
|
|
77
|
-
var editorValue = (0,
|
|
78
|
-
var editorMinDate = (0,
|
|
79
|
-
var editorMaxDate = (0,
|
|
78
|
+
var editorValue = (0, ramda_1.isNil)(value) ? null : (0, moment_1.default)(value);
|
|
79
|
+
var editorMinDate = (0, ramda_1.isNil)(minDate) ? null : (0, moment_1.default)(minDate);
|
|
80
|
+
var editorMaxDate = (0, ramda_1.isNil)(maxDate) ? null : (0, moment_1.default)(maxDate);
|
|
80
81
|
var timestampFormat = format || (0, mdm_sdk_1.getLocaleFormat)();
|
|
81
82
|
// TODO: Fix types for InputProps/InputLabelProps in slotProps.textField
|
|
82
83
|
var editorSlotProps = (0, ramda_1.mergeDeepLeft)(slotProps, {
|
|
@@ -86,12 +87,12 @@ var TimestampEditor = function (_a) {
|
|
|
86
87
|
helperText: errorMessage,
|
|
87
88
|
InputProps: {
|
|
88
89
|
classes: {
|
|
89
|
-
root: styles.inputRoot
|
|
90
|
+
root: (0, classnames_1.default)(styles.inputRoot, (_b = {}, _b[styles.isCrossedOut] = isCrossedOut, _b))
|
|
90
91
|
},
|
|
91
|
-
disableUnderline: (0,
|
|
92
|
+
disableUnderline: (0, ramda_1.isNil)(editorValue)
|
|
92
93
|
},
|
|
93
94
|
InputLabelProps: {
|
|
94
|
-
shrink: !(0,
|
|
95
|
+
shrink: !(0, ramda_1.isNil)(label)
|
|
95
96
|
}
|
|
96
97
|
},
|
|
97
98
|
popper: {
|
|
@@ -106,6 +107,6 @@ var TimestampEditor = function (_a) {
|
|
|
106
107
|
hours: timeViewRenderers_1.renderTimeViewClock,
|
|
107
108
|
minutes: timeViewRenderers_1.renderTimeViewClock,
|
|
108
109
|
seconds: timeViewRenderers_1.renderTimeViewClock
|
|
109
|
-
}, label: label, value: editorValue, minDate: editorMinDate, maxDate: editorMaxDate, onError: function (newError) { return setError(newError); }, onChange: (0,
|
|
110
|
+
}, label: label, value: editorValue, minDate: editorMinDate, maxDate: editorMaxDate, onError: function (newError) { return setError(newError); }, onChange: (0, ramda_1.when)((0, ramda_1.both)(mdm_sdk_1.utils.dates.isValidMomentDateOrNull, mdm_sdk_1.utils.dates.isDateInRange(minDate, maxDate)), (0, ramda_1.pipe)(mdm_sdk_1.utils.dates.momentToDate, onChange)) }, otherProps)));
|
|
110
111
|
};
|
|
111
112
|
exports.default = TimestampEditor;
|
|
@@ -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';
|