@elliemae/ds-query-builder 2.2.0-next.3 → 2.3.0-alpha.1
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 +117 -97
- package/cjs/DSQueryBuilder.js.map +7 -0
- package/cjs/components/AndOrController/AndOrController.js +148 -162
- package/cjs/components/AndOrController/AndOrController.js.map +7 -0
- package/cjs/components/ConditionController/ConditionController.js +88 -72
- package/cjs/components/ConditionController/ConditionController.js.map +7 -0
- package/cjs/components/DisplayOutput/DisplayOutput.js +63 -68
- package/cjs/components/DisplayOutput/DisplayOutput.js.map +7 -0
- package/cjs/components/DragContainerController/DragContainerController.js +61 -41
- package/cjs/components/DragContainerController/DragContainerController.js.map +7 -0
- package/cjs/components/DragControllerRow/DragControllerRow.js +50 -46
- package/cjs/components/DragControllerRow/DragControllerRow.js.map +7 -0
- package/cjs/components/FieldControllerRow/FieldControllerRow.js +54 -32
- package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
- package/cjs/components/Nestable/Nestable.js +143 -209
- package/cjs/components/Nestable/Nestable.js.map +7 -0
- package/cjs/components/Nestable/NestableItem.js +98 -90
- package/cjs/components/Nestable/NestableItem.js.map +7 -0
- package/cjs/components/Nestable/actions/events.js +72 -95
- package/cjs/components/Nestable/actions/events.js.map +7 -0
- package/cjs/components/Nestable/actions/getItemOptions.js +36 -15
- package/cjs/components/Nestable/actions/getItemOptions.js.map +7 -0
- package/cjs/components/Nestable/actions/getPaths.js +46 -51
- package/cjs/components/Nestable/actions/getPaths.js.map +7 -0
- package/cjs/components/Nestable/actions/index.js +42 -28
- package/cjs/components/Nestable/actions/index.js.map +7 -0
- package/cjs/components/Nestable/actions/moveItem.js +44 -42
- package/cjs/components/Nestable/actions/moveItem.js.map +7 -0
- package/cjs/components/Nestable/actions/paths.js +48 -55
- package/cjs/components/Nestable/actions/paths.js.map +7 -0
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js +39 -23
- package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js +39 -26
- package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
- package/cjs/components/Nestable/index.js +36 -7
- package/cjs/components/Nestable/index.js.map +7 -0
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +36 -13
- package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
- package/cjs/components/QueryBuilderImpl.js +118 -202
- package/cjs/components/QueryBuilderImpl.js.map +7 -0
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +80 -78
- package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +154 -211
- package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +39 -26
- package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
- package/cjs/components/format/format.js +48 -22
- package/cjs/components/format/format.js.map +7 -0
- package/cjs/components/format/sqlFormat.js +69 -48
- package/cjs/components/format/sqlFormat.js.map +7 -0
- package/cjs/components/format/sqlSafeFormat.js +72 -55
- package/cjs/components/format/sqlSafeFormat.js.map +7 -0
- package/cjs/components/format/xmlFormat.js +71 -50
- package/cjs/components/format/xmlFormat.js.map +7 -0
- package/cjs/components/helpers/actions.js +151 -186
- package/cjs/components/helpers/actions.js.map +7 -0
- package/cjs/components/helpers/constants.js +36 -8
- package/cjs/components/helpers/constants.js.map +7 -0
- package/cjs/components/helpers/dependencies.js +49 -64
- package/cjs/components/helpers/dependencies.js.map +7 -0
- package/cjs/components/helpers/selectors.js +161 -101
- package/cjs/components/helpers/selectors.js.map +7 -0
- package/cjs/components/helpers/store.js +86 -104
- package/cjs/components/helpers/store.js.map +7 -0
- package/cjs/components/helpers/types.js +72 -44
- package/cjs/components/helpers/types.js.map +7 -0
- package/cjs/index.js +36 -29
- package/cjs/index.js.map +7 -0
- package/cjs/propTypes.js +102 -94
- package/cjs/propTypes.js.map +7 -0
- package/esm/DSQueryBuilder.js +103 -72
- package/esm/DSQueryBuilder.js.map +7 -0
- package/esm/components/AndOrController/AndOrController.js +113 -147
- package/esm/components/AndOrController/AndOrController.js.map +7 -0
- package/esm/components/ConditionController/ConditionController.js +57 -62
- package/esm/components/ConditionController/ConditionController.js.map +7 -0
- package/esm/components/DisplayOutput/DisplayOutput.js +31 -59
- package/esm/components/DisplayOutput/DisplayOutput.js.map +7 -0
- package/esm/components/DragContainerController/DragContainerController.js +32 -35
- package/esm/components/DragContainerController/DragContainerController.js.map +7 -0
- package/esm/components/DragControllerRow/DragControllerRow.js +21 -38
- package/esm/components/DragControllerRow/DragControllerRow.js.map +7 -0
- package/esm/components/FieldControllerRow/FieldControllerRow.js +25 -26
- package/esm/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
- package/esm/components/Nestable/Nestable.js +115 -186
- package/esm/components/Nestable/Nestable.js.map +7 -0
- package/esm/components/Nestable/NestableItem.js +69 -82
- package/esm/components/Nestable/NestableItem.js.map +7 -0
- package/esm/components/Nestable/actions/events.js +45 -79
- package/esm/components/Nestable/actions/events.js.map +7 -0
- package/esm/components/Nestable/actions/getItemOptions.js +7 -11
- package/esm/components/Nestable/actions/getItemOptions.js.map +7 -0
- package/esm/components/Nestable/actions/getPaths.js +17 -43
- package/esm/components/Nestable/actions/getPaths.js.map +7 -0
- package/esm/components/Nestable/actions/index.js +13 -6
- package/esm/components/Nestable/actions/index.js.map +7 -0
- package/esm/components/Nestable/actions/moveItem.js +13 -31
- package/esm/components/Nestable/actions/moveItem.js.map +7 -0
- package/esm/components/Nestable/actions/paths.js +19 -47
- package/esm/components/Nestable/actions/paths.js.map +7 -0
- package/esm/components/Nestable/actions/tryDecreaseDepth.js +10 -19
- package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
- package/esm/components/Nestable/actions/tryIncreaseDepth.js +10 -22
- package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
- package/esm/components/Nestable/index.js +7 -2
- package/esm/components/Nestable/index.js.map +7 -0
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js +7 -5
- package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
- package/esm/components/QueryBuilderImpl.js +82 -187
- package/esm/components/QueryBuilderImpl.js.map +7 -0
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js +50 -70
- package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js +123 -201
- package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js +10 -17
- package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
- package/esm/components/format/format.js +16 -17
- package/esm/components/format/format.js.map +7 -0
- package/esm/components/format/sqlFormat.js +39 -43
- package/esm/components/format/sqlFormat.js.map +7 -0
- package/esm/components/format/sqlSafeFormat.js +43 -50
- package/esm/components/format/sqlSafeFormat.js.map +7 -0
- package/esm/components/format/xmlFormat.js +41 -45
- package/esm/components/format/xmlFormat.js.map +7 -0
- package/esm/components/helpers/actions.js +123 -160
- package/esm/components/helpers/actions.js.map +7 -0
- package/esm/components/helpers/constants.js +7 -2
- package/esm/components/helpers/constants.js.map +7 -0
- package/esm/components/helpers/dependencies.js +19 -39
- package/esm/components/helpers/dependencies.js.map +7 -0
- package/esm/components/helpers/selectors.js +132 -93
- package/esm/components/helpers/selectors.js.map +7 -0
- package/esm/components/helpers/store.js +54 -82
- package/esm/components/helpers/store.js.map +7 -0
- package/esm/components/helpers/types.js +44 -33
- package/esm/components/helpers/types.js.map +7 -0
- package/esm/index.js +7 -4
- package/esm/index.js.map +7 -0
- package/esm/propTypes.js +55 -72
- package/esm/propTypes.js.map +7 -0
- package/package.json +12 -12
- package/types/DSQueryBuilder.d.ts +1 -32
|
@@ -1,103 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var getPaths_exports = {};
|
|
29
|
+
__export(getPaths_exports, {
|
|
30
|
+
getItemByPath: () => getItemByPath,
|
|
31
|
+
getItemDepth: () => getItemDepth,
|
|
32
|
+
getPathById: () => getPathById,
|
|
33
|
+
getRealNextPath: () => getRealNextPath,
|
|
34
|
+
getSplicePath: () => getSplicePath
|
|
35
|
+
});
|
|
36
|
+
var React = __toESM(require("react"));
|
|
14
37
|
function getRealNextPath(prevPath, nextPath) {
|
|
15
|
-
const {
|
|
16
|
-
childrenProp
|
|
17
|
-
} = this.props;
|
|
38
|
+
const { childrenProp } = this.props;
|
|
18
39
|
const ppLastIndex = prevPath.length - 1;
|
|
19
40
|
const npLastIndex = nextPath.length - 1;
|
|
20
|
-
|
|
21
41
|
if (prevPath.length < nextPath.length) {
|
|
22
|
-
// move into deep
|
|
23
42
|
let wasShifted = false;
|
|
24
43
|
return nextPath.map((nextIndex, i) => {
|
|
25
44
|
if (wasShifted) {
|
|
26
45
|
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
27
46
|
}
|
|
28
|
-
|
|
29
|
-
if (typeof prevPath[i] !== 'number') {
|
|
47
|
+
if (typeof prevPath[i] !== "number") {
|
|
30
48
|
return nextIndex;
|
|
31
49
|
}
|
|
32
|
-
|
|
33
50
|
if (nextPath[i] > prevPath[i] && i === ppLastIndex) {
|
|
34
51
|
wasShifted = true;
|
|
35
52
|
return nextIndex - 1;
|
|
36
53
|
}
|
|
37
|
-
|
|
38
54
|
return nextIndex;
|
|
39
55
|
});
|
|
40
56
|
}
|
|
41
|
-
|
|
42
57
|
if (prevPath.length === nextPath.length) {
|
|
43
|
-
// if move bottom + move to item with children => make it a first child instead of swap
|
|
44
58
|
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
45
59
|
const target = this.getItemByPath(nextPath);
|
|
46
|
-
|
|
47
60
|
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
48
61
|
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
|
-
|
|
53
65
|
return nextPath;
|
|
54
66
|
}
|
|
55
67
|
function getPathById(id, items) {
|
|
56
|
-
const {
|
|
57
|
-
childrenProp
|
|
58
|
-
} = this.props;
|
|
68
|
+
const { childrenProp } = this.props;
|
|
59
69
|
let path = [];
|
|
60
70
|
items.every((item, i) => {
|
|
61
71
|
if (item.id === id) {
|
|
62
72
|
path.push(i);
|
|
63
73
|
} else if (item[childrenProp]) {
|
|
64
74
|
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
65
|
-
|
|
66
75
|
if (childrenPath.length) {
|
|
67
76
|
path = path.concat(i).concat(childrenPath);
|
|
68
77
|
}
|
|
69
78
|
}
|
|
70
|
-
|
|
71
79
|
return path.length === 0;
|
|
72
80
|
});
|
|
73
81
|
return path;
|
|
74
82
|
}
|
|
75
83
|
function getItemByPath(path, items) {
|
|
76
|
-
const {
|
|
77
|
-
childrenProp
|
|
78
|
-
} = this.props;
|
|
84
|
+
const { childrenProp } = this.props;
|
|
79
85
|
let item = null;
|
|
80
|
-
path.forEach(index => {
|
|
86
|
+
path.forEach((index) => {
|
|
81
87
|
const list = item ? item[childrenProp] : items;
|
|
82
88
|
item = list[index];
|
|
83
89
|
});
|
|
84
90
|
return item;
|
|
85
91
|
}
|
|
86
92
|
function getItemDepth(item) {
|
|
87
|
-
const {
|
|
88
|
-
childrenProp
|
|
89
|
-
} = this.props;
|
|
93
|
+
const { childrenProp } = this.props;
|
|
90
94
|
let level = 1;
|
|
91
|
-
|
|
92
95
|
if (item[childrenProp].length > 0) {
|
|
93
96
|
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
94
97
|
level += Math.max(...childrenDepths);
|
|
95
98
|
}
|
|
96
|
-
|
|
97
99
|
return level;
|
|
98
100
|
}
|
|
99
|
-
function getSplicePath(path) {
|
|
100
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
101
|
+
function getSplicePath(path, options = {}) {
|
|
101
102
|
const splicePath = {};
|
|
102
103
|
const numToRemove = options.numToRemove || 0;
|
|
103
104
|
const itemsToInsert = options.itemsToInsert || [];
|
|
@@ -108,17 +109,11 @@ function getSplicePath(path) {
|
|
|
108
109
|
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
109
110
|
} else {
|
|
110
111
|
const nextPath = {};
|
|
111
|
-
currentPath[index] = {
|
|
112
|
-
[options.childrenProp]: nextPath
|
|
113
|
-
};
|
|
112
|
+
currentPath[index] = { [options.childrenProp]: nextPath };
|
|
114
113
|
currentPath = nextPath;
|
|
115
114
|
}
|
|
116
115
|
});
|
|
117
116
|
return splicePath;
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
exports.getItemDepth = getItemDepth;
|
|
122
|
-
exports.getPathById = getPathById;
|
|
123
|
-
exports.getRealNextPath = getRealNextPath;
|
|
124
|
-
exports.getSplicePath = getSplicePath;
|
|
118
|
+
module.exports = __toCommonJS(getPaths_exports);
|
|
119
|
+
//# sourceMappingURL=getPaths.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/Nestable/actions/getPaths.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,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
|
+
}
|
|
@@ -1,28 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var actions_exports = {};
|
|
29
|
+
__export(actions_exports, {
|
|
30
|
+
moveItem: () => import_moveItem.moveItem,
|
|
31
|
+
tryDecreaseDepth: () => import_tryDecreaseDepth.tryDecreaseDepth,
|
|
32
|
+
tryIncreaseDepth: () => import_tryIncreaseDepth.tryIncreaseDepth
|
|
33
|
+
});
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_tryIncreaseDepth = require("./tryIncreaseDepth");
|
|
36
|
+
var import_tryDecreaseDepth = require("./tryDecreaseDepth");
|
|
37
|
+
var import_moveItem = require("./moveItem");
|
|
38
|
+
__reExport(actions_exports, require("./paths"));
|
|
39
|
+
__reExport(actions_exports, require("./events"));
|
|
40
|
+
__reExport(actions_exports, require("./getItemOptions"));
|
|
41
|
+
module.exports = __toCommonJS(actions_exports);
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/Nestable/actions/index.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { tryIncreaseDepth } from './tryIncreaseDepth';\nexport { tryDecreaseDepth } from './tryDecreaseDepth';\nexport { moveItem } from './moveItem';\nexport * from './paths';\nexport * from './events';\nexport * from './getItemOptions';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAiC;AACjC,8BAAiC;AACjC,sBAAyB;AACzB,4BAAc;AACd,4BAAc;AACd,4BAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var moveItem_exports = {};
|
|
29
|
+
__export(moveItem_exports, {
|
|
30
|
+
moveItem: () => moveItem
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_react_addons_update = __toESM(require("react-addons-update"));
|
|
34
|
+
function moveItem({ dragItem, pathFrom, pathTo }, extraProps = {}) {
|
|
35
|
+
const { childrenProp } = this.props;
|
|
36
|
+
let { items } = this.state;
|
|
36
37
|
const realPathTo = this.getRealNextPath(pathFrom, pathTo);
|
|
37
38
|
const removePath = this.getSplicePath(pathFrom, {
|
|
38
39
|
numToRemove: 1,
|
|
@@ -43,12 +44,13 @@ function moveItem(_ref) {
|
|
|
43
44
|
itemsToInsert: [dragItem],
|
|
44
45
|
childrenProp
|
|
45
46
|
});
|
|
46
|
-
items =
|
|
47
|
-
items =
|
|
48
|
-
this.setState(
|
|
47
|
+
items = (0, import_react_addons_update.default)(items, removePath);
|
|
48
|
+
items = (0, import_react_addons_update.default)(items, insertPath);
|
|
49
|
+
this.setState({
|
|
49
50
|
items,
|
|
50
|
-
isDirty: true
|
|
51
|
-
|
|
51
|
+
isDirty: true,
|
|
52
|
+
...extraProps
|
|
53
|
+
});
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
module.exports = __toCommonJS(moveItem_exports);
|
|
56
|
+
//# sourceMappingURL=moveItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/Nestable/actions/moveItem.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAAmB;AAEZ,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,wCAAO,OAAO;AACtB,UAAQ,wCAAO,OAAO;AAEtB,OAAK,SAAS;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,OACN;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,105 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var paths_exports = {};
|
|
29
|
+
__export(paths_exports, {
|
|
30
|
+
getItemByPath: () => getItemByPath,
|
|
31
|
+
getItemDepth: () => getItemDepth,
|
|
32
|
+
getPathById: () => getPathById,
|
|
33
|
+
getRealNextPath: () => getRealNextPath,
|
|
34
|
+
getSplicePath: () => getSplicePath
|
|
35
|
+
});
|
|
36
|
+
var React = __toESM(require("react"));
|
|
14
37
|
function getRealNextPath(prevPath, nextPath) {
|
|
15
|
-
const {
|
|
16
|
-
childrenProp
|
|
17
|
-
} = this.props;
|
|
38
|
+
const { childrenProp } = this.props;
|
|
18
39
|
const ppLastIndex = prevPath.length - 1;
|
|
19
40
|
const npLastIndex = nextPath.length - 1;
|
|
20
|
-
|
|
21
41
|
if (prevPath.length < nextPath.length) {
|
|
22
|
-
// move into deep
|
|
23
42
|
let wasShifted = false;
|
|
24
43
|
return nextPath.map((nextIndex, i) => {
|
|
25
44
|
if (wasShifted) {
|
|
26
45
|
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
27
46
|
}
|
|
28
|
-
|
|
29
|
-
if (typeof prevPath[i] !== 'number') {
|
|
47
|
+
if (typeof prevPath[i] !== "number") {
|
|
30
48
|
return nextIndex;
|
|
31
49
|
}
|
|
32
|
-
|
|
33
50
|
if (nextPath[i] > prevPath[i] && i === ppLastIndex) {
|
|
34
51
|
wasShifted = true;
|
|
35
52
|
return nextIndex - 1;
|
|
36
53
|
}
|
|
37
|
-
|
|
38
54
|
return nextIndex;
|
|
39
55
|
});
|
|
40
56
|
}
|
|
41
|
-
|
|
42
57
|
if (prevPath.length === nextPath.length) {
|
|
43
|
-
// if move bottom + move to item with children => make it a first child instead of swap
|
|
44
58
|
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
45
59
|
const target = this.getItemByPath(nextPath);
|
|
46
|
-
|
|
47
60
|
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
48
61
|
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
49
62
|
}
|
|
50
63
|
}
|
|
51
64
|
}
|
|
52
|
-
|
|
53
65
|
return nextPath;
|
|
54
66
|
}
|
|
55
|
-
function getPathById(id) {
|
|
56
|
-
|
|
57
|
-
const {
|
|
58
|
-
childrenProp
|
|
59
|
-
} = this.props;
|
|
67
|
+
function getPathById(id, items = this.getDefaultItems()) {
|
|
68
|
+
const { childrenProp } = this.props;
|
|
60
69
|
let path = [];
|
|
61
70
|
items.every((item, i) => {
|
|
62
71
|
if (item.id === id) {
|
|
63
72
|
path.push(i);
|
|
64
73
|
} else if (item[childrenProp]) {
|
|
65
74
|
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
66
|
-
|
|
67
75
|
if (childrenPath.length) {
|
|
68
76
|
path = path.concat(i).concat(childrenPath);
|
|
69
77
|
}
|
|
70
78
|
}
|
|
71
|
-
|
|
72
79
|
return path.length === 0;
|
|
73
80
|
});
|
|
74
81
|
return path;
|
|
75
82
|
}
|
|
76
|
-
function getItemByPath(path) {
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
childrenProp
|
|
80
|
-
} = this.props;
|
|
83
|
+
function getItemByPath(path, items = this.getDefaultItems()) {
|
|
84
|
+
const { childrenProp } = this.props;
|
|
81
85
|
let item = null;
|
|
82
|
-
path.forEach(index => {
|
|
86
|
+
path.forEach((index) => {
|
|
83
87
|
const list = item ? item[childrenProp] : items;
|
|
84
88
|
item = list[index];
|
|
85
89
|
});
|
|
86
90
|
return item;
|
|
87
91
|
}
|
|
88
92
|
function getItemDepth(item) {
|
|
89
|
-
const {
|
|
90
|
-
childrenProp
|
|
91
|
-
} = this.props;
|
|
93
|
+
const { childrenProp } = this.props;
|
|
92
94
|
let level = 1;
|
|
93
|
-
|
|
94
95
|
if (item[childrenProp].length > 0) {
|
|
95
96
|
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
96
97
|
level += Math.max(...childrenDepths);
|
|
97
98
|
}
|
|
98
|
-
|
|
99
99
|
return level;
|
|
100
100
|
}
|
|
101
|
-
function getSplicePath(path) {
|
|
102
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
101
|
+
function getSplicePath(path, options = {}) {
|
|
103
102
|
const splicePath = {};
|
|
104
103
|
const numToRemove = options.numToRemove || 0;
|
|
105
104
|
const itemsToInsert = options.itemsToInsert || [];
|
|
@@ -110,17 +109,11 @@ function getSplicePath(path) {
|
|
|
110
109
|
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
111
110
|
} else {
|
|
112
111
|
const nextPath = {};
|
|
113
|
-
currentPath[index] = {
|
|
114
|
-
[options.childrenProp]: nextPath
|
|
115
|
-
};
|
|
112
|
+
currentPath[index] = { [options.childrenProp]: nextPath };
|
|
116
113
|
currentPath = nextPath;
|
|
117
114
|
}
|
|
118
115
|
});
|
|
119
116
|
return splicePath;
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
exports.getItemDepth = getItemDepth;
|
|
124
|
-
exports.getPathById = getPathById;
|
|
125
|
-
exports.getRealNextPath = getRealNextPath;
|
|
126
|
-
exports.getSplicePath = getSplicePath;
|
|
118
|
+
module.exports = __toCommonJS(paths_exports);
|
|
119
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/Nestable/actions/paths.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,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
|
+
}
|
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var tryDecreaseDepth_exports = {};
|
|
29
|
+
__export(tryDecreaseDepth_exports, {
|
|
30
|
+
tryDecreaseDepth: () => tryDecreaseDepth
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
5
33
|
function tryDecreaseDepth(dragItem) {
|
|
6
|
-
const {
|
|
7
|
-
childrenProp,
|
|
8
|
-
collapsed
|
|
9
|
-
} = this.props;
|
|
34
|
+
const { childrenProp, collapsed } = this.props;
|
|
10
35
|
const pathFrom = this.getPathById(dragItem.id);
|
|
11
|
-
const itemIndex = pathFrom[pathFrom.length - 1];
|
|
12
|
-
|
|
36
|
+
const itemIndex = pathFrom[pathFrom.length - 1];
|
|
13
37
|
if (pathFrom.length > 1) {
|
|
14
|
-
const parent = this.getItemByPath(pathFrom.slice(0, -1));
|
|
15
|
-
|
|
38
|
+
const parent = this.getItemByPath(pathFrom.slice(0, -1));
|
|
16
39
|
if (itemIndex + 1 === parent[childrenProp].length) {
|
|
17
40
|
const pathTo = pathFrom.slice(0, -1);
|
|
18
|
-
pathTo[pathTo.length - 1] += 1;
|
|
19
|
-
|
|
41
|
+
pathTo[pathTo.length - 1] += 1;
|
|
20
42
|
let collapseProps = {};
|
|
21
|
-
|
|
22
43
|
if (collapsed && parent[childrenProp].length === 1) {
|
|
23
44
|
collapseProps = this.onToggleCollapse(parent, true);
|
|
24
45
|
}
|
|
25
|
-
|
|
26
|
-
this.moveItem({
|
|
27
|
-
dragItem,
|
|
28
|
-
pathFrom,
|
|
29
|
-
pathTo
|
|
30
|
-
}, collapseProps);
|
|
46
|
+
this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
49
|
}
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
module.exports = __toCommonJS(tryDecreaseDepth_exports);
|
|
51
|
+
//# sourceMappingURL=tryDecreaseDepth.js.map
|