"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([[5300],{

/***/ "./src/web/layout/apps/HeaderLayout.less":
/*!***********************************************!*\
  !*** ./src/web/layout/apps/HeaderLayout.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\"] = ({\"app_header\":\"ktcF3PYR_app_header\",\"left\":\"_9AxCdhZ5_left\",\"ml12\":\"qWnmYsCZ_ml12\",\"app_logo\":\"tSwGKkBI_app_logo\",\"app_name\":\"SSQ2qPT1_app_name\",\"nav\":\"P7qM9tdg_nav\",\"user\":\"CIaFqBSZ_user\",\"user_item\":\"TdUzpAnv_user_item\",\"avatar_wrapper\":\"YDDMCYIZ_avatar_wrapper\",\"avatar\":\"TH+650J4_avatar\",\"app_container\":\"fXYCMBVS_app_container\",\"user_info_pop\":\"_3BUVbZ1F_user_info_pop\"});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvd2ViL2xheW91dC9hcHBzL0hlYWRlckxheW91dC5sZXNzIiwibWFwcGluZ3MiOiI7QUFBQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vbm9jb2RlLXBsYXRmb3JtLy4vc3JjL3dlYi9sYXlvdXQvYXBwcy9IZWFkZXJMYXlvdXQubGVzcz9iMjIyIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGV4dHJhY3RlZCBieSBtaW5pLWNzcy1leHRyYWN0LXBsdWdpblxuZXhwb3J0IGRlZmF1bHQge1wiYXBwX2hlYWRlclwiOlwia3RjRjNQWVJfYXBwX2hlYWRlclwiLFwibGVmdFwiOlwiXzlBeENkaFo1X2xlZnRcIixcIm1sMTJcIjpcInFXbm1Zc0NaX21sMTJcIixcImFwcF9sb2dvXCI6XCJ0U3dHS2tCSV9hcHBfbG9nb1wiLFwiYXBwX25hbWVcIjpcIlNTUTJxUFQxX2FwcF9uYW1lXCIsXCJuYXZcIjpcIlA3cU05dGRnX25hdlwiLFwidXNlclwiOlwiQ0lhRnFCU1pfdXNlclwiLFwidXNlcl9pdGVtXCI6XCJUZFV6cEFudl91c2VyX2l0ZW1cIixcImF2YXRhcl93cmFwcGVyXCI6XCJZRERNQ1lJWl9hdmF0YXJfd3JhcHBlclwiLFwiYXZhdGFyXCI6XCJUSCs2NTBKNF9hdmF0YXJcIixcImFwcF9jb250YWluZXJcIjpcImZYWUNNQlZTX2FwcF9jb250YWluZXJcIixcInVzZXJfaW5mb19wb3BcIjpcIl8zQlVWYloxRl91c2VyX2luZm9fcG9wXCJ9OyJdLCJuYW1lcyI6W10sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/web/layout/apps/HeaderLayout.less\n");

/***/ }),

/***/ "./src/web/layout/apps/HeaderLayout.tsx":
/*!**********************************************!*\
  !*** ./src/web/layout/apps/HeaderLayout.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 _WeakMap = __webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/weak-map */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/weak-map.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 _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 _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[\"default\"] = exports.DetailHeaderLayout = 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 _indexOf = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/core-js-stable/instance/index-of */ \"../../node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js\"));\nvar _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/extends */ \"../../node_modules/@babel/runtime-corejs3/helpers/extends.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime-corejs3/helpers/defineProperty */ \"../../node_modules/@babel/runtime-corejs3/helpers/defineProperty.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 _reactRouterDom = __webpack_require__(/*! react-router-dom */ \"../../node_modules/react-router-dom/index.js\");\nvar _HeaderLayout = _interopRequireDefault(__webpack_require__(/*! ./HeaderLayout.less */ \"./src/web/layout/apps/HeaderLayout.less\"));\nvar _reactI18next = __webpack_require__(/*! react-i18next */ \"../../node_modules/react-i18next/dist/es/index.js\");\nvar _Header = _interopRequireDefault(__webpack_require__(/*! @/web/component/common/Header */ \"./src/web/component/common/Header.jsx\"));\nvar _kdesign = __webpack_require__(/*! kd_libs/kdesign1 */ \"webpack/container/remote/kd_libs/kdesign1\");\nvar _app = __webpack_require__(/*! @/app */ \"./src/app.jsx\");\nvar _home = __webpack_require__(/*! @/actions/home */ \"./src/actions/home.js\");\nvar _utils = __webpack_require__(/*! @/utils */ \"./src/utils/index.tsx\");\nvar _ShareButton = _interopRequireDefault(__webpack_require__(/*! @/web/component/common/ShareButton */ \"./src/web/component/common/ShareButton.tsx\"));\nvar _UserPopLayout = _interopRequireDefault(__webpack_require__(/*! @/web/layout/home/UserPopLayout */ \"./src/web/layout/home/UserPopLayout.tsx\"));\nvar _WebUI = __webpack_require__(/*! nocode_component/WebUI */ \"webpack/container/remote/nocode_component/WebUI\");\nvar _FormDataListAuthProvider = __webpack_require__(/*! @/web/component/common/FormDataListAuthProvider */ \"./src/web/component/common/FormDataListAuthProvider.tsx\");\nvar _HeaderNavDropDown = _interopRequireDefault(__webpack_require__(/*! ../designer/HeaderNavDropDown */ \"./src/web/layout/designer/HeaderNavDropDown.tsx\"));\nvar _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ \"../../node_modules/classnames/index.js\"));\nvar _useFormMeta = _interopRequireDefault(__webpack_require__(/*! @/hooks/useFormMeta */ \"./src/hooks/useFormMeta.ts\"));\nvar _useFetchHook = __webpack_require__(/*! @/hooks/useFetchHook */ \"./src/hooks/useFetchHook.ts\");\nvar _eventEmit = _interopRequireDefault(__webpack_require__(/*! @/utils/eventEmit */ \"./src/utils/eventEmit.js\"));\nvar _constants = __webpack_require__(/*! @/constants */ \"./src/constants/index.ts\");\nvar _actionNames = __webpack_require__(/*! @/reducer/actionNames */ \"./src/reducer/actionNames.js\");\nvar _storageTools = __webpack_require__(/*! @/utils/storageTools */ \"./src/utils/storageTools.ts\");\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; }\n/*\n * @Description:\n * @Author: jianhang_he\n * @Date: 2022-09-16 14:19:05\n * @LastEditTime: 2024-05-16 16:02:34\n * @Last Modified by: jianhang_he\n */\n\n// import { printContent, printWrapper } from '@/utils/print'\n// import QRCode from '@/web/component/common/QRCode'\n// import ReactDOM from 'react-dom'\n\n/**\n * 零代码应用首页头部模块\n * @returns jsx\n */\n\nvar AppsHeaderLayout = exports.DetailHeaderLayout = (0, _react.memo)(function (props) {\n  var _context2, _context5, _context6;\n  var _useTranslation = (0, _reactI18next.useTranslation)(),\n    translate = _useTranslation.t;\n  var _useParams = (0, _reactRouterDom.useParams)(),\n    appId = _useParams.appId,\n    targetFormId = _useParams.targetFormId,\n    shareId = _useParams.shareId,\n    Status = _useParams.Status,\n    pkId = _useParams.pkId;\n  var _useContext = (0, _react.useContext)(_app.Context),\n    state = _useContext.state,\n    dispatch = _useContext.dispatch;\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)(Status),\n    _useState4 = (0, _slicedToArray2.default)(_useState3, 2),\n    status = _useState4[0],\n    setStatus = _useState4[1];\n  var _useState5 = (0, _react.useState)(pkId),\n    _useState6 = (0, _slicedToArray2.default)(_useState5, 2),\n    curPkId = _useState6[0],\n    setCurPkId = _useState6[1];\n  var appInfo = state.appsList[appId];\n  var _ref = appInfo || {},\n    istemplate = _ref.istemplate,\n    _ref$manage = _ref.manage,\n    manage = _ref$manage === void 0 ? false : _ref$manage,\n    appImage = _ref.image,\n    appName = _ref.name;\n  var userInfo = state.userInfo; // 分享出来的匿名用户为undefined\n  var authContext = (0, _react.useContext)(_FormDataListAuthProvider.AuthorizeContext) || {};\n  var authList = authContext.authList;\n  var _ref2 = authList || {},\n    editShareAuth = _ref2.editShareAuth,\n    detailShareReqireLoginAuth = _ref2.detailShareReqireLoginAuth,\n    detailShareNotReqireLoginAuth = _ref2.detailShareNotReqireLoginAuth,\n    inputShareReqireLoginAuth = _ref2.inputShareReqireLoginAuth,\n    inputShareNotReqireLoginAuth = _ref2.inputShareNotReqireLoginAuth,\n    printAuth = _ref2.printAuth;\n  var meta = (0, _useFormMeta.default)(targetFormId);\n  var metaRef = (0, _react.useRef)();\n  (0, _react.useEffect)(function () {\n    var updateStatus = function updateStatus(formStatus) {\n      setStatus(formStatus);\n    };\n    _eventEmit.default.on(_constants.UPDATE_STATUS, updateStatus);\n    return function () {\n      _eventEmit.default.off(_constants.UPDATE_STATUS, updateStatus);\n    };\n  }, []);\n  (0, _react.useEffect)(function () {\n    var updateStatus = function updateStatus(id) {\n      setCurPkId(id);\n    };\n    _eventEmit.default.on(_constants.UPDATE_PKID, updateStatus);\n    return function () {\n      _eventEmit.default.off(_constants.UPDATE_PKID, updateStatus);\n    };\n  }, []);\n  (0, _react.useEffect)(function () {\n    metaRef.current = meta;\n  }, [meta]);\n  var isEdit = (0, _react.useMemo)(function () {\n    return status === 'edit';\n  }, [status]);\n  var isView = (0, _react.useMemo)(function () {\n    return status === 'view';\n  }, [status]);\n  var showShare = (0, _react.useMemo)(function () {\n    return isEdit ? editShareAuth : isView ? detailShareReqireLoginAuth || detailShareNotReqireLoginAuth : inputShareReqireLoginAuth || inputShareNotReqireLoginAuth;\n  }, [isEdit, isView, editShareAuth, detailShareReqireLoginAuth, detailShareNotReqireLoginAuth, inputShareNotReqireLoginAuth, inputShareReqireLoginAuth]);\n  (0, _react.useEffect)(function () {\n    if (!appInfo && appId) {\n      // 使用SWR先从缓存内获取数据\n      console.log('appheadlayout appinfo', appInfo);\n      var url = \"nocode/v2/nocode_sys/app/\".concat(appId);\n      (0, _storageTools.getWithPriority)((0, _useFetchHook.getStoreData)(url, ''), (0, _home.getAppInfoById)(appId).then(function (res) {\n        (0, _useFetchHook.setStoreData)(url, '', res || {});\n        return res;\n      }), function (res) {\n        var _res$rows;\n        res && dispatch({\n          type: _actionNames.UPDATE_APP_INFO_BY_ID,\n          payload: {\n            id: appId,\n            value: (_res$rows = res.rows) === null || _res$rows === void 0 ? void 0 : _res$rows[0]\n          }\n        });\n      });\n    }\n  }, [appInfo, appId]);\n  (0, _react.useEffect)(function () {\n    document.title = appName || '';\n  }, [appName]);\n  (0, _react.useEffect)(function () {\n    document.body.addEventListener('click', function () {\n      return setVisible(false);\n    });\n    return function () {\n      return document.body.removeEventListener('click', function () {\n        return setVisible(false);\n      });\n    };\n  }, []);\n  var menu = function menu() {\n    return /*#__PURE__*/_react.default.createElement(_kdesign.Dropdown.Menu, null, /*#__PURE__*/_react.default.createElement(_kdesign.Dropdown.Item, {\n      key: \"edit\"\n    }, /*#__PURE__*/_react.default.createElement(\"span\", null, \"\\u914D\\u7F6E\\u5E94\\u7528\")));\n  };\n  var showIsTemplateNotice = function showIsTemplateNotice() {\n    (0, _utils.showNotice)('error', '预览时无法使用此功能');\n  };\n  var handleEdit = function handleEdit() {\n    var _context;\n    if (istemplate) {\n      return showIsTemplateNotice();\n    }\n    targetFormId ? (0, _utils.openner)((0, _concat.default)(_context = \"/\".concat(appId, \"/admin/\")).call(_context, targetFormId)) : (0, _utils.openner)(\"/\".concat(appId, \"/admin\"));\n  };\n\n  // 点击九个点时，如果是预览的直接拦截\n  var handleClickNavDropDown = (0, _react.useCallback)(function () {\n    if (istemplate) {\n      showIsTemplateNotice();\n      return true;\n    }\n  }, [istemplate]);\n  var handleClickShare = istemplate ? showIsTemplateNotice : undefined;\n  var userPopProps = (0, _react.useMemo)(function () {\n    if (!istemplate) return {};\n    return {\n      handleClickTheme: showIsTemplateNotice,\n      handleClickLogout: showIsTemplateNotice\n    };\n  }, [istemplate]);\n\n  // 是否免登陆（详情和录入的时候才需要）\n  var isDetail = (0, _indexOf.default)(_context2 = window.location.pathname).call(_context2, 'detail') > -1;\n  var allowNoAuth = isDetail && (Status === 'view' || !pkId);\n\n  // 分享弹窗的标题\n  var shareModalTitle = (0, _react.useMemo)(function () {\n    if (!isDetail) return '列表';\n    if (isView) return '详情';\n    if (!pkId) return '';\n    return '编辑';\n  }, [isDetail, allowNoAuth]);\n  var handleClickPrint = function handleClickPrint() {\n    var _context3, _context4;\n    /* const formDoms = document.getElementsByClassName('kd-nc-grid-panel')\n    const dom = formDoms?.[0]\n     const fullLink = window.location.origin + getFullUrl(`nocode/h/${appId}/detail/${targetFormId}/${pkId}/view`)\n    const qrWrapper = <QRCode class='qrcode' value={fullLink} size={80} />\n    const div = document.createElement('div')\n    div.setAttribute('style', 'position:absolute;width:0;height:0;top:-500px;left:-500px')\n    document.body.appendChild(div)\n    ReactDOM.render(qrWrapper, div)\n    setTimeout(() => {\n      const qrDom = div.getElementsByClassName('qrcode')\n      const qrCodeSrc = qrDom[0]?.toDataURL('image/png')\n      document.body.removeChild(div)\n      const wrapper = printWrapper({ title: metaRef?.current?.caption?.zh_CN, children: dom.innerHTML, qrCodeSrc, company: userInfo?.orgs?.[0]?.orgName })\n       if (dom) {\n        printContent(wrapper)\n      }\n    }) */\n    (0, _utils.openner)((0, _concat.default)(_context3 = (0, _concat.default)(_context4 = \"/\".concat(appId, \"/print/\")).call(_context4, targetFormId, \"/\")).call(_context3, curPkId, \"/view\"));\n  };\n  var backgroundColor = (0, _utils.getQueryString)('color', appImage) || '';\n  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Header.default, {\n    className: _HeaderLayout.default.app_header\n  }, /*#__PURE__*/_react.default.createElement(_Header.default.Left, {\n    className: _HeaderLayout.default.left\n  }, !isDetail && /*#__PURE__*/_react.default.createElement(_HeaderNavDropDown.default, {\n    onItemClick: handleClickNavDropDown\n  }), /*#__PURE__*/_react.default.createElement(\"div\", {\n    className: (0, _classnames.default)(_HeaderLayout.default.app_logo, (0, _defineProperty2.default)({}, _HeaderLayout.default.ml12, !isDetail))\n  }, /*#__PURE__*/_react.default.createElement(\"img\", {\n    src: (0, _utils.getShareImage)(appImage, shareId),\n    style: {\n      backgroundColor: backgroundColor\n    },\n    alt: \"\"\n  })), /*#__PURE__*/_react.default.createElement(\"span\", {\n    className: _HeaderLayout.default.app_name\n  }, appName || '')), /*#__PURE__*/_react.default.createElement(_Header.default.Right, {\n    className: _HeaderLayout.default.user\n  }, printAuth && isView && /*#__PURE__*/_react.default.createElement(_WebUI.BtnField, {\n    className: _HeaderLayout.default.user_item,\n    type: \"text\",\n    onClick: handleClickPrint,\n    text: \"\\u6253\\u5370\",\n    icon: {\n      prefix: 'nocodeplatformicon',\n      type: 'dayin'\n    }\n  }), !shareId && userInfo && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showShare && /*#__PURE__*/_react.default.createElement(_ShareButton.default, {\n    config: {\n      appId: appId,\n      targetFormId: targetFormId,\n      Status: Status || 'addNew'\n    },\n    size: \"small\",\n    className: _HeaderLayout.default.user_item,\n    shareLink: [(0, _utils.getPathName)(), window.location.search].join(''),\n    linkName: appName,\n    modalTitle: shareModalTitle,\n    iconType: \"fenxiang\",\n    onClick: handleClickShare,\n    allowNoAuth: allowNoAuth,\n    shareReqireLogin: isEdit ? editShareAuth : isView ? detailShareReqireLoginAuth : inputShareReqireLoginAuth,\n    shareNotReqireLogin: isEdit ? editShareAuth : isView ? detailShareNotReqireLoginAuth : inputShareNotReqireLoginAuth\n  }), manage &&\n  /*#__PURE__*/\n  // <Dropdown menu={menu()} trigger='click' placement='bottomRight' onItemClick={handleEdit}>\n  _react.default.createElement(_WebUI.BtnField, {\n    size: \"small\",\n    \"data-nc-action\": (0, _concat.default)(_context5 = \"\".concat(appId, \"|\")).call(_context5, targetFormId, \"|tb_set\"),\n    type: \"text\",\n    className: _HeaderLayout.default.user_item,\n    text: translate('apps.moreActions'),\n    onClick: handleEdit,\n    icon: {\n      prefix: 'nocodeplatformicon',\n      type: 'shezhi5'\n    }\n  })\n  // </Dropdown>\n  , /*#__PURE__*/_react.default.createElement(_kdesign.Tooltip, {\n    placement: \"bottomRight\",\n    trigger: \"click\",\n    visible: visible,\n    arrow: false,\n    popperClassName: _HeaderLayout.default.user_info_pop,\n    tip: /*#__PURE__*/_react.default.createElement(_UserPopLayout.default, (0, _extends2.default)({\n      appId: appId,\n      formId: targetFormId,\n      setVisible: setVisible,\n      data: userInfo\n    }, userPopProps))\n  }, /*#__PURE__*/_react.default.createElement(\"div\", {\n    className: _HeaderLayout.default.avatar_wrapper,\n    \"data-nc-action\": (0, _concat.default)(_context6 = \"\".concat(appId, \"|\")).call(_context6, targetFormId, \"|tb_head_bn\"),\n    onClick: function onClick() {\n      if (!userInfo) return;\n      setVisible(true);\n    }\n  }, /*#__PURE__*/_react.default.createElement(_WebUI.Avatar, {\n    className: _HeaderLayout.default.avatar,\n    src: userInfo.avatar\n  })))))), /*#__PURE__*/_react.default.createElement(\"div\", {\n    className: _HeaderLayout.default.app_container\n  }, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Outlet, null)));\n});\nAppsHeaderLayout.displayName = 'AppsHeaderLayout';\nvar _default = exports[\"default\"] = AppsHeaderLayout;//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64, \n//# sourceURL=webpack-internal:///./src/web/layout/apps/HeaderLayout.tsx\n");

/***/ })

}]);