@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.
Files changed (142) hide show
  1. package/cjs/DSQueryBuilder.js +117 -97
  2. package/cjs/DSQueryBuilder.js.map +7 -0
  3. package/cjs/components/AndOrController/AndOrController.js +148 -162
  4. package/cjs/components/AndOrController/AndOrController.js.map +7 -0
  5. package/cjs/components/ConditionController/ConditionController.js +88 -72
  6. package/cjs/components/ConditionController/ConditionController.js.map +7 -0
  7. package/cjs/components/DisplayOutput/DisplayOutput.js +63 -68
  8. package/cjs/components/DisplayOutput/DisplayOutput.js.map +7 -0
  9. package/cjs/components/DragContainerController/DragContainerController.js +61 -41
  10. package/cjs/components/DragContainerController/DragContainerController.js.map +7 -0
  11. package/cjs/components/DragControllerRow/DragControllerRow.js +50 -46
  12. package/cjs/components/DragControllerRow/DragControllerRow.js.map +7 -0
  13. package/cjs/components/FieldControllerRow/FieldControllerRow.js +54 -32
  14. package/cjs/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
  15. package/cjs/components/Nestable/Nestable.js +143 -209
  16. package/cjs/components/Nestable/Nestable.js.map +7 -0
  17. package/cjs/components/Nestable/NestableItem.js +98 -90
  18. package/cjs/components/Nestable/NestableItem.js.map +7 -0
  19. package/cjs/components/Nestable/actions/events.js +72 -95
  20. package/cjs/components/Nestable/actions/events.js.map +7 -0
  21. package/cjs/components/Nestable/actions/getItemOptions.js +36 -15
  22. package/cjs/components/Nestable/actions/getItemOptions.js.map +7 -0
  23. package/cjs/components/Nestable/actions/getPaths.js +46 -51
  24. package/cjs/components/Nestable/actions/getPaths.js.map +7 -0
  25. package/cjs/components/Nestable/actions/index.js +42 -28
  26. package/cjs/components/Nestable/actions/index.js.map +7 -0
  27. package/cjs/components/Nestable/actions/moveItem.js +44 -42
  28. package/cjs/components/Nestable/actions/moveItem.js.map +7 -0
  29. package/cjs/components/Nestable/actions/paths.js +48 -55
  30. package/cjs/components/Nestable/actions/paths.js.map +7 -0
  31. package/cjs/components/Nestable/actions/tryDecreaseDepth.js +39 -23
  32. package/cjs/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
  33. package/cjs/components/Nestable/actions/tryIncreaseDepth.js +39 -26
  34. package/cjs/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
  35. package/cjs/components/Nestable/index.js +36 -7
  36. package/cjs/components/Nestable/index.js.map +7 -0
  37. package/cjs/components/QueryBuilderContext/QueryBuilderContext.js +36 -13
  38. package/cjs/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
  39. package/cjs/components/QueryBuilderImpl.js +118 -202
  40. package/cjs/components/QueryBuilderImpl.js.map +7 -0
  41. package/cjs/components/QueryBuilderItem/QueryBuilderItem.js +80 -78
  42. package/cjs/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
  43. package/cjs/components/QueryBuilderRow/QueryBuilderRow.js +154 -211
  44. package/cjs/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
  45. package/cjs/components/ToolBarAnimation/ToolBarAnimation.js +39 -26
  46. package/cjs/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
  47. package/cjs/components/format/format.js +48 -22
  48. package/cjs/components/format/format.js.map +7 -0
  49. package/cjs/components/format/sqlFormat.js +69 -48
  50. package/cjs/components/format/sqlFormat.js.map +7 -0
  51. package/cjs/components/format/sqlSafeFormat.js +72 -55
  52. package/cjs/components/format/sqlSafeFormat.js.map +7 -0
  53. package/cjs/components/format/xmlFormat.js +71 -50
  54. package/cjs/components/format/xmlFormat.js.map +7 -0
  55. package/cjs/components/helpers/actions.js +151 -186
  56. package/cjs/components/helpers/actions.js.map +7 -0
  57. package/cjs/components/helpers/constants.js +36 -8
  58. package/cjs/components/helpers/constants.js.map +7 -0
  59. package/cjs/components/helpers/dependencies.js +49 -64
  60. package/cjs/components/helpers/dependencies.js.map +7 -0
  61. package/cjs/components/helpers/selectors.js +161 -101
  62. package/cjs/components/helpers/selectors.js.map +7 -0
  63. package/cjs/components/helpers/store.js +86 -104
  64. package/cjs/components/helpers/store.js.map +7 -0
  65. package/cjs/components/helpers/types.js +72 -44
  66. package/cjs/components/helpers/types.js.map +7 -0
  67. package/cjs/index.js +36 -29
  68. package/cjs/index.js.map +7 -0
  69. package/cjs/propTypes.js +102 -94
  70. package/cjs/propTypes.js.map +7 -0
  71. package/esm/DSQueryBuilder.js +103 -72
  72. package/esm/DSQueryBuilder.js.map +7 -0
  73. package/esm/components/AndOrController/AndOrController.js +113 -147
  74. package/esm/components/AndOrController/AndOrController.js.map +7 -0
  75. package/esm/components/ConditionController/ConditionController.js +57 -62
  76. package/esm/components/ConditionController/ConditionController.js.map +7 -0
  77. package/esm/components/DisplayOutput/DisplayOutput.js +31 -59
  78. package/esm/components/DisplayOutput/DisplayOutput.js.map +7 -0
  79. package/esm/components/DragContainerController/DragContainerController.js +32 -35
  80. package/esm/components/DragContainerController/DragContainerController.js.map +7 -0
  81. package/esm/components/DragControllerRow/DragControllerRow.js +21 -38
  82. package/esm/components/DragControllerRow/DragControllerRow.js.map +7 -0
  83. package/esm/components/FieldControllerRow/FieldControllerRow.js +25 -26
  84. package/esm/components/FieldControllerRow/FieldControllerRow.js.map +7 -0
  85. package/esm/components/Nestable/Nestable.js +115 -186
  86. package/esm/components/Nestable/Nestable.js.map +7 -0
  87. package/esm/components/Nestable/NestableItem.js +69 -82
  88. package/esm/components/Nestable/NestableItem.js.map +7 -0
  89. package/esm/components/Nestable/actions/events.js +45 -79
  90. package/esm/components/Nestable/actions/events.js.map +7 -0
  91. package/esm/components/Nestable/actions/getItemOptions.js +7 -11
  92. package/esm/components/Nestable/actions/getItemOptions.js.map +7 -0
  93. package/esm/components/Nestable/actions/getPaths.js +17 -43
  94. package/esm/components/Nestable/actions/getPaths.js.map +7 -0
  95. package/esm/components/Nestable/actions/index.js +13 -6
  96. package/esm/components/Nestable/actions/index.js.map +7 -0
  97. package/esm/components/Nestable/actions/moveItem.js +13 -31
  98. package/esm/components/Nestable/actions/moveItem.js.map +7 -0
  99. package/esm/components/Nestable/actions/paths.js +19 -47
  100. package/esm/components/Nestable/actions/paths.js.map +7 -0
  101. package/esm/components/Nestable/actions/tryDecreaseDepth.js +10 -19
  102. package/esm/components/Nestable/actions/tryDecreaseDepth.js.map +7 -0
  103. package/esm/components/Nestable/actions/tryIncreaseDepth.js +10 -22
  104. package/esm/components/Nestable/actions/tryIncreaseDepth.js.map +7 -0
  105. package/esm/components/Nestable/index.js +7 -2
  106. package/esm/components/Nestable/index.js.map +7 -0
  107. package/esm/components/QueryBuilderContext/QueryBuilderContext.js +7 -5
  108. package/esm/components/QueryBuilderContext/QueryBuilderContext.js.map +7 -0
  109. package/esm/components/QueryBuilderImpl.js +82 -187
  110. package/esm/components/QueryBuilderImpl.js.map +7 -0
  111. package/esm/components/QueryBuilderItem/QueryBuilderItem.js +50 -70
  112. package/esm/components/QueryBuilderItem/QueryBuilderItem.js.map +7 -0
  113. package/esm/components/QueryBuilderRow/QueryBuilderRow.js +123 -201
  114. package/esm/components/QueryBuilderRow/QueryBuilderRow.js.map +7 -0
  115. package/esm/components/ToolBarAnimation/ToolBarAnimation.js +10 -17
  116. package/esm/components/ToolBarAnimation/ToolBarAnimation.js.map +7 -0
  117. package/esm/components/format/format.js +16 -17
  118. package/esm/components/format/format.js.map +7 -0
  119. package/esm/components/format/sqlFormat.js +39 -43
  120. package/esm/components/format/sqlFormat.js.map +7 -0
  121. package/esm/components/format/sqlSafeFormat.js +43 -50
  122. package/esm/components/format/sqlSafeFormat.js.map +7 -0
  123. package/esm/components/format/xmlFormat.js +41 -45
  124. package/esm/components/format/xmlFormat.js.map +7 -0
  125. package/esm/components/helpers/actions.js +123 -160
  126. package/esm/components/helpers/actions.js.map +7 -0
  127. package/esm/components/helpers/constants.js +7 -2
  128. package/esm/components/helpers/constants.js.map +7 -0
  129. package/esm/components/helpers/dependencies.js +19 -39
  130. package/esm/components/helpers/dependencies.js.map +7 -0
  131. package/esm/components/helpers/selectors.js +132 -93
  132. package/esm/components/helpers/selectors.js.map +7 -0
  133. package/esm/components/helpers/store.js +54 -82
  134. package/esm/components/helpers/store.js.map +7 -0
  135. package/esm/components/helpers/types.js +44 -33
  136. package/esm/components/helpers/types.js.map +7 -0
  137. package/esm/index.js +7 -4
  138. package/esm/index.js.map +7 -0
  139. package/esm/propTypes.js +55 -72
  140. package/esm/propTypes.js.map +7 -0
  141. package/package.json +12 -12
  142. package/types/DSQueryBuilder.d.ts +1 -32
@@ -1,103 +1,104 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.map.js');
6
- require('core-js/modules/esnext.iterator.map.js');
7
- require('core-js/modules/esnext.async-iterator.every.js');
8
- require('core-js/modules/esnext.iterator.constructor.js');
9
- require('core-js/modules/esnext.iterator.every.js');
10
- require('core-js/modules/esnext.async-iterator.for-each.js');
11
- require('core-js/modules/esnext.iterator.for-each.js');
12
- require('core-js/modules/web.dom-collections.iterator.js');
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
- exports.getItemByPath = getItemByPath;
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
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var tryIncreaseDepth = require('./tryIncreaseDepth.js');
6
- var tryDecreaseDepth = require('./tryDecreaseDepth.js');
7
- var moveItem = require('./moveItem.js');
8
- var paths = require('./paths.js');
9
- var events = require('./events.js');
10
- var getItemOptions = require('./getItemOptions.js');
11
-
12
-
13
-
14
- exports.tryIncreaseDepth = tryIncreaseDepth.tryIncreaseDepth;
15
- exports.tryDecreaseDepth = tryDecreaseDepth.tryDecreaseDepth;
16
- exports.moveItem = moveItem.moveItem;
17
- exports.getItemByPath = paths.getItemByPath;
18
- exports.getItemDepth = paths.getItemDepth;
19
- exports.getPathById = paths.getPathById;
20
- exports.getRealNextPath = paths.getRealNextPath;
21
- exports.getSplicePath = paths.getSplicePath;
22
- exports.onDragEnd = events.onDragEnd;
23
- exports.onDragStart = events.onDragStart;
24
- exports.onKeyDown = events.onKeyDown;
25
- exports.onMouseEnter = events.onMouseEnter;
26
- exports.onMouseMove = events.onMouseMove;
27
- exports.onToggleCollapse = events.onToggleCollapse;
28
- exports.getItemOptions = getItemOptions.getItemOptions;
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
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.filter.js');
6
- require('core-js/modules/esnext.iterator.constructor.js');
7
- require('core-js/modules/esnext.iterator.filter.js');
8
- require('core-js/modules/esnext.async-iterator.for-each.js');
9
- require('core-js/modules/esnext.iterator.for-each.js');
10
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
- var update = require('react-addons-update');
12
-
13
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
-
15
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
16
- var update__default = /*#__PURE__*/_interopDefaultLegacy(update);
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
- function moveItem(_ref) {
22
- let {
23
- dragItem,
24
- pathFrom,
25
- pathTo
26
- } = _ref;
27
- let extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28
- const {
29
- childrenProp
30
- } = this.props;
31
- let {
32
- items
33
- } = this.state; // the remove action might affect the next position,
34
- // so update next coordinates accordingly
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 = update__default["default"](items, removePath);
47
- items = update__default["default"](items, insertPath);
48
- this.setState(_objectSpread({
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
- }, extraProps));
51
+ isDirty: true,
52
+ ...extraProps
53
+ });
52
54
  }
53
-
54
- exports.moveItem = moveItem;
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
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- require('core-js/modules/esnext.async-iterator.map.js');
6
- require('core-js/modules/esnext.iterator.map.js');
7
- require('core-js/modules/esnext.async-iterator.every.js');
8
- require('core-js/modules/esnext.iterator.constructor.js');
9
- require('core-js/modules/esnext.iterator.every.js');
10
- require('core-js/modules/esnext.async-iterator.for-each.js');
11
- require('core-js/modules/esnext.iterator.for-each.js');
12
- require('core-js/modules/web.dom-collections.iterator.js');
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
- let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
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
- let items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultItems();
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
- exports.getItemByPath = getItemByPath;
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
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
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]; // has parent
12
-
36
+ const itemIndex = pathFrom[pathFrom.length - 1];
13
37
  if (pathFrom.length > 1) {
14
- const parent = this.getItemByPath(pathFrom.slice(0, -1)); // is last (by order) item in array
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; // if collapsed by default and is last (by count) item in array remove this node from list of open nodes
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
- exports.tryDecreaseDepth = tryDecreaseDepth;
50
+ module.exports = __toCommonJS(tryDecreaseDepth_exports);
51
+ //# sourceMappingURL=tryDecreaseDepth.js.map