@elliemae/ds-query-builder 3.0.0-next.2 → 3.0.0-next.3
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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/components/Nestable/NestableItem.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\nimport React from 'react';\nimport cn from 'classnames';\n\nconst NestableItem = ({\n item,\n isCopy,\n options,\n index,\n isAndItem,\n isOrItem,\n isDraggableItem,\n singleRow,\n}) => {\n const { dragItem, renderItem, handler, childrenProp } = options;\n\n const isCollapsed = options.isCollapsed(item);\n const isDragging = !isCopy && dragItem && dragItem.id === item.id;\n const hasChildren = item[childrenProp] && item[childrenProp].length > 0;\n\n let Handler;\n const isOrGroup =\n item.element.type === 'group' &&\n (item.element.condition === '' || item.element.condition === false);\n const isAndGroup =\n item.element.type === 'group' &&\n !(item.element.condition === '' || item.element.condition === false);\n\n const itemProps = {\n className: cn(\n `nestable-item${isCopy ? '-copy' : ''}`,\n `nestable-item${isCopy ? '-copy' : ''}-${item.id}`,\n `nestable-item-type-${item.element.type}`,\n {\n 'is-or-group': isOrGroup,\n 'is-and-group': isAndGroup,\n 'is-and-filter': item.element.type === 'filter' && isAndItem,\n 'is-or-filter': item.element.type === 'filter' && isOrItem,\n },\n {\n 'is-dragging': isDragging,\n },\n ),\n };\n\n let rowProps = {};\n let handlerProps = {};\n if (!isCopy) {\n if (dragItem) {\n rowProps = {\n ...rowProps,\n onMouseEnter: e => options.onMouseEnter(e, item),\n };\n } else {\n handlerProps = {\n ...handlerProps,\n draggable: isDraggableItem !== false,\n onDragStart: e => options.onDragStart(e, item),\n };\n }\n }\n\n if (handler) {\n Handler = (\n <span className=\"nestable-item-handler\" {...handlerProps}>\n {handler}\n </span>\n );\n // Handler = React.cloneElement(handler, handlerProps);\n } else {\n rowProps = {\n ...rowProps,\n ...handlerProps,\n };\n }\n\n const childLength = item[childrenProp].length;\n let childClass = 'single';\n if (childLength === 0) childClass = 'empty';\n else if (childLength > 1) childClass = 'multiple';\n\n return (\n <li {...itemProps}>\n <div\n className={`nestable-item-name nestable-item-name--${item.element.type} `}\n {...rowProps}\n >\n {renderItem({\n item,\n handler: Handler,\n index,\n })}\n </div>\n {hasChildren && item.element.type === 'group' && !isCollapsed && (\n <ol className={`nestable-list nestable-child-count-${childClass} `}>\n {item[childrenProp].map((currentitem, i) => (\n <NestableItem\n key={i}\n index={i}\n isAndItem={isAndGroup}\n isCopy={isCopy}\n isOrItem={isOrGroup}\n item={currentitem}\n options={options}\n singleRow={singleRow}\n />\n ))}\n </ol>\n )}\n </li>\n );\n};\n\nexport default NestableItem;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,wBAAe;AAEf,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,EAAE,UAAU,YAAY,SAAS,iBAAiB;AAExD,QAAM,cAAc,QAAQ,YAAY;AACxC,QAAM,aAAa,CAAC,UAAU,YAAY,SAAS,OAAO,KAAK;AAC/D,QAAM,cAAc,KAAK,iBAAiB,KAAK,cAAc,SAAS;AAEtE,MAAI;AACJ,QAAM,YACJ,KAAK,QAAQ,SAAS,WACrB,MAAK,QAAQ,cAAc,MAAM,KAAK,QAAQ,cAAc;AAC/D,QAAM,aACJ,KAAK,QAAQ,SAAS,WACtB,CAAE,MAAK,QAAQ,cAAc,MAAM,KAAK,QAAQ,cAAc;AAEhE,QAAM,YAAY;AAAA,IAChB,WAAW,+BACT,gBAAgB,SAAS,UAAU,MACnC,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
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
27
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(module2))
|
|
29
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
30
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (module2, isNodeMode) => {
|
|
35
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
36
|
+
};
|
|
37
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
+
return (module2, temp) => {
|
|
39
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
+
};
|
|
41
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
42
|
+
var events_exports = {};
|
|
43
|
+
__export(events_exports, {
|
|
44
|
+
onDragEnd: () => onDragEnd,
|
|
45
|
+
onDragStart: () => onDragStart,
|
|
46
|
+
onKeyDown: () => onKeyDown,
|
|
47
|
+
onMouseEnter: () => onMouseEnter,
|
|
48
|
+
onMouseMove: () => onMouseMove,
|
|
49
|
+
onToggleCollapse: () => onToggleCollapse
|
|
50
|
+
});
|
|
51
|
+
var React = __toESM(require("react"));
|
|
52
|
+
var import_utils = require("@elliemae/ds-shared/utils");
|
|
53
|
+
function onDragStart(e, item) {
|
|
54
|
+
if (e) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
e.stopPropagation();
|
|
57
|
+
}
|
|
58
|
+
this.el = (0, import_utils.closest)(e.target, ".nestable-item");
|
|
59
|
+
this.startTrackMouse();
|
|
60
|
+
this.onMouseMove(e);
|
|
61
|
+
const { items } = this.state;
|
|
62
|
+
this.setState({
|
|
63
|
+
dragItem: item,
|
|
64
|
+
itemsOld: items
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function onDragEnd(e, isCancel) {
|
|
68
|
+
if (e && e.preventDefault)
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
this.stopTrackMouse();
|
|
71
|
+
this.el = null;
|
|
72
|
+
const { items } = this.state;
|
|
73
|
+
const nestedInFilter = this.checkFilterChildren(items);
|
|
74
|
+
if (nestedInFilter)
|
|
75
|
+
return this.dragRevert();
|
|
76
|
+
return isCancel ? this.dragRevert() : this.dragApply();
|
|
77
|
+
}
|
|
78
|
+
function onMouseMove(e) {
|
|
79
|
+
const { group, threshold } = this.props;
|
|
80
|
+
const { dragItem } = this.state;
|
|
81
|
+
const { clientX, clientY } = e;
|
|
82
|
+
const transformProps = (0, import_utils.getTransformProps)(clientX, clientY);
|
|
83
|
+
const elCopy = document.querySelector(`.nestable-${group} .nestable-drag-layer > .nestable-list`);
|
|
84
|
+
if (!this.elCopyStyles) {
|
|
85
|
+
const offset = (0, import_utils.getOffsetRect)(this.el);
|
|
86
|
+
const scroll = (0, import_utils.getTotalScroll)(this.el);
|
|
87
|
+
this.elCopyStyles = __spreadValues({
|
|
88
|
+
marginTop: offset.top - clientY - scroll.top,
|
|
89
|
+
marginLeft: offset.left - clientX - scroll.left
|
|
90
|
+
}, transformProps);
|
|
91
|
+
} else {
|
|
92
|
+
this.elCopyStyles = __spreadValues(__spreadValues({}, this.elCopyStyles), transformProps);
|
|
93
|
+
for (const key in transformProps) {
|
|
94
|
+
if (transformProps.hasOwnProperty(key)) {
|
|
95
|
+
elCopy.style[key] = transformProps[key];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const diffX = clientX - this.mouse.last.x;
|
|
99
|
+
if (diffX >= 0 && this.mouse.shift.x >= 0 || diffX <= 0 && this.mouse.shift.x <= 0) {
|
|
100
|
+
this.mouse.shift.x += diffX;
|
|
101
|
+
} else {
|
|
102
|
+
this.mouse.shift.x = 0;
|
|
103
|
+
}
|
|
104
|
+
this.mouse.last.x = clientX;
|
|
105
|
+
if (Math.abs(this.mouse.shift.x) > threshold) {
|
|
106
|
+
if (this.mouse.shift.x > 0) {
|
|
107
|
+
this.tryIncreaseDepth(dragItem);
|
|
108
|
+
} else {
|
|
109
|
+
this.tryDecreaseDepth(dragItem);
|
|
110
|
+
}
|
|
111
|
+
this.mouse.shift.x = 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function onMouseEnter(e, item) {
|
|
116
|
+
if (e) {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
}
|
|
120
|
+
const { collapsed, childrenProp } = this.props;
|
|
121
|
+
const { dragItem } = this.state;
|
|
122
|
+
if (dragItem.id === item.id)
|
|
123
|
+
return;
|
|
124
|
+
const pathFrom = this.getPathById(dragItem.id);
|
|
125
|
+
const pathTo = this.getPathById(item.id);
|
|
126
|
+
let collapseProps = {};
|
|
127
|
+
if (collapsed && pathFrom.length > 1) {
|
|
128
|
+
const parent = this.getItemByPath(pathFrom.slice(0, -1));
|
|
129
|
+
if (parent[childrenProp].length === 1) {
|
|
130
|
+
collapseProps = this.onToggleCollapse(parent, true);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);
|
|
134
|
+
}
|
|
135
|
+
function onToggleCollapse(item, isGetter) {
|
|
136
|
+
const { collapsed } = this.props;
|
|
137
|
+
const { collapsedGroups } = this.state;
|
|
138
|
+
const isCollapsed = this.isCollapsed(item);
|
|
139
|
+
const newState = {
|
|
140
|
+
collapsedGroups: isCollapsed ^ collapsed ? collapsedGroups.filter((id) => id !== item.id) : collapsedGroups.concat(item.id)
|
|
141
|
+
};
|
|
142
|
+
if (isGetter) {
|
|
143
|
+
return newState;
|
|
144
|
+
}
|
|
145
|
+
return this.setState(newState);
|
|
146
|
+
}
|
|
147
|
+
function onKeyDown(e) {
|
|
148
|
+
if (e.which === 27) {
|
|
149
|
+
this.onDragEnd(null, true);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
module.exports = __toCommonJS(events_exports);
|
|
153
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/Nestable/actions/events.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-bitwise, no-loops/no-loops, max-lines, max-statements, no-restricted-syntax, no-prototype-builtins */\nimport {\n closest,\n getOffsetRect,\n getTotalScroll,\n getTransformProps,\n} from '@elliemae/ds-shared/utils';\n\nexport function onDragStart(e, item) {\n if (e) {\n e.preventDefault();\n e.stopPropagation();\n }\n this.el = closest(e.target, '.nestable-item');\n this.startTrackMouse();\n this.onMouseMove(e);\n const { items } = this.state;\n this.setState({\n dragItem: item,\n itemsOld: items,\n });\n}\n\nexport function onDragEnd(e, isCancel) {\n if (e && e.preventDefault) e.preventDefault();\n\n this.stopTrackMouse();\n this.el = null;\n\n // check if filter has children\n const { items } = this.state;\n const nestedInFilter = this.checkFilterChildren(items);\n if (nestedInFilter) return this.dragRevert();\n\n return isCancel ? this.dragRevert() : this.dragApply();\n}\n\nexport function onMouseMove(e) {\n const { group, threshold } = this.props;\n const { dragItem } = this.state;\n const { clientX, clientY } = e;\n const transformProps = getTransformProps(clientX, clientY);\n const elCopy = document.querySelector(\n `.nestable-${group} .nestable-drag-layer > .nestable-list`,\n );\n if (!this.elCopyStyles) {\n const offset = getOffsetRect(this.el);\n const scroll = getTotalScroll(this.el);\n\n this.elCopyStyles = {\n marginTop: offset.top - clientY - scroll.top,\n marginLeft: offset.left - clientX - scroll.left,\n ...transformProps,\n };\n } else {\n this.elCopyStyles = {\n ...this.elCopyStyles,\n ...transformProps,\n };\n for (const key in transformProps) {\n if (transformProps.hasOwnProperty(key)) {\n elCopy.style[key] = transformProps[key];\n }\n }\n const diffX = clientX - this.mouse.last.x;\n if (\n (diffX >= 0 && this.mouse.shift.x >= 0) ||\n (diffX <= 0 && this.mouse.shift.x <= 0)\n ) {\n this.mouse.shift.x += diffX;\n } else {\n this.mouse.shift.x = 0;\n }\n this.mouse.last.x = clientX;\n if (Math.abs(this.mouse.shift.x) > threshold) {\n if (this.mouse.shift.x > 0) {\n this.tryIncreaseDepth(dragItem);\n } else {\n this.tryDecreaseDepth(dragItem);\n }\n this.mouse.shift.x = 0;\n }\n }\n}\nexport function onMouseEnter(e, item) {\n if (e) {\n e.preventDefault();\n e.stopPropagation();\n }\n\n const { collapsed, childrenProp } = this.props;\n const { dragItem } = this.state;\n if (dragItem.id === item.id) return;\n\n const pathFrom = this.getPathById(dragItem.id);\n const pathTo = this.getPathById(item.id);\n\n // if collapsed by default\n // and move last (by count) child\n // remove parent node from list of open nodes\n let collapseProps = {};\n if (collapsed && pathFrom.length > 1) {\n const parent = this.getItemByPath(pathFrom.slice(0, -1));\n if (parent[childrenProp].length === 1) {\n collapseProps = this.onToggleCollapse(parent, true);\n }\n }\n\n this.moveItem({ dragItem, pathFrom, pathTo }, collapseProps);\n}\n\nexport function onToggleCollapse(item, isGetter) {\n const { collapsed } = this.props;\n const { collapsedGroups } = this.state;\n const isCollapsed = this.isCollapsed(item);\n\n const newState = {\n collapsedGroups:\n isCollapsed ^ collapsed\n ? collapsedGroups.filter(id => id !== item.id)\n : collapsedGroups.concat(item.id),\n };\n\n if (isGetter) {\n return newState;\n }\n return this.setState(newState);\n}\nexport function onKeyDown(e) {\n if (e.which === 27) {\n // ESC\n this.onDragEnd(null, true);\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAKO;AAEA,qBAAqB,GAAG,MAAM;AACnC,MAAI,GAAG;AACL,MAAE;AACF,MAAE;AAAA;AAEJ,OAAK,KAAK,0BAAQ,EAAE,QAAQ;AAC5B,OAAK;AACL,OAAK,YAAY;AACjB,QAAM,EAAE,UAAU,KAAK;AACvB,OAAK,SAAS;AAAA,IACZ,UAAU;AAAA,IACV,UAAU;AAAA;AAAA;AAIP,mBAAmB,GAAG,UAAU;AACrC,MAAI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GAAG;AACL,MAAE;AACF,MAAE;AAAA;AAGJ,QAAM,EAAE,WAAW,iBAAiB,KAAK;AACzC,QAAM,EAAE,aAAa,KAAK;AAC1B,MAAI,SAAS,OAAO,KAAK;AAAI;AAE7B,QAAM,WAAW,KAAK,YAAY,SAAS;AAC3C,QAAM,SAAS,KAAK,YAAY,KAAK;AAKrC,MAAI,gBAAgB;AACpB,MAAI,aAAa,SAAS,SAAS,GAAG;AACpC,UAAM,SAAS,KAAK,cAAc,SAAS,MAAM,GAAG;AACpD,QAAI,OAAO,cAAc,WAAW,GAAG;AACrC,sBAAgB,KAAK,iBAAiB,QAAQ;AAAA;AAAA;AAIlD,OAAK,SAAS,EAAE,UAAU,UAAU,UAAU;AAAA;AAGzC,0BAA0B,MAAM,UAAU;AAC/C,QAAM,EAAE,cAAc,KAAK;AAC3B,QAAM,EAAE,oBAAoB,KAAK;AACjC,QAAM,cAAc,KAAK,YAAY;AAErC,QAAM,WAAW;AAAA,IACf,iBACE,cAAc,YACV,gBAAgB,OAAO,QAAM,OAAO,KAAK,MACzC,gBAAgB,OAAO,KAAK;AAAA;AAGpC,MAAI,UAAU;AACZ,WAAO;AAAA;AAET,SAAO,KAAK,SAAS;AAAA;AAEhB,mBAAmB,GAAG;AAC3B,MAAI,EAAE,UAAU,IAAI;AAElB,SAAK,UAAU,MAAM;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 getItemOptions_exports = {};
|
|
29
|
+
__export(getItemOptions_exports, {
|
|
30
|
+
getItemOptions: () => getItemOptions
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
function getItemOptions() {
|
|
34
|
+
const { renderItem, renderCollapseIcon, handler, childrenProp } = this.props;
|
|
35
|
+
const { dragItem } = this.state;
|
|
36
|
+
return {
|
|
37
|
+
dragItem,
|
|
38
|
+
childrenProp,
|
|
39
|
+
renderItem,
|
|
40
|
+
renderCollapseIcon,
|
|
41
|
+
handler,
|
|
42
|
+
onDragStart: this.onDragStart,
|
|
43
|
+
onMouseEnter: this.onMouseEnter,
|
|
44
|
+
isCollapsed: this.isCollapsed,
|
|
45
|
+
onToggleCollapse: this.onToggleCollapse
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
module.exports = __toCommonJS(getItemOptions_exports);
|
|
49
|
+
//# sourceMappingURL=getItemOptions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/Nestable/actions/getItemOptions.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export function getItemOptions() {\n const { renderItem, renderCollapseIcon, handler, childrenProp } = this.props;\n const { dragItem } = this.state;\n\n return {\n dragItem,\n childrenProp,\n renderItem,\n renderCollapseIcon,\n handler,\n\n onDragStart: this.onDragStart,\n onMouseEnter: this.onMouseEnter,\n isCollapsed: this.isCollapsed,\n onToggleCollapse: this.onToggleCollapse,\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,0BAA0B;AAC/B,QAAM,EAAE,YAAY,oBAAoB,SAAS,iBAAiB,KAAK;AACvE,QAAM,EAAE,aAAa,KAAK;AAE1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,aAAa,KAAK;AAAA,IAClB,cAAc,KAAK;AAAA,IACnB,aAAa,KAAK;AAAA,IAClB,kBAAkB,KAAK;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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"));
|
|
37
|
+
function getRealNextPath(prevPath, nextPath) {
|
|
38
|
+
const { childrenProp } = this.props;
|
|
39
|
+
const ppLastIndex = prevPath.length - 1;
|
|
40
|
+
const npLastIndex = nextPath.length - 1;
|
|
41
|
+
if (prevPath.length < nextPath.length) {
|
|
42
|
+
let wasShifted = false;
|
|
43
|
+
return nextPath.map((nextIndex, i) => {
|
|
44
|
+
if (wasShifted) {
|
|
45
|
+
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
46
|
+
}
|
|
47
|
+
if (typeof prevPath[i] !== "number") {
|
|
48
|
+
return nextIndex;
|
|
49
|
+
}
|
|
50
|
+
if (nextPath[i] > prevPath[i] && i === ppLastIndex) {
|
|
51
|
+
wasShifted = true;
|
|
52
|
+
return nextIndex - 1;
|
|
53
|
+
}
|
|
54
|
+
return nextIndex;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (prevPath.length === nextPath.length) {
|
|
58
|
+
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
59
|
+
const target = this.getItemByPath(nextPath);
|
|
60
|
+
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
61
|
+
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return nextPath;
|
|
66
|
+
}
|
|
67
|
+
function getPathById(id, items) {
|
|
68
|
+
const { childrenProp } = this.props;
|
|
69
|
+
let path = [];
|
|
70
|
+
items.every((item, i) => {
|
|
71
|
+
if (item.id === id) {
|
|
72
|
+
path.push(i);
|
|
73
|
+
} else if (item[childrenProp]) {
|
|
74
|
+
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
75
|
+
if (childrenPath.length) {
|
|
76
|
+
path = path.concat(i).concat(childrenPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return path.length === 0;
|
|
80
|
+
});
|
|
81
|
+
return path;
|
|
82
|
+
}
|
|
83
|
+
function getItemByPath(path, items) {
|
|
84
|
+
const { childrenProp } = this.props;
|
|
85
|
+
let item = null;
|
|
86
|
+
path.forEach((index) => {
|
|
87
|
+
const list = item ? item[childrenProp] : items;
|
|
88
|
+
item = list[index];
|
|
89
|
+
});
|
|
90
|
+
return item;
|
|
91
|
+
}
|
|
92
|
+
function getItemDepth(item) {
|
|
93
|
+
const { childrenProp } = this.props;
|
|
94
|
+
let level = 1;
|
|
95
|
+
if (item[childrenProp].length > 0) {
|
|
96
|
+
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
97
|
+
level += Math.max(...childrenDepths);
|
|
98
|
+
}
|
|
99
|
+
return level;
|
|
100
|
+
}
|
|
101
|
+
function getSplicePath(path, options = {}) {
|
|
102
|
+
const splicePath = {};
|
|
103
|
+
const numToRemove = options.numToRemove || 0;
|
|
104
|
+
const itemsToInsert = options.itemsToInsert || [];
|
|
105
|
+
const lastIndex = path.length - 1;
|
|
106
|
+
let currentPath = splicePath;
|
|
107
|
+
path.forEach((index, i) => {
|
|
108
|
+
if (i === lastIndex) {
|
|
109
|
+
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
110
|
+
} else {
|
|
111
|
+
const nextPath = {};
|
|
112
|
+
currentPath[index] = { [options.childrenProp]: nextPath };
|
|
113
|
+
currentPath = nextPath;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return splicePath;
|
|
117
|
+
}
|
|
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;AA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,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,42 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
27
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(module2))
|
|
29
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
30
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (module2, isNodeMode) => {
|
|
35
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
36
|
+
};
|
|
37
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
+
return (module2, temp) => {
|
|
39
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
+
};
|
|
41
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
42
|
+
var moveItem_exports = {};
|
|
43
|
+
__export(moveItem_exports, {
|
|
44
|
+
moveItem: () => moveItem
|
|
45
|
+
});
|
|
46
|
+
var React = __toESM(require("react"));
|
|
47
|
+
var import_react_addons_update = __toESM(require("react-addons-update"));
|
|
48
|
+
function moveItem({ dragItem, pathFrom, pathTo }, extraProps = {}) {
|
|
49
|
+
const { childrenProp } = this.props;
|
|
50
|
+
let { items } = this.state;
|
|
51
|
+
const realPathTo = this.getRealNextPath(pathFrom, pathTo);
|
|
52
|
+
const removePath = this.getSplicePath(pathFrom, {
|
|
53
|
+
numToRemove: 1,
|
|
54
|
+
childrenProp
|
|
55
|
+
});
|
|
56
|
+
const insertPath = this.getSplicePath(realPathTo, {
|
|
57
|
+
numToRemove: 0,
|
|
58
|
+
itemsToInsert: [dragItem],
|
|
59
|
+
childrenProp
|
|
60
|
+
});
|
|
61
|
+
items = (0, import_react_addons_update.default)(items, removePath);
|
|
62
|
+
items = (0, import_react_addons_update.default)(items, insertPath);
|
|
63
|
+
this.setState(__spreadValues({
|
|
64
|
+
items,
|
|
65
|
+
isDirty: true
|
|
66
|
+
}, extraProps));
|
|
67
|
+
}
|
|
68
|
+
module.exports = __toCommonJS(moveItem_exports);
|
|
69
|
+
//# 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,KACN;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
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"));
|
|
37
|
+
function getRealNextPath(prevPath, nextPath) {
|
|
38
|
+
const { childrenProp } = this.props;
|
|
39
|
+
const ppLastIndex = prevPath.length - 1;
|
|
40
|
+
const npLastIndex = nextPath.length - 1;
|
|
41
|
+
if (prevPath.length < nextPath.length) {
|
|
42
|
+
let wasShifted = false;
|
|
43
|
+
return nextPath.map((nextIndex, i) => {
|
|
44
|
+
if (wasShifted) {
|
|
45
|
+
return i === npLastIndex ? nextIndex + 1 : nextIndex;
|
|
46
|
+
}
|
|
47
|
+
if (typeof prevPath[i] !== "number") {
|
|
48
|
+
return nextIndex;
|
|
49
|
+
}
|
|
50
|
+
if (nextPath[i] > prevPath[i] && i === ppLastIndex) {
|
|
51
|
+
wasShifted = true;
|
|
52
|
+
return nextIndex - 1;
|
|
53
|
+
}
|
|
54
|
+
return nextIndex;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (prevPath.length === nextPath.length) {
|
|
58
|
+
if (nextPath[npLastIndex] > prevPath[npLastIndex]) {
|
|
59
|
+
const target = this.getItemByPath(nextPath);
|
|
60
|
+
if (target[childrenProp] && target[childrenProp].length && !this.isCollapsed(target)) {
|
|
61
|
+
return nextPath.slice(0, -1).concat(nextPath[npLastIndex] - 1).concat(0);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return nextPath;
|
|
66
|
+
}
|
|
67
|
+
function getPathById(id, items = this.getDefaultItems()) {
|
|
68
|
+
const { childrenProp } = this.props;
|
|
69
|
+
let path = [];
|
|
70
|
+
items.every((item, i) => {
|
|
71
|
+
if (item.id === id) {
|
|
72
|
+
path.push(i);
|
|
73
|
+
} else if (item[childrenProp]) {
|
|
74
|
+
const childrenPath = this.getPathById(id, item[childrenProp]);
|
|
75
|
+
if (childrenPath.length) {
|
|
76
|
+
path = path.concat(i).concat(childrenPath);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return path.length === 0;
|
|
80
|
+
});
|
|
81
|
+
return path;
|
|
82
|
+
}
|
|
83
|
+
function getItemByPath(path, items = this.getDefaultItems()) {
|
|
84
|
+
const { childrenProp } = this.props;
|
|
85
|
+
let item = null;
|
|
86
|
+
path.forEach((index) => {
|
|
87
|
+
const list = item ? item[childrenProp] : items;
|
|
88
|
+
item = list[index];
|
|
89
|
+
});
|
|
90
|
+
return item;
|
|
91
|
+
}
|
|
92
|
+
function getItemDepth(item) {
|
|
93
|
+
const { childrenProp } = this.props;
|
|
94
|
+
let level = 1;
|
|
95
|
+
if (item[childrenProp].length > 0) {
|
|
96
|
+
const childrenDepths = item[childrenProp].map(this.getItemDepth);
|
|
97
|
+
level += Math.max(...childrenDepths);
|
|
98
|
+
}
|
|
99
|
+
return level;
|
|
100
|
+
}
|
|
101
|
+
function getSplicePath(path, options = {}) {
|
|
102
|
+
const splicePath = {};
|
|
103
|
+
const numToRemove = options.numToRemove || 0;
|
|
104
|
+
const itemsToInsert = options.itemsToInsert || [];
|
|
105
|
+
const lastIndex = path.length - 1;
|
|
106
|
+
let currentPath = splicePath;
|
|
107
|
+
path.forEach((index, i) => {
|
|
108
|
+
if (i === lastIndex) {
|
|
109
|
+
currentPath.$splice = [[index, numToRemove, ...itemsToInsert]];
|
|
110
|
+
} else {
|
|
111
|
+
const nextPath = {};
|
|
112
|
+
currentPath[index] = { [options.childrenProp]: nextPath };
|
|
113
|
+
currentPath = nextPath;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
return splicePath;
|
|
117
|
+
}
|
|
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,SAA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