@reltio/components 1.4.1355 → 1.4.1357
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/DateRangePicker/DateRangePicker.d.ts +2 -0
- package/cjs/components/DateRangePicker/DateRangePicker.js +3 -3
- package/cjs/components/attributes/OvIcon/OvIcon.d.ts +33 -30
- package/cjs/components/attributes/OvIcon/OvIcon.js +36 -11
- package/cjs/components/editors/DateRangeEditor/DateRangeEditor.d.ts +5 -1
- package/cjs/components/editors/DateRangeEditor/DateRangeEditor.js +2 -2
- package/esm/components/DateRangePicker/DateRangePicker.d.ts +2 -0
- package/esm/components/DateRangePicker/DateRangePicker.js +3 -3
- package/esm/components/attributes/OvIcon/OvIcon.d.ts +33 -30
- package/esm/components/attributes/OvIcon/OvIcon.js +14 -12
- package/esm/components/editors/DateRangeEditor/DateRangeEditor.d.ts +5 -1
- package/esm/components/editors/DateRangeEditor/DateRangeEditor.js +2 -2
- package/package.json +3 -3
|
@@ -5,6 +5,8 @@ declare type Props = {
|
|
|
5
5
|
onApply: ([startDate, endDate]: Values) => void;
|
|
6
6
|
values?: Values;
|
|
7
7
|
type?: string;
|
|
8
|
+
minDate?: Date;
|
|
9
|
+
maxDate?: Date;
|
|
8
10
|
};
|
|
9
11
|
declare const DateRangePicker: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
10
12
|
export default DateRangePicker;
|
|
@@ -43,7 +43,7 @@ var START_DATE = 0;
|
|
|
43
43
|
var END_DATE = 1;
|
|
44
44
|
var getDate = function (values, index) { return (0, ramda_1.pathOr)(null, [index], values); };
|
|
45
45
|
var DateRangePicker = (0, react_1.forwardRef)(function (_a, ref) {
|
|
46
|
-
var onCancel = _a.onCancel, onApply = _a.onApply, values = _a.values, type = _a.type;
|
|
46
|
+
var onCancel = _a.onCancel, onApply = _a.onApply, values = _a.values, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
47
47
|
var styles = (0, styles_1.useStyles)();
|
|
48
48
|
var editorFromId = (0, react_1.useRef)((0, nanoid_1.default)());
|
|
49
49
|
var editorToId = (0, react_1.useRef)((0, nanoid_1.default)());
|
|
@@ -75,8 +75,8 @@ var DateRangePicker = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
75
75
|
react_1.default.createElement(SmallIconButton_1.default, { size: "L", icon: ArrowBack_1.default, onClick: onCancel }),
|
|
76
76
|
react_1.default.createElement(Typography_1.default, { className: styles.title }, headerTitle)),
|
|
77
77
|
react_1.default.createElement("div", { className: styles.dateRangeContainer },
|
|
78
|
-
react_1.default.createElement(ComponentEditor, { id: editorFromId.current, label: 'From', variant: "filled", value: startDate, onChange: selectStartDateHandler, className: styles.dateInput, margin: "dense" }),
|
|
79
|
-
react_1.default.createElement(ComponentEditor, { id: editorToId.current, label: 'To', variant: "filled", value: endDate, onChange: selectEndDateHandler, className: styles.dateInput, margin: "dense" })),
|
|
78
|
+
react_1.default.createElement(ComponentEditor, { id: editorFromId.current, label: 'From', variant: "filled", value: startDate, onChange: selectStartDateHandler, className: styles.dateInput, margin: "dense", minDate: minDate, maxDate: maxDate }),
|
|
79
|
+
react_1.default.createElement(ComponentEditor, { id: editorToId.current, label: 'To', variant: "filled", value: endDate, onChange: selectEndDateHandler, className: styles.dateInput, margin: "dense", minDate: minDate, maxDate: maxDate })),
|
|
80
80
|
react_1.default.createElement("div", { className: styles.actionButtons },
|
|
81
81
|
react_1.default.createElement(Button_1.default, { color: "primary", onClick: onUpdate, className: styles.button }, ui_i18n_1.default.text('Update')))));
|
|
82
82
|
});
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeType, SimpleAttributeValue, NestedAttributeValue, ReferenceAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
export declare const ChipWithTooltip: React.ForwardRefExoticComponent<import("prop-types").InferPropsInner<Pick<{
|
|
4
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
5
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
6
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
7
|
+
}, never>> & Partial<import("prop-types").InferPropsInner<Pick<{
|
|
8
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
9
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
10
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
11
|
+
}, "tooltipTitle" | "tooltipPlacement" | "showForDisabled">>> & {
|
|
12
|
+
avatar?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
13
|
+
children?: null;
|
|
14
|
+
clickable?: boolean;
|
|
15
|
+
color?: "default" | "primary" | "secondary";
|
|
16
|
+
deleteIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
19
|
+
label?: React.ReactNode;
|
|
20
|
+
onDelete?: (event: any) => void;
|
|
21
|
+
size?: "medium" | "small";
|
|
22
|
+
variant?: "default" | "outlined";
|
|
23
|
+
} & import("@material-ui/core/OverridableComponent").CommonProps<import("@material-ui/core/Chip").ChipTypeMap<{}, "div">> & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
24
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
25
|
+
}, "translate" | "hidden" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "ref" | "key">>;
|
|
26
|
+
declare type ComplexWithLabel = NestedAttributeValue | ReferenceAttributeValue;
|
|
27
|
+
declare type Props = {
|
|
28
|
+
className?: string;
|
|
29
|
+
attributeType: AttributeType;
|
|
30
|
+
nonOvValues: Array<SimpleAttributeValue | ComplexWithLabel>;
|
|
31
|
+
nonOvTotal: number;
|
|
32
|
+
};
|
|
33
|
+
declare const OvIcon: ({ className, attributeType, nonOvValues, nonOvTotal }: Props) => JSX.Element;
|
|
2
34
|
export default OvIcon;
|
|
3
|
-
import React from "react";
|
|
4
|
-
declare function OvIcon({ className, attributeType, nonOvValues, nonOvTotal }: {
|
|
5
|
-
className: any;
|
|
6
|
-
attributeType: any;
|
|
7
|
-
nonOvValues?: any[];
|
|
8
|
-
nonOvTotal: any;
|
|
9
|
-
}): JSX.Element;
|
|
10
|
-
declare namespace OvIcon {
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
export const className: PropTypes.Requireable<string>;
|
|
13
|
-
export const nonOvTotal: PropTypes.Requireable<number>;
|
|
14
|
-
export { AttributeTypeType as attributeType };
|
|
15
|
-
export const nonOvValues: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
16
|
-
value: PropTypes.Requireable<object>;
|
|
17
|
-
ov: PropTypes.Requireable<boolean>;
|
|
18
|
-
type: PropTypes.Requireable<string>;
|
|
19
|
-
uri: PropTypes.Requireable<string>;
|
|
20
|
-
}> | PropTypes.InferProps<{
|
|
21
|
-
value: PropTypes.Requireable<NonNullable<string | number | boolean>>;
|
|
22
|
-
ov: PropTypes.Requireable<boolean>;
|
|
23
|
-
type: PropTypes.Requireable<string>;
|
|
24
|
-
uri: PropTypes.Requireable<string>;
|
|
25
|
-
lookupCode: PropTypes.Requireable<string>;
|
|
26
|
-
lookupRawValue: PropTypes.Requireable<string>;
|
|
27
|
-
}>>[]>;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
import PropTypes from "prop-types";
|
|
31
|
-
import { AttributeTypeType } from "@reltio/mdm-sdk/src/constants";
|
|
@@ -1,36 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.ChipWithTooltip = void 0;
|
|
7
|
-
var react_1 =
|
|
8
|
-
var prop_types_1 = __importDefault(require("prop-types"));
|
|
30
|
+
var react_1 = __importStar(require("react"));
|
|
9
31
|
var classnames_1 = __importDefault(require("classnames"));
|
|
10
32
|
var Chip_1 = __importDefault(require("@material-ui/core/Chip"));
|
|
11
33
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
12
|
-
var
|
|
34
|
+
var mdm_module_1 = require("@reltio/mdm-module");
|
|
13
35
|
var DataTypeValue_1 = __importDefault(require("../../DataTypeValue/DataTypeValue"));
|
|
14
36
|
var HOCs_1 = require("../../../HOCs");
|
|
37
|
+
var react_redux_1 = require("react-redux");
|
|
38
|
+
var styles_1 = require("./styles");
|
|
15
39
|
exports.ChipWithTooltip = (0, HOCs_1.withTooltip)(Chip_1.default);
|
|
16
40
|
var OvIcon = function (_a) {
|
|
17
|
-
var
|
|
41
|
+
var _b;
|
|
42
|
+
var className = _a.className, attributeType = _a.attributeType, _c = _a.nonOvValues, nonOvValues = _c === void 0 ? [] : _c, nonOvTotal = _a.nonOvTotal;
|
|
18
43
|
var styles = (0, styles_1.useStyles)();
|
|
44
|
+
var dispatch = (0, react_redux_1.useDispatch)();
|
|
45
|
+
var attributeUri = (_b = nonOvValues === null || nonOvValues === void 0 ? void 0 : nonOvValues[0]) === null || _b === void 0 ? void 0 : _b.uri;
|
|
46
|
+
var onClick = (0, react_1.useCallback)(function () {
|
|
47
|
+
var entityUri = attributeUri ? (0, mdm_sdk_1.getEntityUriFromAttributeUri)(attributeUri) : '';
|
|
48
|
+
dispatch(mdm_module_1.ui.actions.openEntity({ uri: entityUri, viewId: null, screen: 'sources' }));
|
|
49
|
+
}, [attributeUri, dispatch]);
|
|
19
50
|
if (!nonOvTotal) {
|
|
20
51
|
return null;
|
|
21
52
|
}
|
|
22
53
|
var tooltipTitle = nonOvValues.length
|
|
23
54
|
? nonOvValues.map(function (value, i) { return (react_1.default.createElement("div", { key: i }, (0, mdm_sdk_1.isComplexAttribute)(attributeType) ? ((0, mdm_sdk_1.getLabel)(value.label)) : (react_1.default.createElement(DataTypeValue_1.default, { value: (0, mdm_sdk_1.getAttributeValue)(value), dataTypeDefinition: (0, mdm_sdk_1.getAttrDataTypeDefinition)(attributeType), rich: false })))); })
|
|
24
55
|
: null;
|
|
25
|
-
return (react_1.default.createElement(exports.ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "top", label: "+ ".concat(nonOvTotal), variant: "outlined", classes: {
|
|
56
|
+
return (react_1.default.createElement(exports.ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "top", label: "+ ".concat(nonOvTotal), variant: "outlined", onClick: onClick, classes: {
|
|
26
57
|
root: (0, classnames_1.default)(styles.container, className),
|
|
27
58
|
label: styles.label
|
|
28
59
|
} }));
|
|
29
60
|
};
|
|
30
|
-
OvIcon.propTypes = {
|
|
31
|
-
className: prop_types_1.default.string,
|
|
32
|
-
nonOvTotal: prop_types_1.default.number,
|
|
33
|
-
attributeType: mdm_sdk_1.AttributeTypeType,
|
|
34
|
-
nonOvValues: prop_types_1.default.arrayOf(prop_types_1.default.oneOfType([mdm_sdk_1.SimpleAttributeValueType, mdm_sdk_1.NestedAttributeValueType, mdm_sdk_1.ReferenceAttributeValueType]))
|
|
35
|
-
};
|
|
36
61
|
exports.default = OvIcon;
|
|
@@ -12,11 +12,15 @@ export declare type DateRangeEditorProps = {
|
|
|
12
12
|
dataTypeDefinition?: DataTypeDefinition;
|
|
13
13
|
MenuProps?: Partial<MenuProps>;
|
|
14
14
|
TextFieldProps?: TextFieldProps;
|
|
15
|
+
DateRangePickerProps?: {
|
|
16
|
+
minDate?: Date;
|
|
17
|
+
maxDate?: Date;
|
|
18
|
+
};
|
|
15
19
|
className?: string;
|
|
16
20
|
classes?: {
|
|
17
21
|
dropdownIndicator?: string;
|
|
18
22
|
root?: string;
|
|
19
23
|
};
|
|
20
24
|
};
|
|
21
|
-
declare const DateRangeEditor: ({ label, values, options, getValuesDateRange, onChange, dataTypeDefinition, TextFieldProps, MenuProps, ...otherProps }: DateRangeEditorProps) => JSX.Element;
|
|
25
|
+
declare const DateRangeEditor: ({ label, values, options, getValuesDateRange, onChange, dataTypeDefinition, DateRangePickerProps, TextFieldProps, MenuProps, ...otherProps }: DateRangeEditorProps) => JSX.Element;
|
|
22
26
|
export default DateRangeEditor;
|
|
@@ -68,7 +68,7 @@ var DateRangeEditor = function (_a) {
|
|
|
68
68
|
var _c;
|
|
69
69
|
var label = _a.label, values = _a.values, options = _a.options, _d = _a.getValuesDateRange, getValuesDateRange = _d === void 0 ? helpers_1.convertValuesToDate : _d, _e = _a.onChange, onChange = _e === void 0 ? ramda_1.identity : _e, _f = _a.dataTypeDefinition, dataTypeDefinition = _f === void 0 ? {
|
|
70
70
|
type: mdm_sdk_1.DataTypes.TYPE_DATE
|
|
71
|
-
} : _f, TextFieldProps = _a.TextFieldProps, MenuProps = _a.MenuProps, otherProps = __rest(_a, ["label", "values", "options", "getValuesDateRange", "onChange", "dataTypeDefinition", "TextFieldProps", "MenuProps"]);
|
|
71
|
+
} : _f, DateRangePickerProps = _a.DateRangePickerProps, TextFieldProps = _a.TextFieldProps, MenuProps = _a.MenuProps, otherProps = __rest(_a, ["label", "values", "options", "getValuesDateRange", "onChange", "dataTypeDefinition", "DateRangePickerProps", "TextFieldProps", "MenuProps"]);
|
|
72
72
|
var classes = otherProps.classes;
|
|
73
73
|
var placeholder = localeFormat + (dataTypeDefinition.type === mdm_sdk_1.DataTypes.TYPE_TIMESTAMP ? ' HH:MM' : '');
|
|
74
74
|
var rangeOptions = (0, react_1.useMemo)(function () {
|
|
@@ -122,7 +122,7 @@ var DateRangeEditor = function (_a) {
|
|
|
122
122
|
style: {
|
|
123
123
|
width: customValue ? '100%' : (0, ramda_1.prop)('clientWidth', inputRef.current)
|
|
124
124
|
}
|
|
125
|
-
} }, MenuProps), customValue ? (react_1.default.createElement(DateRangePicker_1.default, { values: getValuesDateRange(values), onCancel: onCancel, onApply: onItemClick, type: dataTypeDefinition.type })) : (rangeOptions.map(function (option) { return (react_1.default.createElement(MenuItem_1.default, { key: option.value, value: option.value, onClick: function () { return onItemClick(option.value); }, className: styles.menuItem },
|
|
125
|
+
} }, MenuProps), customValue ? (react_1.default.createElement(DateRangePicker_1.default, __assign({ values: getValuesDateRange(values), onCancel: onCancel, onApply: onItemClick, type: dataTypeDefinition.type }, DateRangePickerProps))) : (rangeOptions.map(function (option) { return (react_1.default.createElement(MenuItem_1.default, { key: option.value, value: option.value, onClick: function () { return onItemClick(option.value); }, className: styles.menuItem },
|
|
126
126
|
react_1.default.createElement(Typography_1.default, { classes: { root: styles.menuText } }, option.label))); })))));
|
|
127
127
|
};
|
|
128
128
|
exports.default = DateRangeEditor;
|
|
@@ -5,6 +5,8 @@ declare type Props = {
|
|
|
5
5
|
onApply: ([startDate, endDate]: Values) => void;
|
|
6
6
|
values?: Values;
|
|
7
7
|
type?: string;
|
|
8
|
+
minDate?: Date;
|
|
9
|
+
maxDate?: Date;
|
|
8
10
|
};
|
|
9
11
|
declare const DateRangePicker: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
10
12
|
export default DateRangePicker;
|
|
@@ -15,7 +15,7 @@ var START_DATE = 0;
|
|
|
15
15
|
var END_DATE = 1;
|
|
16
16
|
var getDate = function (values, index) { return pathOr(null, [index], values); };
|
|
17
17
|
var DateRangePicker = forwardRef(function (_a, ref) {
|
|
18
|
-
var onCancel = _a.onCancel, onApply = _a.onApply, values = _a.values, type = _a.type;
|
|
18
|
+
var onCancel = _a.onCancel, onApply = _a.onApply, values = _a.values, type = _a.type, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
19
19
|
var styles = useStyles();
|
|
20
20
|
var editorFromId = useRef(nanoid());
|
|
21
21
|
var editorToId = useRef(nanoid());
|
|
@@ -47,8 +47,8 @@ var DateRangePicker = forwardRef(function (_a, ref) {
|
|
|
47
47
|
React.createElement(SmallIconButton, { size: "L", icon: ArrowBack, onClick: onCancel }),
|
|
48
48
|
React.createElement(Typography, { className: styles.title }, headerTitle)),
|
|
49
49
|
React.createElement("div", { className: styles.dateRangeContainer },
|
|
50
|
-
React.createElement(ComponentEditor, { id: editorFromId.current, label: 'From', variant: "filled", value: startDate, onChange: selectStartDateHandler, className: styles.dateInput, margin: "dense" }),
|
|
51
|
-
React.createElement(ComponentEditor, { id: editorToId.current, label: 'To', variant: "filled", value: endDate, onChange: selectEndDateHandler, className: styles.dateInput, margin: "dense" })),
|
|
50
|
+
React.createElement(ComponentEditor, { id: editorFromId.current, label: 'From', variant: "filled", value: startDate, onChange: selectStartDateHandler, className: styles.dateInput, margin: "dense", minDate: minDate, maxDate: maxDate }),
|
|
51
|
+
React.createElement(ComponentEditor, { id: editorToId.current, label: 'To', variant: "filled", value: endDate, onChange: selectEndDateHandler, className: styles.dateInput, margin: "dense", minDate: minDate, maxDate: maxDate })),
|
|
52
52
|
React.createElement("div", { className: styles.actionButtons },
|
|
53
53
|
React.createElement(Button, { color: "primary", onClick: onUpdate, className: styles.button }, i18n.text('Update')))));
|
|
54
54
|
});
|
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeType, SimpleAttributeValue, NestedAttributeValue, ReferenceAttributeValue } from '@reltio/mdm-sdk';
|
|
3
|
+
export declare const ChipWithTooltip: React.ForwardRefExoticComponent<import("prop-types").InferPropsInner<Pick<{
|
|
4
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
5
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
6
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
7
|
+
}, never>> & Partial<import("prop-types").InferPropsInner<Pick<{
|
|
8
|
+
tooltipTitle: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
|
|
9
|
+
tooltipPlacement: import("prop-types").Requireable<string>;
|
|
10
|
+
showForDisabled: import("prop-types").Requireable<boolean>;
|
|
11
|
+
}, "tooltipTitle" | "tooltipPlacement" | "showForDisabled">>> & {
|
|
12
|
+
avatar?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
13
|
+
children?: null;
|
|
14
|
+
clickable?: boolean;
|
|
15
|
+
color?: "default" | "primary" | "secondary";
|
|
16
|
+
deleteIcon?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
19
|
+
label?: React.ReactNode;
|
|
20
|
+
onDelete?: (event: any) => void;
|
|
21
|
+
size?: "medium" | "small";
|
|
22
|
+
variant?: "default" | "outlined";
|
|
23
|
+
} & import("@material-ui/core/OverridableComponent").CommonProps<import("@material-ui/core/Chip").ChipTypeMap<{}, "div">> & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
24
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
25
|
+
}, "translate" | "hidden" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "ref" | "key">>;
|
|
26
|
+
declare type ComplexWithLabel = NestedAttributeValue | ReferenceAttributeValue;
|
|
27
|
+
declare type Props = {
|
|
28
|
+
className?: string;
|
|
29
|
+
attributeType: AttributeType;
|
|
30
|
+
nonOvValues: Array<SimpleAttributeValue | ComplexWithLabel>;
|
|
31
|
+
nonOvTotal: number;
|
|
32
|
+
};
|
|
33
|
+
declare const OvIcon: ({ className, attributeType, nonOvValues, nonOvTotal }: Props) => JSX.Element;
|
|
2
34
|
export default OvIcon;
|
|
3
|
-
import React from "react";
|
|
4
|
-
declare function OvIcon({ className, attributeType, nonOvValues, nonOvTotal }: {
|
|
5
|
-
className: any;
|
|
6
|
-
attributeType: any;
|
|
7
|
-
nonOvValues?: any[];
|
|
8
|
-
nonOvTotal: any;
|
|
9
|
-
}): JSX.Element;
|
|
10
|
-
declare namespace OvIcon {
|
|
11
|
-
namespace propTypes {
|
|
12
|
-
export const className: PropTypes.Requireable<string>;
|
|
13
|
-
export const nonOvTotal: PropTypes.Requireable<number>;
|
|
14
|
-
export { AttributeTypeType as attributeType };
|
|
15
|
-
export const nonOvValues: PropTypes.Requireable<NonNullable<PropTypes.InferProps<{
|
|
16
|
-
value: PropTypes.Requireable<object>;
|
|
17
|
-
ov: PropTypes.Requireable<boolean>;
|
|
18
|
-
type: PropTypes.Requireable<string>;
|
|
19
|
-
uri: PropTypes.Requireable<string>;
|
|
20
|
-
}> | PropTypes.InferProps<{
|
|
21
|
-
value: PropTypes.Requireable<NonNullable<string | number | boolean>>;
|
|
22
|
-
ov: PropTypes.Requireable<boolean>;
|
|
23
|
-
type: PropTypes.Requireable<string>;
|
|
24
|
-
uri: PropTypes.Requireable<string>;
|
|
25
|
-
lookupCode: PropTypes.Requireable<string>;
|
|
26
|
-
lookupRawValue: PropTypes.Requireable<string>;
|
|
27
|
-
}>>[]>;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
import PropTypes from "prop-types";
|
|
31
|
-
import { AttributeTypeType } from "@reltio/mdm-sdk/src/constants";
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
3
2
|
import classnames from 'classnames';
|
|
4
3
|
import Chip from '@material-ui/core/Chip';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { getAttrDataTypeDefinition, getAttributeValue, isComplexAttribute, getLabel, getEntityUriFromAttributeUri } from '@reltio/mdm-sdk';
|
|
5
|
+
import { ui } from '@reltio/mdm-module';
|
|
7
6
|
import DataTypeValue from '../../DataTypeValue/DataTypeValue';
|
|
8
7
|
import { withTooltip } from '../../../HOCs';
|
|
8
|
+
import { useDispatch } from 'react-redux';
|
|
9
|
+
import { useStyles } from './styles';
|
|
9
10
|
export var ChipWithTooltip = withTooltip(Chip);
|
|
10
11
|
var OvIcon = function (_a) {
|
|
11
|
-
var
|
|
12
|
+
var _b;
|
|
13
|
+
var className = _a.className, attributeType = _a.attributeType, _c = _a.nonOvValues, nonOvValues = _c === void 0 ? [] : _c, nonOvTotal = _a.nonOvTotal;
|
|
12
14
|
var styles = useStyles();
|
|
15
|
+
var dispatch = useDispatch();
|
|
16
|
+
var attributeUri = (_b = nonOvValues === null || nonOvValues === void 0 ? void 0 : nonOvValues[0]) === null || _b === void 0 ? void 0 : _b.uri;
|
|
17
|
+
var onClick = useCallback(function () {
|
|
18
|
+
var entityUri = attributeUri ? getEntityUriFromAttributeUri(attributeUri) : '';
|
|
19
|
+
dispatch(ui.actions.openEntity({ uri: entityUri, viewId: null, screen: 'sources' }));
|
|
20
|
+
}, [attributeUri, dispatch]);
|
|
13
21
|
if (!nonOvTotal) {
|
|
14
22
|
return null;
|
|
15
23
|
}
|
|
16
24
|
var tooltipTitle = nonOvValues.length
|
|
17
25
|
? nonOvValues.map(function (value, i) { return (React.createElement("div", { key: i }, isComplexAttribute(attributeType) ? (getLabel(value.label)) : (React.createElement(DataTypeValue, { value: getAttributeValue(value), dataTypeDefinition: getAttrDataTypeDefinition(attributeType), rich: false })))); })
|
|
18
26
|
: null;
|
|
19
|
-
return (React.createElement(ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "top", label: "+ ".concat(nonOvTotal), variant: "outlined", classes: {
|
|
27
|
+
return (React.createElement(ChipWithTooltip, { tooltipTitle: tooltipTitle, tooltipPlacement: "top", label: "+ ".concat(nonOvTotal), variant: "outlined", onClick: onClick, classes: {
|
|
20
28
|
root: classnames(styles.container, className),
|
|
21
29
|
label: styles.label
|
|
22
30
|
} }));
|
|
23
31
|
};
|
|
24
|
-
OvIcon.propTypes = {
|
|
25
|
-
className: PropTypes.string,
|
|
26
|
-
nonOvTotal: PropTypes.number,
|
|
27
|
-
attributeType: AttributeTypeType,
|
|
28
|
-
nonOvValues: PropTypes.arrayOf(PropTypes.oneOfType([SimpleAttributeValueType, NestedAttributeValueType, ReferenceAttributeValueType]))
|
|
29
|
-
};
|
|
30
32
|
export default OvIcon;
|
|
@@ -12,11 +12,15 @@ export declare type DateRangeEditorProps = {
|
|
|
12
12
|
dataTypeDefinition?: DataTypeDefinition;
|
|
13
13
|
MenuProps?: Partial<MenuProps>;
|
|
14
14
|
TextFieldProps?: TextFieldProps;
|
|
15
|
+
DateRangePickerProps?: {
|
|
16
|
+
minDate?: Date;
|
|
17
|
+
maxDate?: Date;
|
|
18
|
+
};
|
|
15
19
|
className?: string;
|
|
16
20
|
classes?: {
|
|
17
21
|
dropdownIndicator?: string;
|
|
18
22
|
root?: string;
|
|
19
23
|
};
|
|
20
24
|
};
|
|
21
|
-
declare const DateRangeEditor: ({ label, values, options, getValuesDateRange, onChange, dataTypeDefinition, TextFieldProps, MenuProps, ...otherProps }: DateRangeEditorProps) => JSX.Element;
|
|
25
|
+
declare const DateRangeEditor: ({ label, values, options, getValuesDateRange, onChange, dataTypeDefinition, DateRangePickerProps, TextFieldProps, MenuProps, ...otherProps }: DateRangeEditorProps) => JSX.Element;
|
|
22
26
|
export default DateRangeEditor;
|
|
@@ -40,7 +40,7 @@ var DateRangeEditor = function (_a) {
|
|
|
40
40
|
var _c;
|
|
41
41
|
var label = _a.label, values = _a.values, options = _a.options, _d = _a.getValuesDateRange, getValuesDateRange = _d === void 0 ? convertValuesToDate : _d, _e = _a.onChange, onChange = _e === void 0 ? identity : _e, _f = _a.dataTypeDefinition, dataTypeDefinition = _f === void 0 ? {
|
|
42
42
|
type: DataTypes.TYPE_DATE
|
|
43
|
-
} : _f, TextFieldProps = _a.TextFieldProps, MenuProps = _a.MenuProps, otherProps = __rest(_a, ["label", "values", "options", "getValuesDateRange", "onChange", "dataTypeDefinition", "TextFieldProps", "MenuProps"]);
|
|
43
|
+
} : _f, DateRangePickerProps = _a.DateRangePickerProps, TextFieldProps = _a.TextFieldProps, MenuProps = _a.MenuProps, otherProps = __rest(_a, ["label", "values", "options", "getValuesDateRange", "onChange", "dataTypeDefinition", "DateRangePickerProps", "TextFieldProps", "MenuProps"]);
|
|
44
44
|
var classes = otherProps.classes;
|
|
45
45
|
var placeholder = localeFormat + (dataTypeDefinition.type === DataTypes.TYPE_TIMESTAMP ? ' HH:MM' : '');
|
|
46
46
|
var rangeOptions = useMemo(function () {
|
|
@@ -94,7 +94,7 @@ var DateRangeEditor = function (_a) {
|
|
|
94
94
|
style: {
|
|
95
95
|
width: customValue ? '100%' : prop('clientWidth', inputRef.current)
|
|
96
96
|
}
|
|
97
|
-
} }, MenuProps), customValue ? (React.createElement(DateRangePicker, { values: getValuesDateRange(values), onCancel: onCancel, onApply: onItemClick, type: dataTypeDefinition.type })) : (rangeOptions.map(function (option) { return (React.createElement(MenuItem, { key: option.value, value: option.value, onClick: function () { return onItemClick(option.value); }, className: styles.menuItem },
|
|
97
|
+
} }, MenuProps), customValue ? (React.createElement(DateRangePicker, __assign({ values: getValuesDateRange(values), onCancel: onCancel, onApply: onItemClick, type: dataTypeDefinition.type }, DateRangePickerProps))) : (rangeOptions.map(function (option) { return (React.createElement(MenuItem, { key: option.value, value: option.value, onClick: function () { return onItemClick(option.value); }, className: styles.menuItem },
|
|
98
98
|
React.createElement(Typography, { classes: { root: styles.menuText } }, option.label))); })))));
|
|
99
99
|
};
|
|
100
100
|
export default DateRangeEditor;
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1357",
|
|
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.1357",
|
|
11
|
+
"@reltio/mdm-sdk": "^1.4.1357",
|
|
12
12
|
"classnames": "^2.2.5",
|
|
13
13
|
"d3-cloud": "^1.2.5",
|
|
14
14
|
"d3-geo": "^2.0.1",
|