@elliemae/ds-query-builder 3.0.0-next.1 → 3.0.0-next.5
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/dist/cjs/DSQueryBuilder.js +118 -0
- package/dist/cjs/DSQueryBuilder.js.map +7 -0
- package/dist/cjs/components/AndOrController/AndOrController.js +208 -0
- package/dist/cjs/components/AndOrController/AndOrController.js.map +7 -0
- package/dist/cjs/components/ConditionController/ConditionController.js +116 -0
- package/dist/cjs/components/ConditionController/ConditionController.js.map +7 -0
- package/dist/cjs/components/DisplayOutput/DisplayOutput.js +92 -0
- package/dist/cjs/components/DisplayOutput/DisplayOutput.js.map +7 -0
- package/dist/cjs/components/DragContainerController/DragContainerController.js +65 -0
- package/dist/cjs/components/DragContainerController/DragContainerController.js.map +7 -0
- package/dist/cjs/components/DragControllerRow/DragControllerRow.js +83 -0
- package/dist/cjs/components/DragControllerRow/DragControllerRow.js.map +7 -0
- package/dist/cjs/components/FieldControllerRow/FieldControllerRow.js +55 -0
- package/dist/cjs/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
- package/dist/cjs/components/Nestable/Nestable.js +264 -0
- package/dist/cjs/components/Nestable/Nestable.js.map +7 -0
- package/dist/cjs/components/Nestable/NestableItem.js +127 -0
- package/dist/cjs/components/Nestable/NestableItem.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/events.js +153 -0
- package/dist/cjs/components/Nestable/actions/events.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/getItemOptions.js +49 -0
- package/dist/cjs/components/Nestable/actions/getItemOptions.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/getPaths.js +119 -0
- package/dist/cjs/components/Nestable/actions/getPaths.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/index.js +42 -0
- package/dist/cjs/components/Nestable/actions/index.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/moveItem.js +69 -0
- package/dist/cjs/components/Nestable/actions/moveItem.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/paths.js +119 -0
- package/dist/cjs/components/Nestable/actions/paths.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/tryDecreaseDepth.js +51 -0
- package/dist/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
- package/dist/cjs/components/Nestable/actions/tryIncreaseDepth.js +51 -0
- package/dist/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
- package/dist/cjs/components/Nestable/index.js +36 -0
- package/dist/cjs/components/Nestable/index.js.map +7 -0
- package/dist/cjs/components/QueryBuilderContext/QueryBuilderContext.js +36 -0
- package/dist/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
- package/dist/cjs/components/QueryBuilderImpl.js +253 -0
- package/dist/cjs/components/QueryBuilderImpl.js.map +7 -0
- package/dist/cjs/components/QueryBuilderItem/QueryBuilderItem.js +108 -0
- package/dist/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js +235 -0
- package/dist/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
- package/dist/cjs/components/ToolBarAnimation/ToolBarAnimation.js +58 -0
- package/dist/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
- package/dist/cjs/components/format/format.js +59 -0
- package/dist/cjs/components/format/format.js.map +7 -0
- package/dist/cjs/components/format/sqlFormat.js +94 -0
- package/dist/cjs/components/format/sqlFormat.js.map +7 -0
- package/dist/cjs/components/format/sqlSafeFormat.js +98 -0
- package/dist/cjs/components/format/sqlSafeFormat.js.map +7 -0
- package/dist/cjs/components/format/xmlFormat.js +94 -0
- package/dist/cjs/components/format/xmlFormat.js.map +7 -0
- package/dist/cjs/components/helpers/actions.js +253 -0
- package/dist/cjs/components/helpers/actions.js.map +7 -0
- package/dist/cjs/components/helpers/constants.js +39 -0
- package/dist/cjs/components/helpers/constants.js.map +7 -0
- package/dist/cjs/components/helpers/dependencies.js +69 -0
- package/dist/cjs/components/helpers/dependencies.js.map +7 -0
- package/dist/cjs/components/helpers/selectors.js +161 -0
- package/dist/cjs/components/helpers/selectors.js.map +7 -0
- package/dist/cjs/components/helpers/store.js +171 -0
- package/dist/cjs/components/helpers/store.js.map +7 -0
- package/dist/cjs/components/helpers/types.js +92 -0
- package/dist/cjs/components/helpers/types.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +105 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/esm/DSQueryBuilder.js +105 -0
- package/dist/esm/DSQueryBuilder.js.map +7 -0
- package/dist/esm/components/AndOrController/AndOrController.js +179 -0
- package/dist/esm/components/AndOrController/AndOrController.js.map +7 -0
- package/dist/esm/components/ConditionController/ConditionController.js +87 -0
- package/dist/esm/components/ConditionController/ConditionController.js.map +7 -0
- package/dist/esm/components/DisplayOutput/DisplayOutput.js +63 -0
- package/dist/esm/components/DisplayOutput/DisplayOutput.js.map +7 -0
- package/dist/esm/components/DragContainerController/DragContainerController.js +36 -0
- package/dist/esm/components/DragContainerController/DragContainerController.js.map +7 -0
- package/dist/esm/components/DragControllerRow/DragControllerRow.js +56 -0
- package/dist/esm/components/DragControllerRow/DragControllerRow.js.map +7 -0
- package/dist/esm/components/FieldControllerRow/FieldControllerRow.js +26 -0
- package/dist/esm/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
- package/dist/esm/components/Nestable/Nestable.js +253 -0
- package/dist/esm/components/Nestable/Nestable.js.map +7 -0
- package/dist/esm/components/Nestable/NestableItem.js +100 -0
- package/dist/esm/components/Nestable/NestableItem.js.map +7 -0
- package/dist/esm/components/Nestable/actions/events.js +131 -0
- package/dist/esm/components/Nestable/actions/events.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/getItemOptions.js +7 -11
- package/dist/esm/components/Nestable/actions/getItemOptions.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/getPaths.js +17 -43
- package/dist/esm/components/Nestable/actions/getPaths.js.map +7 -0
- package/dist/esm/components/Nestable/actions/index.js +13 -0
- package/dist/esm/components/Nestable/actions/index.js.map +7 -0
- package/dist/esm/components/Nestable/actions/moveItem.js +42 -0
- package/dist/esm/components/Nestable/actions/moveItem.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/paths.js +19 -47
- package/dist/esm/components/Nestable/actions/paths.js.map +7 -0
- package/dist/esm/components/Nestable/actions/tryDecreaseDepth.js +22 -0
- package/dist/esm/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
- package/{esm → dist/esm}/components/Nestable/actions/tryIncreaseDepth.js +10 -22
- package/dist/esm/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
- package/dist/esm/components/Nestable/index.js +7 -0
- package/dist/esm/components/Nestable/index.js.map +7 -0
- package/dist/esm/components/QueryBuilderContext/QueryBuilderContext.js +7 -0
- package/dist/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
- package/dist/esm/components/QueryBuilderImpl.js +226 -0
- package/dist/esm/components/QueryBuilderImpl.js.map +7 -0
- package/dist/esm/components/QueryBuilderItem/QueryBuilderItem.js +81 -0
- package/dist/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js +208 -0
- package/dist/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
- package/dist/esm/components/ToolBarAnimation/ToolBarAnimation.js +31 -0
- package/dist/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
- package/dist/esm/components/format/format.js +30 -0
- package/dist/esm/components/format/format.js.map +7 -0
- package/dist/esm/components/format/sqlFormat.js +65 -0
- package/dist/esm/components/format/sqlFormat.js.map +7 -0
- package/dist/esm/components/format/sqlSafeFormat.js +69 -0
- package/dist/esm/components/format/sqlSafeFormat.js.map +7 -0
- package/dist/esm/components/format/xmlFormat.js +65 -0
- package/dist/esm/components/format/xmlFormat.js.map +7 -0
- package/dist/esm/components/helpers/actions.js +230 -0
- package/dist/esm/components/helpers/actions.js.map +7 -0
- package/dist/esm/components/helpers/constants.js +10 -0
- package/dist/esm/components/helpers/constants.js.map +7 -0
- package/dist/esm/components/helpers/dependencies.js +40 -0
- package/dist/esm/components/helpers/dependencies.js.map +7 -0
- package/dist/esm/components/helpers/selectors.js +132 -0
- package/dist/esm/components/helpers/selectors.js.map +7 -0
- package/dist/esm/components/helpers/store.js +157 -0
- package/dist/esm/components/helpers/store.js.map +7 -0
- package/dist/esm/components/helpers/types.js +63 -0
- package/dist/esm/components/helpers/types.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +76 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/package.json +103 -94
- package/cjs/DSQueryBuilder.js +0 -98
- package/cjs/components/AndOrController/AndOrController.js +0 -222
- package/cjs/components/ConditionController/ConditionController.js +0 -100
- package/cjs/components/DisplayOutput/DisplayOutput.js +0 -93
- package/cjs/components/DragContainerController/DragContainerController.js +0 -45
- package/cjs/components/DragControllerRow/DragControllerRow.js +0 -47
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +0 -33
- package/cjs/components/Nestable/Nestable.js +0 -320
- package/cjs/components/Nestable/NestableItem.js +0 -111
- package/cjs/components/Nestable/actions/events.js +0 -166
- package/cjs/components/Nestable/actions/getItemOptions.js +0 -28
- package/cjs/components/Nestable/actions/getPaths.js +0 -124
- package/cjs/components/Nestable/actions/index.js +0 -28
- package/cjs/components/Nestable/actions/moveItem.js +0 -54
- package/cjs/components/Nestable/actions/paths.js +0 -126
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +0 -35
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +0 -38
- package/cjs/components/Nestable/index.js +0 -7
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +0 -13
- package/cjs/components/QueryBuilderImpl.js +0 -309
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +0 -90
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +0 -276
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +0 -29
- package/cjs/components/format/format.js +0 -33
- package/cjs/components/format/sqlFormat.js +0 -73
- package/cjs/components/format/sqlSafeFormat.js +0 -81
- package/cjs/components/format/xmlFormat.js +0 -73
- package/cjs/components/helpers/actions.js +0 -277
- package/cjs/components/helpers/constants.js +0 -11
- package/cjs/components/helpers/dependencies.js +0 -84
- package/cjs/components/helpers/selectors.js +0 -101
- package/cjs/components/helpers/store.js +0 -177
- package/cjs/components/helpers/types.js +0 -64
- package/cjs/index.js +0 -29
- package/cjs/propTypes.js +0 -97
- package/esm/DSQueryBuilder.js +0 -74
- package/esm/components/AndOrController/AndOrController.js +0 -213
- package/esm/components/ConditionController/ConditionController.js +0 -92
- package/esm/components/DisplayOutput/DisplayOutput.js +0 -87
- package/esm/components/DragContainerController/DragContainerController.js +0 -39
- package/esm/components/DragControllerRow/DragControllerRow.js +0 -39
- package/esm/components/FieldControllerRow/FieldControllerRow.js +0 -27
- package/esm/components/Nestable/Nestable.js +0 -312
- package/esm/components/Nestable/NestableItem.js +0 -103
- package/esm/components/Nestable/actions/events.js +0 -153
- package/esm/components/Nestable/actions/index.js +0 -6
- package/esm/components/Nestable/actions/moveItem.js +0 -45
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +0 -31
- package/esm/components/Nestable/index.js +0 -2
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +0 -5
- package/esm/components/QueryBuilderImpl.js +0 -301
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +0 -83
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +0 -268
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +0 -20
- package/esm/components/format/format.js +0 -31
- package/esm/components/format/sqlFormat.js +0 -69
- package/esm/components/format/sqlSafeFormat.js +0 -76
- package/esm/components/format/xmlFormat.js +0 -69
- package/esm/components/helpers/actions.js +0 -254
- package/esm/components/helpers/constants.js +0 -5
- package/esm/components/helpers/dependencies.js +0 -60
- package/esm/components/helpers/selectors.js +0 -93
- package/esm/components/helpers/store.js +0 -171
- package/esm/components/helpers/types.js +0 -52
- package/esm/index.js +0 -4
- package/esm/propTypes.js +0 -93
- package/types/DSQueryBuilder.d.ts +0 -211
- package/types/components/AndOrController/AndOrController.d.ts +0 -38
- package/types/components/ConditionController/ConditionController.d.ts +0 -16
- package/types/components/DisplayOutput/DisplayOutput.d.ts +0 -7
- package/types/components/DragContainerController/DragContainerController.d.ts +0 -9
- package/types/components/DragControllerRow/DragControllerRow.d.ts +0 -9
- package/types/components/FieldControllerRow/FieldControllerRow.d.ts +0 -9
- package/types/components/Nestable/Nestable.d.ts +0 -51
- package/types/components/Nestable/NestableItem.d.ts +0 -12
- package/types/components/Nestable/actions/events.d.ts +0 -6
- package/types/components/Nestable/actions/getItemOptions.d.ts +0 -11
- package/types/components/Nestable/actions/getPaths.d.ts +0 -5
- package/types/components/Nestable/actions/index.d.ts +0 -6
- package/types/components/Nestable/actions/moveItem.d.ts +0 -5
- package/types/components/Nestable/actions/paths.d.ts +0 -5
- package/types/components/Nestable/actions/tryDecreaseDepth.d.ts +0 -1
- package/types/components/Nestable/actions/tryIncreaseDepth.d.ts +0 -1
- package/types/components/Nestable/index.d.ts +0 -2
- package/types/components/QueryBuilderContext/QueryBuilderContext.d.ts +0 -2
- package/types/components/QueryBuilderImpl.d.ts +0 -49
- package/types/components/QueryBuilderItem/QueryBuilderItem.d.ts +0 -5
- package/types/components/QueryBuilderRow/QueryBuilderRow.d.ts +0 -12
- package/types/components/ToolBarAnimation/ToolBarAnimation.d.ts +0 -3
- package/types/components/format/format.d.ts +0 -26
- package/types/components/format/sqlFormat.d.ts +0 -5
- package/types/components/format/sqlSafeFormat.d.ts +0 -6
- package/types/components/format/xmlFormat.d.ts +0 -5
- package/types/components/helpers/actions.d.ts +0 -63
- package/types/components/helpers/constants.d.ts +0 -3
- package/types/components/helpers/dependencies.d.ts +0 -1
- package/types/components/helpers/selectors.d.ts +0 -20
- package/types/components/helpers/store.d.ts +0 -144
- package/types/components/helpers/types.d.ts +0 -50
- package/types/index.d.ts +0 -2
- package/types/propTypes.d.ts +0 -156
|
@@ -1,99 +1,69 @@
|
|
|
1
|
-
import
|
|
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';
|
|
9
|
-
|
|
1
|
+
import * as React from "react";
|
|
10
2
|
function getRealNextPath(prevPath, nextPath) {
|
|
11
|
-
const {
|
|
12
|
-
childrenProp
|
|
13
|
-
} = this.props;
|
|
3
|
+
const { childrenProp } = this.props;
|
|
14
4
|
const ppLastIndex = prevPath.length - 1;
|
|
15
5
|
const npLastIndex = nextPath.length - 1;
|
|
16
|
-
|
|
17
6
|
if (prevPath.length < nextPath.length) {
|
|
18
|
-
// move into deep
|
|
19
7
|
let wasShifted = false;
|
|
20
8
|
return nextPath.map((nextIndex, i) => {
|
|
21
9
|
if (wasShifted) {
|
|
22
10
|
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
if (typeof prevPath[i] !== 'number') {
|
|
12
|
+
if (typeof prevPath[i] !== "number") {
|
|
26
13
|
return nextIndex;
|
|
27
14
|
}
|
|
28
|
-
|
|
29
15
|
if (nextPath[i] > prevPath[i] && i === ppLastIndex) {
|
|
30
16
|
wasShifted = true;
|
|
31
17
|
return nextIndex - 1;
|
|
32
18
|
}
|
|
33
|
-
|
|
34
19
|
return nextIndex;
|
|
35
20
|
});
|
|
36
21
|
}
|
|
37
|
-
|
|
38
22
|
if (prevPath.length === nextPath.length) {
|
|
39
|
-
// if move bottom + move to item with children => make it a first child instead of swap
|
|
40
23
|
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
41
24
|
const target = this.getItemByPath(nextPath);
|
|
42
|
-
|
|
43
25
|
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
44
26
|
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
45
27
|
}
|
|
46
28
|
}
|
|
47
29
|
}
|
|
48
|
-
|
|
49
30
|
return nextPath;
|
|
50
31
|
}
|
|
51
32
|
function getPathById(id, items) {
|
|
52
|
-
const {
|
|
53
|
-
childrenProp
|
|
54
|
-
} = this.props;
|
|
33
|
+
const { childrenProp } = this.props;
|
|
55
34
|
let path = [];
|
|
56
35
|
items.every((item, i) => {
|
|
57
36
|
if (item.id === id) {
|
|
58
37
|
path.push(i);
|
|
59
38
|
} else if (item[childrenProp]) {
|
|
60
39
|
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
61
|
-
|
|
62
40
|
if (childrenPath.length) {
|
|
63
41
|
path = path.concat(i).concat(childrenPath);
|
|
64
42
|
}
|
|
65
43
|
}
|
|
66
|
-
|
|
67
44
|
return path.length === 0;
|
|
68
45
|
});
|
|
69
46
|
return path;
|
|
70
47
|
}
|
|
71
48
|
function getItemByPath(path, items) {
|
|
72
|
-
const {
|
|
73
|
-
childrenProp
|
|
74
|
-
} = this.props;
|
|
49
|
+
const { childrenProp } = this.props;
|
|
75
50
|
let item = null;
|
|
76
|
-
path.forEach(index => {
|
|
51
|
+
path.forEach((index) => {
|
|
77
52
|
const list = item ? item[childrenProp] : items;
|
|
78
53
|
item = list[index];
|
|
79
54
|
});
|
|
80
55
|
return item;
|
|
81
56
|
}
|
|
82
57
|
function getItemDepth(item) {
|
|
83
|
-
const {
|
|
84
|
-
childrenProp
|
|
85
|
-
} = this.props;
|
|
58
|
+
const { childrenProp } = this.props;
|
|
86
59
|
let level = 1;
|
|
87
|
-
|
|
88
60
|
if (item[childrenProp].length > 0) {
|
|
89
61
|
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
90
62
|
level += Math.max(...childrenDepths);
|
|
91
63
|
}
|
|
92
|
-
|
|
93
64
|
return level;
|
|
94
65
|
}
|
|
95
|
-
function getSplicePath(path) {
|
|
96
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
66
|
+
function getSplicePath(path, options = {}) {
|
|
97
67
|
const splicePath = {};
|
|
98
68
|
const numToRemove = options.numToRemove || 0;
|
|
99
69
|
const itemsToInsert = options.itemsToInsert || [];
|
|
@@ -104,13 +74,17 @@ function getSplicePath(path) {
|
|
|
104
74
|
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
105
75
|
} else {
|
|
106
76
|
const nextPath = {};
|
|
107
|
-
currentPath[index] = {
|
|
108
|
-
[options.childrenProp]: nextPath
|
|
109
|
-
};
|
|
77
|
+
currentPath[index] = { [options.childrenProp]: nextPath };
|
|
110
78
|
currentPath = nextPath;
|
|
111
79
|
}
|
|
112
80
|
});
|
|
113
81
|
return splicePath;
|
|
114
82
|
}
|
|
115
|
-
|
|
116
|
-
|
|
83
|
+
export {
|
|
84
|
+
getItemByPath,
|
|
85
|
+
getItemDepth,
|
|
86
|
+
getPathById,
|
|
87
|
+
getRealNextPath,
|
|
88
|
+
getSplicePath
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=getPaths.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/components/Nestable/actions/getPaths.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function getRealNextPath(prevPath, nextPath) {\n const { childrenProp } = this.props;\n const ppLastIndex = prevPath.length - 1;\n const npLastIndex = nextPath.length - 1;\n\n if (prevPath.length < nextPath.length) {\n // move into deep\n let wasShifted = false;\n\n return nextPath.map((nextIndex, i) => {\n if (wasShifted) {\n return i === npLastIndex ? nextIndex + 1 : nextIndex;\n }\n\n if (typeof prevPath[i] !== 'number') {\n return nextIndex;\n }\n\n if (nextPath[i] > prevPath[i] && i === ppLastIndex) {\n wasShifted = true;\n return nextIndex - 1;\n }\n\n return nextIndex;\n });\n }\n\n if (prevPath.length === nextPath.length) {\n // if move bottom + move to item with children => make it a first child instead of swap\n if (nextPath[npLastIndex] > prevPath[npLastIndex]) {\n const target = this.getItemByPath(nextPath);\n\n if (\n target[childrenProp] &&\n target[childrenProp].length &&\n !this.isCollapsed(target)\n ) {\n return nextPath\n .slice(0, -1)\n .concat(nextPath[npLastIndex] - 1)\n .concat(0);\n }\n }\n }\n\n return nextPath;\n}\n\nexport function getPathById(id, items) {\n const { childrenProp } = this.props;\n let path = [];\n\n items.every((item, i) => {\n if (item.id === id) {\n path.push(i);\n } else if (item[childrenProp]) {\n const childrenPath = this.getPathById(id, item[childrenProp]);\n\n if (childrenPath.length) {\n path = path.concat(i).concat(childrenPath);\n }\n }\n\n return path.length === 0;\n });\n\n return path;\n}\n\nexport function getItemByPath(path, items) {\n const { childrenProp } = this.props;\n let item = null;\n\n path.forEach(index => {\n const list = item ? item[childrenProp] : items;\n item = list[index];\n });\n\n return item;\n}\nexport function getItemDepth(item) {\n const { childrenProp } = this.props;\n let level = 1;\n\n if (item[childrenProp].length > 0) {\n const childrenDepths = item[childrenProp].map(this.getItemDepth);\n level += Math.max(...childrenDepths);\n }\n\n return level;\n}\nexport function getSplicePath(path, options = {}) {\n const splicePath = {};\n const numToRemove = options.numToRemove || 0;\n const itemsToInsert = options.itemsToInsert || [];\n const lastIndex = path.length - 1;\n let currentPath = splicePath;\n\n path.forEach((index, i) => {\n if (i === lastIndex) {\n currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];\n } else {\n const nextPath = {};\n currentPath[index] = { [options.childrenProp]: nextPath };\n currentPath = nextPath;\n }\n });\n\n return splicePath;\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,yBAAyB,UAAU,UAAU;AAClD,QAAM,EAAE,iBAAiB,KAAK;AAC9B,QAAM,cAAc,SAAS,SAAS;AACtC,QAAM,cAAc,SAAS,SAAS;AAEtC,MAAI,SAAS,SAAS,SAAS,QAAQ;AAErC,QAAI,aAAa;AAEjB,WAAO,SAAS,IAAI,CAAC,WAAW,MAAM;AACpC,UAAI,YAAY;AACd,eAAO,MAAM,cAAc,YAAY,IAAI;AAAA;AAG7C,UAAI,OAAO,SAAS,OAAO,UAAU;AACnC,eAAO;AAAA;AAGT,UAAI,SAAS,KAAK,SAAS,MAAM,MAAM,aAAa;AAClD,qBAAa;AACb,eAAO,YAAY;AAAA;AAGrB,aAAO;AAAA;AAAA;AAIX,MAAI,SAAS,WAAW,SAAS,QAAQ;AAEvC,QAAI,SAAS,eAAe,SAAS,cAAc;AACjD,YAAM,SAAS,KAAK,cAAc;AAElC,UACE,OAAO,iBACP,OAAO,cAAc,UACrB,CAAC,KAAK,YAAY,SAClB;AACA,eAAO,SACJ,MAAM,GAAG,IACT,OAAO,SAAS,eAAe,GAC/B,OAAO;AAAA;AAAA;AAAA;AAKhB,SAAO;AAAA;AAGF,qBAAqB,IAAI,OAAO;AACrC,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,OAAO;AAEX,QAAM,MAAM,CAAC,MAAM,MAAM;AACvB,QAAI,KAAK,OAAO,IAAI;AAClB,WAAK,KAAK;AAAA,eACD,KAAK,eAAe;AAC7B,YAAM,eAAe,KAAK,YAAY,IAAI,KAAK;AAE/C,UAAI,aAAa,QAAQ;AACvB,eAAO,KAAK,OAAO,GAAG,OAAO;AAAA;AAAA;AAIjC,WAAO,KAAK,WAAW;AAAA;AAGzB,SAAO;AAAA;AAGF,uBAAuB,MAAM,OAAO;AACzC,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,OAAO;AAEX,OAAK,QAAQ,WAAS;AACpB,UAAM,OAAO,OAAO,KAAK,gBAAgB;AACzC,WAAO,KAAK;AAAA;AAGd,SAAO;AAAA;AAEF,sBAAsB,MAAM;AACjC,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,QAAQ;AAEZ,MAAI,KAAK,cAAc,SAAS,GAAG;AACjC,UAAM,iBAAiB,KAAK,cAAc,IAAI,KAAK;AACnD,aAAS,KAAK,IAAI,GAAG;AAAA;AAGvB,SAAO;AAAA;AAEF,uBAAuB,MAAM,UAAU,IAAI;AAChD,QAAM,aAAa;AACnB,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,gBAAgB,QAAQ,iBAAiB;AAC/C,QAAM,YAAY,KAAK,SAAS;AAChC,MAAI,cAAc;AAElB,OAAK,QAAQ,CAAC,OAAO,MAAM;AACzB,QAAI,MAAM,WAAW;AACnB,kBAAY,UAAU,CAAC,CAAC,OAAO,aAAa,GAAG;AAAA,WAC1C;AACL,YAAM,WAAW;AACjB,kBAAY,SAAS,GAAG,QAAQ,eAAe;AAC/C,oBAAc;AAAA;AAAA;AAIlB,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { tryIncreaseDepth } from "./tryIncreaseDepth";
|
|
3
|
+
import { tryDecreaseDepth } from "./tryDecreaseDepth";
|
|
4
|
+
import { moveItem } from "./moveItem";
|
|
5
|
+
export * from "./paths";
|
|
6
|
+
export * from "./events";
|
|
7
|
+
export * from "./getItemOptions";
|
|
8
|
+
export {
|
|
9
|
+
moveItem,
|
|
10
|
+
tryDecreaseDepth,
|
|
11
|
+
tryIncreaseDepth
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/components/Nestable/actions/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { tryIncreaseDepth } from './tryIncreaseDepth';\nexport { tryDecreaseDepth } from './tryDecreaseDepth';\nexport { moveItem } from './moveItem';\nexport * from './paths';\nexport * from './events';\nexport * from './getItemOptions';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import update from "react-addons-update";
|
|
19
|
+
function moveItem({ dragItem, pathFrom, pathTo }, extraProps = {}) {
|
|
20
|
+
const { childrenProp } = this.props;
|
|
21
|
+
let { items } = this.state;
|
|
22
|
+
const realPathTo = this.getRealNextPath(pathFrom, pathTo);
|
|
23
|
+
const removePath = this.getSplicePath(pathFrom, {
|
|
24
|
+
numToRemove: 1,
|
|
25
|
+
childrenProp
|
|
26
|
+
});
|
|
27
|
+
const insertPath = this.getSplicePath(realPathTo, {
|
|
28
|
+
numToRemove: 0,
|
|
29
|
+
itemsToInsert: [dragItem],
|
|
30
|
+
childrenProp
|
|
31
|
+
});
|
|
32
|
+
items = update(items, removePath);
|
|
33
|
+
items = update(items, insertPath);
|
|
34
|
+
this.setState(__spreadValues({
|
|
35
|
+
items,
|
|
36
|
+
isDirty: true
|
|
37
|
+
}, extraProps));
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
moveItem
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=moveItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/components/Nestable/actions/moveItem.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import update from 'react-addons-update';\n\nexport function moveItem({ dragItem, pathFrom, pathTo }, extraProps = {}) {\n const { childrenProp } = this.props;\n let { items } = this.state;\n\n // the remove action might affect the next position,\n // so update next coordinates accordingly\n const realPathTo = this.getRealNextPath(pathFrom, pathTo);\n\n const removePath = this.getSplicePath(pathFrom, {\n numToRemove: 1,\n childrenProp,\n });\n\n const insertPath = this.getSplicePath(realPathTo, {\n numToRemove: 0,\n itemsToInsert: [dragItem],\n childrenProp,\n });\n\n items = update(items, removePath);\n items = update(items, insertPath);\n\n this.setState({\n items,\n isDirty: true,\n ...extraProps,\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AAEO,kBAAkB,EAAE,UAAU,UAAU,UAAU,aAAa,IAAI;AACxE,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,EAAE,UAAU,KAAK;AAIrB,QAAM,aAAa,KAAK,gBAAgB,UAAU;AAElD,QAAM,aAAa,KAAK,cAAc,UAAU;AAAA,IAC9C,aAAa;AAAA,IACb;AAAA;AAGF,QAAM,aAAa,KAAK,cAAc,YAAY;AAAA,IAChD,aAAa;AAAA,IACb,eAAe,CAAC;AAAA,IAChB;AAAA;AAGF,UAAQ,OAAO,OAAO;AACtB,UAAQ,OAAO,OAAO;AAEtB,OAAK,SAAS;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,KACN;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,101 +1,69 @@
|
|
|
1
|
-
import
|
|
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';
|
|
9
|
-
|
|
1
|
+
import * as React from "react";
|
|
10
2
|
function getRealNextPath(prevPath, nextPath) {
|
|
11
|
-
const {
|
|
12
|
-
childrenProp
|
|
13
|
-
} = this.props;
|
|
3
|
+
const { childrenProp } = this.props;
|
|
14
4
|
const ppLastIndex = prevPath.length - 1;
|
|
15
5
|
const npLastIndex = nextPath.length - 1;
|
|
16
|
-
|
|
17
6
|
if (prevPath.length < nextPath.length) {
|
|
18
|
-
// move into deep
|
|
19
7
|
let wasShifted = false;
|
|
20
8
|
return nextPath.map((nextIndex, i) => {
|
|
21
9
|
if (wasShifted) {
|
|
22
10
|
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
if (typeof prevPath[i] !== 'number') {
|
|
12
|
+
if (typeof prevPath[i] !== "number") {
|
|
26
13
|
return nextIndex;
|
|
27
14
|
}
|
|
28
|
-
|
|
29
15
|
if (nextPath[i] > prevPath[i] && i === ppLastIndex) {
|
|
30
16
|
wasShifted = true;
|
|
31
17
|
return nextIndex - 1;
|
|
32
18
|
}
|
|
33
|
-
|
|
34
19
|
return nextIndex;
|
|
35
20
|
});
|
|
36
21
|
}
|
|
37
|
-
|
|
38
22
|
if (prevPath.length === nextPath.length) {
|
|
39
|
-
// if move bottom + move to item with children => make it a first child instead of swap
|
|
40
23
|
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
41
24
|
const target = this.getItemByPath(nextPath);
|
|
42
|
-
|
|
43
25
|
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
44
26
|
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
45
27
|
}
|
|
46
28
|
}
|
|
47
29
|
}
|
|
48
|
-
|
|
49
30
|
return nextPath;
|
|
50
31
|
}
|
|
51
|
-
function getPathById(id) {
|
|
52
|
-
|
|
53
|
-
const {
|
|
54
|
-
childrenProp
|
|
55
|
-
} = this.props;
|
|
32
|
+
function getPathById(id, items = this.getDefaultItems()) {
|
|
33
|
+
const { childrenProp } = this.props;
|
|
56
34
|
let path = [];
|
|
57
35
|
items.every((item, i) => {
|
|
58
36
|
if (item.id === id) {
|
|
59
37
|
path.push(i);
|
|
60
38
|
} else if (item[childrenProp]) {
|
|
61
39
|
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
62
|
-
|
|
63
40
|
if (childrenPath.length) {
|
|
64
41
|
path = path.concat(i).concat(childrenPath);
|
|
65
42
|
}
|
|
66
43
|
}
|
|
67
|
-
|
|
68
44
|
return path.length === 0;
|
|
69
45
|
});
|
|
70
46
|
return path;
|
|
71
47
|
}
|
|
72
|
-
function getItemByPath(path) {
|
|
73
|
-
|
|
74
|
-
const {
|
|
75
|
-
childrenProp
|
|
76
|
-
} = this.props;
|
|
48
|
+
function getItemByPath(path, items = this.getDefaultItems()) {
|
|
49
|
+
const { childrenProp } = this.props;
|
|
77
50
|
let item = null;
|
|
78
|
-
path.forEach(index => {
|
|
51
|
+
path.forEach((index) => {
|
|
79
52
|
const list = item ? item[childrenProp] : items;
|
|
80
53
|
item = list[index];
|
|
81
54
|
});
|
|
82
55
|
return item;
|
|
83
56
|
}
|
|
84
57
|
function getItemDepth(item) {
|
|
85
|
-
const {
|
|
86
|
-
childrenProp
|
|
87
|
-
} = this.props;
|
|
58
|
+
const { childrenProp } = this.props;
|
|
88
59
|
let level = 1;
|
|
89
|
-
|
|
90
60
|
if (item[childrenProp].length > 0) {
|
|
91
61
|
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
92
62
|
level += Math.max(...childrenDepths);
|
|
93
63
|
}
|
|
94
|
-
|
|
95
64
|
return level;
|
|
96
65
|
}
|
|
97
|
-
function getSplicePath(path) {
|
|
98
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
66
|
+
function getSplicePath(path, options = {}) {
|
|
99
67
|
const splicePath = {};
|
|
100
68
|
const numToRemove = options.numToRemove || 0;
|
|
101
69
|
const itemsToInsert = options.itemsToInsert || [];
|
|
@@ -106,13 +74,17 @@ function getSplicePath(path) {
|
|
|
106
74
|
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
107
75
|
} else {
|
|
108
76
|
const nextPath = {};
|
|
109
|
-
currentPath[index] = {
|
|
110
|
-
[options.childrenProp]: nextPath
|
|
111
|
-
};
|
|
77
|
+
currentPath[index] = { [options.childrenProp]: nextPath };
|
|
112
78
|
currentPath = nextPath;
|
|
113
79
|
}
|
|
114
80
|
});
|
|
115
81
|
return splicePath;
|
|
116
82
|
}
|
|
117
|
-
|
|
118
|
-
|
|
83
|
+
export {
|
|
84
|
+
getItemByPath,
|
|
85
|
+
getItemDepth,
|
|
86
|
+
getPathById,
|
|
87
|
+
getRealNextPath,
|
|
88
|
+
getSplicePath
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/components/Nestable/actions/paths.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function getRealNextPath(prevPath, nextPath) {\n const { childrenProp } = this.props;\n const ppLastIndex = prevPath.length - 1;\n const npLastIndex = nextPath.length - 1;\n\n if (prevPath.length < nextPath.length) {\n // move into deep\n let wasShifted = false;\n\n return nextPath.map((nextIndex, i) => {\n if (wasShifted) {\n return i === npLastIndex ? nextIndex + 1 : nextIndex;\n }\n\n if (typeof prevPath[i] !== 'number') {\n return nextIndex;\n }\n\n if (nextPath[i] > prevPath[i] && i === ppLastIndex) {\n wasShifted = true;\n return nextIndex - 1;\n }\n\n return nextIndex;\n });\n }\n\n if (prevPath.length === nextPath.length) {\n // if move bottom + move to item with children => make it a first child instead of swap\n if (nextPath[npLastIndex] > prevPath[npLastIndex]) {\n const target = this.getItemByPath(nextPath);\n\n if (\n target[childrenProp] &&\n target[childrenProp].length &&\n !this.isCollapsed(target)\n ) {\n return nextPath\n .slice(0, -1)\n .concat(nextPath[npLastIndex] - 1)\n .concat(0);\n }\n }\n }\n\n return nextPath;\n}\n\nexport function getPathById(id, items = this.getDefaultItems()) {\n const { childrenProp } = this.props;\n let path = [];\n\n items.every((item, i) => {\n if (item.id === id) {\n path.push(i);\n } else if (item[childrenProp]) {\n const childrenPath = this.getPathById(id, item[childrenProp]);\n\n if (childrenPath.length) {\n path = path.concat(i).concat(childrenPath);\n }\n }\n\n return path.length === 0;\n });\n\n return path;\n}\n\nexport function getItemByPath(path, items = this.getDefaultItems()) {\n const { childrenProp } = this.props;\n let item = null;\n\n path.forEach(index => {\n const list = item ? item[childrenProp] : items;\n item = list[index];\n });\n\n return item;\n}\n\nexport function getItemDepth(item) {\n const { childrenProp } = this.props;\n let level = 1;\n\n if (item[childrenProp].length > 0) {\n const childrenDepths = item[childrenProp].map(this.getItemDepth);\n level += Math.max(...childrenDepths);\n }\n\n return level;\n}\n\nexport function getSplicePath(path, options = {}) {\n const splicePath = {};\n const numToRemove = options.numToRemove || 0;\n const itemsToInsert = options.itemsToInsert || [];\n const lastIndex = path.length - 1;\n let currentPath = splicePath;\n\n path.forEach((index, i) => {\n if (i === lastIndex) {\n currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];\n } else {\n const nextPath = {};\n currentPath[index] = { [options.childrenProp]: nextPath };\n currentPath = nextPath;\n }\n });\n\n return splicePath;\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,yBAAyB,UAAU,UAAU;AAClD,QAAM,EAAE,iBAAiB,KAAK;AAC9B,QAAM,cAAc,SAAS,SAAS;AACtC,QAAM,cAAc,SAAS,SAAS;AAEtC,MAAI,SAAS,SAAS,SAAS,QAAQ;AAErC,QAAI,aAAa;AAEjB,WAAO,SAAS,IAAI,CAAC,WAAW,MAAM;AACpC,UAAI,YAAY;AACd,eAAO,MAAM,cAAc,YAAY,IAAI;AAAA;AAG7C,UAAI,OAAO,SAAS,OAAO,UAAU;AACnC,eAAO;AAAA;AAGT,UAAI,SAAS,KAAK,SAAS,MAAM,MAAM,aAAa;AAClD,qBAAa;AACb,eAAO,YAAY;AAAA;AAGrB,aAAO;AAAA;AAAA;AAIX,MAAI,SAAS,WAAW,SAAS,QAAQ;AAEvC,QAAI,SAAS,eAAe,SAAS,cAAc;AACjD,YAAM,SAAS,KAAK,cAAc;AAElC,UACE,OAAO,iBACP,OAAO,cAAc,UACrB,CAAC,KAAK,YAAY,SAClB;AACA,eAAO,SACJ,MAAM,GAAG,IACT,OAAO,SAAS,eAAe,GAC/B,OAAO;AAAA;AAAA;AAAA;AAKhB,SAAO;AAAA;AAGF,qBAAqB,IAAI,QAAQ,KAAK,mBAAmB;AAC9D,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,OAAO;AAEX,QAAM,MAAM,CAAC,MAAM,MAAM;AACvB,QAAI,KAAK,OAAO,IAAI;AAClB,WAAK,KAAK;AAAA,eACD,KAAK,eAAe;AAC7B,YAAM,eAAe,KAAK,YAAY,IAAI,KAAK;AAE/C,UAAI,aAAa,QAAQ;AACvB,eAAO,KAAK,OAAO,GAAG,OAAO;AAAA;AAAA;AAIjC,WAAO,KAAK,WAAW;AAAA;AAGzB,SAAO;AAAA;AAGF,uBAAuB,MAAM,QAAQ,KAAK,mBAAmB;AAClE,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,OAAO;AAEX,OAAK,QAAQ,WAAS;AACpB,UAAM,OAAO,OAAO,KAAK,gBAAgB;AACzC,WAAO,KAAK;AAAA;AAGd,SAAO;AAAA;AAGF,sBAAsB,MAAM;AACjC,QAAM,EAAE,iBAAiB,KAAK;AAC9B,MAAI,QAAQ;AAEZ,MAAI,KAAK,cAAc,SAAS,GAAG;AACjC,UAAM,iBAAiB,KAAK,cAAc,IAAI,KAAK;AACnD,aAAS,KAAK,IAAI,GAAG;AAAA;AAGvB,SAAO;AAAA;AAGF,uBAAuB,MAAM,UAAU,IAAI;AAChD,QAAM,aAAa;AACnB,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,gBAAgB,QAAQ,iBAAiB;AAC/C,QAAM,YAAY,KAAK,SAAS;AAChC,MAAI,cAAc;AAElB,OAAK,QAAQ,CAAC,OAAO,MAAM;AACzB,QAAI,MAAM,WAAW;AACnB,kBAAY,UAAU,CAAC,CAAC,OAAO,aAAa,GAAG;AAAA,WAC1C;AACL,YAAM,WAAW;AACjB,kBAAY,SAAS,GAAG,QAAQ,eAAe;AAC/C,oBAAc;AAAA;AAAA;AAIlB,SAAO;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
function tryDecreaseDepth(dragItem) {
|
|
3
|
+
const { childrenProp, collapsed } = this.props;
|
|
4
|
+
const pathFrom = this.getPathById(dragItem.id);
|
|
5
|
+
const itemIndex = pathFrom[pathFrom.length - 1];
|
|
6
|
+
if (pathFrom.length > 1) {
|
|
7
|
+
const parent = this.getItemByPath(pathFrom.slice(0, -1));
|
|
8
|
+
if (itemIndex + 1 === parent[childrenProp].length) {
|
|
9
|
+
const pathTo = pathFrom.slice(0, -1);
|
|
10
|
+
pathTo[pathTo.length - 1] += 1;
|
|
11
|
+
let collapseProps = {};
|
|
12
|
+
if (collapsed && parent[childrenProp].length === 1) {
|
|
13
|
+
collapseProps = this.onToggleCollapse(parent, true);
|
|
14
|
+
}
|
|
15
|
+
this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
tryDecreaseDepth
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=tryDecreaseDepth.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/components/Nestable/actions/tryDecreaseDepth.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function tryDecreaseDepth(dragItem) {\n const { childrenProp, collapsed } = this.props;\n const pathFrom = this.getPathById(dragItem.id);\n const itemIndex = pathFrom[pathFrom.length - 1];\n // has parent\n if (pathFrom.length > 1) {\n const parent = this.getItemByPath(pathFrom.slice(0, -1));\n // is last (by order) item in array\n if (itemIndex + 1 === parent[childrenProp].length) {\n const pathTo = pathFrom.slice(0, -1);\n pathTo[pathTo.length - 1] += 1;\n // if collapsed by default and is last (by count) item in array remove this node from list of open nodes\n let collapseProps = {};\n if (collapsed && parent[childrenProp].length === 1) {\n collapseProps = this.onToggleCollapse(parent, true);\n }\n\n this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,0BAA0B,UAAU;AACzC,QAAM,EAAE,cAAc,cAAc,KAAK;AACzC,QAAM,WAAW,KAAK,YAAY,SAAS;AAC3C,QAAM,YAAY,SAAS,SAAS,SAAS;AAE7C,MAAI,SAAS,SAAS,GAAG;AACvB,UAAM,SAAS,KAAK,cAAc,SAAS,MAAM,GAAG;AAEpD,QAAI,YAAY,MAAM,OAAO,cAAc,QAAQ;AACjD,YAAM,SAAS,SAAS,MAAM,GAAG;AACjC,aAAO,OAAO,SAAS,MAAM;AAE7B,UAAI,gBAAgB;AACpB,UAAI,aAAa,OAAO,cAAc,WAAW,GAAG;AAClD,wBAAgB,KAAK,iBAAiB,QAAQ;AAAA;AAGhD,WAAK,SAAS,EAAE,UAAU,UAAU,UAAU;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,34 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
function tryIncreaseDepth(dragItem) {
|
|
2
|
-
const {
|
|
3
|
-
maxDepth,
|
|
4
|
-
childrenProp,
|
|
5
|
-
collapsed
|
|
6
|
-
} = this.props;
|
|
3
|
+
const { maxDepth, childrenProp, collapsed } = this.props;
|
|
7
4
|
const pathFrom = this.getPathById(dragItem.id);
|
|
8
5
|
const itemIndex = pathFrom[pathFrom.length - 1];
|
|
9
|
-
const newDepth = pathFrom.length + this.getItemDepth(dragItem);
|
|
10
|
-
|
|
6
|
+
const newDepth = pathFrom.length + this.getItemDepth(dragItem);
|
|
11
7
|
if (itemIndex > 0 && newDepth <= maxDepth) {
|
|
12
|
-
const prevSibling = this.getItemByPath(pathFrom.slice(0, -1).concat(itemIndex - 1));
|
|
13
|
-
|
|
8
|
+
const prevSibling = this.getItemByPath(pathFrom.slice(0, -1).concat(itemIndex - 1));
|
|
14
9
|
if (!prevSibling[childrenProp].length || !this.isCollapsed(prevSibling)) {
|
|
15
|
-
const pathTo = pathFrom.slice(0, -1).concat(itemIndex - 1).concat(prevSibling[childrenProp].length);
|
|
16
|
-
// and was no children here
|
|
17
|
-
// open this node
|
|
18
|
-
|
|
10
|
+
const pathTo = pathFrom.slice(0, -1).concat(itemIndex - 1).concat(prevSibling[childrenProp].length);
|
|
19
11
|
let collapseProps = {};
|
|
20
|
-
|
|
21
12
|
if (collapsed && !prevSibling[childrenProp].length) {
|
|
22
13
|
collapseProps = this.onToggleCollapse(prevSibling, true);
|
|
23
14
|
}
|
|
24
|
-
|
|
25
|
-
this.moveItem({
|
|
26
|
-
dragItem,
|
|
27
|
-
pathFrom,
|
|
28
|
-
pathTo
|
|
29
|
-
}, collapseProps);
|
|
15
|
+
this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);
|
|
30
16
|
}
|
|
31
17
|
}
|
|
32
18
|
}
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
export {
|
|
20
|
+
tryIncreaseDepth
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=tryIncreaseDepth.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/components/Nestable/actions/tryIncreaseDepth.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export function tryIncreaseDepth(dragItem) {\n const { maxDepth, childrenProp, collapsed } = this.props;\n const pathFrom = this.getPathById(dragItem.id);\n const itemIndex = pathFrom[pathFrom.length - 1];\n const newDepth = pathFrom.length + this.getItemDepth(dragItem);\n\n // has previous sibling and isn't at max depth\n if (itemIndex > 0 && newDepth <= maxDepth) {\n const prevSibling = this.getItemByPath(\n pathFrom.slice(0, -1).concat(itemIndex - 1),\n );\n // previous sibling is not collapsed\n if (!prevSibling[childrenProp].length || !this.isCollapsed(prevSibling)) {\n const pathTo = pathFrom\n .slice(0, -1)\n .concat(itemIndex - 1)\n .concat(prevSibling[childrenProp].length);\n\n // if collapsed by default\n // and was no children here\n // open this node\n let collapseProps = {};\n if (collapsed && !prevSibling[childrenProp].length) {\n collapseProps = this.onToggleCollapse(prevSibling, true);\n }\n\n this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,0BAA0B,UAAU;AACzC,QAAM,EAAE,UAAU,cAAc,cAAc,KAAK;AACnD,QAAM,WAAW,KAAK,YAAY,SAAS;AAC3C,QAAM,YAAY,SAAS,SAAS,SAAS;AAC7C,QAAM,WAAW,SAAS,SAAS,KAAK,aAAa;AAGrD,MAAI,YAAY,KAAK,YAAY,UAAU;AACzC,UAAM,cAAc,KAAK,cACvB,SAAS,MAAM,GAAG,IAAI,OAAO,YAAY;AAG3C,QAAI,CAAC,YAAY,cAAc,UAAU,CAAC,KAAK,YAAY,cAAc;AACvE,YAAM,SAAS,SACZ,MAAM,GAAG,IACT,OAAO,YAAY,GACnB,OAAO,YAAY,cAAc;AAKpC,UAAI,gBAAgB;AACpB,UAAI,aAAa,CAAC,YAAY,cAAc,QAAQ;AAClD,wBAAgB,KAAK,iBAAiB,aAAa;AAAA;AAGrD,WAAK,SAAS,EAAE,UAAU,UAAU,UAAU;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/Nestable/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import Nestable from './Nestable';\n\nexport default Nestable;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA,IAAO,mBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/QueryBuilderContext/QueryBuilderContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\n\nexport const QueryBuilderContext = React.createContext({});\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEO,MAAM,sBAAsB,OAAM,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|