@reltio/components 1.4.1806 → 1.4.1808

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.
@@ -23,6 +23,20 @@ var DndManager = /** @class */ (function () {
23
23
  if (!needsRedraw) {
24
24
  return;
25
25
  }
26
+ var treeIndex = dropTargetProps.treeIndex, swapFrom = dropTargetProps.swapFrom;
27
+ if (component) {
28
+ var boundingRect = (0, react_dom_1.findDOMNode)(component).getBoundingClientRect(); // eslint-disable-line react/no-find-dom-node
29
+ var ownMiddleY = (boundingRect.bottom - boundingRect.top) / 2;
30
+ var clientOffset = monitor.getClientOffset();
31
+ // Moving down: exit if we're in upper half
32
+ if (swapFrom <= treeIndex && clientOffset.y < boundingRect.top + ownMiddleY) {
33
+ return;
34
+ }
35
+ // Moving up: exit if we're in lower half
36
+ if (swapFrom >= treeIndex && clientOffset.y > boundingRect.top + ownMiddleY) {
37
+ return;
38
+ }
39
+ }
26
40
  _this.lastDropTargetNode = dropTargetProps.node;
27
41
  _this.lastDropTargetDepth = targetDepth;
28
42
  _this.dragHover({
@@ -10,6 +10,6 @@ export declare const useAttributeActions: ({ onSuccess, onError, onLoad }: Props
10
10
  pinAttribute: ({ attributeValue }: PinInlineAttributeEvent) => void;
11
11
  ignoreAttribute: ({ attributeValue }: IgnoreInlineAttributeEvent) => void;
12
12
  updateAttribute: ({ attributeValue, attributeType, crosswalk, clearAttributeFlags }: EditInlineAttributeEvent) => void;
13
- createAttribute: ({ attributeValue, attributeType, crosswalk }: CreateAttributeEvent) => void;
13
+ createAttribute: ({ attributeValue, crosswalk }: CreateAttributeEvent) => void;
14
14
  };
15
15
  export {};
@@ -129,7 +129,7 @@ var useAttributeActions = function (_a) {
129
129
  handleAction(update());
130
130
  }, [handleAction, handleErrorResponse]);
131
131
  var createAttributeAction = (0, react_1.useCallback)(function (_a) {
132
- var attributeValue = _a.attributeValue, attributeType = _a.attributeType, crosswalk = _a.crosswalk;
132
+ var attributeValue = _a.attributeValue, crosswalk = _a.crosswalk;
133
133
  (0, ramda_1.pipe)(mdm_sdk_1.createAttribute, (0, ramda_1.andThen)(function (_a) {
134
134
  var errors = _a[0].errors;
135
135
  if (errors)
@@ -139,7 +139,7 @@ var useAttributeActions = function (_a) {
139
139
  sourceUri: crosswalk.type,
140
140
  crosswalkValue: crosswalk.value,
141
141
  crosswalkSourceTable: crosswalk.sourceTable,
142
- value: (0, mdm_sdk_1.isLookupAttrType)(attributeType)
142
+ value: (0, mdm_sdk_1.isLookupValue)(attributeValue)
143
143
  ? attributeValue.lookupCode
144
144
  : attributeValue.value
145
145
  });
@@ -131,7 +131,6 @@ var useModifiedEntity = function (_a) {
131
131
  });
132
132
  createAttribute({
133
133
  attributeValue: (0, mdm_sdk_1.findAttributeValueByUri)(editedEntity, tempAttributeUri),
134
- attributeType: attributeType,
135
134
  crosswalk: crosswalk
136
135
  });
137
136
  crosswalkForNewAttributes.current = crosswalk;
@@ -1,6 +1,5 @@
1
- import { AttributeValue, Crosswalk, RelationCrosswalk, AttributeType } from '@reltio/mdm-sdk';
1
+ import { AttributeValue, Crosswalk, RelationCrosswalk } from '@reltio/mdm-sdk';
2
2
  export type CreateAttributeEvent = {
3
3
  attributeValue: AttributeValue;
4
- attributeType: AttributeType;
5
4
  crosswalk: Crosswalk | RelationCrosswalk;
6
5
  };
@@ -21,6 +21,20 @@ var DndManager = /** @class */ (function () {
21
21
  if (!needsRedraw) {
22
22
  return;
23
23
  }
24
+ var treeIndex = dropTargetProps.treeIndex, swapFrom = dropTargetProps.swapFrom;
25
+ if (component) {
26
+ var boundingRect = findDOMNode(component).getBoundingClientRect(); // eslint-disable-line react/no-find-dom-node
27
+ var ownMiddleY = (boundingRect.bottom - boundingRect.top) / 2;
28
+ var clientOffset = monitor.getClientOffset();
29
+ // Moving down: exit if we're in upper half
30
+ if (swapFrom <= treeIndex && clientOffset.y < boundingRect.top + ownMiddleY) {
31
+ return;
32
+ }
33
+ // Moving up: exit if we're in lower half
34
+ if (swapFrom >= treeIndex && clientOffset.y > boundingRect.top + ownMiddleY) {
35
+ return;
36
+ }
37
+ }
24
38
  _this.lastDropTargetNode = dropTargetProps.node;
25
39
  _this.lastDropTargetDepth = targetDepth;
26
40
  _this.dragHover({
@@ -10,6 +10,6 @@ export declare const useAttributeActions: ({ onSuccess, onError, onLoad }: Props
10
10
  pinAttribute: ({ attributeValue }: PinInlineAttributeEvent) => void;
11
11
  ignoreAttribute: ({ attributeValue }: IgnoreInlineAttributeEvent) => void;
12
12
  updateAttribute: ({ attributeValue, attributeType, crosswalk, clearAttributeFlags }: EditInlineAttributeEvent) => void;
13
- createAttribute: ({ attributeValue, attributeType, crosswalk }: CreateAttributeEvent) => void;
13
+ createAttribute: ({ attributeValue, crosswalk }: CreateAttributeEvent) => void;
14
14
  };
15
15
  export {};
@@ -35,7 +35,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { useCallback } from 'react';
38
- import { createAttribute, entityCumulativeDelete, getBaseUri, getReferencedRelationFromAttrValue, ignoreAttribute, isComplexAttribute, isImage, isLookupAttrType, isReference, pinAttribute, removeRelation, updateAttribute } from '@reltio/mdm-sdk';
38
+ import { createAttribute, entityCumulativeDelete, getBaseUri, getReferencedRelationFromAttrValue, ignoreAttribute, isComplexAttribute, isImage, isLookupAttrType, isLookupValue, isReference, pinAttribute, removeRelation, updateAttribute } from '@reltio/mdm-sdk';
39
39
  import { andThen, pipe, prop, defaultTo, map } from 'ramda';
40
40
  import { noop } from '../../../core';
41
41
  export var useAttributeActions = function (_a) {
@@ -126,7 +126,7 @@ export var useAttributeActions = function (_a) {
126
126
  handleAction(update());
127
127
  }, [handleAction, handleErrorResponse]);
128
128
  var createAttributeAction = useCallback(function (_a) {
129
- var attributeValue = _a.attributeValue, attributeType = _a.attributeType, crosswalk = _a.crosswalk;
129
+ var attributeValue = _a.attributeValue, crosswalk = _a.crosswalk;
130
130
  pipe(createAttribute, andThen(function (_a) {
131
131
  var errors = _a[0].errors;
132
132
  if (errors)
@@ -136,7 +136,7 @@ export var useAttributeActions = function (_a) {
136
136
  sourceUri: crosswalk.type,
137
137
  crosswalkValue: crosswalk.value,
138
138
  crosswalkSourceTable: crosswalk.sourceTable,
139
- value: isLookupAttrType(attributeType)
139
+ value: isLookupValue(attributeValue)
140
140
  ? attributeValue.lookupCode
141
141
  : attributeValue.value
142
142
  });
@@ -128,7 +128,6 @@ export var useModifiedEntity = function (_a) {
128
128
  });
129
129
  createAttribute({
130
130
  attributeValue: findAttributeValueByUri(editedEntity, tempAttributeUri),
131
- attributeType: attributeType,
132
131
  crosswalk: crosswalk
133
132
  });
134
133
  crosswalkForNewAttributes.current = crosswalk;
@@ -1,6 +1,5 @@
1
- import { AttributeValue, Crosswalk, RelationCrosswalk, AttributeType } from '@reltio/mdm-sdk';
1
+ import { AttributeValue, Crosswalk, RelationCrosswalk } from '@reltio/mdm-sdk';
2
2
  export type CreateAttributeEvent = {
3
3
  attributeValue: AttributeValue;
4
- attributeType: AttributeType;
5
4
  crosswalk: Crosswalk | RelationCrosswalk;
6
5
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.1806",
3
+ "version": "1.4.1808",
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
  "@fluentui/react-context-selector": "^9.1.26",
9
9
  "@react-google-maps/api": "2.7.0",
10
- "@reltio/mdm-sdk": "^1.4.1769",
10
+ "@reltio/mdm-sdk": "^1.4.1770",
11
11
  "classnames": "^2.2.5",
12
12
  "d3-cloud": "^1.2.5",
13
13
  "d3-geo": "^2.0.1",