web-component-gallery 0.1.62 → 0.1.63
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/amap.umd.js +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/tree.umd.js +1639 -8600
- package/lib/tree/Directory.js +1 -1
- package/lib/tree/style/Directory.less +2 -2
- package/package.json +1 -1
- package/plugins/lib/tree/Directory.js +1 -1
- package/plugins/lib/tree/style/Directory.less +2 -2
package/dist/amap.umd.js
CHANGED
|
@@ -8945,7 +8945,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ind
|
|
|
8945
8945
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8946
8946
|
|
|
8947
8947
|
"use strict";
|
|
8948
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_Tree__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/Tree */ \"./plugins/utils/Tree.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/tree/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/input/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/dropdown/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/button/index.js\");\n/* harmony import */ var _style_Directory_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style/Directory.less */ \"./plugins/lib/tree/style/Directory.less\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../index */ \"./plugins/lib/index.js\");\n\n\n\n\n\n\n\n/* 明天来了做一下@快捷指向 */\n\nconst TreeNode = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].TreeNode;\nconst DirectoryTree = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].DirectoryTree;\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'DirectoryTreeMenu',\n props: {\n treeData: {\n type: Array,\n default: () => []\n },\n treeExpandKeys: {\n type: Array,\n default: () => []\n },\n treePlus: {\n type: Boolean,\n default: true\n },\n treeActions: {\n type: Array,\n default: () => []\n },\n treeActionsPlus: {\n type: Boolean,\n default: true\n },\n replaceFields: {\n type: Object,\n default: () => ({\n children: 'children',\n key: 'id',\n title: 'title'\n })\n }\n },\n data() {\n return {\n NodeCheckedKeys: [],\n NodeSelectedKeys: [],\n NodeExpandKeys: [],\n NodeKey: [],\n NodeActions: null,\n MenuDropdown: false,\n NodeActionsStyle: {}\n };\n },\n mounted() {\n this.onInitTree();\n },\n watch: {\n treeData(newValue, oldValue) {\n this.onInitTree(!oldValue.length);\n },\n treeExpandKeys(newValue) {\n this.NodeExpandKeys = newValue;\n }\n },\n methods: {\n TreeNodeRender(node, nodeIndex, parentNode) {\n const h = this.$createElement;\n const {\n replaceFields,\n NodeActions,\n treeActions,\n NodeActionsStyle,\n NodeExpandKeys,\n NodeKey,\n treeActionsPlus,\n createTreeNode,\n handleMouseLeave,\n handleOperateClick,\n handlePlusClick\n } = this;\n const key = node[replaceFields.key];\n return h(TreeNode, {\n \"key\": key,\n \"class\": \"DirectoryTreeMenu__Node\",\n \"scopedSlots\": {\n title: props => {\n return h(\"div\", {\n \"class\": \"__Title\"\n }, [node.type != 'input' ? h(\"span\", [node[replaceFields.title]]) : h(ant_design_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n \"attrs\": {\n \"placeholder\": \"请输入节点名称\",\n \"default-value\": node[replaceFields.title]\n },\n \"on\": {\n ...{\n blur: ({\n target\n }) => createTreeNode(target, node),\n pressEnter: event => event.target.blur(event, true)\n }\n },\n \"ref\": \"inputNodeRef\"\n }), NodeActions && Boolean(treeActions.length) && NodeKey.includes(props.eventKey) && node.type != 'input' && h(\"div\", {\n \"ref\": \"TreeMenuActions\",\n \"class\": \"DirectoryTreeMenu__Actions\",\n \"on\": {\n ...{\n mouseenter: event => event.stopPropagation()\n }\n }\n }, [h(ant_design_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n \"attrs\": {\n \"trigger\": ['click'],\n \"overlayClassName\": \"DirectoryTreeMenu__Dropdown\"\n }\n }, [h(_index__WEBPACK_IMPORTED_MODULE_3__.SvgIcon, {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-more\"\n },\n \"on\": {\n ...{\n click: e => e.preventDefault()\n }\n }\n }), h(\"div\", {\n \"slot\": \"overlay\",\n \"class\": \"DirectoryTreeMenu__Dropdown__Menu\"\n }, [treeActions.map((handle, i) => {\n return h(\"span\", {\n \"key\": i,\n \"on\": {\n ...{\n // this.$emit('handleOperateClick', handle, NodeActions)\n click: () => handleOperateClick(handle, {\n ...node,\n nodeIndex\n }, parentNode)\n }\n }\n }, [h(_index__WEBPACK_IMPORTED_MODULE_3__.SvgIcon, {\n \"attrs\": {\n \"icon-class\": handle.svg\n }\n }), \" \", handle.text]);\n })])]), treeActionsPlus && h(_index__WEBPACK_IMPORTED_MODULE_3__.SvgIcon, {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-plus\"\n },\n \"on\": {\n ...{\n click: () => handlePlusClick()\n }\n }\n })])]);\n }\n }\n }, [node[replaceFields.children] && node[replaceFields.children].length && node[replaceFields.children].map((childNode, childNodeIndex) => this.TreeNodeRender(childNode, childNodeIndex, node))]);\n },\n appendTreeNode() {\n this.treeData.push({\n type: 'input',\n append: true,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n },\n createTreeNode({\n value\n }, node) {\n this.$set(node, 'type', 'text');\n this.$emit(`handlePlus${node.append ? 'Add' : 'Update'}`, value, node.append ? node.parentOrgId : node[this.replaceFields.key]);\n const parentNodes = node.parentOrgId ? this.findItemById(this.treeData, node.parentOrgId)[this.replaceFields.children] : this.treeData;\n if (node.append) {\n const i = parentNodes.findIndex(child => child[this.replaceFields.key] == node[this.replaceFields.key]);\n parentNodes.splice(i, 1);\n }\n },\n handleOperateClick(handle, node, parentNode) {\n const key = node[this.replaceFields.key];\n let that = this;\n switch (handle.type) {\n case 'update':\n const updateNode = this.findItemById(this.treeData, key);\n this.$set(updateNode, 'type', 'input');\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'copy':\n // 明天来了优化一下\n const cloneNode = parentNode ? parentNode[this.replaceFields.children] : this.treeData;\n cloneNode.splice(node.nodeIndex + 1, 0, {\n type: 'input',\n append: true,\n parentOrgId: parentNode ? parentNode[this.replaceFields.key] : null,\n [this.replaceFields.key]: new Date().getTime(),\n [this.replaceFields.title]: node[this.replaceFields.title]\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'delete':\n this.$confirm({\n title: '确定要删除当前节点吗?',\n okText: '确定',\n cancelText: '取消',\n onOk() {\n that.$emit('handleDeleteClick', node);\n console.log('OK');\n },\n onCancel() {\n console.log('Cancel');\n }\n });\n break;\n default:\n this.$emit('handleOperateClick', handle, node);\n break;\n }\n },\n handlePlusClick() {\n const node = this.findItemById(this.treeData, this.NodeActions.id);\n console.log(node, this.NodeActions, '--NodeActions');\n const childNode = node[this.replaceFields.children] ?? [];\n childNode.push({\n type: 'input',\n append: true,\n parentOrgId: this.NodeActions.id,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.NodeExpandKeys.push(this.NodeActions.id);\n node[this.replaceFields.children] = childNode;\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n console.log(node, '--NodeActions');\n },\n findItemById(treeData, id) {\n for (let i = 0; i < treeData.length; i++) {\n if (treeData[i][this.replaceFields.key] === id) return treeData[i];\n let childNode = treeData[i][this.replaceFields.children];\n if (childNode && childNode.length > 0) {\n const foundItem = this.findItemById(treeData[i][this.replaceFields.children], id);\n if (foundItem) return foundItem;\n }\n }\n },\n onInitTree(treeExpend = true) {\n this.treeData && (this.NodeSelectedKeys = [this.treeData.at(0)?.[this.replaceFields.key]]);\n this.NodeExpandKeys = this.treeExpandKeys.length && this.treeExpandKeys || treeExpend && (0,_utils_Tree__WEBPACK_IMPORTED_MODULE_1__.getTreeKey)(this.treeData, true, this.replaceFields) || [];\n },\n onCheck(keys, {}) {\n this.NodeCheckedKeys = keys;\n this.$emit('onCheck', keys);\n },\n onSelect(keys, {\n nativeEvent,\n node\n }) {\n this.NodeSelectedKeys = keys;\n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.$emit('onSelect', keys);\n },\n onExpand(expandedKeys, {\n expanded,\n node\n }) {\n this.NodeExpandKeys = [].concat(expandedKeys);\n console.log(expandedKeys, expanded, node, 'Trigger Expand');\n },\n getIcon(props) {\n const h = this.$createElement;\n const {\n isLeaf,\n expanded\n } = props;\n if (isLeaf) {\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": \"home\"\n }\n });\n }\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": expanded ? 'folder-open' : 'folder'\n }\n });\n },\n handleMouseEnter({\n event,\n node\n }) {\n this.NodeActions = {\n id: node._props.eventKey,\n title: node._props.title,\n parentOrgId: node.$parent.eventKey || null\n };\n // this.MenuDropdown = false \n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.NodeKey.push(node.eventKey);\n // console.log(node, 'handleMouseEnter')\n // 是否加个参数 判断是否处于打开状态\n },\n handleMouseLeave({\n event,\n node\n }) {\n if (this.NodeKey.includes(node.eventKey) && this.NodeSelectedKeys != node.eventKey) {\n const i = this.NodeKey.findIndex(key => key == node.eventKey);\n this.NodeKey.splice(i, 1);\n }\n // this.NodeKey = []\n },\n onDragEnter(node) {\n console.log(node, '--onDragEnter');\n // expandedKeys 需要受控时设置\n // this.expandedKeys = info.expandedKeys\n },\n onDrop(info) {\n const dragKey = info.dragNode.eventKey;\n const dropPos = info.node.pos.split(\"-\");\n // 拖动的位置\n const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);\n const node = info.node; //目标节点\n const dragNode = info.dragNode; // 拖动节点\n const dropKey = node.eventKey;\n console.log(dragNode, node, '--dropToGap');\n if (dragNode.$parent?.eventKey !== node.$parent?.eventKey || !info.dropToGap) {\n // 阻止跨父级拖拽\n this.$message.warning(\"只能在同级排序\");\n return false;\n }\n const {\n key,\n children\n } = this.replaceFields;\n const loop = (data, eventKey, callback) => {\n data.forEach((node, i, array) => {\n if (node[key] === eventKey) {\n return callback(node, i, array);\n }\n if (node[children]) {\n return loop(node[children], eventKey, callback);\n }\n });\n };\n const data = [...this.treeData];\n let dragObj;\n let dragObjIndex;\n loop(data, dragKey, (node, i, array) => {\n dragObj = node;\n dragObjIndex = i;\n });\n let dropIndex;\n loop(data, dropKey, (node, i, array) => {\n dropIndex = i;\n console.log(node, i, dragObj, dragObjIndex, '--i');\n });\n this.$emit('onDrop', {\n [key]: dragObj[key],\n originalIndex: dragObjIndex,\n presentIndex: dropPosition === -1 ? dropIndex : dropIndex + 1\n });\n }\n },\n render() {\n const h = arguments[0];\n const {\n $attrs,\n treePlus,\n treeData,\n NodeCheckedKeys,\n NodeSelectedKeys,\n NodeExpandKeys,\n onCheck,\n onSelect,\n onExpand,\n handleMouseEnter,\n handleMouseLeave,\n onDragEnter,\n onDrop,\n TreeNodeRender,\n appendTreeNode,\n replaceFields\n } = this;\n return h(\"div\", {\n \"class\": \"DirectoryTreeMenu\"\n }, [h(\"div\", {\n \"class\": \"treeDirectory\"\n }, [h(\"span\", [$attrs.menuTitle || '目录']), treePlus && h(ant_design_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n \"attrs\": {\n \"icon\": \"plus\",\n \"size\": \"small\"\n },\n \"on\": {\n ...{\n click: appendTreeNode\n }\n }\n })]), h(DirectoryTree, {\n \"attrs\": {\n \"draggable\": true,\n \"default-expand-all\": true,\n \"checkedKeys\": NodeCheckedKeys,\n \"selectedKeys\": NodeSelectedKeys,\n \"expandedKeys\": NodeExpandKeys,\n \"expandAction\": \"dblclick\",\n ...$attrs,\n \"tree-node-filter-prop\": \"title\"\n },\n \"class\": \"DirectoryTreeMenu__Tree\",\n \"on\": {\n ...{\n check: onCheck,\n select: onSelect,\n expand: onExpand,\n mouseenter: handleMouseEnter,\n mouseleave: handleMouseLeave,\n dragenter: onDragEnter,\n drop: onDrop\n }\n }\n }, [treeData.map((node, nodeIndex) => TreeNodeRender(node, nodeIndex))])]);\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/Directory.js?");
|
|
8948
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_Tree__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/Tree */ \"./plugins/utils/Tree.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/tree/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/input/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/dropdown/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/button/index.js\");\n/* harmony import */ var _style_Directory_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style/Directory.less */ \"./plugins/lib/tree/style/Directory.less\");\n/* harmony import */ var _svgIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../svgIcon */ \"./plugins/lib/svgIcon/index.js\");\n\n\n\n\n\n\n\n/* 明天来了做一下@快捷指向 */\n\nconst TreeNode = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].TreeNode;\nconst DirectoryTree = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].DirectoryTree;\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'DirectoryTreeMenu',\n props: {\n treeData: {\n type: Array,\n default: () => []\n },\n treeExpandKeys: {\n type: Array,\n default: () => []\n },\n treePlus: {\n type: Boolean,\n default: true\n },\n treeActions: {\n type: Array,\n default: () => []\n },\n treeActionsPlus: {\n type: Boolean,\n default: true\n },\n replaceFields: {\n type: Object,\n default: () => ({\n children: 'children',\n key: 'id',\n title: 'title'\n })\n }\n },\n data() {\n return {\n NodeCheckedKeys: [],\n NodeSelectedKeys: [],\n NodeExpandKeys: [],\n NodeKey: [],\n NodeActions: null,\n MenuDropdown: false,\n NodeActionsStyle: {}\n };\n },\n mounted() {\n this.onInitTree();\n },\n watch: {\n treeData(newValue, oldValue) {\n this.onInitTree(!oldValue.length);\n },\n treeExpandKeys(newValue) {\n this.NodeExpandKeys = newValue;\n }\n },\n methods: {\n TreeNodeRender(node, nodeIndex, parentNode) {\n const h = this.$createElement;\n const {\n replaceFields,\n NodeActions,\n treeActions,\n NodeActionsStyle,\n NodeExpandKeys,\n NodeKey,\n treeActionsPlus,\n createTreeNode,\n handleMouseLeave,\n handleOperateClick,\n handlePlusClick\n } = this;\n const key = node[replaceFields.key];\n return h(TreeNode, {\n \"key\": key,\n \"class\": \"DirectoryTreeMenu__Node\",\n \"scopedSlots\": {\n title: props => {\n return h(\"div\", {\n \"class\": \"__Title\"\n }, [node.type != 'input' ? h(\"span\", [node[replaceFields.title]]) : h(ant_design_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n \"attrs\": {\n \"placeholder\": \"请输入节点名称\",\n \"default-value\": node[replaceFields.title]\n },\n \"on\": {\n ...{\n blur: ({\n target\n }) => createTreeNode(target, node),\n pressEnter: event => event.target.blur(event, true)\n }\n },\n \"ref\": \"inputNodeRef\"\n }), NodeActions && Boolean(treeActions.length) && NodeKey.includes(props.eventKey) && node.type != 'input' && h(\"div\", {\n \"ref\": \"TreeMenuActions\",\n \"class\": \"DirectoryTreeMenu__Actions\",\n \"on\": {\n ...{\n mouseenter: event => event.stopPropagation()\n }\n }\n }, [h(ant_design_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n \"attrs\": {\n \"trigger\": ['click'],\n \"overlayClassName\": \"DirectoryTreeMenu__Dropdown\"\n }\n }, [h(_svgIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-more\"\n },\n \"on\": {\n ...{\n click: e => e.preventDefault()\n }\n }\n }), h(\"div\", {\n \"slot\": \"overlay\",\n \"class\": \"DirectoryTreeMenu__Dropdown__Menu\"\n }, [treeActions.map((handle, i) => {\n return h(\"span\", {\n \"key\": i,\n \"on\": {\n ...{\n // this.$emit('handleOperateClick', handle, NodeActions)\n click: () => handleOperateClick(handle, {\n ...node,\n nodeIndex\n }, parentNode)\n }\n }\n }, [h(_svgIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n \"attrs\": {\n \"icon-class\": handle.svg\n }\n }), \" \", handle.text]);\n })])]), treeActionsPlus && h(_svgIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-plus\"\n },\n \"on\": {\n ...{\n click: () => handlePlusClick()\n }\n }\n })])]);\n }\n }\n }, [node[replaceFields.children] && node[replaceFields.children].length && node[replaceFields.children].map((childNode, childNodeIndex) => this.TreeNodeRender(childNode, childNodeIndex, node))]);\n },\n appendTreeNode() {\n this.treeData.push({\n type: 'input',\n append: true,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n },\n createTreeNode({\n value\n }, node) {\n this.$set(node, 'type', 'text');\n this.$emit(`handlePlus${node.append ? 'Add' : 'Update'}`, value, node.append ? node.parentOrgId : node[this.replaceFields.key]);\n const parentNodes = node.parentOrgId ? this.findItemById(this.treeData, node.parentOrgId)[this.replaceFields.children] : this.treeData;\n if (node.append) {\n const i = parentNodes.findIndex(child => child[this.replaceFields.key] == node[this.replaceFields.key]);\n parentNodes.splice(i, 1);\n }\n },\n handleOperateClick(handle, node, parentNode) {\n const key = node[this.replaceFields.key];\n let that = this;\n switch (handle.type) {\n case 'update':\n const updateNode = this.findItemById(this.treeData, key);\n this.$set(updateNode, 'type', 'input');\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'copy':\n // 明天来了优化一下\n const cloneNode = parentNode ? parentNode[this.replaceFields.children] : this.treeData;\n cloneNode.splice(node.nodeIndex + 1, 0, {\n type: 'input',\n append: true,\n parentOrgId: parentNode ? parentNode[this.replaceFields.key] : null,\n [this.replaceFields.key]: new Date().getTime(),\n [this.replaceFields.title]: node[this.replaceFields.title]\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'delete':\n this.$confirm({\n title: '确定要删除当前节点吗?',\n okText: '确定',\n cancelText: '取消',\n onOk() {\n that.$emit('handleDeleteClick', node);\n console.log('OK');\n },\n onCancel() {\n console.log('Cancel');\n }\n });\n break;\n default:\n this.$emit('handleOperateClick', handle, node);\n break;\n }\n },\n handlePlusClick() {\n const node = this.findItemById(this.treeData, this.NodeActions.id);\n console.log(node, this.NodeActions, '--NodeActions');\n const childNode = node[this.replaceFields.children] ?? [];\n childNode.push({\n type: 'input',\n append: true,\n parentOrgId: this.NodeActions.id,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.NodeExpandKeys.push(this.NodeActions.id);\n node[this.replaceFields.children] = childNode;\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n console.log(node, '--NodeActions');\n },\n findItemById(treeData, id) {\n for (let i = 0; i < treeData.length; i++) {\n if (treeData[i][this.replaceFields.key] === id) return treeData[i];\n let childNode = treeData[i][this.replaceFields.children];\n if (childNode && childNode.length > 0) {\n const foundItem = this.findItemById(treeData[i][this.replaceFields.children], id);\n if (foundItem) return foundItem;\n }\n }\n },\n onInitTree(treeExpend = true) {\n this.treeData && (this.NodeSelectedKeys = [this.treeData.at(0)?.[this.replaceFields.key]]);\n this.NodeExpandKeys = this.treeExpandKeys.length && this.treeExpandKeys || treeExpend && (0,_utils_Tree__WEBPACK_IMPORTED_MODULE_1__.getTreeKey)(this.treeData, true, this.replaceFields) || [];\n },\n onCheck(keys, {}) {\n this.NodeCheckedKeys = keys;\n this.$emit('onCheck', keys);\n },\n onSelect(keys, {\n nativeEvent,\n node\n }) {\n this.NodeSelectedKeys = keys;\n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.$emit('onSelect', keys);\n },\n onExpand(expandedKeys, {\n expanded,\n node\n }) {\n this.NodeExpandKeys = [].concat(expandedKeys);\n console.log(expandedKeys, expanded, node, 'Trigger Expand');\n },\n getIcon(props) {\n const h = this.$createElement;\n const {\n isLeaf,\n expanded\n } = props;\n if (isLeaf) {\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": \"home\"\n }\n });\n }\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": expanded ? 'folder-open' : 'folder'\n }\n });\n },\n handleMouseEnter({\n event,\n node\n }) {\n this.NodeActions = {\n id: node._props.eventKey,\n title: node._props.title,\n parentOrgId: node.$parent.eventKey || null\n };\n // this.MenuDropdown = false \n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.NodeKey.push(node.eventKey);\n // console.log(node, 'handleMouseEnter')\n // 是否加个参数 判断是否处于打开状态\n },\n handleMouseLeave({\n event,\n node\n }) {\n if (this.NodeKey.includes(node.eventKey) && this.NodeSelectedKeys != node.eventKey) {\n const i = this.NodeKey.findIndex(key => key == node.eventKey);\n this.NodeKey.splice(i, 1);\n }\n // this.NodeKey = []\n },\n onDragEnter(node) {\n console.log(node, '--onDragEnter');\n // expandedKeys 需要受控时设置\n // this.expandedKeys = info.expandedKeys\n },\n onDrop(info) {\n const dragKey = info.dragNode.eventKey;\n const dropPos = info.node.pos.split(\"-\");\n // 拖动的位置\n const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);\n const node = info.node; //目标节点\n const dragNode = info.dragNode; // 拖动节点\n const dropKey = node.eventKey;\n console.log(dragNode, node, '--dropToGap');\n if (dragNode.$parent?.eventKey !== node.$parent?.eventKey || !info.dropToGap) {\n // 阻止跨父级拖拽\n this.$message.warning(\"只能在同级排序\");\n return false;\n }\n const {\n key,\n children\n } = this.replaceFields;\n const loop = (data, eventKey, callback) => {\n data.forEach((node, i, array) => {\n if (node[key] === eventKey) {\n return callback(node, i, array);\n }\n if (node[children]) {\n return loop(node[children], eventKey, callback);\n }\n });\n };\n const data = [...this.treeData];\n let dragObj;\n let dragObjIndex;\n loop(data, dragKey, (node, i, array) => {\n dragObj = node;\n dragObjIndex = i;\n });\n let dropIndex;\n loop(data, dropKey, (node, i, array) => {\n dropIndex = i;\n console.log(node, i, dragObj, dragObjIndex, '--i');\n });\n this.$emit('onDrop', {\n [key]: dragObj[key],\n originalIndex: dragObjIndex,\n presentIndex: dropPosition === -1 ? dropIndex : dropIndex + 1\n });\n }\n },\n render() {\n const h = arguments[0];\n const {\n $attrs,\n treePlus,\n treeData,\n NodeCheckedKeys,\n NodeSelectedKeys,\n NodeExpandKeys,\n onCheck,\n onSelect,\n onExpand,\n handleMouseEnter,\n handleMouseLeave,\n onDragEnter,\n onDrop,\n TreeNodeRender,\n appendTreeNode,\n replaceFields\n } = this;\n return h(\"div\", {\n \"class\": \"DirectoryTreeMenu\"\n }, [h(\"div\", {\n \"class\": \"treeDirectory\"\n }, [h(\"span\", [$attrs.menuTitle || '目录']), treePlus && h(ant_design_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n \"attrs\": {\n \"icon\": \"plus\",\n \"size\": \"small\"\n },\n \"on\": {\n ...{\n click: appendTreeNode\n }\n }\n })]), h(DirectoryTree, {\n \"attrs\": {\n \"draggable\": true,\n \"default-expand-all\": true,\n \"checkedKeys\": NodeCheckedKeys,\n \"selectedKeys\": NodeSelectedKeys,\n \"expandedKeys\": NodeExpandKeys,\n \"expandAction\": \"dblclick\",\n ...$attrs,\n \"tree-node-filter-prop\": \"title\"\n },\n \"class\": \"DirectoryTreeMenu__Tree\",\n \"on\": {\n ...{\n check: onCheck,\n select: onSelect,\n expand: onExpand,\n mouseenter: handleMouseEnter,\n mouseleave: handleMouseLeave,\n dragenter: onDragEnter,\n drop: onDrop\n }\n }\n }, [treeData.map((node, nodeIndex) => TreeNodeRender(node, nodeIndex))])]);\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/Directory.js?");
|
|
8949
8949
|
|
|
8950
8950
|
/***/ }),
|
|
8951
8951
|
|
|
@@ -9164,7 +9164,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
9164
9164
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9165
9165
|
|
|
9166
9166
|
"use strict";
|
|
9167
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\\n/* stylelint-disable no-duplicate-selectors */\\n/* stylelint-disable */\\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\\n.DirectoryTreeMenu {\\n height: 100%;\\n padding: 16px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Actions {\\n display: flex;\\n gap: 0 8px;\\n position: relative;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons {\\n cursor: pointer;\\n width: 16px;\\n height: 16px;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons:focus {\\n outline: none;\\n}\\n.DirectoryTreeMenu .treeDirectory {\\n width: 100%;\\n height: 40px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu .treeDirectory > span {\\n flex: 1;\\n text-align: left;\\n color: #FFFFFF;\\n font-size: 16px;\\n font-weight: 700;\\n position: relative;\\n padding-left: 12px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu .treeDirectory > span::after {\\n width: 4px;\\n height: 12px;\\n left: 0;\\n top: calc((100% - 12px) / 2);\\n content: '';\\n position: absolute;\\n background: #1677FF;\\n border-radius: 2px;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) {\\n margin-right: 12px;\\n line-height: 16px;\\n border-color: #FFFFFF;\\n width: 16px;\\n height: 16px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) i {\\n font-size: 11px;\\n color: #FFFFFF;\\n}\\n.DirectoryTreeMenu__Tree {\\n height: calc(100% - 40px);\\n overflow-y: auto;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-track {\\n border-radius: 0;\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-thumb {\\n border-radius: 0;\\n border-radius: 5px;\\n background-image: -webkit-linear-gradient(270deg, #1890ff 0%, transparent 100%);\\n -webkit-transition: all 0.2s;\\n transition: all 0.2s;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-corner {\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 6px;\\n height: 56px;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 4px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu {\\n width: 140px;\\n height: auto;\\n border-radius: 2px;\\n padding: 12px 0;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span {\\n display: flex;\\n cursor: pointer;\\n align-items: center;\\n font-size: 14px;\\n margin-bottom: 2px;\\n padding: 0 16px;\\n box-sizing: border-box;\\n width: 100%;\\n height: 26px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span:last-child {\\n margin: 0;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span .svg-icon {\\n margin-right: 8px;\\n width: 16px;\\n height: 16px;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper {\\n width: calc(100% - 24px);\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title {\\n display: inline-block;\\n width: calc(100% - 24px);\\n height: 100%;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title {\\n gap: 0 8px;\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title > span {\\n white-space: normal;\\n width: calc(100% - 56px);\\n text-overflow: -o-ellipsis-lastline;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n display: -webkit-box;\\n -webkit-line-clamp: 1;\\n line-clamp: 1;\\n -webkit-box-orient: vertical;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/style/Directory.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9167
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\\n/* stylelint-disable no-duplicate-selectors */\\n/* stylelint-disable */\\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\\n.DirectoryTreeMenu {\\n height: 100%;\\n padding: 16px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Actions {\\n display: flex;\\n gap: 0 8px;\\n position: relative;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons {\\n cursor: pointer;\\n width: 16px !important;\\n height: 16px !important;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons:focus {\\n outline: none;\\n}\\n.DirectoryTreeMenu .treeDirectory {\\n width: 100%;\\n height: 40px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu .treeDirectory > span {\\n flex: 1;\\n text-align: left;\\n color: #FFFFFF;\\n font-size: 16px;\\n font-weight: 700;\\n position: relative;\\n padding-left: 12px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu .treeDirectory > span::after {\\n width: 4px;\\n height: 12px;\\n left: 0;\\n top: calc((100% - 12px) / 2);\\n content: '';\\n position: absolute;\\n background: #1677FF;\\n border-radius: 2px;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) {\\n margin-right: 12px;\\n line-height: 16px;\\n border-color: #FFFFFF;\\n width: 16px;\\n height: 16px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) i {\\n font-size: 11px;\\n color: #FFFFFF;\\n}\\n.DirectoryTreeMenu__Tree {\\n height: calc(100% - 40px);\\n overflow-y: auto;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-track {\\n border-radius: 0;\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-thumb {\\n border-radius: 0;\\n border-radius: 5px;\\n background-image: -webkit-linear-gradient(270deg, #1890ff 0%, transparent 100%);\\n -webkit-transition: all 0.2s;\\n transition: all 0.2s;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-corner {\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 6px;\\n height: 56px;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 4px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu {\\n width: 140px;\\n height: auto;\\n border-radius: 2px;\\n padding: 12px 0;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span {\\n display: flex;\\n cursor: pointer;\\n align-items: center;\\n font-size: 14px;\\n margin-bottom: 2px;\\n padding: 0 16px;\\n box-sizing: border-box;\\n width: 100%;\\n height: 26px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span:last-child {\\n margin: 0;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span .svg-icon {\\n margin-right: 8px;\\n width: 16px;\\n height: 16px;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper {\\n width: calc(100% - 24px);\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title {\\n display: inline-block;\\n width: calc(100% - 24px);\\n height: 100%;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title {\\n gap: 0 8px;\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title > span {\\n white-space: normal;\\n width: calc(100% - 56px);\\n text-overflow: -o-ellipsis-lastline;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n display: -webkit-box;\\n -webkit-line-clamp: 1;\\n line-clamp: 1;\\n -webkit-box-orient: vertical;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/style/Directory.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9168
9168
|
|
|
9169
9169
|
/***/ }),
|
|
9170
9170
|
|
package/dist/index.umd.js
CHANGED
|
@@ -8945,7 +8945,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _ind
|
|
|
8945
8945
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8946
8946
|
|
|
8947
8947
|
"use strict";
|
|
8948
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_Tree__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/Tree */ \"./plugins/utils/Tree.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/tree/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/input/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/dropdown/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/button/index.js\");\n/* harmony import */ var _style_Directory_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style/Directory.less */ \"./plugins/lib/tree/style/Directory.less\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../index */ \"./plugins/lib/index.js\");\n\n\n\n\n\n\n\n/* 明天来了做一下@快捷指向 */\n\nconst TreeNode = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].TreeNode;\nconst DirectoryTree = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].DirectoryTree;\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'DirectoryTreeMenu',\n props: {\n treeData: {\n type: Array,\n default: () => []\n },\n treeExpandKeys: {\n type: Array,\n default: () => []\n },\n treePlus: {\n type: Boolean,\n default: true\n },\n treeActions: {\n type: Array,\n default: () => []\n },\n treeActionsPlus: {\n type: Boolean,\n default: true\n },\n replaceFields: {\n type: Object,\n default: () => ({\n children: 'children',\n key: 'id',\n title: 'title'\n })\n }\n },\n data() {\n return {\n NodeCheckedKeys: [],\n NodeSelectedKeys: [],\n NodeExpandKeys: [],\n NodeKey: [],\n NodeActions: null,\n MenuDropdown: false,\n NodeActionsStyle: {}\n };\n },\n mounted() {\n this.onInitTree();\n },\n watch: {\n treeData(newValue, oldValue) {\n this.onInitTree(!oldValue.length);\n },\n treeExpandKeys(newValue) {\n this.NodeExpandKeys = newValue;\n }\n },\n methods: {\n TreeNodeRender(node, nodeIndex, parentNode) {\n const h = this.$createElement;\n const {\n replaceFields,\n NodeActions,\n treeActions,\n NodeActionsStyle,\n NodeExpandKeys,\n NodeKey,\n treeActionsPlus,\n createTreeNode,\n handleMouseLeave,\n handleOperateClick,\n handlePlusClick\n } = this;\n const key = node[replaceFields.key];\n return h(TreeNode, {\n \"key\": key,\n \"class\": \"DirectoryTreeMenu__Node\",\n \"scopedSlots\": {\n title: props => {\n return h(\"div\", {\n \"class\": \"__Title\"\n }, [node.type != 'input' ? h(\"span\", [node[replaceFields.title]]) : h(ant_design_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n \"attrs\": {\n \"placeholder\": \"请输入节点名称\",\n \"default-value\": node[replaceFields.title]\n },\n \"on\": {\n ...{\n blur: ({\n target\n }) => createTreeNode(target, node),\n pressEnter: event => event.target.blur(event, true)\n }\n },\n \"ref\": \"inputNodeRef\"\n }), NodeActions && Boolean(treeActions.length) && NodeKey.includes(props.eventKey) && node.type != 'input' && h(\"div\", {\n \"ref\": \"TreeMenuActions\",\n \"class\": \"DirectoryTreeMenu__Actions\",\n \"on\": {\n ...{\n mouseenter: event => event.stopPropagation()\n }\n }\n }, [h(ant_design_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n \"attrs\": {\n \"trigger\": ['click'],\n \"overlayClassName\": \"DirectoryTreeMenu__Dropdown\"\n }\n }, [h(_index__WEBPACK_IMPORTED_MODULE_3__.SvgIcon, {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-more\"\n },\n \"on\": {\n ...{\n click: e => e.preventDefault()\n }\n }\n }), h(\"div\", {\n \"slot\": \"overlay\",\n \"class\": \"DirectoryTreeMenu__Dropdown__Menu\"\n }, [treeActions.map((handle, i) => {\n return h(\"span\", {\n \"key\": i,\n \"on\": {\n ...{\n // this.$emit('handleOperateClick', handle, NodeActions)\n click: () => handleOperateClick(handle, {\n ...node,\n nodeIndex\n }, parentNode)\n }\n }\n }, [h(_index__WEBPACK_IMPORTED_MODULE_3__.SvgIcon, {\n \"attrs\": {\n \"icon-class\": handle.svg\n }\n }), \" \", handle.text]);\n })])]), treeActionsPlus && h(_index__WEBPACK_IMPORTED_MODULE_3__.SvgIcon, {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-plus\"\n },\n \"on\": {\n ...{\n click: () => handlePlusClick()\n }\n }\n })])]);\n }\n }\n }, [node[replaceFields.children] && node[replaceFields.children].length && node[replaceFields.children].map((childNode, childNodeIndex) => this.TreeNodeRender(childNode, childNodeIndex, node))]);\n },\n appendTreeNode() {\n this.treeData.push({\n type: 'input',\n append: true,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n },\n createTreeNode({\n value\n }, node) {\n this.$set(node, 'type', 'text');\n this.$emit(`handlePlus${node.append ? 'Add' : 'Update'}`, value, node.append ? node.parentOrgId : node[this.replaceFields.key]);\n const parentNodes = node.parentOrgId ? this.findItemById(this.treeData, node.parentOrgId)[this.replaceFields.children] : this.treeData;\n if (node.append) {\n const i = parentNodes.findIndex(child => child[this.replaceFields.key] == node[this.replaceFields.key]);\n parentNodes.splice(i, 1);\n }\n },\n handleOperateClick(handle, node, parentNode) {\n const key = node[this.replaceFields.key];\n let that = this;\n switch (handle.type) {\n case 'update':\n const updateNode = this.findItemById(this.treeData, key);\n this.$set(updateNode, 'type', 'input');\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'copy':\n // 明天来了优化一下\n const cloneNode = parentNode ? parentNode[this.replaceFields.children] : this.treeData;\n cloneNode.splice(node.nodeIndex + 1, 0, {\n type: 'input',\n append: true,\n parentOrgId: parentNode ? parentNode[this.replaceFields.key] : null,\n [this.replaceFields.key]: new Date().getTime(),\n [this.replaceFields.title]: node[this.replaceFields.title]\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'delete':\n this.$confirm({\n title: '确定要删除当前节点吗?',\n okText: '确定',\n cancelText: '取消',\n onOk() {\n that.$emit('handleDeleteClick', node);\n console.log('OK');\n },\n onCancel() {\n console.log('Cancel');\n }\n });\n break;\n default:\n this.$emit('handleOperateClick', handle, node);\n break;\n }\n },\n handlePlusClick() {\n const node = this.findItemById(this.treeData, this.NodeActions.id);\n console.log(node, this.NodeActions, '--NodeActions');\n const childNode = node[this.replaceFields.children] ?? [];\n childNode.push({\n type: 'input',\n append: true,\n parentOrgId: this.NodeActions.id,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.NodeExpandKeys.push(this.NodeActions.id);\n node[this.replaceFields.children] = childNode;\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n console.log(node, '--NodeActions');\n },\n findItemById(treeData, id) {\n for (let i = 0; i < treeData.length; i++) {\n if (treeData[i][this.replaceFields.key] === id) return treeData[i];\n let childNode = treeData[i][this.replaceFields.children];\n if (childNode && childNode.length > 0) {\n const foundItem = this.findItemById(treeData[i][this.replaceFields.children], id);\n if (foundItem) return foundItem;\n }\n }\n },\n onInitTree(treeExpend = true) {\n this.treeData && (this.NodeSelectedKeys = [this.treeData.at(0)?.[this.replaceFields.key]]);\n this.NodeExpandKeys = this.treeExpandKeys.length && this.treeExpandKeys || treeExpend && (0,_utils_Tree__WEBPACK_IMPORTED_MODULE_1__.getTreeKey)(this.treeData, true, this.replaceFields) || [];\n },\n onCheck(keys, {}) {\n this.NodeCheckedKeys = keys;\n this.$emit('onCheck', keys);\n },\n onSelect(keys, {\n nativeEvent,\n node\n }) {\n this.NodeSelectedKeys = keys;\n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.$emit('onSelect', keys);\n },\n onExpand(expandedKeys, {\n expanded,\n node\n }) {\n this.NodeExpandKeys = [].concat(expandedKeys);\n console.log(expandedKeys, expanded, node, 'Trigger Expand');\n },\n getIcon(props) {\n const h = this.$createElement;\n const {\n isLeaf,\n expanded\n } = props;\n if (isLeaf) {\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": \"home\"\n }\n });\n }\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": expanded ? 'folder-open' : 'folder'\n }\n });\n },\n handleMouseEnter({\n event,\n node\n }) {\n this.NodeActions = {\n id: node._props.eventKey,\n title: node._props.title,\n parentOrgId: node.$parent.eventKey || null\n };\n // this.MenuDropdown = false \n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.NodeKey.push(node.eventKey);\n // console.log(node, 'handleMouseEnter')\n // 是否加个参数 判断是否处于打开状态\n },\n handleMouseLeave({\n event,\n node\n }) {\n if (this.NodeKey.includes(node.eventKey) && this.NodeSelectedKeys != node.eventKey) {\n const i = this.NodeKey.findIndex(key => key == node.eventKey);\n this.NodeKey.splice(i, 1);\n }\n // this.NodeKey = []\n },\n onDragEnter(node) {\n console.log(node, '--onDragEnter');\n // expandedKeys 需要受控时设置\n // this.expandedKeys = info.expandedKeys\n },\n onDrop(info) {\n const dragKey = info.dragNode.eventKey;\n const dropPos = info.node.pos.split(\"-\");\n // 拖动的位置\n const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);\n const node = info.node; //目标节点\n const dragNode = info.dragNode; // 拖动节点\n const dropKey = node.eventKey;\n console.log(dragNode, node, '--dropToGap');\n if (dragNode.$parent?.eventKey !== node.$parent?.eventKey || !info.dropToGap) {\n // 阻止跨父级拖拽\n this.$message.warning(\"只能在同级排序\");\n return false;\n }\n const {\n key,\n children\n } = this.replaceFields;\n const loop = (data, eventKey, callback) => {\n data.forEach((node, i, array) => {\n if (node[key] === eventKey) {\n return callback(node, i, array);\n }\n if (node[children]) {\n return loop(node[children], eventKey, callback);\n }\n });\n };\n const data = [...this.treeData];\n let dragObj;\n let dragObjIndex;\n loop(data, dragKey, (node, i, array) => {\n dragObj = node;\n dragObjIndex = i;\n });\n let dropIndex;\n loop(data, dropKey, (node, i, array) => {\n dropIndex = i;\n console.log(node, i, dragObj, dragObjIndex, '--i');\n });\n this.$emit('onDrop', {\n [key]: dragObj[key],\n originalIndex: dragObjIndex,\n presentIndex: dropPosition === -1 ? dropIndex : dropIndex + 1\n });\n }\n },\n render() {\n const h = arguments[0];\n const {\n $attrs,\n treePlus,\n treeData,\n NodeCheckedKeys,\n NodeSelectedKeys,\n NodeExpandKeys,\n onCheck,\n onSelect,\n onExpand,\n handleMouseEnter,\n handleMouseLeave,\n onDragEnter,\n onDrop,\n TreeNodeRender,\n appendTreeNode,\n replaceFields\n } = this;\n return h(\"div\", {\n \"class\": \"DirectoryTreeMenu\"\n }, [h(\"div\", {\n \"class\": \"treeDirectory\"\n }, [h(\"span\", [$attrs.menuTitle || '目录']), treePlus && h(ant_design_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n \"attrs\": {\n \"icon\": \"plus\",\n \"size\": \"small\"\n },\n \"on\": {\n ...{\n click: appendTreeNode\n }\n }\n })]), h(DirectoryTree, {\n \"attrs\": {\n \"draggable\": true,\n \"default-expand-all\": true,\n \"checkedKeys\": NodeCheckedKeys,\n \"selectedKeys\": NodeSelectedKeys,\n \"expandedKeys\": NodeExpandKeys,\n \"expandAction\": \"dblclick\",\n ...$attrs,\n \"tree-node-filter-prop\": \"title\"\n },\n \"class\": \"DirectoryTreeMenu__Tree\",\n \"on\": {\n ...{\n check: onCheck,\n select: onSelect,\n expand: onExpand,\n mouseenter: handleMouseEnter,\n mouseleave: handleMouseLeave,\n dragenter: onDragEnter,\n drop: onDrop\n }\n }\n }, [treeData.map((node, nodeIndex) => TreeNodeRender(node, nodeIndex))])]);\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/Directory.js?");
|
|
8948
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.push.js */ \"./node_modules/core-js/modules/es.array.push.js\");\n/* harmony import */ var core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_push_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_Tree__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/Tree */ \"./plugins/utils/Tree.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/tree/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/input/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/dropdown/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ant-design-vue */ \"./node_modules/ant-design-vue/es/button/index.js\");\n/* harmony import */ var _style_Directory_less__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style/Directory.less */ \"./plugins/lib/tree/style/Directory.less\");\n/* harmony import */ var _svgIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../svgIcon */ \"./plugins/lib/svgIcon/index.js\");\n\n\n\n\n\n\n\n/* 明天来了做一下@快捷指向 */\n\nconst TreeNode = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].TreeNode;\nconst DirectoryTree = ant_design_vue__WEBPACK_IMPORTED_MODULE_4__[\"default\"].DirectoryTree;\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'DirectoryTreeMenu',\n props: {\n treeData: {\n type: Array,\n default: () => []\n },\n treeExpandKeys: {\n type: Array,\n default: () => []\n },\n treePlus: {\n type: Boolean,\n default: true\n },\n treeActions: {\n type: Array,\n default: () => []\n },\n treeActionsPlus: {\n type: Boolean,\n default: true\n },\n replaceFields: {\n type: Object,\n default: () => ({\n children: 'children',\n key: 'id',\n title: 'title'\n })\n }\n },\n data() {\n return {\n NodeCheckedKeys: [],\n NodeSelectedKeys: [],\n NodeExpandKeys: [],\n NodeKey: [],\n NodeActions: null,\n MenuDropdown: false,\n NodeActionsStyle: {}\n };\n },\n mounted() {\n this.onInitTree();\n },\n watch: {\n treeData(newValue, oldValue) {\n this.onInitTree(!oldValue.length);\n },\n treeExpandKeys(newValue) {\n this.NodeExpandKeys = newValue;\n }\n },\n methods: {\n TreeNodeRender(node, nodeIndex, parentNode) {\n const h = this.$createElement;\n const {\n replaceFields,\n NodeActions,\n treeActions,\n NodeActionsStyle,\n NodeExpandKeys,\n NodeKey,\n treeActionsPlus,\n createTreeNode,\n handleMouseLeave,\n handleOperateClick,\n handlePlusClick\n } = this;\n const key = node[replaceFields.key];\n return h(TreeNode, {\n \"key\": key,\n \"class\": \"DirectoryTreeMenu__Node\",\n \"scopedSlots\": {\n title: props => {\n return h(\"div\", {\n \"class\": \"__Title\"\n }, [node.type != 'input' ? h(\"span\", [node[replaceFields.title]]) : h(ant_design_vue__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n \"attrs\": {\n \"placeholder\": \"请输入节点名称\",\n \"default-value\": node[replaceFields.title]\n },\n \"on\": {\n ...{\n blur: ({\n target\n }) => createTreeNode(target, node),\n pressEnter: event => event.target.blur(event, true)\n }\n },\n \"ref\": \"inputNodeRef\"\n }), NodeActions && Boolean(treeActions.length) && NodeKey.includes(props.eventKey) && node.type != 'input' && h(\"div\", {\n \"ref\": \"TreeMenuActions\",\n \"class\": \"DirectoryTreeMenu__Actions\",\n \"on\": {\n ...{\n mouseenter: event => event.stopPropagation()\n }\n }\n }, [h(ant_design_vue__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n \"attrs\": {\n \"trigger\": ['click'],\n \"overlayClassName\": \"DirectoryTreeMenu__Dropdown\"\n }\n }, [h(_svgIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-more\"\n },\n \"on\": {\n ...{\n click: e => e.preventDefault()\n }\n }\n }), h(\"div\", {\n \"slot\": \"overlay\",\n \"class\": \"DirectoryTreeMenu__Dropdown__Menu\"\n }, [treeActions.map((handle, i) => {\n return h(\"span\", {\n \"key\": i,\n \"on\": {\n ...{\n // this.$emit('handleOperateClick', handle, NodeActions)\n click: () => handleOperateClick(handle, {\n ...node,\n nodeIndex\n }, parentNode)\n }\n }\n }, [h(_svgIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n \"attrs\": {\n \"icon-class\": handle.svg\n }\n }), \" \", handle.text]);\n })])]), treeActionsPlus && h(_svgIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n \"class\": \"ActionsIcons\",\n \"attrs\": {\n \"icon-class\": \"tree-plus\"\n },\n \"on\": {\n ...{\n click: () => handlePlusClick()\n }\n }\n })])]);\n }\n }\n }, [node[replaceFields.children] && node[replaceFields.children].length && node[replaceFields.children].map((childNode, childNodeIndex) => this.TreeNodeRender(childNode, childNodeIndex, node))]);\n },\n appendTreeNode() {\n this.treeData.push({\n type: 'input',\n append: true,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n },\n createTreeNode({\n value\n }, node) {\n this.$set(node, 'type', 'text');\n this.$emit(`handlePlus${node.append ? 'Add' : 'Update'}`, value, node.append ? node.parentOrgId : node[this.replaceFields.key]);\n const parentNodes = node.parentOrgId ? this.findItemById(this.treeData, node.parentOrgId)[this.replaceFields.children] : this.treeData;\n if (node.append) {\n const i = parentNodes.findIndex(child => child[this.replaceFields.key] == node[this.replaceFields.key]);\n parentNodes.splice(i, 1);\n }\n },\n handleOperateClick(handle, node, parentNode) {\n const key = node[this.replaceFields.key];\n let that = this;\n switch (handle.type) {\n case 'update':\n const updateNode = this.findItemById(this.treeData, key);\n this.$set(updateNode, 'type', 'input');\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'copy':\n // 明天来了优化一下\n const cloneNode = parentNode ? parentNode[this.replaceFields.children] : this.treeData;\n cloneNode.splice(node.nodeIndex + 1, 0, {\n type: 'input',\n append: true,\n parentOrgId: parentNode ? parentNode[this.replaceFields.key] : null,\n [this.replaceFields.key]: new Date().getTime(),\n [this.replaceFields.title]: node[this.replaceFields.title]\n });\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n break;\n case 'delete':\n this.$confirm({\n title: '确定要删除当前节点吗?',\n okText: '确定',\n cancelText: '取消',\n onOk() {\n that.$emit('handleDeleteClick', node);\n console.log('OK');\n },\n onCancel() {\n console.log('Cancel');\n }\n });\n break;\n default:\n this.$emit('handleOperateClick', handle, node);\n break;\n }\n },\n handlePlusClick() {\n const node = this.findItemById(this.treeData, this.NodeActions.id);\n console.log(node, this.NodeActions, '--NodeActions');\n const childNode = node[this.replaceFields.children] ?? [];\n childNode.push({\n type: 'input',\n append: true,\n parentOrgId: this.NodeActions.id,\n [this.replaceFields.key]: new Date().getTime()\n });\n this.NodeExpandKeys.push(this.NodeActions.id);\n node[this.replaceFields.children] = childNode;\n this.$nextTick(() => this.$refs.inputNodeRef.focus());\n console.log(node, '--NodeActions');\n },\n findItemById(treeData, id) {\n for (let i = 0; i < treeData.length; i++) {\n if (treeData[i][this.replaceFields.key] === id) return treeData[i];\n let childNode = treeData[i][this.replaceFields.children];\n if (childNode && childNode.length > 0) {\n const foundItem = this.findItemById(treeData[i][this.replaceFields.children], id);\n if (foundItem) return foundItem;\n }\n }\n },\n onInitTree(treeExpend = true) {\n this.treeData && (this.NodeSelectedKeys = [this.treeData.at(0)?.[this.replaceFields.key]]);\n this.NodeExpandKeys = this.treeExpandKeys.length && this.treeExpandKeys || treeExpend && (0,_utils_Tree__WEBPACK_IMPORTED_MODULE_1__.getTreeKey)(this.treeData, true, this.replaceFields) || [];\n },\n onCheck(keys, {}) {\n this.NodeCheckedKeys = keys;\n this.$emit('onCheck', keys);\n },\n onSelect(keys, {\n nativeEvent,\n node\n }) {\n this.NodeSelectedKeys = keys;\n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.$emit('onSelect', keys);\n },\n onExpand(expandedKeys, {\n expanded,\n node\n }) {\n this.NodeExpandKeys = [].concat(expandedKeys);\n console.log(expandedKeys, expanded, node, 'Trigger Expand');\n },\n getIcon(props) {\n const h = this.$createElement;\n const {\n isLeaf,\n expanded\n } = props;\n if (isLeaf) {\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": \"home\"\n }\n });\n }\n return h(ant_design_vue__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n \"attrs\": {\n \"type\": expanded ? 'folder-open' : 'folder'\n }\n });\n },\n handleMouseEnter({\n event,\n node\n }) {\n this.NodeActions = {\n id: node._props.eventKey,\n title: node._props.title,\n parentOrgId: node.$parent.eventKey || null\n };\n // this.MenuDropdown = false \n this.NodeKey = [].concat(this.NodeSelectedKeys);\n this.NodeKey.push(node.eventKey);\n // console.log(node, 'handleMouseEnter')\n // 是否加个参数 判断是否处于打开状态\n },\n handleMouseLeave({\n event,\n node\n }) {\n if (this.NodeKey.includes(node.eventKey) && this.NodeSelectedKeys != node.eventKey) {\n const i = this.NodeKey.findIndex(key => key == node.eventKey);\n this.NodeKey.splice(i, 1);\n }\n // this.NodeKey = []\n },\n onDragEnter(node) {\n console.log(node, '--onDragEnter');\n // expandedKeys 需要受控时设置\n // this.expandedKeys = info.expandedKeys\n },\n onDrop(info) {\n const dragKey = info.dragNode.eventKey;\n const dropPos = info.node.pos.split(\"-\");\n // 拖动的位置\n const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1]);\n const node = info.node; //目标节点\n const dragNode = info.dragNode; // 拖动节点\n const dropKey = node.eventKey;\n console.log(dragNode, node, '--dropToGap');\n if (dragNode.$parent?.eventKey !== node.$parent?.eventKey || !info.dropToGap) {\n // 阻止跨父级拖拽\n this.$message.warning(\"只能在同级排序\");\n return false;\n }\n const {\n key,\n children\n } = this.replaceFields;\n const loop = (data, eventKey, callback) => {\n data.forEach((node, i, array) => {\n if (node[key] === eventKey) {\n return callback(node, i, array);\n }\n if (node[children]) {\n return loop(node[children], eventKey, callback);\n }\n });\n };\n const data = [...this.treeData];\n let dragObj;\n let dragObjIndex;\n loop(data, dragKey, (node, i, array) => {\n dragObj = node;\n dragObjIndex = i;\n });\n let dropIndex;\n loop(data, dropKey, (node, i, array) => {\n dropIndex = i;\n console.log(node, i, dragObj, dragObjIndex, '--i');\n });\n this.$emit('onDrop', {\n [key]: dragObj[key],\n originalIndex: dragObjIndex,\n presentIndex: dropPosition === -1 ? dropIndex : dropIndex + 1\n });\n }\n },\n render() {\n const h = arguments[0];\n const {\n $attrs,\n treePlus,\n treeData,\n NodeCheckedKeys,\n NodeSelectedKeys,\n NodeExpandKeys,\n onCheck,\n onSelect,\n onExpand,\n handleMouseEnter,\n handleMouseLeave,\n onDragEnter,\n onDrop,\n TreeNodeRender,\n appendTreeNode,\n replaceFields\n } = this;\n return h(\"div\", {\n \"class\": \"DirectoryTreeMenu\"\n }, [h(\"div\", {\n \"class\": \"treeDirectory\"\n }, [h(\"span\", [$attrs.menuTitle || '目录']), treePlus && h(ant_design_vue__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n \"attrs\": {\n \"icon\": \"plus\",\n \"size\": \"small\"\n },\n \"on\": {\n ...{\n click: appendTreeNode\n }\n }\n })]), h(DirectoryTree, {\n \"attrs\": {\n \"draggable\": true,\n \"default-expand-all\": true,\n \"checkedKeys\": NodeCheckedKeys,\n \"selectedKeys\": NodeSelectedKeys,\n \"expandedKeys\": NodeExpandKeys,\n \"expandAction\": \"dblclick\",\n ...$attrs,\n \"tree-node-filter-prop\": \"title\"\n },\n \"class\": \"DirectoryTreeMenu__Tree\",\n \"on\": {\n ...{\n check: onCheck,\n select: onSelect,\n expand: onExpand,\n mouseenter: handleMouseEnter,\n mouseleave: handleMouseLeave,\n dragenter: onDragEnter,\n drop: onDrop\n }\n }\n }, [treeData.map((node, nodeIndex) => TreeNodeRender(node, nodeIndex))])]);\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/Directory.js?");
|
|
8949
8949
|
|
|
8950
8950
|
/***/ }),
|
|
8951
8951
|
|
|
@@ -9164,7 +9164,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _nod
|
|
|
9164
9164
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9165
9165
|
|
|
9166
9166
|
"use strict";
|
|
9167
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\\n/* stylelint-disable no-duplicate-selectors */\\n/* stylelint-disable */\\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\\n.DirectoryTreeMenu {\\n height: 100%;\\n padding: 16px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Actions {\\n display: flex;\\n gap: 0 8px;\\n position: relative;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons {\\n cursor: pointer;\\n width: 16px;\\n height: 16px;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons:focus {\\n outline: none;\\n}\\n.DirectoryTreeMenu .treeDirectory {\\n width: 100%;\\n height: 40px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu .treeDirectory > span {\\n flex: 1;\\n text-align: left;\\n color: #FFFFFF;\\n font-size: 16px;\\n font-weight: 700;\\n position: relative;\\n padding-left: 12px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu .treeDirectory > span::after {\\n width: 4px;\\n height: 12px;\\n left: 0;\\n top: calc((100% - 12px) / 2);\\n content: '';\\n position: absolute;\\n background: #1677FF;\\n border-radius: 2px;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) {\\n margin-right: 12px;\\n line-height: 16px;\\n border-color: #FFFFFF;\\n width: 16px;\\n height: 16px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) i {\\n font-size: 11px;\\n color: #FFFFFF;\\n}\\n.DirectoryTreeMenu__Tree {\\n height: calc(100% - 40px);\\n overflow-y: auto;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-track {\\n border-radius: 0;\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-thumb {\\n border-radius: 0;\\n border-radius: 5px;\\n background-image: -webkit-linear-gradient(270deg, #1890ff 0%, transparent 100%);\\n -webkit-transition: all 0.2s;\\n transition: all 0.2s;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-corner {\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 6px;\\n height: 56px;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 4px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu {\\n width: 140px;\\n height: auto;\\n border-radius: 2px;\\n padding: 12px 0;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span {\\n display: flex;\\n cursor: pointer;\\n align-items: center;\\n font-size: 14px;\\n margin-bottom: 2px;\\n padding: 0 16px;\\n box-sizing: border-box;\\n width: 100%;\\n height: 26px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span:last-child {\\n margin: 0;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span .svg-icon {\\n margin-right: 8px;\\n width: 16px;\\n height: 16px;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper {\\n width: calc(100% - 24px);\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title {\\n display: inline-block;\\n width: calc(100% - 24px);\\n height: 100%;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title {\\n gap: 0 8px;\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title > span {\\n white-space: normal;\\n width: calc(100% - 56px);\\n text-overflow: -o-ellipsis-lastline;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n display: -webkit-box;\\n -webkit-line-clamp: 1;\\n line-clamp: 1;\\n -webkit-box-orient: vertical;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/style/Directory.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9167
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\");\n/* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__);\n// Imports\n\nvar ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]});\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"/* 混入样式 */\\n/* 布局( 纯为了不想多写一行 */\\n/* 正方体盒子 */\\n/* 滚动条样式 */\\n/* 文字换行省略(默认1行)*/\\n/* flex布局 */\\n/* flex排版方式 */\\n/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\\n/* stylelint-disable no-duplicate-selectors */\\n/* stylelint-disable */\\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\\n.DirectoryTreeMenu {\\n height: 100%;\\n padding: 16px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Actions {\\n display: flex;\\n gap: 0 8px;\\n position: relative;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons {\\n cursor: pointer;\\n width: 16px !important;\\n height: 16px !important;\\n}\\n.DirectoryTreeMenu__Actions .ActionsIcons:focus {\\n outline: none;\\n}\\n.DirectoryTreeMenu .treeDirectory {\\n width: 100%;\\n height: 40px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu .treeDirectory > span {\\n flex: 1;\\n text-align: left;\\n color: #FFFFFF;\\n font-size: 16px;\\n font-weight: 700;\\n position: relative;\\n padding-left: 12px;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu .treeDirectory > span::after {\\n width: 4px;\\n height: 12px;\\n left: 0;\\n top: calc((100% - 12px) / 2);\\n content: '';\\n position: absolute;\\n background: #1677FF;\\n border-radius: 2px;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) {\\n margin-right: 12px;\\n line-height: 16px;\\n border-color: #FFFFFF;\\n width: 16px;\\n height: 16px;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: center;\\n}\\n.DirectoryTreeMenu .treeDirectory :deep(.ant-btn) i {\\n font-size: 11px;\\n color: #FFFFFF;\\n}\\n.DirectoryTreeMenu__Tree {\\n height: calc(100% - 40px);\\n overflow-y: auto;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-track {\\n border-radius: 0;\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-thumb {\\n border-radius: 0;\\n border-radius: 5px;\\n background-image: -webkit-linear-gradient(270deg, #1890ff 0%, transparent 100%);\\n -webkit-transition: all 0.2s;\\n transition: all 0.2s;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar-corner {\\n background-color: transparent;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 6px;\\n height: 56px;\\n}\\n.DirectoryTreeMenu__Tree::-webkit-scrollbar {\\n width: 4px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu {\\n width: 140px;\\n height: auto;\\n border-radius: 2px;\\n padding: 12px 0;\\n box-sizing: border-box;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span {\\n display: flex;\\n cursor: pointer;\\n align-items: center;\\n font-size: 14px;\\n margin-bottom: 2px;\\n padding: 0 16px;\\n box-sizing: border-box;\\n width: 100%;\\n height: 26px;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span:last-child {\\n margin: 0;\\n}\\n.DirectoryTreeMenu__Dropdown__Menu span .svg-icon {\\n margin-right: 8px;\\n width: 16px;\\n height: 16px;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper {\\n width: calc(100% - 24px);\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title {\\n display: inline-block;\\n width: calc(100% - 24px);\\n height: 100%;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title {\\n gap: 0 8px;\\n width: 100%;\\n height: 100%;\\n display: flex;\\n gap: 0;\\n flex-direction: row;\\n flex-wrap: wrap;\\n align-items: center;\\n justify-content: flex-start;\\n}\\n.DirectoryTreeMenu__Node .ant-tree-node-content-wrapper .ant-tree-title .__Title > span {\\n white-space: normal;\\n width: calc(100% - 56px);\\n text-overflow: -o-ellipsis-lastline;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n display: -webkit-box;\\n -webkit-line-clamp: 1;\\n line-clamp: 1;\\n -webkit-box-orient: vertical;\\n}\\n\", \"\"]);\n// Exports\n/* harmony default export */ __webpack_exports__[\"default\"] = (___CSS_LOADER_EXPORT___);\n\n\n//# sourceURL=webpack://mui/./plugins/lib/tree/style/Directory.less?./node_modules/css-loader/dist/cjs.js!./node_modules/less-loader/dist/cjs.js??clonedRuleSet-2.use%5B2%5D");
|
|
9168
9168
|
|
|
9169
9169
|
/***/ }),
|
|
9170
9170
|
|