@reltio/components 1.4.1024 → 1.4.1026

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.
@@ -0,0 +1,10 @@
1
+ import { Entity } from '@reltio/mdm-sdk';
2
+ declare type Props = {
3
+ isHistoryTabActive: boolean;
4
+ entity: Entity;
5
+ };
6
+ export declare const useHistoryEnabled: ({ isHistoryTabActive, entity }: Props) => {
7
+ isHistoryEnabled: boolean;
8
+ isProfilePersisted: boolean;
9
+ };
10
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useHistoryEnabled = void 0;
4
+ var react_1 = require("react");
5
+ var mdm_sdk_1 = require("@reltio/mdm-sdk");
6
+ var useHistoryEnabled = function (_a) {
7
+ var isHistoryTabActive = _a.isHistoryTabActive, entity = _a.entity;
8
+ var _b = react_1.useState(false), wasHistoryTabActive = _b[0], setWasHistoryTabActive = _b[1];
9
+ var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
10
+ react_1.useEffect(function () {
11
+ if (!isHistoryTabActive) {
12
+ setWasHistoryTabActive(false);
13
+ }
14
+ }, [entityUri]);
15
+ react_1.useEffect(function () {
16
+ if (isHistoryTabActive) {
17
+ setWasHistoryTabActive(true);
18
+ }
19
+ }, [isHistoryTabActive]);
20
+ var isProfilePersisted = entityUri && !mdm_sdk_1.isTempUri(entityUri) && !mdm_sdk_1.isDataTenantEntity(entity);
21
+ var isHistoryEnabled = wasHistoryTabActive && isProfilePersisted;
22
+ return { isHistoryEnabled: isHistoryEnabled, isProfilePersisted: isProfilePersisted };
23
+ };
24
+ exports.useHistoryEnabled = useHistoryEnabled;
@@ -1,6 +1,7 @@
1
1
  export { useHistorySlice } from './hooks/useHistorySlice';
2
2
  export { useHistory } from './hooks/useHistory';
3
3
  export { useHistoryDiff } from './hooks/useHistoryDiff';
4
+ export { useHistoryEnabled } from './hooks/useHistoryEnabled';
4
5
  export { default as HistoryView } from './HistoryView/HistoryView';
5
6
  export { default as HistoryHeader } from './HistoryHeader/HistoryHeader';
6
7
  export { default as ProfileBandHistory } from './ProfileBandHistory/ProfileBandHistory';
@@ -13,13 +13,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.HistoryPanelEmptyState = exports.ProfileBandHistory = exports.HistoryHeader = exports.HistoryView = exports.useHistoryDiff = exports.useHistory = exports.useHistorySlice = void 0;
16
+ exports.HistoryPanelEmptyState = exports.ProfileBandHistory = exports.HistoryHeader = exports.HistoryView = exports.useHistoryEnabled = exports.useHistoryDiff = exports.useHistory = exports.useHistorySlice = void 0;
17
17
  var useHistorySlice_1 = require("./hooks/useHistorySlice");
18
18
  Object.defineProperty(exports, "useHistorySlice", { enumerable: true, get: function () { return useHistorySlice_1.useHistorySlice; } });
19
19
  var useHistory_1 = require("./hooks/useHistory");
20
20
  Object.defineProperty(exports, "useHistory", { enumerable: true, get: function () { return useHistory_1.useHistory; } });
21
21
  var useHistoryDiff_1 = require("./hooks/useHistoryDiff");
22
22
  Object.defineProperty(exports, "useHistoryDiff", { enumerable: true, get: function () { return useHistoryDiff_1.useHistoryDiff; } });
23
+ var useHistoryEnabled_1 = require("./hooks/useHistoryEnabled");
24
+ Object.defineProperty(exports, "useHistoryEnabled", { enumerable: true, get: function () { return useHistoryEnabled_1.useHistoryEnabled; } });
23
25
  var HistoryView_1 = require("./HistoryView/HistoryView");
24
26
  Object.defineProperty(exports, "HistoryView", { enumerable: true, get: function () { return __importDefault(HistoryView_1).default; } });
25
27
  var HistoryHeader_1 = require("./HistoryHeader/HistoryHeader");
@@ -0,0 +1,10 @@
1
+ import { Entity } from '@reltio/mdm-sdk';
2
+ declare type Props = {
3
+ isHistoryTabActive: boolean;
4
+ entity: Entity;
5
+ };
6
+ export declare const useHistoryEnabled: ({ isHistoryTabActive, entity }: Props) => {
7
+ isHistoryEnabled: boolean;
8
+ isProfilePersisted: boolean;
9
+ };
10
+ export {};
@@ -0,0 +1,20 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { isTempUri, isDataTenantEntity } from '@reltio/mdm-sdk';
3
+ export var useHistoryEnabled = function (_a) {
4
+ var isHistoryTabActive = _a.isHistoryTabActive, entity = _a.entity;
5
+ var _b = useState(false), wasHistoryTabActive = _b[0], setWasHistoryTabActive = _b[1];
6
+ var entityUri = entity === null || entity === void 0 ? void 0 : entity.uri;
7
+ useEffect(function () {
8
+ if (!isHistoryTabActive) {
9
+ setWasHistoryTabActive(false);
10
+ }
11
+ }, [entityUri]);
12
+ useEffect(function () {
13
+ if (isHistoryTabActive) {
14
+ setWasHistoryTabActive(true);
15
+ }
16
+ }, [isHistoryTabActive]);
17
+ var isProfilePersisted = entityUri && !isTempUri(entityUri) && !isDataTenantEntity(entity);
18
+ var isHistoryEnabled = wasHistoryTabActive && isProfilePersisted;
19
+ return { isHistoryEnabled: isHistoryEnabled, isProfilePersisted: isProfilePersisted };
20
+ };
@@ -1,6 +1,7 @@
1
1
  export { useHistorySlice } from './hooks/useHistorySlice';
2
2
  export { useHistory } from './hooks/useHistory';
3
3
  export { useHistoryDiff } from './hooks/useHistoryDiff';
4
+ export { useHistoryEnabled } from './hooks/useHistoryEnabled';
4
5
  export { default as HistoryView } from './HistoryView/HistoryView';
5
6
  export { default as HistoryHeader } from './HistoryHeader/HistoryHeader';
6
7
  export { default as ProfileBandHistory } from './ProfileBandHistory/ProfileBandHistory';
@@ -1,6 +1,7 @@
1
1
  export { useHistorySlice } from './hooks/useHistorySlice';
2
2
  export { useHistory } from './hooks/useHistory';
3
3
  export { useHistoryDiff } from './hooks/useHistoryDiff';
4
+ export { useHistoryEnabled } from './hooks/useHistoryEnabled';
4
5
  export { default as HistoryView } from './HistoryView/HistoryView';
5
6
  export { default as HistoryHeader } from './HistoryHeader/HistoryHeader';
6
7
  export { default as ProfileBandHistory } from './ProfileBandHistory/ProfileBandHistory';
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1024",
3
+ "version": "1.4.1026",
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.1024",
11
- "@reltio/mdm-sdk": "^1.4.1024",
10
+ "@reltio/mdm-module": "^1.4.1026",
11
+ "@reltio/mdm-sdk": "^1.4.1026",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",