@elliemae/ds-query-builder 2.3.0-alpha.9 → 2.3.0-next.11
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.
- package/cjs/DSQueryBuilder.js +98 -0
- package/cjs/components/AndOrController/AndOrController.js +222 -0
- package/cjs/components/ConditionController/ConditionController.js +100 -0
- package/cjs/components/DisplayOutput/DisplayOutput.js +93 -0
- package/cjs/components/DragContainerController/DragContainerController.js +45 -0
- package/cjs/components/DragControllerRow/DragControllerRow.js +47 -0
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +33 -0
- package/cjs/components/Nestable/Nestable.js +320 -0
- package/cjs/components/Nestable/NestableItem.js +111 -0
- package/cjs/components/Nestable/actions/events.js +166 -0
- package/cjs/components/Nestable/actions/getItemOptions.js +28 -0
- package/cjs/components/Nestable/actions/getPaths.js +124 -0
- package/cjs/components/Nestable/actions/index.js +28 -0
- package/cjs/components/Nestable/actions/moveItem.js +54 -0
- package/cjs/components/Nestable/actions/paths.js +126 -0
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +35 -0
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +38 -0
- package/cjs/components/Nestable/index.js +7 -0
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +13 -0
- package/cjs/components/QueryBuilderImpl.js +309 -0
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +90 -0
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +276 -0
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +29 -0
- package/cjs/components/format/format.js +33 -0
- package/cjs/components/format/sqlFormat.js +73 -0
- package/cjs/components/format/sqlSafeFormat.js +81 -0
- package/cjs/components/format/xmlFormat.js +73 -0
- package/cjs/components/helpers/actions.js +277 -0
- package/cjs/components/helpers/constants.js +11 -0
- package/cjs/components/helpers/dependencies.js +84 -0
- package/cjs/components/helpers/selectors.js +101 -0
- package/cjs/components/helpers/store.js +177 -0
- package/cjs/components/helpers/types.js +64 -0
- package/cjs/index.js +29 -0
- package/cjs/propTypes.js +97 -0
- package/esm/DSQueryBuilder.js +74 -0
- package/esm/components/AndOrController/AndOrController.js +213 -0
- package/esm/components/ConditionController/ConditionController.js +92 -0
- package/esm/components/DisplayOutput/DisplayOutput.js +87 -0
- package/esm/components/DragContainerController/DragContainerController.js +39 -0
- package/esm/components/DragControllerRow/DragControllerRow.js +39 -0
- package/esm/components/FieldControllerRow/FieldControllerRow.js +27 -0
- package/esm/components/Nestable/Nestable.js +312 -0
- package/esm/components/Nestable/NestableItem.js +103 -0
- package/esm/components/Nestable/actions/events.js +153 -0
- package/{dist/esm → esm}/components/Nestable/actions/getItemOptions.js +11 -7
- package/{dist/esm → esm}/components/Nestable/actions/getPaths.js +43 -17
- package/esm/components/Nestable/actions/index.js +6 -0
- package/esm/components/Nestable/actions/moveItem.js +45 -0
- package/{dist/esm → esm}/components/Nestable/actions/paths.js +47 -19
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +31 -0
- package/{dist/esm → esm}/components/Nestable/actions/tryIncreaseDepth.js +22 -10
- package/esm/components/Nestable/index.js +2 -0
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +5 -0
- package/esm/components/QueryBuilderImpl.js +301 -0
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +83 -0
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +268 -0
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +20 -0
- package/esm/components/format/format.js +31 -0
- package/esm/components/format/sqlFormat.js +69 -0
- package/esm/components/format/sqlSafeFormat.js +76 -0
- package/esm/components/format/xmlFormat.js +69 -0
- package/esm/components/helpers/actions.js +254 -0
- package/esm/components/helpers/constants.js +5 -0
- package/esm/components/helpers/dependencies.js +60 -0
- package/esm/components/helpers/selectors.js +93 -0
- package/esm/components/helpers/store.js +171 -0
- package/esm/components/helpers/types.js +52 -0
- package/esm/index.js +4 -0
- package/esm/propTypes.js +93 -0
- package/package.json +95 -97
- package/{dist/types → types}/DSQueryBuilder.d.ts +0 -0
- package/{dist/types → types}/components/AndOrController/AndOrController.d.ts +0 -0
- package/{dist/types → types}/components/ConditionController/ConditionController.d.ts +0 -0
- package/{dist/types → types}/components/DisplayOutput/DisplayOutput.d.ts +0 -0
- package/{dist/types → types}/components/DragContainerController/DragContainerController.d.ts +0 -0
- package/{dist/types → types}/components/DragControllerRow/DragControllerRow.d.ts +0 -0
- package/{dist/types → types}/components/FieldControllerRow/FieldControllerRow.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/Nestable.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/NestableItem.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/events.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/getItemOptions.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/getPaths.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/index.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/moveItem.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/paths.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/tryDecreaseDepth.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/actions/tryIncreaseDepth.d.ts +0 -0
- package/{dist/types → types}/components/Nestable/index.d.ts +0 -0
- package/{dist/types → types}/components/QueryBuilderContext/QueryBuilderContext.d.ts +0 -0
- package/{dist/types → types}/components/QueryBuilderImpl.d.ts +0 -0
- package/{dist/types → types}/components/QueryBuilderItem/QueryBuilderItem.d.ts +0 -0
- package/{dist/types → types}/components/QueryBuilderRow/QueryBuilderRow.d.ts +0 -0
- package/{dist/types → types}/components/ToolBarAnimation/ToolBarAnimation.d.ts +0 -0
- package/{dist/types → types}/components/format/format.d.ts +0 -0
- package/{dist/types → types}/components/format/sqlFormat.d.ts +0 -0
- package/{dist/types → types}/components/format/sqlSafeFormat.d.ts +0 -0
- package/{dist/types → types}/components/format/xmlFormat.d.ts +0 -0
- package/{dist/types → types}/components/helpers/actions.d.ts +0 -0
- package/{dist/types → types}/components/helpers/constants.d.ts +0 -0
- package/{dist/types → types}/components/helpers/dependencies.d.ts +0 -0
- package/{dist/types → types}/components/helpers/selectors.d.ts +0 -0
- package/{dist/types → types}/components/helpers/store.d.ts +0 -0
- package/{dist/types → types}/components/helpers/types.d.ts +0 -0
- package/{dist/types → types}/index.d.ts +0 -0
- package/{dist/types → types}/propTypes.d.ts +0 -0
- package/dist/cjs/DSQueryBuilder.js +0 -118
- package/dist/cjs/DSQueryBuilder.js.map +0 -7
- package/dist/cjs/components/AndOrController/AndOrController.js +0 -208
- package/dist/cjs/components/AndOrController/AndOrController.js.map +0 -7
- package/dist/cjs/components/ConditionController/ConditionController.js +0 -116
- package/dist/cjs/components/ConditionController/ConditionController.js.map +0 -7
- package/dist/cjs/components/DisplayOutput/DisplayOutput.js +0 -92
- package/dist/cjs/components/DisplayOutput/DisplayOutput.js.map +0 -7
- package/dist/cjs/components/DragContainerController/DragContainerController.js +0 -65
- package/dist/cjs/components/DragContainerController/DragContainerController.js.map +0 -7
- package/dist/cjs/components/DragControllerRow/DragControllerRow.js +0 -51
- package/dist/cjs/components/DragControllerRow/DragControllerRow.js.map +0 -7
- package/dist/cjs/components/FieldControllerRow/FieldControllerRow.js +0 -55
- package/dist/cjs/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
- package/dist/cjs/components/Nestable/Nestable.js +0 -254
- package/dist/cjs/components/Nestable/Nestable.js.map +0 -7
- package/dist/cjs/components/Nestable/NestableItem.js +0 -119
- package/dist/cjs/components/Nestable/NestableItem.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/events.js +0 -143
- package/dist/cjs/components/Nestable/actions/events.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/getItemOptions.js +0 -49
- package/dist/cjs/components/Nestable/actions/getItemOptions.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/getPaths.js +0 -119
- package/dist/cjs/components/Nestable/actions/getPaths.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/index.js +0 -42
- package/dist/cjs/components/Nestable/actions/index.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/moveItem.js +0 -56
- package/dist/cjs/components/Nestable/actions/moveItem.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/paths.js +0 -119
- package/dist/cjs/components/Nestable/actions/paths.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/tryDecreaseDepth.js +0 -51
- package/dist/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
- package/dist/cjs/components/Nestable/actions/tryIncreaseDepth.js +0 -51
- package/dist/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
- package/dist/cjs/components/Nestable/index.js +0 -36
- package/dist/cjs/components/Nestable/index.js.map +0 -7
- package/dist/cjs/components/QueryBuilderContext/QueryBuilderContext.js +0 -36
- package/dist/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
- package/dist/cjs/components/QueryBuilderImpl.js +0 -225
- package/dist/cjs/components/QueryBuilderImpl.js.map +0 -7
- package/dist/cjs/components/QueryBuilderItem/QueryBuilderItem.js +0 -92
- package/dist/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js +0 -219
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
- package/dist/cjs/components/ToolBarAnimation/ToolBarAnimation.js +0 -42
- package/dist/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
- package/dist/cjs/components/format/format.js +0 -59
- package/dist/cjs/components/format/format.js.map +0 -7
- package/dist/cjs/components/format/sqlFormat.js +0 -94
- package/dist/cjs/components/format/sqlFormat.js.map +0 -7
- package/dist/cjs/components/format/sqlSafeFormat.js +0 -98
- package/dist/cjs/components/format/sqlSafeFormat.js.map +0 -7
- package/dist/cjs/components/format/xmlFormat.js +0 -94
- package/dist/cjs/components/format/xmlFormat.js.map +0 -7
- package/dist/cjs/components/helpers/actions.js +0 -242
- package/dist/cjs/components/helpers/actions.js.map +0 -7
- package/dist/cjs/components/helpers/constants.js +0 -39
- package/dist/cjs/components/helpers/constants.js.map +0 -7
- package/dist/cjs/components/helpers/dependencies.js +0 -69
- package/dist/cjs/components/helpers/dependencies.js.map +0 -7
- package/dist/cjs/components/helpers/selectors.js +0 -161
- package/dist/cjs/components/helpers/selectors.js.map +0 -7
- package/dist/cjs/components/helpers/store.js +0 -159
- package/dist/cjs/components/helpers/store.js.map +0 -7
- package/dist/cjs/components/helpers/types.js +0 -92
- package/dist/cjs/components/helpers/types.js.map +0 -7
- package/dist/cjs/index.js +0 -36
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/propTypes.js +0 -105
- package/dist/cjs/propTypes.js.map +0 -7
- package/dist/esm/DSQueryBuilder.js +0 -105
- package/dist/esm/DSQueryBuilder.js.map +0 -7
- package/dist/esm/components/AndOrController/AndOrController.js +0 -179
- package/dist/esm/components/AndOrController/AndOrController.js.map +0 -7
- package/dist/esm/components/ConditionController/ConditionController.js +0 -87
- package/dist/esm/components/ConditionController/ConditionController.js.map +0 -7
- package/dist/esm/components/DisplayOutput/DisplayOutput.js +0 -63
- package/dist/esm/components/DisplayOutput/DisplayOutput.js.map +0 -7
- package/dist/esm/components/DragContainerController/DragContainerController.js +0 -36
- package/dist/esm/components/DragContainerController/DragContainerController.js.map +0 -7
- package/dist/esm/components/DragControllerRow/DragControllerRow.js +0 -22
- package/dist/esm/components/DragControllerRow/DragControllerRow.js.map +0 -7
- package/dist/esm/components/FieldControllerRow/FieldControllerRow.js +0 -26
- package/dist/esm/components/FieldControllerRow/FieldControllerRow.js.map +0 -7
- package/dist/esm/components/Nestable/Nestable.js +0 -241
- package/dist/esm/components/Nestable/Nestable.js.map +0 -7
- package/dist/esm/components/Nestable/NestableItem.js +0 -90
- package/dist/esm/components/Nestable/NestableItem.js.map +0 -7
- package/dist/esm/components/Nestable/actions/events.js +0 -119
- package/dist/esm/components/Nestable/actions/events.js.map +0 -7
- package/dist/esm/components/Nestable/actions/getItemOptions.js.map +0 -7
- package/dist/esm/components/Nestable/actions/getPaths.js.map +0 -7
- package/dist/esm/components/Nestable/actions/index.js +0 -13
- package/dist/esm/components/Nestable/actions/index.js.map +0 -7
- package/dist/esm/components/Nestable/actions/moveItem.js +0 -27
- package/dist/esm/components/Nestable/actions/moveItem.js.map +0 -7
- package/dist/esm/components/Nestable/actions/paths.js.map +0 -7
- package/dist/esm/components/Nestable/actions/tryDecreaseDepth.js +0 -22
- package/dist/esm/components/Nestable/actions/tryDecreaseDepth.js.map +0 -7
- package/dist/esm/components/Nestable/actions/tryIncreaseDepth.js.map +0 -7
- package/dist/esm/components/Nestable/index.js +0 -7
- package/dist/esm/components/Nestable/index.js.map +0 -7
- package/dist/esm/components/QueryBuilderContext/QueryBuilderContext.js +0 -7
- package/dist/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -7
- package/dist/esm/components/QueryBuilderImpl.js +0 -196
- package/dist/esm/components/QueryBuilderImpl.js.map +0 -7
- package/dist/esm/components/QueryBuilderItem/QueryBuilderItem.js +0 -63
- package/dist/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -7
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js +0 -190
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -7
- package/dist/esm/components/ToolBarAnimation/ToolBarAnimation.js +0 -13
- package/dist/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -7
- package/dist/esm/components/format/format.js +0 -30
- package/dist/esm/components/format/format.js.map +0 -7
- package/dist/esm/components/format/sqlFormat.js +0 -65
- package/dist/esm/components/format/sqlFormat.js.map +0 -7
- package/dist/esm/components/format/sqlSafeFormat.js +0 -69
- package/dist/esm/components/format/sqlSafeFormat.js.map +0 -7
- package/dist/esm/components/format/xmlFormat.js +0 -65
- package/dist/esm/components/format/xmlFormat.js.map +0 -7
- package/dist/esm/components/helpers/actions.js +0 -217
- package/dist/esm/components/helpers/actions.js.map +0 -7
- package/dist/esm/components/helpers/constants.js +0 -10
- package/dist/esm/components/helpers/constants.js.map +0 -7
- package/dist/esm/components/helpers/dependencies.js +0 -40
- package/dist/esm/components/helpers/dependencies.js.map +0 -7
- package/dist/esm/components/helpers/selectors.js +0 -132
- package/dist/esm/components/helpers/selectors.js.map +0 -7
- package/dist/esm/components/helpers/store.js +0 -143
- package/dist/esm/components/helpers/store.js.map +0 -7
- package/dist/esm/components/helpers/types.js +0 -63
- package/dist/esm/components/helpers/types.js.map +0 -7
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/propTypes.js +0 -76
- package/dist/esm/propTypes.js.map +0 -7
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
5
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
12
|
+
import { Component } from 'react';
|
|
13
|
+
import cn from 'classnames';
|
|
14
|
+
import { listWithChildren } from '@elliemae/ds-shared/utils';
|
|
15
|
+
import { isEqualWith } from '@elliemae/ds-utilities';
|
|
16
|
+
import { tryIncreaseDepth } from './actions/tryIncreaseDepth.js';
|
|
17
|
+
import { tryDecreaseDepth } from './actions/tryDecreaseDepth.js';
|
|
18
|
+
import { moveItem } from './actions/moveItem.js';
|
|
19
|
+
import { getItemDepth, getPathById, getItemByPath, getSplicePath, getRealNextPath } from './actions/paths.js';
|
|
20
|
+
import { onDragStart, onDragEnd, onMouseMove, onMouseEnter, onToggleCollapse, onKeyDown } from './actions/events.js';
|
|
21
|
+
import { getItemOptions } from './actions/getItemOptions.js';
|
|
22
|
+
import NestableItem from './NestableItem.js';
|
|
23
|
+
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
+
|
|
28
|
+
const shallowCompare = (instance, nextProps, nextState) => !isEqualWith(instance.props, nextProps) || !isEqualWith(instance.state, nextState);
|
|
29
|
+
|
|
30
|
+
class Nestable extends Component {
|
|
31
|
+
constructor(props) {
|
|
32
|
+
super(props);
|
|
33
|
+
|
|
34
|
+
this.onDragStart = (e, item) => {
|
|
35
|
+
onDragStart.call(this, e, item);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
this.onDragEnd = (e, isCancel) => onDragEnd.call(this, e, isCancel);
|
|
39
|
+
|
|
40
|
+
this.onMouseMove = e => onMouseMove.call(this, e);
|
|
41
|
+
|
|
42
|
+
this.onMouseEnter = (e, item) => onMouseEnter.call(this, e, item);
|
|
43
|
+
|
|
44
|
+
this.onToggleCollapse = (item, isGetter) => onToggleCollapse.call(this, item, isGetter);
|
|
45
|
+
|
|
46
|
+
this.onKeyDown = e => onKeyDown.call(this, e);
|
|
47
|
+
|
|
48
|
+
this.getDefaultItems = () => {
|
|
49
|
+
const {
|
|
50
|
+
items
|
|
51
|
+
} = this.state;
|
|
52
|
+
return items;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.getItemDepth = item => getItemDepth.call(this, item);
|
|
56
|
+
|
|
57
|
+
this.startTrackMouse = () => {
|
|
58
|
+
document.addEventListener('mousemove', this.onMouseMove);
|
|
59
|
+
document.addEventListener('mouseup', this.onDragEnd);
|
|
60
|
+
document.addEventListener('keydown', this.onKeyDown);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
this.stopTrackMouse = () => {
|
|
64
|
+
document.removeEventListener('mousemove', this.onMouseMove);
|
|
65
|
+
document.removeEventListener('mouseup', this.onDragEnd);
|
|
66
|
+
document.removeEventListener('keydown', this.onKeyDown);
|
|
67
|
+
this.elCopyStyles = null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
this.isCollapsed = item => {
|
|
71
|
+
const {
|
|
72
|
+
collapsed
|
|
73
|
+
} = this.props;
|
|
74
|
+
const {
|
|
75
|
+
collapsedGroups
|
|
76
|
+
} = this.state;
|
|
77
|
+
return !!(collapsedGroups.indexOf(item.id) > -1 ^ collapsed);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
this.checkFilterChildren = items => items.find(current => {
|
|
81
|
+
const {
|
|
82
|
+
element: {
|
|
83
|
+
type
|
|
84
|
+
},
|
|
85
|
+
children
|
|
86
|
+
} = current;
|
|
87
|
+
if (type === 'filter' && children.length > 0) return true;
|
|
88
|
+
return this.checkFilterChildren(children);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
this.dragRevert = () => {
|
|
92
|
+
const {
|
|
93
|
+
itemsOld
|
|
94
|
+
} = this.state;
|
|
95
|
+
this.setState({
|
|
96
|
+
items: itemsOld,
|
|
97
|
+
itemsOld: null,
|
|
98
|
+
dragItem: null,
|
|
99
|
+
isDirty: false
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
this.state = {
|
|
104
|
+
items: [],
|
|
105
|
+
itemsOld: null,
|
|
106
|
+
dragItem: null,
|
|
107
|
+
isDirty: false,
|
|
108
|
+
collapsedGroups: [],
|
|
109
|
+
stopTrackingMouse: this.stopTrackMouse.bind(this),
|
|
110
|
+
oldProps: props
|
|
111
|
+
};
|
|
112
|
+
this.el = null;
|
|
113
|
+
this.elCopyStyles = null;
|
|
114
|
+
this.mouse = {
|
|
115
|
+
last: {
|
|
116
|
+
x: 0
|
|
117
|
+
},
|
|
118
|
+
shift: {
|
|
119
|
+
x: 0
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
componentDidMount() {
|
|
125
|
+
const {
|
|
126
|
+
childrenProp
|
|
127
|
+
} = this.props;
|
|
128
|
+
let {
|
|
129
|
+
items
|
|
130
|
+
} = this.props; // make sure every item has property 'children'
|
|
131
|
+
|
|
132
|
+
items = listWithChildren(items, childrenProp);
|
|
133
|
+
this.setState({
|
|
134
|
+
items
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
componentWillUnmount() {
|
|
139
|
+
this.stopTrackMouse();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static getDerivedStateFromProps(props, state) {
|
|
143
|
+
const {
|
|
144
|
+
items: itemsNew,
|
|
145
|
+
childrenProp
|
|
146
|
+
} = props;
|
|
147
|
+
const {
|
|
148
|
+
stopTrackingMouse,
|
|
149
|
+
oldProps
|
|
150
|
+
} = state;
|
|
151
|
+
|
|
152
|
+
if (shallowCompare({
|
|
153
|
+
props: oldProps,
|
|
154
|
+
state: {}
|
|
155
|
+
}, props, {})) {
|
|
156
|
+
stopTrackingMouse();
|
|
157
|
+
const extra = {};
|
|
158
|
+
|
|
159
|
+
if (oldProps.collapsed !== props.collapsed) {
|
|
160
|
+
extra.collapsedGroups = [];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return _objectSpread({
|
|
164
|
+
items: listWithChildren(itemsNew, childrenProp),
|
|
165
|
+
dragItem: null,
|
|
166
|
+
isDirty: false,
|
|
167
|
+
oldProps: props
|
|
168
|
+
}, extra);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
getPathById(id) {
|
|
175
|
+
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
|
|
176
|
+
return getPathById.call(this, id, items);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
getItemByPath(path) {
|
|
180
|
+
let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
|
|
181
|
+
return getItemByPath.call(this, path, items);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getSplicePath(path) {
|
|
185
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
186
|
+
return getSplicePath.call(this, path, options);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
getRealNextPath(prevPath, nextPath) {
|
|
190
|
+
return getRealNextPath.call(this, prevPath, nextPath);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
getItemOptions() {
|
|
194
|
+
return getItemOptions.call(this);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
dragApply() {
|
|
198
|
+
const {
|
|
199
|
+
onChange
|
|
200
|
+
} = this.props;
|
|
201
|
+
const {
|
|
202
|
+
items,
|
|
203
|
+
isDirty,
|
|
204
|
+
dragItem
|
|
205
|
+
} = this.state;
|
|
206
|
+
this.setState({
|
|
207
|
+
itemsOld: null,
|
|
208
|
+
dragItem: null,
|
|
209
|
+
isDirty: false
|
|
210
|
+
});
|
|
211
|
+
if (onChange && isDirty) onChange(items, dragItem);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
tryIncreaseDepth(dragItem) {
|
|
215
|
+
tryIncreaseDepth.call(this, dragItem);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
tryDecreaseDepth(dragItem) {
|
|
219
|
+
tryDecreaseDepth.call(this, dragItem);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
moveItem(_ref) {
|
|
223
|
+
let {
|
|
224
|
+
dragItem,
|
|
225
|
+
pathFrom,
|
|
226
|
+
pathTo
|
|
227
|
+
} = _ref;
|
|
228
|
+
let extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
229
|
+
moveItem.call(this, {
|
|
230
|
+
dragItem,
|
|
231
|
+
pathFrom,
|
|
232
|
+
pathTo
|
|
233
|
+
}, extraProps);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
renderDragLayer() {
|
|
237
|
+
const {
|
|
238
|
+
group
|
|
239
|
+
} = this.props;
|
|
240
|
+
const {
|
|
241
|
+
dragItem
|
|
242
|
+
} = this.state;
|
|
243
|
+
const el = document.querySelector(".nestable-".concat(group, " .nestable-item-").concat(dragItem.id));
|
|
244
|
+
let listStyles = {};
|
|
245
|
+
|
|
246
|
+
if (el) {
|
|
247
|
+
listStyles.width = el.clientWidth;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (this.elCopyStyles) {
|
|
251
|
+
listStyles = _objectSpread(_objectSpread({}, listStyles), this.elCopyStyles);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const options = this.getItemOptions();
|
|
255
|
+
return /*#__PURE__*/_jsx("div", {
|
|
256
|
+
className: "nestable-drag-layer"
|
|
257
|
+
}, void 0, /*#__PURE__*/_jsx("ol", {
|
|
258
|
+
className: "nestable-list",
|
|
259
|
+
style: listStyles
|
|
260
|
+
}, void 0, /*#__PURE__*/_jsx(NestableItem, {
|
|
261
|
+
isCopy: true,
|
|
262
|
+
item: dragItem,
|
|
263
|
+
options: options
|
|
264
|
+
})));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
render() {
|
|
268
|
+
const {
|
|
269
|
+
items,
|
|
270
|
+
dragItem
|
|
271
|
+
} = this.state;
|
|
272
|
+
const {
|
|
273
|
+
group,
|
|
274
|
+
isAndItem,
|
|
275
|
+
isOrItem,
|
|
276
|
+
isDraggableItem,
|
|
277
|
+
setDraggableItems,
|
|
278
|
+
singleRow
|
|
279
|
+
} = this.props;
|
|
280
|
+
const options = this.getItemOptions();
|
|
281
|
+
const childLength = items.length;
|
|
282
|
+
let childClass = 'single';
|
|
283
|
+
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
284
|
+
return /*#__PURE__*/_jsx("div", {
|
|
285
|
+
className: cn('nestable', "nestable-".concat(group), {
|
|
286
|
+
'is-drag-active': dragItem
|
|
287
|
+
})
|
|
288
|
+
}, void 0, /*#__PURE__*/_jsx("ol", {
|
|
289
|
+
className: "nestable-list nestable-group nestable-child-count-".concat(childClass)
|
|
290
|
+
}, void 0, items.map((item, i) => /*#__PURE__*/_jsx(NestableItem, {
|
|
291
|
+
index: i,
|
|
292
|
+
isAndItem: isAndItem,
|
|
293
|
+
isDraggableItem: isDraggableItem,
|
|
294
|
+
isOrItem: isOrItem,
|
|
295
|
+
item: item,
|
|
296
|
+
options: options,
|
|
297
|
+
setDraggableItems: setDraggableItems,
|
|
298
|
+
singleRow: singleRow
|
|
299
|
+
}, item.id))), dragItem && this.renderDragLayer());
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
Nestable.defaultProps = {
|
|
305
|
+
items: [],
|
|
306
|
+
collapsed: false,
|
|
307
|
+
group: Math.random().toString(36).slice(2),
|
|
308
|
+
childrenProp: 'children',
|
|
309
|
+
onChange: () => {}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export { Nestable as default };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import 'react';
|
|
11
|
+
import cn from 'classnames';
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
|
|
18
|
+
const NestableItem = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
item,
|
|
21
|
+
isCopy,
|
|
22
|
+
options,
|
|
23
|
+
index,
|
|
24
|
+
isAndItem,
|
|
25
|
+
isOrItem,
|
|
26
|
+
isDraggableItem,
|
|
27
|
+
singleRow
|
|
28
|
+
} = _ref;
|
|
29
|
+
const {
|
|
30
|
+
dragItem,
|
|
31
|
+
renderItem,
|
|
32
|
+
handler,
|
|
33
|
+
childrenProp
|
|
34
|
+
} = options;
|
|
35
|
+
const isCollapsed = options.isCollapsed(item);
|
|
36
|
+
const isDragging = !isCopy && dragItem && dragItem.id === item.id;
|
|
37
|
+
const hasChildren = item[childrenProp] && item[childrenProp].length > 0;
|
|
38
|
+
let Handler;
|
|
39
|
+
const isOrGroup = item.element.type === 'group' && (item.element.condition === '' || item.element.condition === false);
|
|
40
|
+
const isAndGroup = item.element.type === 'group' && !(item.element.condition === '' || item.element.condition === false);
|
|
41
|
+
const itemProps = {
|
|
42
|
+
className: cn("nestable-item".concat(isCopy ? '-copy' : ''), "nestable-item".concat(isCopy ? '-copy' : '', "-").concat(item.id), "nestable-item-type-".concat(item.element.type), {
|
|
43
|
+
'is-or-group': isOrGroup,
|
|
44
|
+
'is-and-group': isAndGroup,
|
|
45
|
+
'is-and-filter': item.element.type === 'filter' && isAndItem,
|
|
46
|
+
'is-or-filter': item.element.type === 'filter' && isOrItem
|
|
47
|
+
}, {
|
|
48
|
+
'is-dragging': isDragging
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
let rowProps = {};
|
|
52
|
+
let handlerProps = {};
|
|
53
|
+
|
|
54
|
+
if (!isCopy) {
|
|
55
|
+
if (dragItem) {
|
|
56
|
+
rowProps = _objectSpread(_objectSpread({}, rowProps), {}, {
|
|
57
|
+
onMouseEnter: e => options.onMouseEnter(e, item)
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
handlerProps = _objectSpread(_objectSpread({}, handlerProps), {}, {
|
|
61
|
+
draggable: isDraggableItem !== false,
|
|
62
|
+
onDragStart: e => options.onDragStart(e, item)
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (handler) {
|
|
68
|
+
Handler = /*#__PURE__*/jsx("span", _objectSpread(_objectSpread({
|
|
69
|
+
className: "nestable-item-handler"
|
|
70
|
+
}, handlerProps), {}, {
|
|
71
|
+
children: handler
|
|
72
|
+
})); // Handler = React.cloneElement(handler, handlerProps);
|
|
73
|
+
} else {
|
|
74
|
+
rowProps = _objectSpread(_objectSpread({}, rowProps), handlerProps);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const childLength = item[childrenProp].length;
|
|
78
|
+
let childClass = 'single';
|
|
79
|
+
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
80
|
+
return /*#__PURE__*/jsxs("li", _objectSpread(_objectSpread({}, itemProps), {}, {
|
|
81
|
+
children: [/*#__PURE__*/jsx("div", _objectSpread(_objectSpread({
|
|
82
|
+
className: "nestable-item-name nestable-item-name--".concat(item.element.type, " ")
|
|
83
|
+
}, rowProps), {}, {
|
|
84
|
+
children: renderItem({
|
|
85
|
+
item,
|
|
86
|
+
handler: Handler,
|
|
87
|
+
index
|
|
88
|
+
})
|
|
89
|
+
})), hasChildren && item.element.type === 'group' && !isCollapsed && /*#__PURE__*/_jsx("ol", {
|
|
90
|
+
className: "nestable-list nestable-child-count-".concat(childClass, " ")
|
|
91
|
+
}, void 0, item[childrenProp].map((currentitem, i) => /*#__PURE__*/_jsx(NestableItem, {
|
|
92
|
+
index: i,
|
|
93
|
+
isAndItem: isAndGroup,
|
|
94
|
+
isCopy: isCopy,
|
|
95
|
+
isOrItem: isOrGroup,
|
|
96
|
+
item: currentitem,
|
|
97
|
+
options: options,
|
|
98
|
+
singleRow: singleRow
|
|
99
|
+
}, i)))]
|
|
100
|
+
}));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { NestableItem as default };
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
7
|
+
import { closest, getTransformProps, getOffsetRect, getTotalScroll } from '@elliemae/ds-shared/utils';
|
|
8
|
+
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
function onDragStart(e, item) {
|
|
13
|
+
if (e) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this.el = closest(e.target, '.nestable-item');
|
|
19
|
+
this.startTrackMouse();
|
|
20
|
+
this.onMouseMove(e);
|
|
21
|
+
const {
|
|
22
|
+
items
|
|
23
|
+
} = this.state;
|
|
24
|
+
this.setState({
|
|
25
|
+
dragItem: item,
|
|
26
|
+
itemsOld: items
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function onDragEnd(e, isCancel) {
|
|
30
|
+
if (e && e.preventDefault) e.preventDefault();
|
|
31
|
+
this.stopTrackMouse();
|
|
32
|
+
this.el = null; // check if filter has children
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
items
|
|
36
|
+
} = this.state;
|
|
37
|
+
const nestedInFilter = this.checkFilterChildren(items);
|
|
38
|
+
if (nestedInFilter) return this.dragRevert();
|
|
39
|
+
return isCancel ? this.dragRevert() : this.dragApply();
|
|
40
|
+
}
|
|
41
|
+
function onMouseMove(e) {
|
|
42
|
+
const {
|
|
43
|
+
group,
|
|
44
|
+
threshold
|
|
45
|
+
} = this.props;
|
|
46
|
+
const {
|
|
47
|
+
dragItem
|
|
48
|
+
} = this.state;
|
|
49
|
+
const {
|
|
50
|
+
clientX,
|
|
51
|
+
clientY
|
|
52
|
+
} = e;
|
|
53
|
+
const transformProps = getTransformProps(clientX, clientY);
|
|
54
|
+
const elCopy = document.querySelector(".nestable-".concat(group, " .nestable-drag-layer > .nestable-list"));
|
|
55
|
+
|
|
56
|
+
if (!this.elCopyStyles) {
|
|
57
|
+
const offset = getOffsetRect(this.el);
|
|
58
|
+
const scroll = getTotalScroll(this.el);
|
|
59
|
+
this.elCopyStyles = _objectSpread({
|
|
60
|
+
marginTop: offset.top - clientY - scroll.top,
|
|
61
|
+
marginLeft: offset.left - clientX - scroll.left
|
|
62
|
+
}, transformProps);
|
|
63
|
+
} else {
|
|
64
|
+
this.elCopyStyles = _objectSpread(_objectSpread({}, this.elCopyStyles), transformProps);
|
|
65
|
+
|
|
66
|
+
for (const key in transformProps) {
|
|
67
|
+
if (transformProps.hasOwnProperty(key)) {
|
|
68
|
+
elCopy.style[key] = transformProps[key];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const diffX = clientX - this.mouse.last.x;
|
|
73
|
+
|
|
74
|
+
if (diffX >= 0 && this.mouse.shift.x >= 0 || diffX <= 0 && this.mouse.shift.x <= 0) {
|
|
75
|
+
this.mouse.shift.x += diffX;
|
|
76
|
+
} else {
|
|
77
|
+
this.mouse.shift.x = 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.mouse.last.x = clientX;
|
|
81
|
+
|
|
82
|
+
if (Math.abs(this.mouse.shift.x) > threshold) {
|
|
83
|
+
if (this.mouse.shift.x > 0) {
|
|
84
|
+
this.tryIncreaseDepth(dragItem);
|
|
85
|
+
} else {
|
|
86
|
+
this.tryDecreaseDepth(dragItem);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
this.mouse.shift.x = 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function onMouseEnter(e, item) {
|
|
94
|
+
if (e) {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const {
|
|
100
|
+
collapsed,
|
|
101
|
+
childrenProp
|
|
102
|
+
} = this.props;
|
|
103
|
+
const {
|
|
104
|
+
dragItem
|
|
105
|
+
} = this.state;
|
|
106
|
+
if (dragItem.id === item.id) return;
|
|
107
|
+
const pathFrom = this.getPathById(dragItem.id);
|
|
108
|
+
const pathTo = this.getPathById(item.id); // if collapsed by default
|
|
109
|
+
// and move last (by count) child
|
|
110
|
+
// remove parent node from list of open nodes
|
|
111
|
+
|
|
112
|
+
let collapseProps = {};
|
|
113
|
+
|
|
114
|
+
if (collapsed && pathFrom.length > 1) {
|
|
115
|
+
const parent = this.getItemByPath(pathFrom.slice(0, -1));
|
|
116
|
+
|
|
117
|
+
if (parent[childrenProp].length === 1) {
|
|
118
|
+
collapseProps = this.onToggleCollapse(parent, true);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.moveItem({
|
|
123
|
+
dragItem,
|
|
124
|
+
pathFrom,
|
|
125
|
+
pathTo
|
|
126
|
+
}, collapseProps);
|
|
127
|
+
}
|
|
128
|
+
function onToggleCollapse(item, isGetter) {
|
|
129
|
+
const {
|
|
130
|
+
collapsed
|
|
131
|
+
} = this.props;
|
|
132
|
+
const {
|
|
133
|
+
collapsedGroups
|
|
134
|
+
} = this.state;
|
|
135
|
+
const isCollapsed = this.isCollapsed(item);
|
|
136
|
+
const newState = {
|
|
137
|
+
collapsedGroups: isCollapsed ^ collapsed ? collapsedGroups.filter(id => id !== item.id) : collapsedGroups.concat(item.id)
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
if (isGetter) {
|
|
141
|
+
return newState;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return this.setState(newState);
|
|
145
|
+
}
|
|
146
|
+
function onKeyDown(e) {
|
|
147
|
+
if (e.which === 27) {
|
|
148
|
+
// ESC
|
|
149
|
+
this.onDragEnd(null, true);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export { onDragEnd, onDragStart, onKeyDown, onMouseEnter, onMouseMove, onToggleCollapse };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
function getItemOptions() {
|
|
3
|
-
const {
|
|
4
|
-
|
|
2
|
+
const {
|
|
3
|
+
renderItem,
|
|
4
|
+
renderCollapseIcon,
|
|
5
|
+
handler,
|
|
6
|
+
childrenProp
|
|
7
|
+
} = this.props;
|
|
8
|
+
const {
|
|
9
|
+
dragItem
|
|
10
|
+
} = this.state;
|
|
5
11
|
return {
|
|
6
12
|
dragItem,
|
|
7
13
|
childrenProp,
|
|
@@ -14,7 +20,5 @@ function getItemOptions() {
|
|
|
14
20
|
onToggleCollapse: this.onToggleCollapse
|
|
15
21
|
};
|
|
16
22
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=getItemOptions.js.map
|
|
23
|
+
|
|
24
|
+
export { getItemOptions };
|