@reltio/components 1.4.1250 → 1.4.1253

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.
@@ -1,18 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { Entity } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ className?: string;
5
+ entity?: Entity;
6
+ children?: ReactNode;
7
+ };
8
+ declare const ProfileBand: ({ className, entity, children }: Props) => JSX.Element;
1
9
  export default ProfileBand;
2
- declare function ProfileBand({ className, entity, children, classes, showEntityId }: {
3
- className: any;
4
- entity: any;
5
- children: any;
6
- classes: any;
7
- showEntityId?: boolean;
8
- }): JSX.Element;
9
- declare namespace ProfileBand {
10
- namespace propTypes {
11
- const className: PropTypes.Requireable<string>;
12
- const entity: PropTypes.Requireable<object>;
13
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
14
- const classes: PropTypes.Requireable<object>;
15
- const showEntityId: PropTypes.Requireable<boolean>;
16
- }
17
- }
18
- import PropTypes from "prop-types";
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  var react_1 = __importStar(require("react"));
26
- var prop_types_1 = __importDefault(require("prop-types"));
27
26
  var classnames_1 = __importDefault(require("classnames"));
28
27
  var react_redux_1 = require("react-redux");
29
28
  var ramda_1 = require("ramda");
@@ -37,9 +36,10 @@ var EntityTypeBadge_1 = __importDefault(require("../EntityTypeBadge/EntityTypeBa
37
36
  var styles_1 = __importDefault(require("./styles"));
38
37
  var ProfileBand = function (_a) {
39
38
  var _b;
40
- var className = _a.className, entity = _a.entity, children = _a.children, classes = _a.classes, _c = _a.showEntityId, showEntityId = _c === void 0 ? true : _c;
41
- var styles = styles_1.default({ classes: classes });
39
+ var className = _a.className, entity = _a.entity, children = _a.children;
40
+ var styles = styles_1.default();
42
41
  var metadata = react_redux_1.useSelector(mdm_module_1.default.selectors.getMetadata);
42
+ var showEntityId = react_redux_1.useSelector(mdm_module_1.default.selectors.getShowEntityId);
43
43
  var handleCopyEntityIdToClipboard = react_1.useCallback(function () {
44
44
  navigator.clipboard.writeText(mdm_sdk_1.getEntityId(entity));
45
45
  }, [entity]);
@@ -72,11 +72,4 @@ var ProfileBand = function (_a) {
72
72
  entityId)))))),
73
73
  children && react_1.default.createElement("div", null, children))));
74
74
  };
75
- ProfileBand.propTypes = {
76
- className: prop_types_1.default.string,
77
- entity: prop_types_1.default.object,
78
- children: prop_types_1.default.node,
79
- classes: prop_types_1.default.object,
80
- showEntityId: prop_types_1.default.bool
81
- };
82
75
  exports.default = ProfileBand;
@@ -1,2 +1,2 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo">;
1
2
  export default useStyles;
2
- declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "businessCard" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "specialInfo">;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useStyles = void 0;
3
4
  var styles_1 = require("@material-ui/core/styles");
4
- var useStyles = styles_1.makeStyles(function (theme) { return ({
5
+ exports.useStyles = styles_1.makeStyles(function (theme) { return ({
5
6
  profileBandWrapper: {
6
7
  // especially for IE (overflow fix)
7
8
  flexShrink: 0
@@ -83,4 +84,4 @@ var useStyles = styles_1.makeStyles(function (theme) { return ({
83
84
  }
84
85
  }
85
86
  }); });
86
- exports.default = useStyles;
87
+ exports.default = exports.useStyles;
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "@keyframes animate" | "highlighted" | "justImported" | "businessCard" | "secondRow">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "businessCard" | "@keyframes animate" | "highlighted" | "justImported" | "secondRow">;
@@ -20,10 +20,12 @@ var getDependentLookupEditorContext = function (state, attributeValue, attribute
20
20
  var autocompleteConfig = mdm_module_1.default.selectors.getLookupAutocomplete(state);
21
21
  var autopopulationEnabled = mdm_sdk_1.isAutopopulationEnabled(autocompleteConfig, attributeTypeUri);
22
22
  var isEmptyValue = !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.lookupCode) && !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value);
23
- var placeholder = (isEmptyValue && isBlocked && ui_i18n_1.default.text('Populating values...')) || missedParentsMessage || '';
23
+ var placeholder = (isEmptyValue && isBlocked && ui_i18n_1.default.text('Populating values...')) ||
24
+ (isEmptyValue && missedParentsMessage) ||
25
+ '';
24
26
  var context = {
25
- parents: parents,
26
- disabled: !!missedParentsMessage || isBlocked,
27
+ parents: missedParentsMessage ? null : parents,
28
+ disabled: (!!missedParentsMessage && isEmptyValue) || isBlocked,
27
29
  placeholder: placeholder,
28
30
  autopopulationId: autopopulationEnabled ? valueUri : null
29
31
  };
@@ -102,13 +102,15 @@ var DependentLookupEditor = function (_a) {
102
102
  var loadOptions = react_1.useCallback(function (value, pageNumber) {
103
103
  if (pageNumber === void 0) { pageNumber = 1; }
104
104
  setOptionsAreLoading(true);
105
- return getLookups({
106
- type: lookupTypeCode,
107
- parents: parents,
108
- displayNamePrefix: value,
109
- max: max + 1,
110
- offset: (pageNumber - 1) * max
111
- })
105
+ return (parents === null
106
+ ? Promise.resolve([])
107
+ : getLookups({
108
+ type: lookupTypeCode,
109
+ parents: parents,
110
+ displayNamePrefix: value,
111
+ max: max + 1,
112
+ offset: (pageNumber - 1) * max
113
+ }))
112
114
  .then(function (buildOptions) { return helpers_1.buildLookupOptions(buildOptions); })
113
115
  .catch(function () { return []; })
114
116
  .finally(function () { return setOptionsAreLoading(false); });
@@ -1,18 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { Entity } from '@reltio/mdm-sdk';
3
+ declare type Props = {
4
+ className?: string;
5
+ entity?: Entity;
6
+ children?: ReactNode;
7
+ };
8
+ declare const ProfileBand: ({ className, entity, children }: Props) => JSX.Element;
1
9
  export default ProfileBand;
2
- declare function ProfileBand({ className, entity, children, classes, showEntityId }: {
3
- className: any;
4
- entity: any;
5
- children: any;
6
- classes: any;
7
- showEntityId?: boolean;
8
- }): JSX.Element;
9
- declare namespace ProfileBand {
10
- namespace propTypes {
11
- const className: PropTypes.Requireable<string>;
12
- const entity: PropTypes.Requireable<object>;
13
- const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
14
- const classes: PropTypes.Requireable<object>;
15
- const showEntityId: PropTypes.Requireable<boolean>;
16
- }
17
- }
18
- import PropTypes from "prop-types";
@@ -1,5 +1,4 @@
1
1
  import React, { useCallback } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import classnames from 'classnames';
4
3
  import { useSelector } from 'react-redux';
5
4
  import { isNil } from 'ramda';
@@ -13,9 +12,10 @@ import EntityTypeBadge from '../EntityTypeBadge/EntityTypeBadge';
13
12
  import useStyles from './styles';
14
13
  var ProfileBand = function (_a) {
15
14
  var _b;
16
- var className = _a.className, entity = _a.entity, children = _a.children, classes = _a.classes, _c = _a.showEntityId, showEntityId = _c === void 0 ? true : _c;
17
- var styles = useStyles({ classes: classes });
15
+ var className = _a.className, entity = _a.entity, children = _a.children;
16
+ var styles = useStyles();
18
17
  var metadata = useSelector(mdmModule.selectors.getMetadata);
18
+ var showEntityId = useSelector(mdmModule.selectors.getShowEntityId);
19
19
  var handleCopyEntityIdToClipboard = useCallback(function () {
20
20
  navigator.clipboard.writeText(getEntityId(entity));
21
21
  }, [entity]);
@@ -48,11 +48,4 @@ var ProfileBand = function (_a) {
48
48
  entityId)))))),
49
49
  children && React.createElement("div", null, children))));
50
50
  };
51
- ProfileBand.propTypes = {
52
- className: PropTypes.string,
53
- entity: PropTypes.object,
54
- children: PropTypes.node,
55
- classes: PropTypes.object,
56
- showEntityId: PropTypes.bool
57
- };
58
51
  export default ProfileBand;
@@ -1,2 +1,2 @@
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "businessCard" | "specialInfo">;
1
2
  export default useStyles;
2
- declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "entityType" | "profileBand" | "secondaryLabel" | "inactive" | "entityId" | "badge" | "profileIcon" | "businessCard" | "profileBandWrapper" | "imageProfileIcon" | "profileInfo" | "specialInfo">;
@@ -1,5 +1,5 @@
1
1
  import { makeStyles } from '@material-ui/core/styles';
2
- var useStyles = makeStyles(function (theme) { return ({
2
+ export var useStyles = makeStyles(function (theme) { return ({
3
3
  profileBandWrapper: {
4
4
  // especially for IE (overflow fix)
5
5
  flexShrink: 0
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "@keyframes animate" | "highlighted" | "justImported" | "businessCard" | "secondRow">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "item" | "image" | "secondaryLabel" | "inactive" | "selected" | "avatar" | "clickable" | "info" | "businessCard" | "@keyframes animate" | "highlighted" | "justImported" | "secondRow">;
@@ -14,10 +14,12 @@ export var getDependentLookupEditorContext = function (state, attributeValue, at
14
14
  var autocompleteConfig = mdmModule.selectors.getLookupAutocomplete(state);
15
15
  var autopopulationEnabled = isAutopopulationEnabled(autocompleteConfig, attributeTypeUri);
16
16
  var isEmptyValue = !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.lookupCode) && !(attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value);
17
- var placeholder = (isEmptyValue && isBlocked && i18n.text('Populating values...')) || missedParentsMessage || '';
17
+ var placeholder = (isEmptyValue && isBlocked && i18n.text('Populating values...')) ||
18
+ (isEmptyValue && missedParentsMessage) ||
19
+ '';
18
20
  var context = {
19
- parents: parents,
20
- disabled: !!missedParentsMessage || isBlocked,
21
+ parents: missedParentsMessage ? null : parents,
22
+ disabled: (!!missedParentsMessage && isEmptyValue) || isBlocked,
21
23
  placeholder: placeholder,
22
24
  autopopulationId: autopopulationEnabled ? valueUri : null
23
25
  };
@@ -77,13 +77,15 @@ var DependentLookupEditor = function (_a) {
77
77
  var loadOptions = useCallback(function (value, pageNumber) {
78
78
  if (pageNumber === void 0) { pageNumber = 1; }
79
79
  setOptionsAreLoading(true);
80
- return getLookups({
81
- type: lookupTypeCode,
82
- parents: parents,
83
- displayNamePrefix: value,
84
- max: max + 1,
85
- offset: (pageNumber - 1) * max
86
- })
80
+ return (parents === null
81
+ ? Promise.resolve([])
82
+ : getLookups({
83
+ type: lookupTypeCode,
84
+ parents: parents,
85
+ displayNamePrefix: value,
86
+ max: max + 1,
87
+ offset: (pageNumber - 1) * max
88
+ }))
87
89
  .then(function (buildOptions) { return buildLookupOptions(buildOptions); })
88
90
  .catch(function () { return []; })
89
91
  .finally(function () { return setOptionsAreLoading(false); });
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1250",
3
+ "version": "1.4.1253",
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.1250",
11
- "@reltio/mdm-sdk": "^1.4.1250",
10
+ "@reltio/mdm-module": "^1.4.1253",
11
+ "@reltio/mdm-sdk": "^1.4.1253",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",