@reltio/components 1.4.1159 → 1.4.1162

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.
Files changed (53) hide show
  1. package/cjs/components/AttributesFiltersBuilder/AttributesFiltersBuilder.js +2 -2
  2. package/cjs/components/AttributesFiltersBuilder/components/{ValueEditor/ValueEditor.d.ts → ValuesEditor/ValuesEditor.d.ts} +0 -0
  3. package/cjs/components/AttributesFiltersBuilder/components/{ValueEditor/ValueEditor.js → ValuesEditor/ValuesEditor.js} +0 -0
  4. package/cjs/components/AttributesFiltersBuilder/components/{ValueEditor → ValuesEditor}/styles.d.ts +0 -0
  5. package/cjs/components/AttributesFiltersBuilder/components/{ValueEditor → ValuesEditor}/styles.js +2 -0
  6. package/cjs/components/ProfilesList/styles.d.ts +1 -1
  7. package/cjs/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.js +1 -1
  8. package/cjs/components/ReltioMap/helpers/index.js +1 -1
  9. package/cjs/components/ReltioMap/index.d.ts +2 -1
  10. package/cjs/components/ReltioMap/index.js +3 -6
  11. package/cjs/constants/index.d.ts +1 -1
  12. package/cjs/constants/index.js +2 -1
  13. package/cjs/constants/map.d.ts +5 -0
  14. package/cjs/constants/map.js +6 -1
  15. package/cjs/hooks/index.d.ts +1 -2
  16. package/cjs/hooks/index.js +1 -2
  17. package/cjs/hooks/useAPI/API.js +21 -22
  18. package/cjs/hooks/useAPI/index.d.ts +1 -2
  19. package/cjs/hooks/useAPI/index.js +1 -3
  20. package/cjs/hooks/useAPI/types.d.ts +3 -66
  21. package/cjs/hooks/useAPI/types.js +0 -41
  22. package/cjs/hooks/useAPI/useAPI.js +11 -11
  23. package/cjs/hooks/useCustomScripts.js +30 -11
  24. package/cjs/hooks/useSavedStateForEntityType.js +2 -2
  25. package/esm/components/AttributesFiltersBuilder/AttributesFiltersBuilder.js +2 -2
  26. package/esm/components/AttributesFiltersBuilder/components/{ValueEditor/ValueEditor.d.ts → ValuesEditor/ValuesEditor.d.ts} +0 -0
  27. package/esm/components/AttributesFiltersBuilder/components/{ValueEditor/ValueEditor.js → ValuesEditor/ValuesEditor.js} +0 -0
  28. package/esm/components/AttributesFiltersBuilder/components/{ValueEditor → ValuesEditor}/styles.d.ts +0 -0
  29. package/esm/components/AttributesFiltersBuilder/components/{ValueEditor → ValuesEditor}/styles.js +2 -0
  30. package/esm/components/ProfilesList/styles.d.ts +1 -1
  31. package/esm/components/ReltioMap/MapControls/TopRightMapControls/TopRightMapControls.js +1 -1
  32. package/esm/components/ReltioMap/helpers/index.js +1 -1
  33. package/esm/components/ReltioMap/index.d.ts +2 -1
  34. package/esm/components/ReltioMap/index.js +4 -7
  35. package/esm/constants/index.d.ts +1 -1
  36. package/esm/constants/index.js +1 -1
  37. package/esm/constants/map.d.ts +5 -0
  38. package/esm/constants/map.js +5 -0
  39. package/esm/hooks/index.d.ts +1 -2
  40. package/esm/hooks/index.js +1 -1
  41. package/esm/hooks/useAPI/API.js +1 -2
  42. package/esm/hooks/useAPI/index.d.ts +1 -2
  43. package/esm/hooks/useAPI/index.js +0 -1
  44. package/esm/hooks/useAPI/types.d.ts +3 -66
  45. package/esm/hooks/useAPI/types.js +1 -40
  46. package/esm/hooks/useAPI/useAPI.js +3 -3
  47. package/esm/hooks/useCustomScripts.js +30 -11
  48. package/esm/hooks/useSavedStateForEntityType.js +3 -3
  49. package/package.json +3 -3
  50. package/cjs/components/ReltioMap/constants.d.ts +0 -14
  51. package/cjs/components/ReltioMap/constants.js +0 -17
  52. package/esm/components/ReltioMap/constants.d.ts +0 -14
  53. package/esm/components/ReltioMap/constants.js +0 -14
@@ -26,14 +26,14 @@ var useSavedStateForEntityType = function (_a) {
26
26
  }
27
27
  };
28
28
  useDidUpdateEffect_1.useDidUpdateEffect(saveChangesLocallyForPrevEntityType, [entityTypeUri]);
29
- var updateSavedState = function (stateToSave) {
29
+ var updateSavedState = react_1.useCallback(function (stateToSave) {
30
30
  var _a;
31
31
  var changedState = (_a = {},
32
32
  _a[entityTypeUri] = stateToSave,
33
33
  _a);
34
34
  setChangedState(changedState);
35
35
  saveState(__assign(__assign({}, savedState), changedState));
36
- };
36
+ }, [entityTypeUri, saveState, savedState]);
37
37
  react_1.useEffect(function () {
38
38
  getSavedState()
39
39
  .then(function (savedState) {
@@ -13,7 +13,7 @@ import FilterSelector from './components/FilterSelector/FilterSelector';
13
13
  import RowActions from './components/RowActions/RowActions';
14
14
  import QueryBuilderRowsGroup from '../QueryBuilderRowsGroup/QueryBuilderRowsGroup';
15
15
  import AttributeSelector from './components/AttributeSelector/AttributeSelector';
16
- import ValueEditor from './components/ValueEditor/ValueEditor';
16
+ import ValuesEditor from './components/ValuesEditor/ValuesEditor';
17
17
  import { useStyles } from './styles';
18
18
  var EMPTY_FILTER = { fieldName: null, filter: null, values: [] };
19
19
  var Stub = function () { return null; };
@@ -83,6 +83,6 @@ var AttributesFiltersBuilder = function (_a) {
83
83
  var addNewFilter = useCallback(function (newFilter) {
84
84
  onChange(__spreadArray(__spreadArray([], actualFilters.current), [newFilter]));
85
85
  }, [onChange]);
86
- return (React.createElement(QueryBuilderRowsGroup, { rowClasses: rowClasses, rowsData: rowsData, AttributeSelectorComponent: AttributeSelector, FilterSelectorComponent: FilterSelector, ValuesEditorComponent: ValueEditor, ActionsComponent: RowActions, LogicOperatorComponent: Stub, filterSelectorRefIndex: lastAttributesCountRef.current, filterSelectorRef: attributeFilterRef, lastRowAttributeSelectorProps: lastRowAttributeSelectorProps, attributesGroup: attributeSelectorItems, changeFilter: changeFilter, addNewFilter: addNewFilter, addRowAfterIndex: addRowAfterIndex, removeRow: removeRow, duplicateRow: duplicateRow }));
86
+ return (React.createElement(QueryBuilderRowsGroup, { rowClasses: rowClasses, rowsData: rowsData, AttributeSelectorComponent: AttributeSelector, FilterSelectorComponent: FilterSelector, ValuesEditorComponent: ValuesEditor, ActionsComponent: RowActions, LogicOperatorComponent: Stub, filterSelectorRefIndex: lastAttributesCountRef.current, filterSelectorRef: attributeFilterRef, lastRowAttributeSelectorProps: lastRowAttributeSelectorProps, attributesGroup: attributeSelectorItems, changeFilter: changeFilter, addNewFilter: addNewFilter, addRowAfterIndex: addRowAfterIndex, removeRow: removeRow, duplicateRow: duplicateRow }));
87
87
  };
88
88
  export default memo(AttributesFiltersBuilder);
@@ -15,6 +15,8 @@ export var useStyles = makeStyles(function () { return ({
15
15
  margin: 0
16
16
  },
17
17
  valuesEditor: {
18
+ display: 'flex',
19
+ alignItems: 'center',
18
20
  width: '222px!important',
19
21
  minHeight: '40px',
20
22
  flexShrink: 0
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"label" | "image" | "secondaryLabel" | "item" | "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" | "@keyframes animate" | "highlighted" | "justImported" | "businessCard" | "secondRow">;
@@ -3,7 +3,7 @@ import i18n from 'ui-i18n';
3
3
  import Button from '@material-ui/core/Button';
4
4
  import { withTooltip } from '../../../../HOCs';
5
5
  import HighlightOffIcon from '@material-ui/icons/HighlightOff';
6
- import { MAP_DRAWING_MODES } from '../../constants';
6
+ import { MAP_DRAWING_MODES } from '../../../../constants';
7
7
  import RadiusIcon from '../../../../icons/Radius';
8
8
  import DrawIcon from '../../../../icons/Draw';
9
9
  import { useStyles } from './styles';
@@ -3,7 +3,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
3
3
  to[j] = from[i];
4
4
  return to;
5
5
  };
6
- import { MAP_DRAWING_MODES, MAP_MINIMUM_SCALE_RADIUS } from '../constants';
6
+ import { MAP_DRAWING_MODES, MAP_MINIMUM_SCALE_RADIUS } from '../../../constants';
7
7
  export var getMapBoundsPolygon = function (map) {
8
8
  var bounds = map.getBounds();
9
9
  var ne = bounds.getNorthEast();
@@ -15,6 +15,7 @@ declare type Props = {
15
15
  drawingModes?: DrawingModes;
16
16
  markerClusterer?: boolean;
17
17
  markerClustererOptions?: MarkerClustererProps['options'];
18
+ mapOptions?: google.maps.MapOptions;
18
19
  mapContainerClassName: string;
19
20
  onMapBoundsChanged?: (value: MapBounds | null) => void;
20
21
  onOverlayUpdated?: (value: {
@@ -23,5 +24,5 @@ declare type Props = {
23
24
  }) => void;
24
25
  onMarkerClicked?: (value: Marker) => void;
25
26
  };
26
- export declare const ReltioMap: ({ markers, mapKey, defaultZoom, defaultCenter, loadingElement, isSearchOnMapMove, isSearchEnabled, activeOverlay, overlayOptions, drawingModes, markerClusterer, markerClustererOptions, mapContainerClassName, onMapBoundsChanged, onOverlayUpdated, onMarkerClicked }: Props) => JSX.Element;
27
+ export declare const ReltioMap: ({ markers, mapKey, defaultZoom, defaultCenter, loadingElement, isSearchOnMapMove, isSearchEnabled, activeOverlay, overlayOptions, drawingModes, markerClusterer, markerClustererOptions, mapOptions, mapContainerClassName, onMapBoundsChanged, onOverlayUpdated, onMarkerClicked }: Props) => JSX.Element;
27
28
  export {};
@@ -17,7 +17,7 @@ import { TopRightMapControls } from './MapControls/TopRightMapControls/TopRightM
17
17
  import { TopCenterMapControls } from './MapControls/TopCenterMapControls/TopCenterMapControls';
18
18
  import { getMapBoundsPolygon, getDrawingMode, fitMapBoundsForMarkers, fitMapBoundsForOverlay } from './helpers';
19
19
  import EntityMarker from './EntityMarker/EntityMarker';
20
- import { DEFAULT_OVERLAY_OPTIONS, MAP_DRAWING_MODES } from '../../constants';
20
+ import { DEFAULT_GOOGLE_MAP_OPTIONS, DEFAULT_OVERLAY_OPTIONS, MAP_DRAWING_MODES } from '../../constants';
21
21
  import { useStyles } from './styles';
22
22
  import { usePrevious } from '../../hooks';
23
23
  var ON_MAP_MOVE_DEBOUNCE_INTERVAL = 1000;
@@ -38,7 +38,7 @@ var useFitMapBounds = function (_a) {
38
38
  }, [map, markers, activeOverlay]);
39
39
  };
40
40
  export var ReltioMap = function (_a) {
41
- var _b = _a.markers, markers = _b === void 0 ? [] : _b, mapKey = _a.mapKey, defaultZoom = _a.defaultZoom, defaultCenter = _a.defaultCenter, loadingElement = _a.loadingElement, isSearchOnMapMove = _a.isSearchOnMapMove, isSearchEnabled = _a.isSearchEnabled, activeOverlay = _a.activeOverlay, overlayOptions = _a.overlayOptions, _c = _a.drawingModes, drawingModes = _c === void 0 ? [] : _c, markerClusterer = _a.markerClusterer, markerClustererOptions = _a.markerClustererOptions, mapContainerClassName = _a.mapContainerClassName, onMapBoundsChanged = _a.onMapBoundsChanged, onOverlayUpdated = _a.onOverlayUpdated, onMarkerClicked = _a.onMarkerClicked;
41
+ var _b = _a.markers, markers = _b === void 0 ? [] : _b, mapKey = _a.mapKey, defaultZoom = _a.defaultZoom, defaultCenter = _a.defaultCenter, loadingElement = _a.loadingElement, isSearchOnMapMove = _a.isSearchOnMapMove, isSearchEnabled = _a.isSearchEnabled, activeOverlay = _a.activeOverlay, overlayOptions = _a.overlayOptions, _c = _a.drawingModes, drawingModes = _c === void 0 ? [] : _c, markerClusterer = _a.markerClusterer, markerClustererOptions = _a.markerClustererOptions, mapOptions = _a.mapOptions, mapContainerClassName = _a.mapContainerClassName, onMapBoundsChanged = _a.onMapBoundsChanged, onOverlayUpdated = _a.onOverlayUpdated, onMarkerClicked = _a.onMarkerClicked;
42
42
  var styles = useStyles();
43
43
  var _d = useJsApiLoader({
44
44
  googleMapsApiKey: mapKey,
@@ -50,6 +50,7 @@ export var ReltioMap = function (_a) {
50
50
  var _g = useState(null), drawingMode = _g[0], setDrawingMode = _g[1];
51
51
  useFitMapBounds({ markers: markers, activeOverlay: activeOverlay, map: map, isSearchOnMapMove: isSearchOnMapMove });
52
52
  var allOverlayOptions = useMemo(function () { return (__assign(__assign({}, DEFAULT_OVERLAY_OPTIONS), (overlayOptions || {}))); }, [overlayOptions]);
53
+ var googleMapOptions = useMemo(function () { return (__assign(__assign({}, DEFAULT_GOOGLE_MAP_OPTIONS), (mapOptions || {}))); }, [mapOptions]);
53
54
  var handleChangeIsSearchOnMapMove = useCallback(function (isSearchOnMapMove) {
54
55
  onMapBoundsChanged(isSearchOnMapMove ? getMapBoundsPolygon(map) : null);
55
56
  setDrawingMode(null);
@@ -115,11 +116,7 @@ export var ReltioMap = function (_a) {
115
116
  if (!isLoaded) {
116
117
  return loadingElement;
117
118
  }
118
- return (React.createElement(GoogleMap, { mapTypeId: window.google.maps.MapTypeId.ROADMAP, options: {
119
- mapTypeControl: false,
120
- streetViewControl: false,
121
- fullscreenControl: false
122
- }, onLoad: setMap, zoom: defaultZoom, center: defaultCenter, onZoomChanged: handleMapMoveStart, onDragStart: handleMapMoveStart, onIdle: handleMapIdle, mapContainerClassName: mapContainerClassName },
119
+ return (React.createElement(GoogleMap, { mapTypeId: window.google.maps.MapTypeId.ROADMAP, options: googleMapOptions, onLoad: setMap, zoom: defaultZoom, center: defaultCenter, onZoomChanged: handleMapMoveStart, onDragStart: handleMapMoveStart, onIdle: handleMapIdle, mapContainerClassName: mapContainerClassName },
123
120
  map && isSearchEnabled && Boolean(drawingModes.length) && (React.createElement(MapControlContainer, { className: styles.mapControlContainer, position: window.google.maps.ControlPosition.TOP_RIGHT, map: map },
124
121
  React.createElement(TopRightMapControls, { hasActiveOverlay: !!activeOverlay, drawingModes: drawingModes, drawingMode: drawingMode, onDrawingModeChanged: setDrawingMode, onClearOverlay: handleClearOverlay }))),
125
122
  map && isSearchEnabled && (React.createElement(MapControlContainer, { className: styles.mapControlContainer, position: window.google.maps.ControlPosition.TOP_CENTER, map: map },
@@ -1,4 +1,4 @@
1
1
  export { COMMENTS_CONTAINER_VISIBILITY_AREA } from "./classnames";
2
2
  export { ALWAYS_VISIBLE_TYPE_URIS } from "./attributes";
3
3
  export { SortingType, ColumnFilterType, ColumnsDataType, QueryBuilderAttributeType, QueryBuilderAttributeDataType } from "./prop-types";
4
- export { MAP_DRAWING_MODES, DEFAULT_OVERLAY_OPTIONS, MAP_MINIMUM_SCALE_RADIUS } from "./map";
4
+ export { MAP_DRAWING_MODES, DEFAULT_GOOGLE_MAP_OPTIONS, DEFAULT_OVERLAY_OPTIONS, MAP_MINIMUM_SCALE_RADIUS } from "./map";
@@ -1,4 +1,4 @@
1
1
  export { SortingType, ColumnFilterType, ColumnsDataType, QueryBuilderAttributeType, QueryBuilderAttributeDataType } from './prop-types';
2
2
  export { COMMENTS_CONTAINER_VISIBILITY_AREA } from './classnames';
3
3
  export { ALWAYS_VISIBLE_TYPE_URIS } from './attributes';
4
- export { MAP_DRAWING_MODES, DEFAULT_OVERLAY_OPTIONS, MAP_MINIMUM_SCALE_RADIUS } from './map';
4
+ export { MAP_DRAWING_MODES, DEFAULT_GOOGLE_MAP_OPTIONS, DEFAULT_OVERLAY_OPTIONS, MAP_MINIMUM_SCALE_RADIUS } from './map';
@@ -11,4 +11,9 @@ export declare const DEFAULT_OVERLAY_OPTIONS: {
11
11
  editable: boolean;
12
12
  zIndex: number;
13
13
  };
14
+ export declare const DEFAULT_GOOGLE_MAP_OPTIONS: {
15
+ mapTypeControl: boolean;
16
+ streetViewControl: boolean;
17
+ fullscreenControl: boolean;
18
+ };
14
19
  export declare const MAP_MINIMUM_SCALE_RADIUS = 0.001;
@@ -11,4 +11,9 @@ export var DEFAULT_OVERLAY_OPTIONS = {
11
11
  editable: true,
12
12
  zIndex: 1
13
13
  };
14
+ export var DEFAULT_GOOGLE_MAP_OPTIONS = {
15
+ mapTypeControl: false,
16
+ streetViewControl: false,
17
+ fullscreenControl: false
18
+ };
14
19
  export var MAP_MINIMUM_SCALE_RADIUS = 0.001;
@@ -1,6 +1,5 @@
1
1
  export { useActions } from './useActions';
2
- export { useAPI, CustomAction } from './useAPI';
3
- export type { CustomActionTask } from './useAPI';
2
+ export { useAPI } from './useAPI';
4
3
  export { useAsyncMount } from './useAsyncMount';
5
4
  export { useCollaboration } from './useCollaboration';
6
5
  export { useCommentsEntitiesMap } from './useCommentsEntitiesMap';
@@ -1,5 +1,5 @@
1
1
  export { useActions } from './useActions';
2
- export { useAPI, CustomAction } from './useAPI';
2
+ export { useAPI } from './useAPI';
3
3
  export { useAsyncMount } from './useAsyncMount';
4
4
  export { useCollaboration } from './useCollaboration';
5
5
  export { useCommentsEntitiesMap } from './useCommentsEntitiesMap';
@@ -9,8 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { sendRequestFromCustomSandbox, sendWorkflowRequest, startProcessFromQuery } from '@reltio/mdm-sdk';
13
- import { RequestAction } from './types';
12
+ import { RequestAction, sendRequestFromCustomSandbox, sendWorkflowRequest, startProcessFromQuery } from '@reltio/mdm-sdk';
14
13
  var processFromQuery = function (params, permissions, workflowPath, tenant, environment) {
15
14
  if (!params.processDefinitionId) {
16
15
  return new Promise(function (resolve) { return resolve({ errorMessage: 'processDefinitionId is empty' }); });
@@ -1,5 +1,4 @@
1
1
  export { useAPI } from './useAPI';
2
- export { CustomAction } from './types';
3
2
  export { processRequest } from './API';
4
3
  export { getWorkerURL } from './helpers';
5
- export type { CustomActionTask, Params, Request } from './types';
4
+ export type { Request } from './types';
@@ -1,4 +1,3 @@
1
1
  export { useAPI } from './useAPI';
2
- export { CustomAction } from './types';
3
2
  export { processRequest } from './API';
4
3
  export { getWorkerURL } from './helpers';
@@ -1,52 +1,8 @@
1
- import { CustomScript, CustomViewConfig, PrimitiveValue } from '@reltio/mdm-sdk';
2
- export declare enum RequestAction {
3
- WORKFLOW = "workflow",
4
- WORKFLOW_START_PROCESS_FROM_QUERY = "workflow/startProcessFromQuery",
5
- API = "api",
6
- GET_ENTITY_URI = "getEntityUri",
7
- GET_ENTITY = "getEntity",
8
- GET_API_PATH = "getApiPath",
9
- WORKFLOW_GET_WORKFLOW_PATH = "workflow/getWorkflowPath",
10
- GET_SEARCH_QUERY = "getSearchQuery",
11
- GET_TENANT = "getTenant",
12
- GET_USER = "getUser",
13
- GET_PERSPECTIVE = "getPerspective",
14
- SET_PERSPECTIVE = "setPerspective",
15
- SET_ENTITY_URI = "setEntityUri",
16
- ALERT = "alert",
17
- CONFIRM = "confirm",
18
- PROMPT = "prompt",
19
- OPEN_WINDOW = "openWindow",
20
- GET_CONFIGURATION = "getConfiguration",
21
- GET_UI_CONFIGURATION = "getUiConfiguration",
22
- OPEN_SEARCH = "openSearch",
23
- WORKFLOW_CHECK_PERMISSION = "workflow/checkPermission"
24
- }
25
- export declare type Params = {
26
- url?: string;
27
- name?: RequestAction;
28
- id?: string | number;
29
- method?: 'PUT' | 'DELETE' | 'GET' | 'POST';
30
- data?: {
31
- [key: string]: unknown;
32
- };
33
- headers?: {
34
- [key: string]: string;
35
- };
36
- processDefinitionId?: string;
37
- searchString?: string;
38
- perspective?: string;
39
- permission?: string;
40
- searchState?: unknown;
41
- defaultText?: string;
42
- text?: string;
43
- html?: string;
44
- type?: string;
45
- };
1
+ import { CustomActionTask, CustomActionTaskParams, CustomScript, CustomViewConfig, RequestAction } from '@reltio/mdm-sdk';
46
2
  export declare type ProcessRequestParams = {
47
3
  name: RequestAction;
48
4
  paramObject: {
49
- params: Params;
5
+ params: CustomActionTaskParams;
50
6
  };
51
7
  permissions?: string[];
52
8
  worker: Worker;
@@ -68,25 +24,6 @@ export declare type ProcessRequestParams = {
68
24
  showPerspective: (perspective: any) => void;
69
25
  setEntityUri: (entityUri: string, listener: () => void) => void;
70
26
  };
71
- export declare enum CustomAction {
72
- SET_HTML = "setHtml",
73
- LOG = "log",
74
- SET_VISIBILITY = "setVisibility",
75
- MESSAGE = "message",
76
- SET_ENABLED = "setEnabled",
77
- SET_TOOLTIP = "setToolTip",
78
- SET_LABEL = "setLabel",
79
- SET_HEIGHT = "setHeight",
80
- SET_WIDTH = "setWidth",
81
- RETURN_PROCESSED_API_RESPONSE = "returnProcessedApiResponse",
82
- RETURN_PROCESSED_API_REQUEST = "returnProcessedApiRequest",
83
- REQUEST = "request",
84
- EVENT = "event"
85
- }
86
- export declare type CustomActionTask = {
87
- action: CustomAction;
88
- params: Params | PrimitiveValue;
89
- };
90
27
  export declare type Request = Omit<CustomActionTask, 'params'> & {
91
- params: Params;
28
+ params: CustomActionTaskParams;
92
29
  };
@@ -1,40 +1 @@
1
- export var RequestAction;
2
- (function (RequestAction) {
3
- RequestAction["WORKFLOW"] = "workflow";
4
- RequestAction["WORKFLOW_START_PROCESS_FROM_QUERY"] = "workflow/startProcessFromQuery";
5
- RequestAction["API"] = "api";
6
- RequestAction["GET_ENTITY_URI"] = "getEntityUri";
7
- RequestAction["GET_ENTITY"] = "getEntity";
8
- RequestAction["GET_API_PATH"] = "getApiPath";
9
- RequestAction["WORKFLOW_GET_WORKFLOW_PATH"] = "workflow/getWorkflowPath";
10
- RequestAction["GET_SEARCH_QUERY"] = "getSearchQuery";
11
- RequestAction["GET_TENANT"] = "getTenant";
12
- RequestAction["GET_USER"] = "getUser";
13
- RequestAction["GET_PERSPECTIVE"] = "getPerspective";
14
- RequestAction["SET_PERSPECTIVE"] = "setPerspective";
15
- RequestAction["SET_ENTITY_URI"] = "setEntityUri";
16
- RequestAction["ALERT"] = "alert";
17
- RequestAction["CONFIRM"] = "confirm";
18
- RequestAction["PROMPT"] = "prompt";
19
- RequestAction["OPEN_WINDOW"] = "openWindow";
20
- RequestAction["GET_CONFIGURATION"] = "getConfiguration";
21
- RequestAction["GET_UI_CONFIGURATION"] = "getUiConfiguration";
22
- RequestAction["OPEN_SEARCH"] = "openSearch";
23
- RequestAction["WORKFLOW_CHECK_PERMISSION"] = "workflow/checkPermission";
24
- })(RequestAction || (RequestAction = {}));
25
- export var CustomAction;
26
- (function (CustomAction) {
27
- CustomAction["SET_HTML"] = "setHtml";
28
- CustomAction["LOG"] = "log";
29
- CustomAction["SET_VISIBILITY"] = "setVisibility";
30
- CustomAction["MESSAGE"] = "message";
31
- CustomAction["SET_ENABLED"] = "setEnabled";
32
- CustomAction["SET_TOOLTIP"] = "setToolTip";
33
- CustomAction["SET_LABEL"] = "setLabel";
34
- CustomAction["SET_HEIGHT"] = "setHeight";
35
- CustomAction["SET_WIDTH"] = "setWidth";
36
- CustomAction["RETURN_PROCESSED_API_RESPONSE"] = "returnProcessedApiResponse";
37
- CustomAction["RETURN_PROCESSED_API_REQUEST"] = "returnProcessedApiRequest";
38
- CustomAction["REQUEST"] = "request";
39
- CustomAction["EVENT"] = "event";
40
- })(CustomAction || (CustomAction = {}));
1
+ export {};
@@ -12,12 +12,11 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { useCallback, useContext, useEffect, useRef, useState } from 'react';
13
13
  import { useDispatch, useSelector } from 'react-redux';
14
14
  import mdmModule, { ui } from '@reltio/mdm-module';
15
- import { CustomScriptPlatform, initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
15
+ import { CustomAction, CustomScriptPlatform, initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
16
16
  import { useWorkflowCheckPermission } from '../../components/workflow';
17
17
  import { SandboxAPIContext } from '../../contexts';
18
18
  import { processRequest } from './API';
19
19
  import { getWorkerURL } from './helpers';
20
- import { CustomAction } from './types';
21
20
  export var useAPI = function (config) {
22
21
  if (config === void 0) { config = {}; }
23
22
  var _a = useState(), html = _a[0], setHtml = _a[1];
@@ -42,7 +41,8 @@ export var useAPI = function (config) {
42
41
  var _g = useSelector(mdmModule.selectors.getSearchProviderData) || {}, typeSearch = _g.type, search = _g.data;
43
42
  var openSearch = function (search) { return dispatch(ui.actions.openSearch(search)); };
44
43
  var workerRef = useRef();
45
- var process = function (task, worker, innerText) {
44
+ var process = function (_a) {
45
+ var task = _a.task, worker = _a.worker, innerText = _a.innerText;
46
46
  if (task) {
47
47
  var handlersToReset_1 = [];
48
48
  var processInnerHtml_1 = function (parent) {
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  var __spreadArray = (this && this.__spreadArray) || function (to, from) {
13
24
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
14
25
  to[j] = from[i];
@@ -17,18 +28,22 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
17
28
  import { useContext, useEffect, useRef } from 'react';
18
29
  import { useDispatch, useSelector } from 'react-redux';
19
30
  import mdmModule, { ui } from '@reltio/mdm-module';
20
- import { CustomScriptPlatform, initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
31
+ import { CustomAction, CustomScriptPlatform, initializeWebWorker, isEmptyValue } from '@reltio/mdm-sdk';
21
32
  import nanoid from 'nanoid';
22
- import { find, map, pick, pipe, prop, omit } from 'ramda';
33
+ import { find, map, omit, pick, pipe, prop } from 'ramda';
23
34
  import { useWorkflowCheckPermission } from '../components/workflow';
24
35
  import { SandboxAPIContext } from '../contexts';
25
- import { CustomAction, getWorkerURL, processRequest } from './useAPI';
36
+ import { getWorkerURL, processRequest } from './useAPI';
26
37
  var isURLtoProcess = function (processApi, url) {
27
38
  return (processApi || []).some(function (request) {
28
39
  var regExp = new RegExp("^" + request + "$");
29
40
  return request.replace(/\/*$/, '') === url || (request && regExp.test(url));
30
41
  });
31
42
  };
43
+ var getCustomViewConfig = function (config) {
44
+ var processApiResponse = config.processApiResponse, processApiRequest = config.processApiRequest, permissions = config.permissions, files = config.files, otherProps = __rest(config, ["processApiResponse", "processApiRequest", "permissions", "files"]);
45
+ return __assign({ action: { processApiResponse: processApiResponse, processApiRequest: processApiRequest, permissions: permissions, files: files } }, otherProps);
46
+ };
32
47
  export var useCustomScripts = function (config, _a) {
33
48
  var addInternalRequestInterceptor = _a.addInternalRequestInterceptor, addInternalResponseInterceptor = _a.addInternalResponseInterceptor, removeInternalRequestInterceptor = _a.removeInternalRequestInterceptor, removeInternalResponseInterceptor = _a.removeInternalResponseInterceptor;
34
49
  var customScripts = config.reduce(function (acc, customScript) {
@@ -56,14 +71,17 @@ export var useCustomScripts = function (config, _a) {
56
71
  var requestListeners = useRef({});
57
72
  var responseListeners = useRef({});
58
73
  var workers = useRef({});
59
- var process = function (task, worker) {
60
- var _a, _b;
74
+ var process = function (_a) {
75
+ var _b, _c;
76
+ var task = _a.task, worker = _a.worker, config = _a.config;
61
77
  if (task) {
62
78
  switch (task.action) {
63
79
  case CustomAction.REQUEST: {
64
- if (((_b = (_a = task.params) === null || _a === void 0 ? void 0 : _a.headers) === null || _b === void 0 ? void 0 : _b.origin) !== 'ui') {
65
- processRequest(__assign({ name: task.params.name, paramObject: task, permissions: customScripts[0].permissions, worker: worker,
66
- metadata: metadata, config: { action: customScripts[0] }, user: user,
80
+ if (((_c = (_b = task.params) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c.origin) !== 'ui') {
81
+ processRequest(__assign({ name: task.params.name, paramObject: task, permissions: config.action.permissions, worker: worker,
82
+ metadata: metadata,
83
+ config: config,
84
+ user: user,
67
85
  apiPath: apiPath,
68
86
  tenant: tenant,
69
87
  workflowPath: workflowPath,
@@ -73,7 +91,7 @@ export var useCustomScripts = function (config, _a) {
73
91
  workflowCheckPermission: workflowCheckPermission }, qxApi));
74
92
  }
75
93
  else {
76
- var _c = task.params, headers = _c.headers, id = _c.id, fakeURL = _c.url, method = _c.method, data = _c.data;
94
+ var _d = task.params, headers = _d.headers, id = _d.id, fakeURL = _d.url, method = _d.method, data = _d.data;
77
95
  var url = fakeURL.replace(reltioPath, apiPath);
78
96
  if (requestListeners.current[headers.requestId]) {
79
97
  requestListeners.current[headers.requestId].next(url, __assign(__assign({}, data), { id: id,
@@ -87,7 +105,7 @@ export var useCustomScripts = function (config, _a) {
87
105
  }
88
106
  case CustomAction.RETURN_PROCESSED_API_RESPONSE:
89
107
  case CustomAction.RETURN_PROCESSED_API_REQUEST: {
90
- var _d = task.params, id = _d.id, data = _d.data;
108
+ var _e = task.params, id = _e.id, data = _e.data;
91
109
  if (responseListeners.current[id]) {
92
110
  responseListeners.current[id].next(data);
93
111
  responseListeners.current = omit([id], responseListeners.current);
@@ -100,7 +118,8 @@ export var useCustomScripts = function (config, _a) {
100
118
  useEffect(function () {
101
119
  workers.current = customScripts.reduce(function (acc, customScript) {
102
120
  var _a;
103
- return __assign(__assign({}, acc), (_a = {}, _a[customScript.actionId] = initializeWebWorker(workerUrl, customScript.files, process), _a));
121
+ var customViewConfig = getCustomViewConfig(customScript);
122
+ return __assign(__assign({}, acc), (_a = {}, _a[customScript.actionId] = initializeWebWorker(workerUrl, customScript.files, process, customViewConfig), _a));
104
123
  }, workers.current);
105
124
  return function () {
106
125
  Object.keys(workers.current).forEach(function (actionId) {
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { useEffect, useState } from 'react';
12
+ import { useCallback, useEffect, useState } from 'react';
13
13
  import { useDidUpdateEffect } from './useDidUpdateEffect';
14
14
  export var useSavedStateForEntityType = function (_a) {
15
15
  var getSavedState = _a.getSavedState, saveState = _a.saveState, entityTypeUri = _a.entityTypeUri;
@@ -23,14 +23,14 @@ export var useSavedStateForEntityType = function (_a) {
23
23
  }
24
24
  };
25
25
  useDidUpdateEffect(saveChangesLocallyForPrevEntityType, [entityTypeUri]);
26
- var updateSavedState = function (stateToSave) {
26
+ var updateSavedState = useCallback(function (stateToSave) {
27
27
  var _a;
28
28
  var changedState = (_a = {},
29
29
  _a[entityTypeUri] = stateToSave,
30
30
  _a);
31
31
  setChangedState(changedState);
32
32
  saveState(__assign(__assign({}, savedState), changedState));
33
- };
33
+ }, [entityTypeUri, saveState, savedState]);
34
34
  useEffect(function () {
35
35
  getSavedState()
36
36
  .then(function (savedState) {
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1159",
3
+ "version": "1.4.1162",
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.1159",
11
- "@reltio/mdm-sdk": "^1.4.1159",
10
+ "@reltio/mdm-module": "^1.4.1162",
11
+ "@reltio/mdm-sdk": "^1.4.1162",
12
12
  "classnames": "^2.2.5",
13
13
  "d3-cloud": "^1.2.5",
14
14
  "d3-geo": "^2.0.1",
@@ -1,14 +0,0 @@
1
- export declare const MAP_DRAWING_MODES: {
2
- CIRCLE: string;
3
- POLYGON: string;
4
- };
5
- export declare const DEFAULT_OVERLAY_OPTIONS: {
6
- fillColor: string;
7
- fillOpacity: number;
8
- strokeWeight: number;
9
- strokeColor: string;
10
- clickable: boolean;
11
- editable: boolean;
12
- zIndex: number;
13
- };
14
- export declare const MAP_MINIMUM_SCALE_RADIUS = 0.001;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MAP_MINIMUM_SCALE_RADIUS = exports.DEFAULT_OVERLAY_OPTIONS = exports.MAP_DRAWING_MODES = void 0;
4
- exports.MAP_DRAWING_MODES = {
5
- CIRCLE: 'circle',
6
- POLYGON: 'polygon'
7
- };
8
- exports.DEFAULT_OVERLAY_OPTIONS = {
9
- fillColor: 'rgb(242,82,82)',
10
- fillOpacity: 0.1,
11
- strokeWeight: 2,
12
- strokeColor: '#F25252',
13
- clickable: false,
14
- editable: true,
15
- zIndex: 1
16
- };
17
- exports.MAP_MINIMUM_SCALE_RADIUS = 0.001;
@@ -1,14 +0,0 @@
1
- export declare const MAP_DRAWING_MODES: {
2
- CIRCLE: string;
3
- POLYGON: string;
4
- };
5
- export declare const DEFAULT_OVERLAY_OPTIONS: {
6
- fillColor: string;
7
- fillOpacity: number;
8
- strokeWeight: number;
9
- strokeColor: string;
10
- clickable: boolean;
11
- editable: boolean;
12
- zIndex: number;
13
- };
14
- export declare const MAP_MINIMUM_SCALE_RADIUS = 0.001;
@@ -1,14 +0,0 @@
1
- export var MAP_DRAWING_MODES = {
2
- CIRCLE: 'circle',
3
- POLYGON: 'polygon'
4
- };
5
- export var DEFAULT_OVERLAY_OPTIONS = {
6
- fillColor: 'rgb(242,82,82)',
7
- fillOpacity: 0.1,
8
- strokeWeight: 2,
9
- strokeColor: '#F25252',
10
- clickable: false,
11
- editable: true,
12
- zIndex: 1
13
- };
14
- export var MAP_MINIMUM_SCALE_RADIUS = 0.001;