"use strict";
/*
 * ATTENTION: An "eval-source-map" devtool has been used.
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunknocode_platform"] = self["webpackChunknocode_platform"] || []).push([[9208],{

/***/ "./src/web/component/common/TreeNodeTitle.less":
/*!*****************************************************!*\
  !*** ./src/web/component/common/TreeNodeTitle.less ***!
  \*****************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\"title\":\"O8Hm+nQz_title\",\"title-name\":\"OuZ9o325_title-name\",\"title-icon\":\"_3Q38LMSO_title-icon\",\"title-drag\":\"bnA7BGaC_title-drag\",\"title-more\":\"cbPfkWhG_title-more\",\"tree-node-item-hover\":\"jQdR1264_tree-node-item-hover\",\"popper\":\"tzoheLQL_popper\"});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvd2ViL2NvbXBvbmVudC9jb21tb24vVHJlZU5vZGVUaXRsZS5sZXNzIiwibWFwcGluZ3MiOiI7QUFBQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vbm9jb2RlLXBsYXRmb3JtLy4vc3JjL3dlYi9jb21wb25lbnQvY29tbW9uL1RyZWVOb2RlVGl0bGUubGVzcz8zZmFjIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpblxuZXhwb3J0IGRlZmF1bHQge1widGl0bGVcIjpcIk84SG0rblF6X3RpdGxlXCIsXCJ0aXRsZS1uYW1lXCI6XCJPdVo5bzMyNV90aXRsZS1uYW1lXCIsXCJ0aXRsZS1pY29uXCI6XCJfM1EzOExNU09fdGl0bGUtaWNvblwiLFwidGl0bGUtZHJhZ1wiOlwiYm5BN0JHYUNfdGl0bGUtZHJhZ1wiLFwidGl0bGUtbW9yZVwiOlwiY2JQZmtXaEdfdGl0bGUtbW9yZVwiLFwidHJlZS1ub2RlLWl0ZW0taG92ZXJcIjpcImpRZFIxMjY0X3RyZWUtbm9kZS1pdGVtLWhvdmVyXCIsXCJwb3BwZXJcIjpcInR6b2hlTFFMX3BvcHBlclwifTsiXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/web/component/common/TreeNodeTitle.less\n");

/***/ }),

/***/ "./src/utils/menuTreeUtil.js":
/*!***********************************!*\
  !*** ./src/utils/menuTreeUtil.js ***!
  \***********************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs3/helpers/typeof */ \"../../node_modules/@babel/runtime-corejs3/helpers/typeof.js\");\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/keys */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js\");\nvar _filterInstanceProperty = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/filter */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/define-properties */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/define-property */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/define-property.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/weak-map */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/weak-map.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"../../node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.loopEditName = exports.loopAddMenu = exports.getTreeFirstFormNode = exports.getNodeKeyByFormId = exports.getNodeById = exports.getNodeByFormId = exports.getMenuTreeData = exports.getGroupNodes = exports.getFormNodes = void 0;\nexports.transformTreeData = transformTreeData;\nvar _splice = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/splice */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/splice.js\"));\nvar _promise = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/promise */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/promise.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/defineProperty */ \"../../node_modules/@babel/runtime-corejs3/helpers/defineProperty.js\"));\nvar _react = _interopRequireWildcard(__webpack_require__(/*! kd_libs/react */ \"webpack/container/remote/kd_libs/react\"));\nvar _kdesign = __webpack_require__(/*! kd_libs/kdesign1 */ \"webpack/container/remote/kd_libs/kdesign1\");\nvar _TreeNodeTitle = __webpack_require__(/*! @/web/component/common/TreeNodeTitle */ \"./src/web/component/common/TreeNodeTitle.tsx\");\nvar _useFetchHook = __webpack_require__(/*! @/hooks/useFetchHook */ \"./src/hooks/useFetchHook.ts\");\nvar _api = __webpack_require__(/*! @/ajax/api */ \"./src/ajax/api.js\");\nvar _storageTools = __webpack_require__(/*! @/utils/storageTools */ \"./src/utils/storageTools.ts\");\nvar _apps = __webpack_require__(/*! @/actions/apps */ \"./src/actions/apps.ts\");\nvar _home = __webpack_require__(/*! @/actions/home */ \"./src/actions/home.js\");\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /*\n * @Description:\n * @Author: jianhang_he\n * @Date: 2023-02-22 21:01:12\n * @LastEditTime: 2024-07-16 15:09:55\n * @Last Modified by: xiaoman_xie\n */\n/**\n * 格式化树数据\n * @param {Array} data 树菜单数据\n * @returns Object\n */\nvar getTreeFirstFormNode = exports.getTreeFirstFormNode = function getTreeFirstFormNode(treeData) {\n  var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n  var i = 0;\n  while (i < treeData.length) {\n    var item = treeData[i];\n    if (item.formId) {\n      result = result || {\n        formId: item.formId,\n        key: item.key,\n        name: item.name,\n        type: item.type\n      };\n      return result;\n    } else if (item.children && !result) {\n      result = getTreeFirstFormNode(item.children);\n    }\n    i++;\n  }\n  return result;\n};\nfunction transformTreeData(data, renderTitle, renderIcon, maxGroupDeth) {\n  var depth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n  var getIsSelectable = arguments.length > 5 ? arguments[5] : undefined;\n  var _depth = depth + 1;\n  var canAddChildGroup = true;\n  if (_depth >= maxGroupDeth) {\n    canAddChildGroup = false;\n  }\n  data.forEach(function (item) {\n    var key = item.key,\n      id = item.id,\n      children = item.children,\n      formId = item.formId,\n      name = item.name,\n      parentId = item.parentId,\n      seq = item.seq,\n      image = item.image,\n      type = item.type;\n    item.key = key || id || '';\n    item.title = renderTitle ? renderTitle({\n      name: name,\n      key: item.key,\n      formId: formId,\n      parentId: parentId,\n      seq: seq,\n      image: image,\n      canAddChildGroup: canAddChildGroup,\n      type: type\n    }) : name;\n    item.children = children && children.length > 0 && transformTreeData(children, renderTitle, renderIcon, maxGroupDeth, _depth, getIsSelectable);\n    item.selectable = getIsSelectable ? getIsSelectable() : !!formId;\n    renderIcon && (item.icon = renderIcon(_objectSpread(_objectSpread({}, item), {}, {\n      hasChild: children && children.length > 0\n    })));\n  });\n  return data;\n}\nvar getNodeKeyByFormId = exports.getNodeKeyByFormId = function getNodeKeyByFormId(treeData, formId) {\n  var _getNodeByFormId;\n  var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n  return (_getNodeByFormId = getNodeByFormId(treeData, formId, result)) === null || _getNodeByFormId === void 0 ? void 0 : _getNodeByFormId.key;\n};\nvar getNodeByFormId = exports.getNodeByFormId = function getNodeByFormId(treeData, formId) {\n  var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n  var i = 0;\n  while (i < treeData.length) {\n    var item = treeData[i];\n    if (item.formId === formId) {\n      result = result || item;\n      return result;\n    } else if (item.children && !result) {\n      result = getNodeByFormId(item.children, formId, result);\n    }\n    i++;\n  }\n  return result;\n};\nvar getNodeById = exports.getNodeById = function getNodeById(treeData, id) {\n  var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n  var i = 0;\n  while (i < treeData.length) {\n    var item = treeData[i];\n    if (item.id === id) {\n      result = result || item;\n      return result;\n    } else if (item.children && !result) {\n      result = getNodeById(item.children, id, result);\n    }\n    i++;\n  }\n  return result;\n};\nvar getGroupNodes = exports.getGroupNodes = function getGroupNodes(treeData, maxGroupDeth) {\n  var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];\n  var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n  treeData.forEach(function (item) {\n    if (!item.formId && depth < maxGroupDeth) {\n      // delete item.children\n      result.push(item);\n    }\n    if (item.children) {\n      var _depth = depth + 1;\n      getGroupNodes(item.children, maxGroupDeth, result, _depth);\n    }\n  });\n  return result;\n};\nvar getFormNodes = exports.getFormNodes = function getFormNodes(treeData) {\n  var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n  treeData.forEach(function (item) {\n    if (!item.children && item.formId) {\n      result.push(item);\n    }\n    if (item.children) {\n      getFormNodes(item.children, result);\n    }\n  });\n  return result;\n};\nvar loopAddMenu = exports.loopAddMenu = function loopAddMenu(data, parentId, child, insertAfterId) {\n  var hasFind = false;\n  var childHasFind = false;\n  for (var i = 0; i < (data === null || data === void 0 ? void 0 : data.length); i++) {\n    // 复制表单插入到表单后\n    if (data[i].formId === insertAfterId) {\n      (0, _splice.default)(data).call(data, i + 1, 0, child);\n      hasFind = true;\n      break;\n    }\n    // 新建分组直接push\n    if (!insertAfterId && data[i].key === parentId) {\n      data[i].children = data[i].children || [];\n      data[i].children.push(child);\n      hasFind = true;\n      break;\n    } else {\n      if (data[i].children) {\n        var childResult = loopAddMenu(data[i].children, parentId, child, insertAfterId);\n        if (childResult) childHasFind = childResult;\n      }\n    }\n  }\n  return hasFind || childHasFind; // 用于判断数据是否加入\n};\nvar loopEditName = exports.loopEditName = function loopEditName(nodes, id, name) {\n  for (var i = 0; i < (nodes === null || nodes === void 0 ? void 0 : nodes.length); i++) {\n    if (nodes[i].id === id) {\n      nodes[i].name = name;\n      break;\n    } else {\n      loopEditName(nodes[i].children, id);\n    }\n  }\n};\n\n// 获取右侧菜单树svg图标+菜单名数据，同时获取缓存和发起请求，callback会在缓存或后端数据回来后调用（2次），return最终的promise\nvar getMenuTreeData = exports.getMenuTreeData = function getMenuTreeData(appId, callback) {\n  var GET_APP_MENU_LIST = (0, _apps.getReqUrl)(appId);\n  var cachePromise = _promise.default.all([(0, _useFetchHook.getStoreData)(_api.GET_LINEICON_COLOR, ''), (0, _useFetchHook.getStoreData)(GET_APP_MENU_LIST, '')]);\n  var fetchPromise = _promise.default.all([(0, _home.getLineIconAndColor)(), (0, _apps.getFormList)(appId)]).then(function (values) {\n    (0, _useFetchHook.setStoreData)(_api.GET_LINEICON_COLOR, '', _objectSpread({}, values[0]));\n    (0, _useFetchHook.setStoreData)(GET_APP_MENU_LIST, '', _objectSpread({}, values[1]));\n    return values;\n  });\n  return (0, _storageTools.getWithPriority)(cachePromise, fetchPromise, callback);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64, \n//# sourceURL=webpack-internal:///./src/utils/menuTreeUtil.js\n");

/***/ }),

/***/ "./src/web/component/common/TreeNodeTitle.tsx":
/*!****************************************************!*\
  !*** ./src/web/component/common/TreeNodeTitle.tsx ***!
  \****************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

eval("\n\nvar _typeof = __webpack_require__(/*! @babel/runtime-corejs3/helpers/typeof */ \"../../node_modules/@babel/runtime-corejs3/helpers/typeof.js\");\nvar _Object$keys = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/keys */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js\");\nvar _Object$getOwnPropertySymbols = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js\");\nvar _filterInstanceProperty2 = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/filter */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js\");\nvar _Object$getOwnPropertyDescriptor = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor.js\");\nvar _Object$getOwnPropertyDescriptors = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors.js\");\nvar _Object$defineProperties = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/define-properties */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/define-properties.js\");\nvar _Object$defineProperty = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/object/define-property */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/object/define-property.js\");\nvar _WeakMap = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/weak-map */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/weak-map.js\");\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime-corejs3/helpers/interopRequireDefault */ \"../../node_modules/@babel/runtime-corejs3/helpers/interopRequireDefault.js\");\n_Object$defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.TreeNodeTitle = void 0;\nvar _concat = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/concat */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js\"));\nvar _filter = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/filter */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js\"));\nvar _map = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/map */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/map.js\"));\nvar _includes = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/includes */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js\"));\nvar _trim = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/trim */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/defineProperty */ \"../../node_modules/@babel/runtime-corejs3/helpers/defineProperty.js\"));\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/extends */ \"../../node_modules/@babel/runtime-corejs3/helpers/extends.js\"));\nvar _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/slicedToArray */ \"../../node_modules/@babel/runtime-corejs3/helpers/slicedToArray.js\"));\nvar _react = _interopRequireWildcard(__webpack_require__(/*! kd_libs/react */ \"webpack/container/remote/kd_libs/react\"));\nvar _kdesign = __webpack_require__(/*! kd_libs/kdesign1 */ \"webpack/container/remote/kd_libs/kdesign1\");\nvar _WebUI = __webpack_require__(/*! nocode_component/WebUI */ \"webpack/container/remote/nocode_component/WebUI\");\nvar _TreeNodeTitle = _interopRequireDefault(__webpack_require__(/*! ./TreeNodeTitle.less */ \"./src/web/component/common/TreeNodeTitle.less\"));\nvar _utils = __webpack_require__(/*! @/utils */ \"./src/utils/index.tsx\");\nfunction _getRequireWildcardCache(e) { if (\"function\" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }\nfunction _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \"object\" != _typeof(e) && \"function\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if (\"default\" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }\nfunction ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty2(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }\nvar TreeNodeTitle = exports.TreeNodeTitle = function TreeNodeTitle(props) {\n  var isGroupNode = props.isGroupNode,\n    title = props.title,\n    formId = props.formId,\n    appId = props.appId,\n    nodeKey = props.nodeKey,\n    parentId = props.parentId,\n    seq = props.seq,\n    image = props.image,\n    hideDrag = props.hideDrag,\n    onDelete = props.onDelete,\n    onEditName = props.onEditName,\n    onAddChildGroup = props.onAddChildGroup,\n    onCopy = props.onCopy,\n    canAddChildGroup = props.canAddChildGroup,\n    onSave = props.onSave,\n    handleEditing = props.handleEditing,\n    type = props.type;\n  var _useState = (0, _react.useState)(false),\n    _useState2 = (0, _slicedToArray2.default)(_useState, 2),\n    visible = _useState2[0],\n    setVisible = _useState2[1];\n  var _useState3 = (0, _react.useState)(false),\n    _useState4 = (0, _slicedToArray2.default)(_useState3, 2),\n    editing = _useState4[0],\n    setEditing = _useState4[1];\n  var _useState5 = (0, _react.useState)(title),\n    _useState6 = (0, _slicedToArray2.default)(_useState5, 2),\n    inputName = _useState6[0],\n    setInputName = _useState6[1];\n  var _useState7 = (0, _react.useState)(title),\n    _useState8 = (0, _slicedToArray2.default)(_useState7, 2),\n    name = _useState8[0],\n    setName = _useState8[1];\n  var titleRef = (0, _react.useRef)();\n  var inputRef = (0, _react.useRef)();\n  var createUiActionDataStr = (0, _react.useCallback)(function (actionName) {\n    var _context, _context2;\n    return (0, _concat.default)(_context = (0, _concat.default)(_context2 = \"\".concat(appId || '', \"|\")).call(_context2, formId || '', \"|\")).call(_context, actionName);\n  }, [appId, formId]);\n  (0, _react.useEffect)(function () {\n    var _inputRef$current;\n    // 渲染完input聚焦\n    editing && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus());\n    handleEditing === null || handleEditing === void 0 || handleEditing(editing);\n  }, [editing]);\n  (0, _react.useEffect)(function () {\n    name !== inputName && setInputName(name);\n  }, [name]);\n  (0, _react.useEffect)(function () {\n    setInputName(title);\n  }, [title]);\n  var formNodeOptions = [{\n    name: '修改名称',\n    key: 'editName',\n    hidden: !onEditName\n  }, {\n    name: '复制',\n    key: 'copy',\n    hidden: !onCopy,\n    useActionName: {\n      'data-nc-action': createUiActionDataStr('sa_fm_copy')\n    }\n  }, {\n    name: '删除',\n    key: 'delete',\n    hidden: !onDelete\n  }];\n  var groupNodeOptions = [{\n    name: '修改名称',\n    key: 'editName'\n  }, {\n    name: '新建子分组',\n    key: 'addChildGroup',\n    useActionName: {\n      'data-nc-action': createUiActionDataStr('sa_fm_csg')\n    }\n  }, {\n    name: '删除',\n    key: 'delete'\n  }];\n  var notAddChildGroupNodeOptions = [{\n    name: '修改名称',\n    key: 'editName'\n  }, {\n    name: '删除',\n    key: 'delete'\n  }];\n  var renderMenu = function renderMenu() {\n    var _options$filter;\n    var options = isGroupNode ? canAddChildGroup ? groupNodeOptions : notAddChildGroupNodeOptions : formNodeOptions;\n    return /*#__PURE__*/_react.default.createElement(_kdesign.Dropdown.Menu, null, (_options$filter = (0, _filter.default)(options).call(options, function (item) {\n      return !item.hidden;\n    })) === null || _options$filter === void 0 ? void 0 : (0, _map.default)(_options$filter).call(_options$filter, function (item) {\n      return /*#__PURE__*/_react.default.createElement(_kdesign.Dropdown.Item, (0, _extends2.default)({\n        key: item.key\n      }, item === null || item === void 0 ? void 0 : item.useActionName), /*#__PURE__*/_react.default.createElement(\"span\", null, item.name));\n    }));\n  };\n  var params = {\n    id: nodeKey,\n    formId: formId,\n    name: name,\n    parentId: parentId,\n    seq: seq,\n    image: image,\n    type: type\n  };\n  var handleItemClick = function handleItemClick(key) {\n    setVisible(false);\n    var targetEle = findTreeNodeLoop(titleRef.current);\n    targetEle === null || targetEle === void 0 || targetEle.setAttribute('data-node-visible', false);\n    switch (key) {\n      case 'editName':\n        // onEditName && onEditName(formId, nodeKey)\n        setEditing(true);\n        break;\n      case 'delete':\n        onDelete && onDelete(nodeKey, formId);\n        break;\n      case 'addChildGroup':\n        onAddChildGroup && onAddChildGroup(nodeKey);\n        break;\n      case 'copy':\n        onCopy && onCopy(params);\n        break;\n      default:\n        break;\n    }\n  };\n  var handleVisibleChange = function handleVisibleChange(value) {\n    setVisible(value);\n    if (titleRef.current) {\n      var targetEle = findTreeNodeLoop(titleRef.current);\n      targetEle === null || targetEle === void 0 || targetEle.setAttribute('data-node-visible', value);\n      value ? targetEle === null || targetEle === void 0 ? void 0 : targetEle.classList.add(_TreeNodeTitle.default['tree-node-item-hover']) : targetEle === null || targetEle === void 0 ? void 0 : targetEle.classList.remove(_TreeNodeTitle.default['tree-node-item-hover']);\n    }\n  };\n  var findTreeNodeLoop = function findTreeNodeLoop(ele) {\n    while (ele) {\n      if ((0, _includes.default)(Array.prototype).apply(ele.classList, ['kd-tree-node-item'])) return ele;\n      ele = ele.parentElement;\n    }\n  };\n  var handleChange = function handleChange(value) {\n    setInputName((0, _trim.default)(value).call(value));\n  };\n  var handleBlur = function handleBlur(e, textValue) {\n    var _e$target;\n    var value = (e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value) || textValue;\n    if (value && value !== name) {\n      var closeMessage = (0, _utils.showLoadingMessage)('正在修改名称，请稍候...');\n      onSave === null || onSave === void 0 || onSave(_objectSpread(_objectSpread({}, params), {}, {\n        name: value\n      })).then(function (res) {\n        setEditing(false);\n        setName(value);\n        onEditName && onEditName(formId, nodeKey, value);\n        closeMessage({\n          type: 'success',\n          content: '修改名称成功'\n        });\n      }).catch(function (err) {\n        closeMessage({\n          type: 'error',\n          content: err === null || err === void 0 ? void 0 : err.message\n        });\n      });\n    } else {\n      setEditing(false);\n    }\n  };\n  var handleEnter = function handleEnter(value, e) {\n    handleBlur(e, value);\n  };\n  return /*#__PURE__*/_react.default.createElement(\"span\", {\n    className: _TreeNodeTitle.default.title,\n    ref: titleRef,\n    \"data-tree-node-key\": nodeKey\n  }, !editing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(\"span\", {\n    className: _TreeNodeTitle.default['title-name'],\n    title: title\n  }, title), /*#__PURE__*/_react.default.createElement(\"span\", {\n    className: _TreeNodeTitle.default['title-icon'],\n    \"data-menu-btn\": \"true\"\n  }, /*#__PURE__*/_react.default.createElement(\"span\", {\n    className: _TreeNodeTitle.default['title-more'],\n    onClick: function onClick(e) {\n      // 点击图标不展开树节点\n      e.stopPropagation();\n    }\n  }, /*#__PURE__*/_react.default.createElement(_kdesign.Dropdown, {\n    menu: renderMenu(visible),\n    popperClassName: _TreeNodeTitle.default.popper,\n    visible: visible,\n    onItemClick: handleItemClick,\n    onVisibleChange: handleVisibleChange,\n    trigger: \"hover\"\n  }, /*#__PURE__*/_react.default.createElement(_WebUI.BtnField, {\n    type: \"text\"\n  }, /*#__PURE__*/_react.default.createElement(_kdesign.Icon, {\n    prefix: \"nocodeplatformicon\",\n    type: \"gengduo3\"\n  })))), !hideDrag && /*#__PURE__*/_react.default.createElement(_WebUI.BtnField, {\n    type: \"text\",\n    className: _TreeNodeTitle.default['title-drag']\n  }, /*#__PURE__*/_react.default.createElement(_kdesign.Icon, {\n    prefix: \"nocodeplatformicon\",\n    type: \"tuozhuai\"\n  })))) : /*#__PURE__*/_react.default.createElement(_WebUI.Text, {\n    ref: inputRef,\n    value: inputName,\n    onChange: handleChange,\n    onBlur: handleBlur,\n    onPressEnter: handleEnter,\n    maxLength: 50,\n    size: \"small\",\n    allowClear: true\n  }));\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64, \n//# sourceURL=webpack-internal:///./src/web/component/common/TreeNodeTitle.tsx\n");

/***/ })

}]);