@elliemae/ds-query-builder 1.60.0 → 2.0.0-alpha.12
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 +58 -151
- package/cjs/components/AndOrController/AndOrController.js +126 -162
- package/cjs/components/ConditionController/ConditionController.js +40 -60
- package/cjs/components/DisplayOutput/DisplayOutput.js +62 -83
- package/cjs/components/DragContainerController/DragContainerController.js +20 -21
- package/cjs/components/DragControllerRow/DragControllerRow.js +33 -23
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +14 -19
- package/cjs/components/Nestable/Nestable.js +243 -283
- package/cjs/components/Nestable/NestableItem.js +61 -52
- package/cjs/components/Nestable/actions/events.js +53 -35
- package/cjs/components/Nestable/actions/getItemOptions.js +14 -12
- package/cjs/components/Nestable/actions/getPaths.js +46 -38
- package/cjs/components/Nestable/actions/index.js +21 -26
- package/cjs/components/Nestable/actions/moveItem.js +26 -16
- package/cjs/components/Nestable/actions/paths.js +48 -40
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +12 -12
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +14 -14
- package/cjs/components/Nestable/index.js +2 -25
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +1 -2
- package/cjs/components/QueryBuilderImpl.js +216 -283
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +59 -77
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +154 -174
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +16 -11
- package/cjs/components/format/format.js +27 -39
- package/cjs/components/format/sqlFormat.js +35 -32
- package/cjs/components/format/sqlSafeFormat.js +38 -35
- package/cjs/components/format/xmlFormat.js +35 -32
- package/cjs/components/helpers/actions.js +108 -93
- package/cjs/components/helpers/constants.js +3 -4
- package/cjs/components/helpers/dependencies.js +36 -26
- package/cjs/components/helpers/selectors.js +18 -19
- package/cjs/components/helpers/store.js +87 -109
- package/cjs/components/helpers/types.js +9 -10
- package/cjs/index.js +19 -76
- package/cjs/propTypes.js +4 -5
- package/esm/DSQueryBuilder.js +37 -130
- package/esm/components/AndOrController/AndOrController.js +120 -152
- package/esm/components/ConditionController/ConditionController.js +37 -57
- package/esm/components/DisplayOutput/DisplayOutput.js +61 -76
- package/esm/components/DragContainerController/DragContainerController.js +20 -21
- package/esm/components/DragControllerRow/DragControllerRow.js +27 -17
- package/esm/components/FieldControllerRow/FieldControllerRow.js +13 -18
- package/esm/components/Nestable/Nestable.js +235 -268
- package/esm/components/Nestable/NestableItem.js +58 -48
- package/esm/components/Nestable/actions/events.js +52 -34
- package/esm/components/Nestable/actions/getItemOptions.js +14 -12
- package/esm/components/Nestable/actions/getPaths.js +46 -33
- package/esm/components/Nestable/actions/index.js +0 -5
- package/esm/components/Nestable/actions/moveItem.js +23 -13
- package/esm/components/Nestable/actions/paths.js +48 -35
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +12 -12
- package/esm/components/Nestable/actions/tryIncreaseDepth.js +14 -14
- package/esm/components/Nestable/index.js +0 -23
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +1 -2
- package/esm/components/QueryBuilderImpl.js +204 -265
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +52 -70
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +149 -164
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +16 -10
- package/esm/components/format/format.js +19 -27
- package/esm/components/format/sqlFormat.js +34 -31
- package/esm/components/format/sqlSafeFormat.js +37 -34
- package/esm/components/format/xmlFormat.js +34 -31
- package/esm/components/helpers/actions.js +100 -85
- package/esm/components/helpers/constants.js +3 -4
- package/esm/components/helpers/dependencies.js +33 -21
- package/esm/components/helpers/selectors.js +5 -6
- package/esm/components/helpers/store.js +84 -104
- package/esm/components/helpers/types.js +9 -10
- package/esm/index.js +0 -57
- package/esm/propTypes.js +1 -2
- package/package.json +173 -15
- package/types/DSQueryBuilder.d.ts +211 -0
- package/types/components/AndOrController/AndOrController.d.ts +38 -0
- package/types/components/ConditionController/ConditionController.d.ts +16 -0
- package/types/components/DisplayOutput/DisplayOutput.d.ts +7 -0
- package/types/components/DragContainerController/DragContainerController.d.ts +9 -0
- package/types/components/DragControllerRow/DragControllerRow.d.ts +9 -0
- package/types/components/FieldControllerRow/FieldControllerRow.d.ts +9 -0
- package/types/components/Nestable/Nestable.d.ts +51 -0
- package/types/components/Nestable/NestableItem.d.ts +12 -0
- package/types/components/Nestable/actions/events.d.ts +6 -0
- package/types/components/Nestable/actions/getItemOptions.d.ts +11 -0
- package/types/components/Nestable/actions/getPaths.d.ts +5 -0
- package/types/components/Nestable/actions/index.d.ts +6 -0
- package/types/components/Nestable/actions/moveItem.d.ts +5 -0
- package/types/components/Nestable/actions/paths.d.ts +5 -0
- package/types/components/Nestable/actions/tryDecreaseDepth.d.ts +1 -0
- package/types/components/Nestable/actions/tryIncreaseDepth.d.ts +1 -0
- package/types/components/Nestable/index.d.ts +2 -0
- package/types/components/QueryBuilderContext/QueryBuilderContext.d.ts +2 -0
- package/types/components/QueryBuilderImpl.d.ts +49 -0
- package/types/components/QueryBuilderItem/QueryBuilderItem.d.ts +5 -0
- package/types/components/QueryBuilderRow/QueryBuilderRow.d.ts +12 -0
- package/types/components/ToolBarAnimation/ToolBarAnimation.d.ts +3 -0
- package/types/components/format/format.d.ts +26 -0
- package/types/components/format/sqlFormat.d.ts +5 -0
- package/types/components/format/sqlSafeFormat.d.ts +6 -0
- package/types/components/format/xmlFormat.d.ts +5 -0
- package/types/components/helpers/actions.d.ts +63 -0
- package/types/components/helpers/constants.d.ts +3 -0
- package/types/components/helpers/dependencies.d.ts +1 -0
- package/types/components/helpers/selectors.d.ts +20 -0
- package/types/components/helpers/store.d.ts +144 -0
- package/types/components/helpers/types.d.ts +50 -0
- package/types/index.d.ts +2 -0
- package/types/propTypes.d.ts +156 -0
- package/DSQueryBuilder/package.json +0 -10
- package/cjs/DSQueryBuilder.js.map +0 -1
- package/cjs/components/AndOrController/AndOrController.js.map +0 -1
- package/cjs/components/ConditionController/ConditionController.js.map +0 -1
- package/cjs/components/DisplayOutput/DisplayOutput.js.map +0 -1
- package/cjs/components/DragContainerController/DragContainerController.js.map +0 -1
- package/cjs/components/DragControllerRow/DragControllerRow.js.map +0 -1
- package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +0 -1
- package/cjs/components/Nestable/Nestable.js.map +0 -1
- package/cjs/components/Nestable/NestableItem.js.map +0 -1
- package/cjs/components/Nestable/actions/events.js.map +0 -1
- package/cjs/components/Nestable/actions/getItemOptions.js.map +0 -1
- package/cjs/components/Nestable/actions/getPaths.js.map +0 -1
- package/cjs/components/Nestable/actions/index.js.map +0 -1
- package/cjs/components/Nestable/actions/moveItem.js.map +0 -1
- package/cjs/components/Nestable/actions/paths.js.map +0 -1
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +0 -1
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +0 -1
- package/cjs/components/Nestable/index.js.map +0 -1
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -1
- package/cjs/components/QueryBuilderImpl.js.map +0 -1
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -1
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -1
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -1
- package/cjs/components/format/format.js.map +0 -1
- package/cjs/components/format/sqlFormat.js.map +0 -1
- package/cjs/components/format/sqlSafeFormat.js.map +0 -1
- package/cjs/components/format/xmlFormat.js.map +0 -1
- package/cjs/components/helpers/actions.js.map +0 -1
- package/cjs/components/helpers/constants.js.map +0 -1
- package/cjs/components/helpers/dependencies.js.map +0 -1
- package/cjs/components/helpers/selectors.js.map +0 -1
- package/cjs/components/helpers/store.js.map +0 -1
- package/cjs/components/helpers/types.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/propTypes.js.map +0 -1
- package/components/AndOrController/AndOrController/package.json +0 -10
- package/components/ConditionController/ConditionController/package.json +0 -10
- package/components/DisplayOutput/DisplayOutput/package.json +0 -10
- package/components/DragContainerController/DragContainerController/package.json +0 -10
- package/components/DragControllerRow/DragControllerRow/package.json +0 -10
- package/components/FieldControllerRow/FieldControllerRow/package.json +0 -10
- package/components/Nestable/Nestable/package.json +0 -10
- package/components/Nestable/NestableItem/package.json +0 -10
- package/components/Nestable/actions/events/package.json +0 -10
- package/components/Nestable/actions/getItemOptions/package.json +0 -10
- package/components/Nestable/actions/getPaths/package.json +0 -10
- package/components/Nestable/actions/moveItem/package.json +0 -10
- package/components/Nestable/actions/package.json +0 -10
- package/components/Nestable/actions/paths/package.json +0 -10
- package/components/Nestable/actions/tryDecreaseDepth/package.json +0 -10
- package/components/Nestable/actions/tryIncreaseDepth/package.json +0 -10
- package/components/Nestable/package.json +0 -10
- package/components/QueryBuilderContext/QueryBuilderContext/package.json +0 -10
- package/components/QueryBuilderImpl/package.json +0 -10
- package/components/QueryBuilderItem/QueryBuilderItem/package.json +0 -10
- package/components/QueryBuilderRow/QueryBuilderRow/package.json +0 -10
- package/components/ToolBarAnimation/ToolBarAnimation/package.json +0 -10
- package/components/format/format/package.json +0 -10
- package/components/format/sqlFormat/package.json +0 -10
- package/components/format/sqlSafeFormat/package.json +0 -10
- package/components/format/xmlFormat/package.json +0 -10
- package/components/helpers/actions/package.json +0 -10
- package/components/helpers/constants/package.json +0 -10
- package/components/helpers/dependencies/package.json +0 -10
- package/components/helpers/selectors/package.json +0 -10
- package/components/helpers/store/package.json +0 -10
- package/components/helpers/types/package.json +0 -10
- package/esm/DSQueryBuilder.js.map +0 -1
- package/esm/components/AndOrController/AndOrController.js.map +0 -1
- package/esm/components/ConditionController/ConditionController.js.map +0 -1
- package/esm/components/DisplayOutput/DisplayOutput.js.map +0 -1
- package/esm/components/DragContainerController/DragContainerController.js.map +0 -1
- package/esm/components/DragControllerRow/DragControllerRow.js.map +0 -1
- package/esm/components/FieldControllerRow/FieldControllerRow.js.map +0 -1
- package/esm/components/Nestable/Nestable.js.map +0 -1
- package/esm/components/Nestable/NestableItem.js.map +0 -1
- package/esm/components/Nestable/actions/events.js.map +0 -1
- package/esm/components/Nestable/actions/getItemOptions.js.map +0 -1
- package/esm/components/Nestable/actions/getPaths.js.map +0 -1
- package/esm/components/Nestable/actions/index.js.map +0 -1
- package/esm/components/Nestable/actions/moveItem.js.map +0 -1
- package/esm/components/Nestable/actions/paths.js.map +0 -1
- package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +0 -1
- package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +0 -1
- package/esm/components/Nestable/index.js.map +0 -1
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +0 -1
- package/esm/components/QueryBuilderImpl.js.map +0 -1
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +0 -1
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +0 -1
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +0 -1
- package/esm/components/format/format.js.map +0 -1
- package/esm/components/format/sqlFormat.js.map +0 -1
- package/esm/components/format/sqlSafeFormat.js.map +0 -1
- package/esm/components/format/xmlFormat.js.map +0 -1
- package/esm/components/helpers/actions.js.map +0 -1
- package/esm/components/helpers/constants.js.map +0 -1
- package/esm/components/helpers/dependencies.js.map +0 -1
- package/esm/components/helpers/selectors.js.map +0 -1
- package/esm/components/helpers/store.js.map +0 -1
- package/esm/components/helpers/types.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/propTypes.js.map +0 -1
- package/propTypes/package.json +0 -10
|
@@ -1,32 +1,44 @@
|
|
|
1
|
-
import
|
|
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';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import 'react';
|
|
4
11
|
import cn from 'classnames';
|
|
12
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
13
|
|
|
6
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7
15
|
|
|
8
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
17
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 = {
|
|
30
42
|
className: cn("nestable-item".concat(isCopy ? '-copy' : ''), "nestable-item".concat(isCopy ? '-copy' : '', "-").concat(item.id), "nestable-item-type-".concat(item.element.type), {
|
|
31
43
|
'is-or-group': isOrGroup,
|
|
32
44
|
'is-and-group': isAndGroup,
|
|
@@ -36,48 +48,47 @@ var NestableItem = function NestableItem(_ref) {
|
|
|
36
48
|
'is-dragging': isDragging
|
|
37
49
|
})
|
|
38
50
|
};
|
|
39
|
-
|
|
40
|
-
|
|
51
|
+
let rowProps = {};
|
|
52
|
+
let handlerProps = {};
|
|
41
53
|
|
|
42
54
|
if (!isCopy) {
|
|
43
55
|
if (dragItem) {
|
|
44
56
|
rowProps = _objectSpread(_objectSpread({}, rowProps), {}, {
|
|
45
|
-
onMouseEnter:
|
|
46
|
-
return options.onMouseEnter(e, item);
|
|
47
|
-
}
|
|
57
|
+
onMouseEnter: e => options.onMouseEnter(e, item)
|
|
48
58
|
});
|
|
49
59
|
} else {
|
|
50
60
|
handlerProps = _objectSpread(_objectSpread({}, handlerProps), {}, {
|
|
51
61
|
draggable: isDraggableItem !== false,
|
|
52
|
-
onDragStart:
|
|
53
|
-
return options.onDragStart(e, item);
|
|
54
|
-
}
|
|
62
|
+
onDragStart: e => options.onDragStart(e, item)
|
|
55
63
|
});
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
if (handler) {
|
|
60
|
-
Handler = /*#__PURE__*/
|
|
68
|
+
Handler = /*#__PURE__*/jsx("span", _objectSpread(_objectSpread({
|
|
61
69
|
className: "nestable-item-handler"
|
|
62
|
-
}, handlerProps),
|
|
70
|
+
}, handlerProps), {}, {
|
|
71
|
+
children: handler
|
|
72
|
+
})); // Handler = React.cloneElement(handler, handlerProps);
|
|
63
73
|
} else {
|
|
64
74
|
rowProps = _objectSpread(_objectSpread({}, rowProps), handlerProps);
|
|
65
75
|
}
|
|
66
76
|
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
const childLength = item[childrenProp].length;
|
|
78
|
+
let childClass = 'single';
|
|
69
79
|
if (childLength === 0) childClass = 'empty';else if (childLength > 1) childClass = 'multiple';
|
|
70
|
-
return /*#__PURE__*/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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, {
|
|
81
92
|
index: i,
|
|
82
93
|
isAndItem: isAndGroup,
|
|
83
94
|
isCopy: isCopy,
|
|
@@ -85,9 +96,8 @@ var NestableItem = function NestableItem(_ref) {
|
|
|
85
96
|
item: currentitem,
|
|
86
97
|
options: options,
|
|
87
98
|
singleRow: singleRow
|
|
88
|
-
})
|
|
89
|
-
}))
|
|
99
|
+
}, i)))]
|
|
100
|
+
}));
|
|
90
101
|
};
|
|
91
102
|
|
|
92
103
|
export { NestableItem as default };
|
|
93
|
-
//# sourceMappingURL=NestableItem.js.map
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
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';
|
|
2
7
|
import { closest, getTransformProps, getOffsetRect, getTotalScroll } from '@elliemae/ds-shared/utils';
|
|
3
8
|
|
|
4
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -13,7 +18,9 @@ function onDragStart(e, item) {
|
|
|
13
18
|
this.el = closest(e.target, '.nestable-item');
|
|
14
19
|
this.startTrackMouse();
|
|
15
20
|
this.onMouseMove(e);
|
|
16
|
-
|
|
21
|
+
const {
|
|
22
|
+
items
|
|
23
|
+
} = this.state;
|
|
17
24
|
this.setState({
|
|
18
25
|
dragItem: item,
|
|
19
26
|
itemsOld: items
|
|
@@ -24,24 +31,31 @@ function onDragEnd(e, isCancel) {
|
|
|
24
31
|
this.stopTrackMouse();
|
|
25
32
|
this.el = null; // check if filter has children
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
const {
|
|
35
|
+
items
|
|
36
|
+
} = this.state;
|
|
37
|
+
const nestedInFilter = this.checkFilterChildren(items);
|
|
29
38
|
if (nestedInFilter) return this.dragRevert();
|
|
30
39
|
return isCancel ? this.dragRevert() : this.dragApply();
|
|
31
40
|
}
|
|
32
41
|
function onMouseMove(e) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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"));
|
|
41
55
|
|
|
42
56
|
if (!this.elCopyStyles) {
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
const offset = getOffsetRect(this.el);
|
|
58
|
+
const scroll = getTotalScroll(this.el);
|
|
45
59
|
this.elCopyStyles = _objectSpread({
|
|
46
60
|
marginTop: offset.top - clientY - scroll.top,
|
|
47
61
|
marginLeft: offset.left - clientX - scroll.left
|
|
@@ -49,13 +63,13 @@ function onMouseMove(e) {
|
|
|
49
63
|
} else {
|
|
50
64
|
this.elCopyStyles = _objectSpread(_objectSpread({}, this.elCopyStyles), transformProps);
|
|
51
65
|
|
|
52
|
-
for (
|
|
66
|
+
for (const key in transformProps) {
|
|
53
67
|
if (transformProps.hasOwnProperty(key)) {
|
|
54
68
|
elCopy.style[key] = transformProps[key];
|
|
55
69
|
}
|
|
56
70
|
}
|
|
57
71
|
|
|
58
|
-
|
|
72
|
+
const diffX = clientX - this.mouse.last.x;
|
|
59
73
|
|
|
60
74
|
if (diffX >= 0 && this.mouse.shift.x >= 0 || diffX <= 0 && this.mouse.shift.x <= 0) {
|
|
61
75
|
this.mouse.shift.x += diffX;
|
|
@@ -82,20 +96,23 @@ function onMouseEnter(e, item) {
|
|
|
82
96
|
e.stopPropagation();
|
|
83
97
|
}
|
|
84
98
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
const {
|
|
100
|
+
collapsed,
|
|
101
|
+
childrenProp
|
|
102
|
+
} = this.props;
|
|
103
|
+
const {
|
|
104
|
+
dragItem
|
|
105
|
+
} = this.state;
|
|
89
106
|
if (dragItem.id === item.id) return;
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
const pathFrom = this.getPathById(dragItem.id);
|
|
108
|
+
const pathTo = this.getPathById(item.id); // if collapsed by default
|
|
92
109
|
// and move last (by count) child
|
|
93
110
|
// remove parent node from list of open nodes
|
|
94
111
|
|
|
95
|
-
|
|
112
|
+
let collapseProps = {};
|
|
96
113
|
|
|
97
114
|
if (collapsed && pathFrom.length > 1) {
|
|
98
|
-
|
|
115
|
+
const parent = this.getItemByPath(pathFrom.slice(0, -1));
|
|
99
116
|
|
|
100
117
|
if (parent[childrenProp].length === 1) {
|
|
101
118
|
collapseProps = this.onToggleCollapse(parent, true);
|
|
@@ -103,19 +120,21 @@ function onMouseEnter(e, item) {
|
|
|
103
120
|
}
|
|
104
121
|
|
|
105
122
|
this.moveItem({
|
|
106
|
-
dragItem
|
|
107
|
-
pathFrom
|
|
108
|
-
pathTo
|
|
123
|
+
dragItem,
|
|
124
|
+
pathFrom,
|
|
125
|
+
pathTo
|
|
109
126
|
}, collapseProps);
|
|
110
127
|
}
|
|
111
128
|
function onToggleCollapse(item, isGetter) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
collapsedGroups
|
|
117
|
-
|
|
118
|
-
|
|
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)
|
|
119
138
|
};
|
|
120
139
|
|
|
121
140
|
if (isGetter) {
|
|
@@ -132,4 +151,3 @@ function onKeyDown(e) {
|
|
|
132
151
|
}
|
|
133
152
|
|
|
134
153
|
export { onDragEnd, onDragStart, onKeyDown, onMouseEnter, onMouseMove, onToggleCollapse };
|
|
135
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
function getItemOptions() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const {
|
|
3
|
+
renderItem,
|
|
4
|
+
renderCollapseIcon,
|
|
5
|
+
handler,
|
|
6
|
+
childrenProp
|
|
7
|
+
} = this.props;
|
|
8
|
+
const {
|
|
9
|
+
dragItem
|
|
10
|
+
} = this.state;
|
|
8
11
|
return {
|
|
9
|
-
dragItem
|
|
10
|
-
childrenProp
|
|
11
|
-
renderItem
|
|
12
|
-
renderCollapseIcon
|
|
13
|
-
handler
|
|
12
|
+
dragItem,
|
|
13
|
+
childrenProp,
|
|
14
|
+
renderItem,
|
|
15
|
+
renderCollapseIcon,
|
|
16
|
+
handler,
|
|
14
17
|
onDragStart: this.onDragStart,
|
|
15
18
|
onMouseEnter: this.onMouseEnter,
|
|
16
19
|
isCollapsed: this.isCollapsed,
|
|
@@ -19,4 +22,3 @@ function getItemOptions() {
|
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export { getItemOptions };
|
|
22
|
-
//# sourceMappingURL=getItemOptions.js.map
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.every.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.every.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
9
|
|
|
4
10
|
function getRealNextPath(prevPath, nextPath) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
const {
|
|
12
|
+
childrenProp
|
|
13
|
+
} = this.props;
|
|
14
|
+
const ppLastIndex = prevPath.length - 1;
|
|
15
|
+
const npLastIndex = nextPath.length - 1;
|
|
8
16
|
|
|
9
17
|
if (prevPath.length < nextPath.length) {
|
|
10
18
|
// move into deep
|
|
11
|
-
|
|
12
|
-
return nextPath.map(
|
|
19
|
+
let wasShifted = false;
|
|
20
|
+
return nextPath.map((nextIndex, i) => {
|
|
13
21
|
if (wasShifted) {
|
|
14
22
|
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
15
23
|
}
|
|
@@ -30,7 +38,7 @@ function getRealNextPath(prevPath, nextPath) {
|
|
|
30
38
|
if (prevPath.length === nextPath.length) {
|
|
31
39
|
// if move bottom + move to item with children => make it a first child instead of swap
|
|
32
40
|
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
33
|
-
|
|
41
|
+
const target = this.getItemByPath(nextPath);
|
|
34
42
|
|
|
35
43
|
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
36
44
|
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
@@ -41,15 +49,15 @@ function getRealNextPath(prevPath, nextPath) {
|
|
|
41
49
|
return nextPath;
|
|
42
50
|
}
|
|
43
51
|
function getPathById(id, items) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
items.every(
|
|
52
|
+
const {
|
|
53
|
+
childrenProp
|
|
54
|
+
} = this.props;
|
|
55
|
+
let path = [];
|
|
56
|
+
items.every((item, i) => {
|
|
49
57
|
if (item.id === id) {
|
|
50
58
|
path.push(i);
|
|
51
59
|
} else if (item[childrenProp]) {
|
|
52
|
-
|
|
60
|
+
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
53
61
|
|
|
54
62
|
if (childrenPath.length) {
|
|
55
63
|
path = path.concat(i).concat(childrenPath);
|
|
@@ -61,38 +69,44 @@ function getPathById(id, items) {
|
|
|
61
69
|
return path;
|
|
62
70
|
}
|
|
63
71
|
function getItemByPath(path, items) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
const {
|
|
73
|
+
childrenProp
|
|
74
|
+
} = this.props;
|
|
75
|
+
let item = null;
|
|
76
|
+
path.forEach(index => {
|
|
77
|
+
const list = item ? item[childrenProp] : items;
|
|
68
78
|
item = list[index];
|
|
69
79
|
});
|
|
70
80
|
return item;
|
|
71
81
|
}
|
|
72
82
|
function getItemDepth(item) {
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
const {
|
|
84
|
+
childrenProp
|
|
85
|
+
} = this.props;
|
|
86
|
+
let level = 1;
|
|
75
87
|
|
|
76
88
|
if (item[childrenProp].length > 0) {
|
|
77
|
-
|
|
78
|
-
level += Math.max
|
|
89
|
+
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
90
|
+
level += Math.max(...childrenDepths);
|
|
79
91
|
}
|
|
80
92
|
|
|
81
93
|
return level;
|
|
82
94
|
}
|
|
83
95
|
function getSplicePath(path) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
path.forEach(
|
|
96
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
97
|
+
const splicePath = {};
|
|
98
|
+
const numToRemove = options.numToRemove || 0;
|
|
99
|
+
const itemsToInsert = options.itemsToInsert || [];
|
|
100
|
+
const lastIndex = path.length - 1;
|
|
101
|
+
let currentPath = splicePath;
|
|
102
|
+
path.forEach((index, i) => {
|
|
91
103
|
if (i === lastIndex) {
|
|
92
|
-
currentPath.$splice = [[index, numToRemove
|
|
104
|
+
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
93
105
|
} else {
|
|
94
|
-
|
|
95
|
-
currentPath[index] =
|
|
106
|
+
const nextPath = {};
|
|
107
|
+
currentPath[index] = {
|
|
108
|
+
[options.childrenProp]: nextPath
|
|
109
|
+
};
|
|
96
110
|
currentPath = nextPath;
|
|
97
111
|
}
|
|
98
112
|
});
|
|
@@ -100,4 +114,3 @@ function getSplicePath(path) {
|
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
export { getItemByPath, getItemDepth, getPathById, getRealNextPath, getSplicePath };
|
|
103
|
-
//# sourceMappingURL=getPaths.js.map
|
|
@@ -4,8 +4,3 @@ export { moveItem } from './moveItem.js';
|
|
|
4
4
|
export { getItemByPath, getItemDepth, getPathById, getRealNextPath, getSplicePath } from './paths.js';
|
|
5
5
|
export { onDragEnd, onDragStart, onKeyDown, onMouseEnter, onMouseMove, onToggleCollapse } from './events.js';
|
|
6
6
|
export { getItemOptions } from './getItemOptions.js';
|
|
7
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
-
import 'react-addons-update';
|
|
9
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
10
|
-
import '@elliemae/ds-shared/utils';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import update from 'react-addons-update';
|
|
3
8
|
|
|
@@ -5,31 +10,36 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
10
|
|
|
6
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
12
|
function moveItem(_ref) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
let {
|
|
14
|
+
dragItem,
|
|
15
|
+
pathFrom,
|
|
16
|
+
pathTo
|
|
17
|
+
} = _ref;
|
|
18
|
+
let extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
|
+
const {
|
|
20
|
+
childrenProp
|
|
21
|
+
} = this.props;
|
|
22
|
+
let {
|
|
23
|
+
items
|
|
24
|
+
} = this.state; // the remove action might affect the next position,
|
|
14
25
|
// so update next coordinates accordingly
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
const realPathTo = this.getRealNextPath(pathFrom, pathTo);
|
|
28
|
+
const removePath = this.getSplicePath(pathFrom, {
|
|
18
29
|
numToRemove: 1,
|
|
19
|
-
childrenProp
|
|
30
|
+
childrenProp
|
|
20
31
|
});
|
|
21
|
-
|
|
32
|
+
const insertPath = this.getSplicePath(realPathTo, {
|
|
22
33
|
numToRemove: 0,
|
|
23
34
|
itemsToInsert: [dragItem],
|
|
24
|
-
childrenProp
|
|
35
|
+
childrenProp
|
|
25
36
|
});
|
|
26
37
|
items = update(items, removePath);
|
|
27
38
|
items = update(items, insertPath);
|
|
28
39
|
this.setState(_objectSpread({
|
|
29
|
-
items
|
|
40
|
+
items,
|
|
30
41
|
isDirty: true
|
|
31
42
|
}, extraProps));
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
export { moveItem };
|
|
35
|
-
//# sourceMappingURL=moveItem.js.map
|