@reltio/components 1.4.822 → 1.4.826

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.
@@ -33,7 +33,10 @@ var changeVisibleColumns = function (state, nextVisibleColumns) {
33
33
  var isRemovedColumn = function (columnId) { return removedColumns.includes(columnId); };
34
34
  return ramda_1.evolve({
35
35
  visibleColumns: ramda_1.always(nextVisibleColumns),
36
- sorting: ramda_1.when(function (sorting) { return isRemovedColumn(sorting.field); }, function () {
36
+ sorting: ramda_1.when(function (sorting) {
37
+ if (sorting === void 0) { sorting = {}; }
38
+ return isRemovedColumn(sorting.field);
39
+ }, function () {
37
40
  var nextSortField = nextVisibleColumns[0];
38
41
  return { field: nextSortField, order: 'asc' };
39
42
  }),
@@ -1 +1 @@
1
- export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"button" | "overlay" | "selected" | "checkedIcon" | "selectionMode" | "actions" | "actionButton" | "dropDownMenuButton">;
1
+ export declare const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"button" | "overlay" | "selected" | "checkedIcon" | "actions" | "selectionMode" | "actionButton" | "dropDownMenuButton">;
@@ -1 +1 @@
1
- export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"deleted" | "label" | "expandButton" | "actions" | "editor" | "editedLabel" | "titleContainer">;
1
+ export const useStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"deleted" | "label" | "actions" | "expandButton" | "editor" | "editedLabel" | "titleContainer">;
@@ -1,27 +1,26 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.useCrosswalkActions = void 0;
7
4
  var react_1 = require("react");
8
5
  var ramda_1 = require("ramda");
9
- var ui_i18n_1 = __importDefault(require("ui-i18n"));
10
6
  var mdm_sdk_1 = require("@reltio/mdm-sdk");
11
7
  var core_1 = require("../../../core");
12
8
  var useCrosswalkActions = function (_a) {
13
9
  var _b = _a.onLoad, onLoad = _b === void 0 ? core_1.noop : _b, _c = _a.onSuccess, onSuccess = _c === void 0 ? core_1.noop : _c, _d = _a.onError, onError = _d === void 0 ? core_1.noop : _d;
14
- var handleAction = react_1.useCallback(function (request) {
10
+ var handleRequest = react_1.useCallback(function (request) {
15
11
  onLoad();
16
12
  request
17
- .then(function () {
13
+ .then(function (_a) {
14
+ var errors = _a.errors;
15
+ if (errors)
16
+ throw errors;
18
17
  onSuccess();
19
18
  })
20
19
  .catch(onError);
21
20
  }, [onLoad, onError, onSuccess]);
22
21
  var addCrosswalkAction = react_1.useCallback(function (_a) {
23
22
  var entity = _a.entity, contributorCrosswalk = _a.contributorCrosswalk, crosswalk = _a.crosswalk;
24
- var promise = contributorCrosswalk
23
+ var addRequest = contributorCrosswalk
25
24
  ? mdm_sdk_1.addCrosswalkInContributor({
26
25
  entityTypeUri: entity.type,
27
26
  contributorCrosswalkType: contributorCrosswalk.type,
@@ -34,38 +33,32 @@ var useCrosswalkActions = function (_a) {
34
33
  })
35
34
  : mdm_sdk_1.addCrosswalk({ entityUri: entity.uri, crosswalk: crosswalk });
36
35
  ramda_1.pipe(ramda_1.andThen(function (_a) {
37
- var errors = _a[0].errors;
38
- if (errors)
39
- throw errors;
40
- }), handleAction)(promise);
41
- }, [handleAction]);
36
+ var response = _a[0];
37
+ return response;
38
+ }), handleRequest)(addRequest);
39
+ }, [handleRequest]);
42
40
  var editCrosswalkAction = react_1.useCallback(function (_a) {
43
41
  var entityUri = _a.entityUri, crosswalkId = _a.crosswalkId, attributeName = _a.attributeName, value = _a.value;
44
42
  ramda_1.pipe(ramda_1.ifElse(function (_a) {
45
43
  var value = _a.value;
46
44
  return ramda_1.isNil(value);
47
- }, mdm_sdk_1.deleteCrosswalkAttribute, mdm_sdk_1.editCrosswalkAttribute), ramda_1.andThen(function (response) {
48
- if (!response[0].successful)
49
- throw new Error(ui_i18n_1.default.text('Failed to edit crosswalk'));
45
+ }, mdm_sdk_1.deleteCrosswalkAttribute, mdm_sdk_1.editCrosswalkAttribute), ramda_1.andThen(function (_a) {
46
+ var response = _a[0];
50
47
  return response;
51
- }), handleAction)({
48
+ }), handleRequest)({
52
49
  entityUri: entityUri,
53
50
  crosswalkId: crosswalkId,
54
51
  attributeName: attributeName,
55
52
  value: value
56
53
  });
57
- }, [handleAction]);
54
+ }, [handleRequest]);
58
55
  var deleteCrosswalkAction = react_1.useCallback(function (_a) {
59
56
  var entityUri = _a.entityUri, crosswalkId = _a.crosswalkId;
60
- ramda_1.pipe(mdm_sdk_1.deleteCrosswalk, ramda_1.andThen(function (response) {
61
- if (response.status === 'failed')
62
- throw new Error(ui_i18n_1.default.text('Failed to delete crosswalk'));
63
- return response;
64
- }), handleAction)({
57
+ ramda_1.pipe(mdm_sdk_1.deleteCrosswalk, handleRequest)({
65
58
  entityUri: entityUri,
66
59
  crosswalkId: crosswalkId
67
60
  });
68
- }, [handleAction]);
61
+ }, [handleRequest]);
69
62
  return {
70
63
  addCrosswalk: addCrosswalkAction,
71
64
  editCrosswalk: editCrosswalkAction,
@@ -1,4 +1,16 @@
1
- export function useActions({ actions, dispatch }: {
2
- actions: any;
3
- dispatch: any;
4
- }): {};
1
+ declare type UseActions = ({ actions, dispatch }: {
2
+ actions: {
3
+ [key: string]: <T>(payload: T) => {
4
+ type: string;
5
+ payload: T;
6
+ };
7
+ };
8
+ dispatch: <T>({ type, payload }: {
9
+ type: string;
10
+ payload: T;
11
+ }) => void;
12
+ }) => {
13
+ [key in keyof typeof actions]: <T>(payload: T) => void;
14
+ };
15
+ export declare const useActions: UseActions;
16
+ export {};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.822",
3
+ "version": "1.4.826",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
7
  "@date-io/moment": "^1.3.5",
8
8
  "@react-google-maps/api": "^2.7.0",
9
- "@reltio/mdm-module": "^1.4.822",
10
- "@reltio/mdm-sdk": "^1.4.822",
9
+ "@reltio/mdm-module": "^1.4.826",
10
+ "@reltio/mdm-sdk": "^1.4.826",
11
11
  "classnames": "^2.2.5",
12
12
  "frontend-collective-react-dnd-scrollzone": "^1.0.2",
13
13
  "nanoid": "^2.0.0",