@reltio/components 1.4.847 → 1.4.851
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/components/ProfileBand/styles.js +1 -1
- package/components/attributes/OvIcon/OvIcon.d.ts +3 -1
- package/components/attributes/OvIcon/OvIcon.js +4 -4
- package/components/attributes/editMode/AttributesFactory/AttributesFactory.js +3 -2
- package/components/attributes/editMode/AttributesList/AttributesList.d.ts +3 -1
- package/components/attributes/editMode/AttributesList/AttributesList.js +4 -8
- package/components/attributes/editMode/AttributesPager/AttributeRenderer.d.ts +1 -1
- package/components/attributes/editMode/AttributesPager/AttributeRenderer.js +8 -7
- package/components/attributes/editMode/AttributesPager/AttributesPager.d.ts +1 -1
- package/components/attributes/editMode/AttributesPager/AttributesPager.js +5 -5
- package/components/attributes/editMode/AttributesPager/index.d.ts +2 -1
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
- package/components/attributes/editMode/ComplexAttribute/ComplexAttribute.js +2 -2
- package/components/attributes/editMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/components/attributes/editMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/components/attributes/editMode/ReferenceAttribute/index.d.ts +1 -0
- package/components/attributes/inline/AttributesList/AttributesList.d.ts +2 -2
- package/components/attributes/inline/AttributesPager/AttributesPager.d.ts +2 -2
- package/components/attributes/inline/ComplexAttribute/ComplexAttribute.d.ts +3 -3
- package/components/attributes/inline/ComplexAttribute/ComplexAttribute.js +6 -6
- package/components/attributes/inline/ImageAttribute/ImageAttribute.d.ts +2 -2
- package/components/attributes/inline/ImageAttributesBlock/ImageAttributesBlock.d.ts +2 -2
- package/components/attributes/inline/NestedAttribute/NestedAttribute.d.ts +2 -2
- package/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.d.ts +3 -3
- package/components/attributes/inline/NestedAttributesBlock/NestedAttributesBlock.js +3 -3
- package/components/attributes/inline/ReferenceAttribute/ReferenceAttribute.d.ts +2 -2
- package/components/attributes/inline/ReferenceAttributesBlock/ReferenceAttributesBlock.d.ts +2 -2
- package/components/attributes/inline/SimpleAttribute/SimpleAttribute.d.ts +3 -3
- package/components/attributes/inline/SimpleAttribute/SimpleAttribute.js +5 -5
- package/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.d.ts +3 -3
- package/components/attributes/inline/SimpleAttributesBlock/SimpleAttributesBlock.js +3 -3
- package/components/attributes/readMode/AttributesList/AttributesList.d.ts +2 -1
- package/components/attributes/readMode/AttributesList/AttributesList.js +7 -3
- package/components/attributes/readMode/AttributesPager/AttributesPager.d.ts +2 -1
- package/components/attributes/readMode/AttributesPager/AttributesPager.js +13 -7
- package/components/attributes/readMode/AttributesPager/MultiLineRenderer.d.ts +5 -3
- package/components/attributes/readMode/AttributesPager/MultiLineRenderer.js +8 -8
- package/components/attributes/readMode/AttributesPager/OneLineRenderer.d.ts +4 -2
- package/components/attributes/readMode/AttributesPager/OneLineRenderer.js +3 -3
- package/components/attributes/readMode/AttributesPager/index.d.ts +3 -1
- package/components/attributes/readMode/ComplexAttribute/ComplexAttribute.d.ts +3 -1
- package/components/attributes/readMode/ComplexAttribute/ComplexAttribute.js +4 -3
- package/components/attributes/readMode/NestedAttribute/NestedAttribute.d.ts +1 -0
- package/components/attributes/readMode/ReferenceAttribute/ReferenceAttribute.d.ts +1 -0
- package/components/attributes/readMode/ReferenceAttribute/index.d.ts +1 -0
- package/components/crosswalks/AttributesTable/AttributesTable.d.ts +8 -7
- package/components/crosswalks/AttributesTable/AttributesTable.js +12 -9
- package/components/crosswalks/AttributesTable/cell-renderers/AttributeValuesRenderer.d.ts +2 -1
- package/components/crosswalks/AttributesTable/cell-renderers/AttributeValuesRenderer.js +3 -3
- package/components/crosswalks/AttributesTable/cell-renderers/AttributesHeadCellRenderer.d.ts +9 -2
- package/components/crosswalks/AttributesTable/cell-renderers/AttributesHeadCellRenderer.js +19 -3
- package/components/crosswalks/AttributesTable/cell-renderers/attribute-renderers/AttributesFactory.d.ts +2 -0
- package/components/history/ProfileBandHistory/ProfileBandHistory.d.ts +3 -0
- package/components/history/ProfileBandHistory/ProfileBandHistory.js +45 -0
- package/components/history/ProfileBandHistory/styles.d.ts +1 -0
- package/components/history/ProfileBandHistory/styles.js +18 -0
- package/components/history/hooks/useHistorySlice.d.ts +4 -0
- package/components/history/hooks/useHistorySlice.js +58 -0
- package/components/history/index.d.ts +2 -2
- package/components/history/index.js +5 -5
- package/components/index.d.ts +1 -0
- package/components/index.js +3 -1
- package/package.json +3 -3
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
export const ChipWithTooltip: React.ForwardRefExoticComponent<any>;
|
|
2
2
|
export default OvIcon;
|
|
3
3
|
import React from "react";
|
|
4
|
-
declare function OvIcon({ className, attributeType, nonOvValues }: {
|
|
4
|
+
declare function OvIcon({ className, attributeType, nonOvValues, nonOvTotal }: {
|
|
5
5
|
className: any;
|
|
6
6
|
attributeType: any;
|
|
7
7
|
nonOvValues?: any[];
|
|
8
|
+
nonOvTotal: any;
|
|
8
9
|
}): JSX.Element;
|
|
9
10
|
declare namespace OvIcon {
|
|
10
11
|
namespace propTypes {
|
|
11
12
|
export const className: PropTypes.Requireable<string>;
|
|
13
|
+
export const nonOvTotal: PropTypes.Requireable<number>;
|
|
12
14
|
export { AttributeTypeType as attributeType };
|
|
13
15
|
export const nonOvValues: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
14
16
|
value: PropTypes.Requireable<string | number | boolean>;
|
|
@@ -14,19 +14,19 @@ var DataTypeValue_1 = __importDefault(require("../../DataTypeValue/DataTypeValue
|
|
|
14
14
|
var HOCs_1 = require("../../../HOCs");
|
|
15
15
|
exports.ChipWithTooltip = HOCs_1.withTooltip(Chip_1.default);
|
|
16
16
|
var OvIcon = function (_a) {
|
|
17
|
-
var className = _a.className, attributeType = _a.attributeType, _b = _a.nonOvValues, nonOvValues = _b === void 0 ? [] : _b;
|
|
17
|
+
var className = _a.className, attributeType = _a.attributeType, _b = _a.nonOvValues, nonOvValues = _b === void 0 ? [] : _b, nonOvTotal = _a.nonOvTotal;
|
|
18
18
|
var styles = styles_1.useStyles();
|
|
19
|
-
|
|
20
|
-
if (!length) {
|
|
19
|
+
if (!nonOvTotal) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
return (react_1.default.createElement(exports.ChipWithTooltip, { tooltipTitle: nonOvValues.map(function (value, i) { return (react_1.default.createElement("div", { key: i }, mdm_sdk_1.isComplexAttribute(attributeType) ? (mdm_sdk_1.getLabel(value.label)) : (react_1.default.createElement(DataTypeValue_1.default, { value: mdm_sdk_1.getAttributeValue(value), dataTypeDefinition: mdm_sdk_1.getAttrDataTypeDefinition(attributeType), rich: false })))); }), tooltipPlacement: "top", label: "+ " +
|
|
22
|
+
return (react_1.default.createElement(exports.ChipWithTooltip, { tooltipTitle: nonOvValues.map(function (value, i) { return (react_1.default.createElement("div", { key: i }, mdm_sdk_1.isComplexAttribute(attributeType) ? (mdm_sdk_1.getLabel(value.label)) : (react_1.default.createElement(DataTypeValue_1.default, { value: mdm_sdk_1.getAttributeValue(value), dataTypeDefinition: mdm_sdk_1.getAttrDataTypeDefinition(attributeType), rich: false })))); }), tooltipPlacement: "top", label: "+ " + nonOvTotal, variant: "outlined", classes: {
|
|
24
23
|
root: classnames_1.default(styles.container, className),
|
|
25
24
|
label: styles.label
|
|
26
25
|
} }));
|
|
27
26
|
};
|
|
28
27
|
OvIcon.propTypes = {
|
|
29
28
|
className: prop_types_1.default.string,
|
|
29
|
+
nonOvTotal: prop_types_1.default.number,
|
|
30
30
|
attributeType: mdm_sdk_1.AttributeTypeType,
|
|
31
31
|
nonOvValues: prop_types_1.default.arrayOf(prop_types_1.default.oneOfType([mdm_sdk_1.SimpleAttributeValueType, mdm_sdk_1.NestedAttributeValueType, mdm_sdk_1.ReferenceAttributeValueType]))
|
|
32
32
|
};
|
|
@@ -35,8 +35,9 @@ var EditModeAttributesFactory = /** @class */ (function () {
|
|
|
35
35
|
}
|
|
36
36
|
EditModeAttributesFactory.build = function (attributeType, props) {
|
|
37
37
|
if (props === void 0) { props = {}; }
|
|
38
|
-
|
|
39
|
-
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, errors = props.errors, crosswalks = props.crosswalks, propsForSimpleAttribute = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "errors", "crosswalks"]);
|
|
38
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
39
|
+
var showEmptyEditors = props.showEmptyEditors, onAddAttributes = props.onAddAttributes, lazy = props.lazy, errors = props.errors, crosswalks = props.crosswalks, showNonOv = props.showNonOv, propsForSimpleAttribute = __rest(props, ["showEmptyEditors", "onAddAttributes", "lazy", "errors", "crosswalks", "showNonOv"]);
|
|
40
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
40
41
|
switch (attributeType.type) {
|
|
41
42
|
case mdm_sdk_1.DataTypes.TYPE_NESTED:
|
|
42
43
|
return react_1.default.createElement(NestedAttribute_1.default, __assign({}, props));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare var _default: React.MemoExoticComponent<{
|
|
2
|
-
({ attrTypes, entity, parentUri, showEmptyEditors, mode, crosswalks, drawLines, children, className, alwaysVisibleTypeUris, onAddAttributes, onChangeAttribute, onDeleteAttribute, additionalControlsRenderer }: {
|
|
2
|
+
({ attrTypes, entity, parentUri, showEmptyEditors, mode, crosswalks, drawLines, children, className, alwaysVisibleTypeUris, onAddAttributes, onChangeAttribute, onDeleteAttribute, additionalControlsRenderer, showNonOv }: {
|
|
3
3
|
attrTypes: any;
|
|
4
4
|
entity: any;
|
|
5
5
|
parentUri: any;
|
|
@@ -14,6 +14,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
14
14
|
onChangeAttribute: any;
|
|
15
15
|
onDeleteAttribute: any;
|
|
16
16
|
additionalControlsRenderer: any;
|
|
17
|
+
showNonOv: any;
|
|
17
18
|
}): JSX.Element;
|
|
18
19
|
propTypes: {
|
|
19
20
|
attrTypes: PropTypes.Requireable<any[]>;
|
|
@@ -24,6 +25,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
24
25
|
mode: PropTypes.Requireable<any>;
|
|
25
26
|
crosswalks: PropTypes.Requireable<any[]>;
|
|
26
27
|
drawLines: PropTypes.Requireable<boolean>;
|
|
28
|
+
showNonOv: PropTypes.Requireable<boolean>;
|
|
27
29
|
className: PropTypes.Requireable<string>;
|
|
28
30
|
alwaysVisibleTypeUris: PropTypes.Requireable<any[]>;
|
|
29
31
|
onAddAttributes: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -45,16 +45,11 @@ var constants_1 = require("../../../../constants");
|
|
|
45
45
|
var attributesView_1 = require("../../helpers/attributesView");
|
|
46
46
|
var helpers_1 = require("./helpers");
|
|
47
47
|
var AttributesList = function (_a) {
|
|
48
|
-
var attrTypes = _a.attrTypes, entity = _a.entity, parentUri = _a.parentUri, showEmptyEditors = _a.showEmptyEditors, mode = _a.mode, crosswalks = _a.crosswalks, drawLines = _a.drawLines, children = _a.children, className = _a.className, _b = _a.alwaysVisibleTypeUris, alwaysVisibleTypeUris = _b === void 0 ? constants_1.ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer;
|
|
48
|
+
var attrTypes = _a.attrTypes, entity = _a.entity, parentUri = _a.parentUri, showEmptyEditors = _a.showEmptyEditors, mode = _a.mode, crosswalks = _a.crosswalks, drawLines = _a.drawLines, children = _a.children, className = _a.className, _b = _a.alwaysVisibleTypeUris, alwaysVisibleTypeUris = _b === void 0 ? constants_1.ALWAYS_VISIBLE_TYPE_URIS : _b, onAddAttributes = _a.onAddAttributes, onChangeAttribute = _a.onChangeAttribute, onDeleteAttribute = _a.onDeleteAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, showNonOv = _a.showNonOv;
|
|
49
49
|
var _c = entity.attributes, attributes = _c === void 0 ? {} : _c;
|
|
50
50
|
var creatableAttrTypes = react_1.useMemo(function () { return mdm_sdk_1.getCreatableAttributeTypes(mode, attrTypes); }, [attrTypes, mode]);
|
|
51
51
|
var moreAttrTypes = helpers_1.getMoreAttrTypes(creatableAttrTypes, entity);
|
|
52
|
-
var pagersData = react_1.useMemo(function () { return mdm_sdk_1.getAttributesListForEditMode(attrTypes, mode, entity, showEmptyEditors); }, [
|
|
53
|
-
attrTypes,
|
|
54
|
-
mode,
|
|
55
|
-
entity,
|
|
56
|
-
showEmptyEditors
|
|
57
|
-
]);
|
|
52
|
+
var pagersData = react_1.useMemo(function () { return mdm_sdk_1.getAttributesListForEditMode(attrTypes, mode, entity, showEmptyEditors, showNonOv); }, [attrTypes, mode, entity, showEmptyEditors, showNonOv]);
|
|
58
53
|
var _d = react_1.useMemo(function () { return attributesView_1.splitPagersData(alwaysVisibleTypeUris, pagersData); }, [pagersData, alwaysVisibleTypeUris]), alwaysVisiblePagersData = _d[0], regularPagersData = _d[1];
|
|
59
54
|
var onAddMoreAttributes = react_1.useCallback(function (attributeTypes) {
|
|
60
55
|
onAddAttributes(attributeTypes.map(function (attributeType) { return ({ attributeType: attributeType, parentUri: parentUri }); }));
|
|
@@ -67,7 +62,7 @@ var AttributesList = function (_a) {
|
|
|
67
62
|
react_1.default.createElement(BranchDecorator_1.default, __assign({}, decoratorProps, { plain: true }), creatableAttrTypes.length > 0 && (react_1.default.createElement(MoreAttributesButton_1.default, { label: ui_i18n_1.default.text('More attributes'), onApply: onAddMoreAttributes, dense: drawLines, data: moreAttrTypes }))),
|
|
68
63
|
regularPagersData.concat(alwaysVisiblePagersData).map(function (_a) {
|
|
69
64
|
var attrType = _a.attrType, values = _a.values;
|
|
70
|
-
return (react_1.default.createElement(AttributesPager_1.default, { key: attrType.uri, attributeType: attrType, drawLines: drawLines, values: values, paging: ramda_1.path(['paging', attrType.uri], attributes), parentUri: parentUri, showEmptyEditors: showEmptyEditors, mode: mode, crosswalks: crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute, additionalControlsRenderer: additionalControlsRenderer }));
|
|
65
|
+
return (react_1.default.createElement(AttributesPager_1.default, { key: attrType.uri, attributeType: attrType, drawLines: drawLines, values: values, paging: ramda_1.path(['paging', attrType.uri], attributes), parentUri: parentUri, showEmptyEditors: showEmptyEditors, mode: mode, crosswalks: crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute, additionalControlsRenderer: additionalControlsRenderer, showNonOv: showNonOv }));
|
|
71
66
|
})));
|
|
72
67
|
};
|
|
73
68
|
AttributesList.propTypes = {
|
|
@@ -79,6 +74,7 @@ AttributesList.propTypes = {
|
|
|
79
74
|
mode: mdm_sdk_1.ModeType,
|
|
80
75
|
crosswalks: prop_types_1.default.array,
|
|
81
76
|
drawLines: prop_types_1.default.bool,
|
|
77
|
+
showNonOv: prop_types_1.default.bool,
|
|
82
78
|
className: prop_types_1.default.string,
|
|
83
79
|
alwaysVisibleTypeUris: prop_types_1.default.array,
|
|
84
80
|
onAddAttributes: prop_types_1.default.func,
|
|
@@ -4,5 +4,5 @@ import { AttributePagerProps } from './index';
|
|
|
4
4
|
declare type Props = Required<Omit<AttributePagerProps, 'drawLines' | 'values'>> & {
|
|
5
5
|
values: (SimpleAttributeValue | NestedAttributeValue | ReferenceAttributeValue)[];
|
|
6
6
|
};
|
|
7
|
-
declare const AttributeRenderer: ({ max, values, attributeType, parentUri, mode, showEmptyEditors, errorMessage, errors, paging, crosswalks, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: Props) => JSX.Element;
|
|
7
|
+
declare const AttributeRenderer: ({ max, values, attributeType, parentUri, mode, showEmptyEditors, errorMessage, errors, paging, crosswalks, showNonOv, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: Props) => JSX.Element;
|
|
8
8
|
export default AttributeRenderer;
|
|
@@ -34,7 +34,7 @@ var CardinalityMessage_1 = __importDefault(require("./CardinalityMessage"));
|
|
|
34
34
|
var styles_1 = require("./styles");
|
|
35
35
|
var utils_1 = require("./utils");
|
|
36
36
|
var AttributeRenderer = function (_a) {
|
|
37
|
-
var max = _a.max, values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, showEmptyEditors = _a.showEmptyEditors, errorMessage = _a.errorMessage, errors = _a.errors, paging = _a.paging, crosswalks = _a.crosswalks, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
37
|
+
var max = _a.max, values = _a.values, attributeType = _a.attributeType, parentUri = _a.parentUri, mode = _a.mode, showEmptyEditors = _a.showEmptyEditors, errorMessage = _a.errorMessage, errors = _a.errors, paging = _a.paging, crosswalks = _a.crosswalks, showNonOv = _a.showNonOv, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
38
38
|
var styles = styles_1.useStyles();
|
|
39
39
|
var _b = react_1.useState(max), visibleValuesCount = _b[0], setVisibleValuesCount = _b[1];
|
|
40
40
|
var _c = react_1.useState(false), hadDeletions = _c[0], setHadDeletions = _c[1];
|
|
@@ -66,12 +66,13 @@ var AttributeRenderer = function (_a) {
|
|
|
66
66
|
return null;
|
|
67
67
|
}
|
|
68
68
|
var newValuesCount = (utils_1.filterNewValues(values) || []).length;
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
var
|
|
69
|
+
var totalProp = showNonOv ? 'totalValues' : 'totalOvValues';
|
|
70
|
+
var totalVisibleValues = ramda_1.ifElse(ramda_1.has(totalProp), ramda_1.pipe(ramda_1.prop(totalProp), ramda_1.add(newValuesCount)), ramda_1.always(values.length))(paging);
|
|
71
|
+
var hasPaging = max < totalVisibleValues;
|
|
72
|
+
var showMore = hasPaging && visibleValuesCount < totalVisibleValues;
|
|
73
|
+
var showLess = hasPaging && visibleValuesCount >= totalVisibleValues;
|
|
73
74
|
var onShowMore = function () {
|
|
74
|
-
if (values.length <
|
|
75
|
+
if (values.length < totalVisibleValues) {
|
|
75
76
|
requestNextPageOfAttributeValues({
|
|
76
77
|
parentUri: parentUri,
|
|
77
78
|
attributeTypeUri: attributeTypeUri,
|
|
@@ -87,7 +88,7 @@ var AttributeRenderer = function (_a) {
|
|
|
87
88
|
};
|
|
88
89
|
var shownValues = values.slice(0, visibleValuesCount);
|
|
89
90
|
var lastIndex = shownValues ? shownValues.length - 1 : 0;
|
|
90
|
-
var hiddenValuesCount =
|
|
91
|
+
var hiddenValuesCount = totalVisibleValues - visibleValuesCount;
|
|
91
92
|
return (react_1.default.createElement("div", { className: styles.wrapper },
|
|
92
93
|
react_1.default.createElement(Title_1.default, { label: label, isRequired: isRequired, className: styles.title, attributeType: attributeType }),
|
|
93
94
|
isEditableMode && react_1.default.createElement(CardinalityMessage_1.default, { cardinality: cardinality }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttributePagerProps } from './index';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ values, attributeType, mode, crosswalks, drawLines, paging, parentUri, errors, errorMessage, max, showEmptyEditors, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: AttributePagerProps) => JSX.Element>;
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ values, attributeType, mode, crosswalks, drawLines, paging, parentUri, errors, errorMessage, max, showEmptyEditors, showNonOv, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: AttributePagerProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -49,11 +49,11 @@ var RENDERER_TYPES;
|
|
|
49
49
|
RENDERER_TYPES["default"] = "default";
|
|
50
50
|
})(RENDERER_TYPES || (RENDERER_TYPES = {}));
|
|
51
51
|
var AttributesPager = function (_a) {
|
|
52
|
-
var values = _a.values,
|
|
53
|
-
attributeType = _a.attributeType, _b = _a.mode, mode = _b === void 0 ? mdm_sdk_1.Mode.Viewing : _b, crosswalks = _a.crosswalks, drawLines = _a.drawLines, _c = _a.paging, paging = _c === void 0 ? {} : _c, parentUri = _a.parentUri, errors = _a.errors, errorMessage = _a.errorMessage, _d = _a.max, max = _d === void 0 ? Infinity : _d, showEmptyEditors = _a.showEmptyEditors, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
52
|
+
var values = _a.values, attributeType = _a.attributeType, _b = _a.mode, mode = _b === void 0 ? mdm_sdk_1.Mode.Viewing : _b, crosswalks = _a.crosswalks, drawLines = _a.drawLines, _c = _a.paging, paging = _c === void 0 ? {} : _c, parentUri = _a.parentUri, errors = _a.errors, errorMessage = _a.errorMessage, _d = _a.max, max = _d === void 0 ? Infinity : _d, showEmptyEditors = _a.showEmptyEditors, showNonOv = _a.showNonOv, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, onDeactivateError = _a.onDeactivateError, additionalControlsRenderer = _a.additionalControlsRenderer, requestNextPageOfAttributeValues = _a.requestNextPageOfAttributeValues;
|
|
54
53
|
var styles = styles_1.useStyles();
|
|
55
54
|
var partitionByOv = ramda_1.partition(mdm_sdk_1.isOv);
|
|
56
55
|
var ovValues = partitionByOv(values)[0];
|
|
56
|
+
var visibleValues = showNonOv ? values : ovValues;
|
|
57
57
|
var commonProps = {
|
|
58
58
|
errorMessage: errorMessage,
|
|
59
59
|
errors: errors,
|
|
@@ -73,14 +73,14 @@ var AttributesPager = function (_a) {
|
|
|
73
73
|
])(attributeType);
|
|
74
74
|
switch (type) {
|
|
75
75
|
case RENDERER_TYPES.special: {
|
|
76
|
-
return (react_1.default.createElement(SpecialRenderer_1.default, __assign({ values:
|
|
76
|
+
return (react_1.default.createElement(SpecialRenderer_1.default, __assign({ values: visibleValues, attributeType: attributeType }, commonProps)));
|
|
77
77
|
}
|
|
78
78
|
case RENDERER_TYPES.imageLine:
|
|
79
79
|
return (react_1.default.createElement("div", { className: styles.wrapper },
|
|
80
80
|
react_1.default.createElement(Title_1.default, { label: attributeType === null || attributeType === void 0 ? void 0 : attributeType.label, attributeType: attributeType }),
|
|
81
|
-
react_1.default.createElement(ImageAttributesLine_1.default, { attributeValues:
|
|
81
|
+
react_1.default.createElement(ImageAttributesLine_1.default, { attributeValues: visibleValues, attributeType: attributeType, onDeleteAttribute: onDeleteAttribute, parentUri: parentUri, onChangeAttribute: onChangeAttribute })));
|
|
82
82
|
default:
|
|
83
|
-
return (react_1.default.createElement(AttributeRenderer_1.default, __assign({ values:
|
|
83
|
+
return (react_1.default.createElement(AttributeRenderer_1.default, __assign({ values: visibleValues, attributeType: attributeType, max: max, paging: paging, crosswalks: crosswalks, showEmptyEditors: showEmptyEditors, requestNextPageOfAttributeValues: requestNextPageOfAttributeValues, showNonOv: showNonOv }, commonProps)));
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
return react_1.default.createElement(BranchDecorator_1.default, { enabled: drawLines }, renderAttribute());
|
|
@@ -29,6 +29,7 @@ declare type OwnProps = {
|
|
|
29
29
|
drawLines: boolean;
|
|
30
30
|
max?: number;
|
|
31
31
|
showEmptyEditors: boolean;
|
|
32
|
+
showNonOv?: boolean;
|
|
32
33
|
onAddAttributes: (params: AttributeItem[]) => void;
|
|
33
34
|
onDeleteAttribute: (param: AttributeItem) => void;
|
|
34
35
|
onChangeAttribute: (param: AttributeItem) => void;
|
|
@@ -36,5 +37,5 @@ declare type OwnProps = {
|
|
|
36
37
|
};
|
|
37
38
|
export declare type AttributePagerProps = StateProps & DispatchProps & OwnProps;
|
|
38
39
|
export { AttributesPager, CardinalityMessage };
|
|
39
|
-
declare const _default: import("react-redux").ConnectedComponent<import("react").MemoExoticComponent<({ values, attributeType, mode, crosswalks, drawLines, paging, parentUri, errors, errorMessage, max, showEmptyEditors, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: AttributePagerProps) => JSX.Element>, import("react-redux").Omit<StateProps & DispatchProps & OwnProps, "errorMessage" | "max" | "errors" | "requestNextPageOfAttributeValues" | "onDeactivateError"> & OwnProps>;
|
|
40
|
+
declare const _default: import("react-redux").ConnectedComponent<import("react").MemoExoticComponent<({ values, attributeType, mode, crosswalks, drawLines, paging, parentUri, errors, errorMessage, max, showEmptyEditors, showNonOv, onAddAttributes, onDeleteAttribute, onChangeAttribute, onDeactivateError, additionalControlsRenderer, requestNextPageOfAttributeValues }: AttributePagerProps) => JSX.Element>, import("react-redux").Omit<StateProps & DispatchProps & OwnProps, "errorMessage" | "max" | "errors" | "requestNextPageOfAttributeValues" | "onDeactivateError"> & OwnProps>;
|
|
40
41
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ComplexAttribute;
|
|
2
|
-
declare function ComplexAttribute({ label, attributeTypesList, attributeType, attributeValue, children, errors, ownError, mode, metadata, crosswalks, lazy, showEmptyEditors, onAddOneMore, onAddAttributes, onDeleteAttribute, onChangeAttribute, additionalControlsRenderer, hideDeleteButton, state }: {
|
|
2
|
+
declare function ComplexAttribute({ label, attributeTypesList, attributeType, attributeValue, children, errors, ownError, mode, metadata, crosswalks, lazy, showEmptyEditors, onAddOneMore, onAddAttributes, onDeleteAttribute, onChangeAttribute, additionalControlsRenderer, hideDeleteButton, state, showNonOv }: {
|
|
3
3
|
label: any;
|
|
4
4
|
attributeTypesList: any;
|
|
5
5
|
attributeType: any;
|
|
@@ -19,6 +19,7 @@ declare function ComplexAttribute({ label, attributeTypesList, attributeType, at
|
|
|
19
19
|
additionalControlsRenderer: any;
|
|
20
20
|
hideDeleteButton: any;
|
|
21
21
|
state: any;
|
|
22
|
+
showNonOv: any;
|
|
22
23
|
}): JSX.Element;
|
|
23
24
|
declare namespace ComplexAttribute {
|
|
24
25
|
const propTypes: {
|
|
@@ -127,6 +128,7 @@ declare namespace ComplexAttribute {
|
|
|
127
128
|
onChangeAttribute: PropTypes.Requireable<(...args: any[]) => any>;
|
|
128
129
|
additionalControlsRenderer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
129
130
|
hideDeleteButton: PropTypes.Requireable<boolean>;
|
|
131
|
+
showNonOv: PropTypes.Requireable<boolean>;
|
|
130
132
|
state: PropTypes.Requireable<string>;
|
|
131
133
|
label: PropTypes.Requireable<string>;
|
|
132
134
|
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
@@ -48,7 +48,7 @@ var AttributesList_1 = __importDefault(require("../AttributesList/AttributesList
|
|
|
48
48
|
var ArrowExpandButton_1 = __importDefault(require("../../../ArrowExpandButton/ArrowExpandButton"));
|
|
49
49
|
var ComplexAttribute = function (_a) {
|
|
50
50
|
var _b;
|
|
51
|
-
var label = _a.label, attributeTypesList = _a.attributeTypesList, attributeType = _a.attributeType, attributeValue = _a.attributeValue, children = _a.children, errors = _a.errors, ownError = _a.ownError, mode = _a.mode, metadata = _a.metadata, crosswalks = _a.crosswalks, lazy = _a.lazy, showEmptyEditors = _a.showEmptyEditors, onAddOneMore = _a.onAddOneMore, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, hideDeleteButton = _a.hideDeleteButton, state = _a.state;
|
|
51
|
+
var label = _a.label, attributeTypesList = _a.attributeTypesList, attributeType = _a.attributeType, attributeValue = _a.attributeValue, children = _a.children, errors = _a.errors, ownError = _a.ownError, mode = _a.mode, metadata = _a.metadata, crosswalks = _a.crosswalks, lazy = _a.lazy, showEmptyEditors = _a.showEmptyEditors, onAddOneMore = _a.onAddOneMore, onAddAttributes = _a.onAddAttributes, onDeleteAttribute = _a.onDeleteAttribute, onChangeAttribute = _a.onChangeAttribute, additionalControlsRenderer = _a.additionalControlsRenderer, hideDeleteButton = _a.hideDeleteButton, state = _a.state, showNonOv = _a.showNonOv;
|
|
52
52
|
var styles = styles_1.useStyles();
|
|
53
53
|
var deleted = state === 'deleted';
|
|
54
54
|
var edited = state === 'edited';
|
|
@@ -99,7 +99,7 @@ var ComplexAttribute = function (_a) {
|
|
|
99
99
|
")")),
|
|
100
100
|
additionalControlsRenderer && additionalControlsRenderer({ attributeType: attributeType, attributeValue: attributeValue }),
|
|
101
101
|
showDeleteButton && react_1.default.createElement(SmallIconButton_1.default, { icon: Delete_1.default, onClick: onDeleteThis, size: "L" }))),
|
|
102
|
-
expanded && (react_1.default.createElement(AttributesList_1.default, { attrTypes: attributeTypesList, entity: attributeListEntity, showEmptyEditors: showEmptyEditors || isNew, drawLines: true, parentUri: uri, mode: mode, crosswalks: crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute, additionalControlsRenderer: additionalControlsRenderer }, children))));
|
|
102
|
+
expanded && (react_1.default.createElement(AttributesList_1.default, { attrTypes: attributeTypesList, entity: attributeListEntity, showEmptyEditors: showEmptyEditors || isNew, drawLines: true, parentUri: uri, mode: mode, crosswalks: crosswalks, onAddAttributes: onAddAttributes, onChangeAttribute: onChangeAttribute, onDeleteAttribute: onDeleteAttribute, additionalControlsRenderer: additionalControlsRenderer, showNonOv: showNonOv }, children))));
|
|
103
103
|
};
|
|
104
104
|
ComplexAttribute.propTypes = __assign({ label: prop_types_1.default.string, children: prop_types_1.default.node, attributeTypesList: prop_types_1.default.arrayOf(mdm_sdk_1.AttributeTypeType), attributeValue: prop_types_1.default.oneOfType([mdm_sdk_1.NestedAttributeValueType, mdm_sdk_1.ReferenceAttributeValueType]) }, mdm_sdk_1.ComplexAttributeType);
|
|
105
105
|
exports.default = ComplexAttribute;
|
|
@@ -106,6 +106,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
106
106
|
onChangeAttribute: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
107
107
|
additionalControlsRenderer: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
108
108
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
109
|
+
showNonOv: import("prop-types").Requireable<boolean>;
|
|
109
110
|
state: import("prop-types").Requireable<string>;
|
|
110
111
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
111
112
|
value: import("prop-types").Requireable<object>;
|
|
@@ -114,6 +114,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
114
114
|
onChangeAttribute: PropTypes.Requireable<(...args: any[]) => any>;
|
|
115
115
|
additionalControlsRenderer: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
116
|
hideDeleteButton: PropTypes.Requireable<boolean>;
|
|
117
|
+
showNonOv: PropTypes.Requireable<boolean>;
|
|
117
118
|
state: PropTypes.Requireable<string>;
|
|
118
119
|
attributeValue: PropTypes.Requireable<PropTypes.InferProps<{
|
|
119
120
|
refEntity: PropTypes.Requireable<object>;
|
|
@@ -115,6 +115,7 @@ declare var _default: import("react-redux").ConnectedComponent<import("react").M
|
|
|
115
115
|
onChangeAttribute: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
116
116
|
additionalControlsRenderer: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
117
117
|
hideDeleteButton: import("prop-types").Requireable<boolean>;
|
|
118
|
+
showNonOv: import("prop-types").Requireable<boolean>;
|
|
118
119
|
state: import("prop-types").Requireable<string>;
|
|
119
120
|
attributeValue: import("prop-types").Requireable<import("prop-types").InferProps<{
|
|
120
121
|
refEntity: import("prop-types").Requireable<object>;
|
|
@@ -11,8 +11,8 @@ declare type Props = {
|
|
|
11
11
|
attributes: RecordAttributesType;
|
|
12
12
|
parentUri: string;
|
|
13
13
|
crosswalksMap: CrosswalksMap;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
disableDelete?: boolean;
|
|
15
|
+
disableEdit?: boolean;
|
|
16
16
|
onPin: (event: PinAttributeEvent) => void;
|
|
17
17
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
18
18
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -13,8 +13,8 @@ declare type Props = {
|
|
|
13
13
|
paging?: Paging;
|
|
14
14
|
max?: number;
|
|
15
15
|
crosswalksMap: CrosswalksMap;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
disableDelete?: boolean;
|
|
17
|
+
disableEdit?: boolean;
|
|
18
18
|
onPin: (event: PinAttributeEvent) => void;
|
|
19
19
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
20
20
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -13,13 +13,13 @@ declare type Props = {
|
|
|
13
13
|
lazy?: boolean;
|
|
14
14
|
attributeTypesList: AttributeType[];
|
|
15
15
|
crosswalksMap: CrosswalksMap;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
disableEdit?: boolean;
|
|
17
|
+
disableDelete?: boolean;
|
|
18
18
|
onPin: (event: PinAttributeEvent) => void;
|
|
19
19
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
20
20
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
21
21
|
onEdit: (event: EditAttributeEvent) => void;
|
|
22
22
|
onAdd: (event: AddAttributeEvent) => void;
|
|
23
23
|
};
|
|
24
|
-
declare const ComplexAttribute: ({ attributeType, attributeValue, attributeTypesList, label, crosswalksMap,
|
|
24
|
+
declare const ComplexAttribute: ({ attributeType, attributeValue, attributeTypesList, label, crosswalksMap, disableEdit, disableDelete, onPin, onIgnore, onDelete, onEdit, onAdd }: Props) => JSX.Element;
|
|
25
25
|
export default ComplexAttribute;
|
|
@@ -37,17 +37,17 @@ var hooks_1 = require("../../../../hooks");
|
|
|
37
37
|
var contexts_1 = require("../../../../contexts");
|
|
38
38
|
var styles_1 = require("./styles");
|
|
39
39
|
var ComplexAttribute = function (_a) {
|
|
40
|
-
var attributeType = _a.attributeType, attributeValue = _a.attributeValue, attributeTypesList = _a.attributeTypesList, label = _a.label, crosswalksMap = _a.crosswalksMap,
|
|
40
|
+
var attributeType = _a.attributeType, attributeValue = _a.attributeValue, attributeTypesList = _a.attributeTypesList, label = _a.label, crosswalksMap = _a.crosswalksMap, disableEdit = _a.disableEdit, disableDelete = _a.disableDelete, onPin = _a.onPin, onIgnore = _a.onIgnore, onDelete = _a.onDelete, onEdit = _a.onEdit, onAdd = _a.onAdd;
|
|
41
41
|
var styles = styles_1.useStyles();
|
|
42
|
-
var
|
|
43
|
-
var canEdit =
|
|
44
|
-
var canDelete =
|
|
42
|
+
var _b = useAttributeState_1.useAttributeState(), isReadingMode = _b.isReadingMode, onMouseEnter = _b.onMouseEnter, onMouseLeave = _b.onMouseLeave;
|
|
43
|
+
var canEdit = !disableEdit && mdm_sdk_1.checkMetadataForUpdate(mdm_sdk_1.ModeTypes.EDITING, attributeType);
|
|
44
|
+
var canDelete = !disableDelete && mdm_sdk_1.checkMetadataForDelete(mdm_sdk_1.ModeTypes.EDITING, attributeType);
|
|
45
45
|
var isTemporary = mdm_sdk_1.isTempUri(attributeValue.uri);
|
|
46
46
|
var showPin = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.pin);
|
|
47
47
|
var showIgnore = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.ignored);
|
|
48
48
|
var showDelete = !isReadingMode && canDelete;
|
|
49
49
|
var expandedFromContext = contexts_1.useAttributeExpanded(attributeValue.uri);
|
|
50
|
-
var
|
|
50
|
+
var _c = react_1.useState(expandedFromContext || isTemporary), expanded = _c[0], setExpanded = _c[1];
|
|
51
51
|
hooks_1.useDidUpdateEffect(function () {
|
|
52
52
|
if (expandedFromContext)
|
|
53
53
|
setExpanded(expandedFromContext);
|
|
@@ -70,6 +70,6 @@ var ComplexAttribute = function (_a) {
|
|
|
70
70
|
crosswalks: crosswalksMap[attributeValue.uri]
|
|
71
71
|
});
|
|
72
72
|
} })))),
|
|
73
|
-
expanded && (react_1.default.createElement(AttributesList_1.default, { attributeTypes: attributeTypesList, attributes: attributeValue.value, parentUri: attributeValue.uri, crosswalksMap: crosswalksMap,
|
|
73
|
+
expanded && (react_1.default.createElement(AttributesList_1.default, { attributeTypes: attributeTypesList, attributes: attributeValue.value, parentUri: attributeValue.uri, crosswalksMap: crosswalksMap, disableEdit: !canEdit, disableDelete: !canDelete, onPin: onPin, onIgnore: onIgnore, onDelete: onDelete, onEdit: onEdit, onAdd: onAdd }))));
|
|
74
74
|
};
|
|
75
75
|
exports.default = ComplexAttribute;
|
|
@@ -10,8 +10,8 @@ declare type Props = {
|
|
|
10
10
|
attributeValue: ImageAttributeValue;
|
|
11
11
|
attributeType: AttributeType;
|
|
12
12
|
crosswalksMap: CrosswalksMap;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
disableEdit?: boolean;
|
|
14
|
+
disableDelete?: boolean;
|
|
15
15
|
onPin: (event: PinAttributeEvent) => void;
|
|
16
16
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
17
17
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -11,8 +11,8 @@ declare type Props = {
|
|
|
11
11
|
attributeType: AttributeType;
|
|
12
12
|
attributeValues: ImageAttributeValue[];
|
|
13
13
|
crosswalksMap: CrosswalksMap;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
disableDelete?: boolean;
|
|
15
|
+
disableEdit?: boolean;
|
|
16
16
|
onPin: (event: PinAttributeEvent) => void;
|
|
17
17
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
18
18
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -10,8 +10,8 @@ declare type Props = {
|
|
|
10
10
|
attributeValue: NestedAttributeValue;
|
|
11
11
|
attributeType: AttributeType;
|
|
12
12
|
crosswalksMap: CrosswalksMap;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
disableEdit?: boolean;
|
|
14
|
+
disableDelete?: boolean;
|
|
15
15
|
onPin: (event: PinAttributeEvent) => void;
|
|
16
16
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
17
17
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -12,13 +12,13 @@ declare type Props = {
|
|
|
12
12
|
attributeValues: NestedAttributeValue[];
|
|
13
13
|
crosswalksMap: CrosswalksMap;
|
|
14
14
|
parentUri: string;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
disableDelete?: boolean;
|
|
16
|
+
disableEdit?: boolean;
|
|
17
17
|
onPin: (event: PinAttributeEvent) => void;
|
|
18
18
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
19
19
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
20
20
|
onEdit: (event: EditAttributeEvent) => void;
|
|
21
21
|
onAdd: (event: AddAttributeEvent) => void;
|
|
22
22
|
};
|
|
23
|
-
declare const NestedAttributesBlock: ({ className, attributeValues, attributeType, onAdd, parentUri, ...props }: Props) => JSX.Element;
|
|
23
|
+
declare const NestedAttributesBlock: ({ className, attributeValues, attributeType, onAdd, parentUri, disableEdit, ...props }: Props) => JSX.Element;
|
|
24
24
|
export default NestedAttributesBlock;
|
|
@@ -31,14 +31,14 @@ var NestedAttribute_1 = __importDefault(require("../NestedAttribute/NestedAttrib
|
|
|
31
31
|
var Button_1 = __importDefault(require("@material-ui/core/Button"));
|
|
32
32
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
33
33
|
var NestedAttributesBlock = function (_a) {
|
|
34
|
-
var className = _a.className, attributeValues = _a.attributeValues, attributeType = _a.attributeType, onAdd = _a.onAdd, parentUri = _a.parentUri, props = __rest(_a, ["className", "attributeValues", "attributeType", "onAdd", "parentUri"]);
|
|
35
|
-
var canCreate = mdm_sdk_1.checkMetadataForCreate(mdm_sdk_1.ModeTypes.EDITING, attributeType);
|
|
34
|
+
var className = _a.className, attributeValues = _a.attributeValues, attributeType = _a.attributeType, onAdd = _a.onAdd, parentUri = _a.parentUri, disableEdit = _a.disableEdit, props = __rest(_a, ["className", "attributeValues", "attributeType", "onAdd", "parentUri", "disableEdit"]);
|
|
35
|
+
var canCreate = !disableEdit && mdm_sdk_1.checkMetadataForCreate(mdm_sdk_1.ModeTypes.EDITING, attributeType);
|
|
36
36
|
return attributeValues.length === 0 && canCreate ? (react_1.default.createElement(Button_1.default, { variant: "text", color: "primary", onClick: function () {
|
|
37
37
|
return onAdd({
|
|
38
38
|
parentUri: parentUri,
|
|
39
39
|
attributeType: attributeType,
|
|
40
40
|
index: 0
|
|
41
41
|
});
|
|
42
|
-
} }, ui_i18n_1.default.text('Create attribute'))) : (react_1.default.createElement("div", { className: className }, attributeValues.map(function (value) { return (react_1.default.createElement(NestedAttribute_1.default, __assign({ key: value.uri, attributeValue: value, attributeType: attributeType, onAdd: onAdd }, props))); })));
|
|
42
|
+
} }, ui_i18n_1.default.text('Create attribute'))) : (react_1.default.createElement("div", { className: className }, attributeValues.map(function (value) { return (react_1.default.createElement(NestedAttribute_1.default, __assign({ key: value.uri, attributeValue: value, attributeType: attributeType, onAdd: onAdd, disableEdit: disableEdit }, props))); })));
|
|
43
43
|
};
|
|
44
44
|
exports.default = NestedAttributesBlock;
|
|
@@ -10,8 +10,8 @@ declare type Props = {
|
|
|
10
10
|
attributeValue: ReferenceAttributeValue;
|
|
11
11
|
attributeType: AttributeType;
|
|
12
12
|
crosswalksMap: RelationCrosswalksMap;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
disableEdit?: boolean;
|
|
14
|
+
disableDelete?: boolean;
|
|
15
15
|
onPin: (event: PinAttributeEvent) => void;
|
|
16
16
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
17
17
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -11,8 +11,8 @@ declare type Props = {
|
|
|
11
11
|
attributeType: AttributeType;
|
|
12
12
|
attributeValues: ReferenceAttributeValue[];
|
|
13
13
|
crosswalksMap: RelationCrosswalksMap;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
disableDelete?: boolean;
|
|
15
|
+
disableEdit?: boolean;
|
|
16
16
|
onPin: (event: PinAttributeEvent) => void;
|
|
17
17
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
18
18
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
@@ -10,12 +10,12 @@ declare type Props = {
|
|
|
10
10
|
attributeValue: SimpleAttributeValue;
|
|
11
11
|
attributeType: AttributeType;
|
|
12
12
|
crosswalk: Crosswalk | RelationCrosswalk;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
disableEdit?: boolean;
|
|
14
|
+
disableDelete?: boolean;
|
|
15
15
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
16
16
|
onEdit: (event: EditAttributeEvent) => void;
|
|
17
17
|
onPin: (event: PinAttributeEvent) => void;
|
|
18
18
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
19
19
|
};
|
|
20
|
-
declare const SimpleAttribute: ({ className, dataReltioId, attributeType, attributeValue, crosswalk,
|
|
20
|
+
declare const SimpleAttribute: ({ className, dataReltioId, attributeType, attributeValue, crosswalk, disableEdit, disableDelete, onIgnore, onEdit, onPin, onDelete }: Props) => JSX.Element;
|
|
21
21
|
export default SimpleAttribute;
|
|
@@ -40,19 +40,19 @@ var useAttributeState_1 = require("../hooks/useAttributeState");
|
|
|
40
40
|
var contexts_1 = require("../../../../contexts");
|
|
41
41
|
var styles_1 = require("./styles");
|
|
42
42
|
var SimpleAttribute = function (_a) {
|
|
43
|
-
var className = _a.className, dataReltioId = _a.dataReltioId, _b = _a.attributeType, attributeType = _b === void 0 ? null : _b, attributeValue = _a.attributeValue, crosswalk = _a.crosswalk,
|
|
44
|
-
var
|
|
43
|
+
var className = _a.className, dataReltioId = _a.dataReltioId, _b = _a.attributeType, attributeType = _b === void 0 ? null : _b, attributeValue = _a.attributeValue, crosswalk = _a.crosswalk, disableEdit = _a.disableEdit, disableDelete = _a.disableDelete, onIgnore = _a.onIgnore, onEdit = _a.onEdit, onPin = _a.onPin, onDelete = _a.onDelete;
|
|
44
|
+
var _c = useAttributeState_1.useAttributeState(), isReadingMode = _c.isReadingMode, isEditingMode = _c.isEditingMode, isHovered = _c.isHovered, onMouseEnter = _c.onMouseEnter, onMouseLeave = _c.onMouseLeave, setReadingMode = _c.setReadingMode, setEditingMode = _c.setEditingMode;
|
|
45
45
|
var containerRef = react_1.useRef();
|
|
46
46
|
var id = mdm_sdk_1.getLastUriPart(attributeValue.uri);
|
|
47
47
|
var crosswalkDisabled = mdm_sdk_1.isCrosswalkDisabled(crosswalk);
|
|
48
48
|
var canModifyAttribute = !attributeType.system && !crosswalkDisabled;
|
|
49
|
-
var canEdit = canModifyAttribute &&
|
|
50
|
-
var canDelete = canModifyAttribute &&
|
|
49
|
+
var canEdit = canModifyAttribute && !disableEdit && mdm_sdk_1.checkMetadataForUpdate(mdm_sdk_1.ModeTypes.EDITING, attributeType);
|
|
50
|
+
var canDelete = canModifyAttribute && !disableDelete && mdm_sdk_1.checkMetadataForDelete(mdm_sdk_1.ModeTypes.EDITING, attributeType);
|
|
51
51
|
var isTemporary = mdm_sdk_1.isTempUri(attributeValue.uri);
|
|
52
52
|
var showPin = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.pin);
|
|
53
53
|
var showIgnore = !isTemporary && ((!isReadingMode && canEdit) || attributeValue.ignored);
|
|
54
54
|
var color = contexts_1.useCrosswalkColor(crosswalk);
|
|
55
|
-
var
|
|
55
|
+
var _d = contexts_1.useCrosswalkHighlight(crosswalk), isHighlighted = _d.isHighlighted, isDimmed = _d.isDimmed, highlightCrosswalk = _d.highlightCrosswalk, removeHighlight = _d.removeHighlight;
|
|
56
56
|
var styles = styles_1.useStyles({
|
|
57
57
|
variant: crosswalkDisabled ? 'outlined' : 'filled',
|
|
58
58
|
opaque: !isDimmed,
|
|
@@ -11,13 +11,13 @@ declare type Props = {
|
|
|
11
11
|
attributeValues: SimpleAttributeValue[];
|
|
12
12
|
crosswalksMap: CrosswalksMap;
|
|
13
13
|
parentUri: string;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
disableDelete?: boolean;
|
|
15
|
+
disableEdit?: boolean;
|
|
16
16
|
onPin: (event: PinAttributeEvent) => void;
|
|
17
17
|
onIgnore: (event: IgnoreAttributeEvent) => void;
|
|
18
18
|
onDelete: (event: DeleteAttributeEvent) => void;
|
|
19
19
|
onEdit: (event: EditAttributeEvent) => void;
|
|
20
20
|
onAdd: (event: AddAttributeEvent) => void;
|
|
21
21
|
};
|
|
22
|
-
declare const SimpleAttributesBlock: ({ attributeValues, attributeType, parentUri,
|
|
22
|
+
declare const SimpleAttributesBlock: ({ attributeValues, attributeType, parentUri, disableEdit, crosswalksMap, onAdd, ...props }: Props) => JSX.Element;
|
|
23
23
|
export default SimpleAttributesBlock;
|
|
@@ -32,7 +32,7 @@ var react_dnd_1 = require("react-dnd");
|
|
|
32
32
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
33
33
|
var styles_1 = require("./styles");
|
|
34
34
|
var SimpleAttributesBlock = function (_a) {
|
|
35
|
-
var attributeValues = _a.attributeValues, attributeType = _a.attributeType, parentUri = _a.parentUri,
|
|
35
|
+
var attributeValues = _a.attributeValues, attributeType = _a.attributeType, parentUri = _a.parentUri, disableEdit = _a.disableEdit, crosswalksMap = _a.crosswalksMap, onAdd = _a.onAdd, props = __rest(_a, ["attributeValues", "attributeType", "parentUri", "disableEdit", "crosswalksMap", "onAdd"]);
|
|
36
36
|
var styles = styles_1.useStyles();
|
|
37
37
|
var _b = react_dnd_1.useDrop({
|
|
38
38
|
accept: 'Crosswalk',
|
|
@@ -41,7 +41,7 @@ var SimpleAttributesBlock = function (_a) {
|
|
|
41
41
|
var isRelationCrosswalk = mdm_sdk_1.isRelationUri(crosswalk.uri) || crosswalk.ownerType === 'relation';
|
|
42
42
|
var isEntityCrosswalk = mdm_sdk_1.isEntityUri(crosswalk.uri) && crosswalk.ownerType === 'entity';
|
|
43
43
|
return (mdm_sdk_1.checkMetadataForCreate(mdm_sdk_1.ModeTypes.EDITING, attributeType) &&
|
|
44
|
-
|
|
44
|
+
!disableEdit &&
|
|
45
45
|
((isRelationCrosswalk && mdm_sdk_1.isRelationTypeUri(attributeType.uri)) ||
|
|
46
46
|
(isEntityCrosswalk && mdm_sdk_1.isEntityTypeUri(attributeType.uri))));
|
|
47
47
|
},
|
|
@@ -58,7 +58,7 @@ var SimpleAttributesBlock = function (_a) {
|
|
|
58
58
|
return (react_1.default.createElement("div", { ref: drop, className: styles.simpleAttributesWrapper },
|
|
59
59
|
attributeValues.map(function (value) {
|
|
60
60
|
var _a;
|
|
61
|
-
return (_a = crosswalksMap[value.uri]) === null || _a === void 0 ? void 0 : _a.map(function (crosswalk) { return (react_1.default.createElement(SimpleAttribute_1.default, __assign({ key: value.uri + crosswalk.uri, attributeType: attributeType, attributeValue: value, crosswalk: crosswalk,
|
|
61
|
+
return (_a = crosswalksMap[value.uri]) === null || _a === void 0 ? void 0 : _a.map(function (crosswalk) { return (react_1.default.createElement(SimpleAttribute_1.default, __assign({ key: value.uri + crosswalk.uri, attributeType: attributeType, attributeValue: value, crosswalk: crosswalk, disableEdit: disableEdit, dataReltioId: "value-index-" + attributeIndex++ }, props))); });
|
|
62
62
|
}),
|
|
63
63
|
isDragItemOver && react_1.default.createElement("div", { className: styles.dropIndicator }, ui_i18n_1.default.text('Drop here'))));
|
|
64
64
|
};
|
|
@@ -9,6 +9,7 @@ declare type Props = {
|
|
|
9
9
|
className?: string;
|
|
10
10
|
max?: number;
|
|
11
11
|
alwaysVisibleTypeUris?: string[];
|
|
12
|
+
showNonOv?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const _default: React.MemoExoticComponent<({ attrTypes, entity, parentUri, drawLines, children, className, max, alwaysVisibleTypeUris }: Props) => JSX.Element>;
|
|
14
|
+
declare const _default: React.MemoExoticComponent<({ attrTypes, entity, parentUri, drawLines, children, className, max, alwaysVisibleTypeUris, showNonOv }: Props) => JSX.Element>;
|
|
14
15
|
export default _default;
|