"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file 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["webpackJsonp_bos-platform"] = self["webpackJsonp_bos-platform"] || []).push([[7564],{

/***/ "./src/component/mobile/KDCustom.js":
/*!******************************************!*\
  !*** ./src/component/mobile/KDCustom.js ***!
  \******************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"../../node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"../../node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"../../node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"../../node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.array.index-of.js */ \"../../node_modules/core-js/modules/es.array.index-of.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"../../node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"../../node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.function.bind.js */ \"../../node_modules/core-js/modules/es.function.bind.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"../../node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.object.create.js */ \"../../node_modules/core-js/modules/es.object.create.js\");\n__webpack_require__(/*! core-js/modules/es.object.define-property.js */ \"../../node_modules/core-js/modules/es.object.define-property.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"../../node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"../../node_modules/core-js/modules/es.object.get-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"../../node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.object.set-prototype-of.js */ \"../../node_modules/core-js/modules/es.object.set-prototype-of.js\");\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"../../node_modules/core-js/modules/es.reflect.construct.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"../../node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"../../node_modules/core-js/modules/es.weak-map.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"../../node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports[\"default\"] = void 0;\n__webpack_require__(/*! core-js/modules/es.array.is-array.js */ \"../../node_modules/core-js/modules/es.array.is-array.js\");\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"../../node_modules/core-js/modules/es.object.assign.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"../../node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"../../node_modules/core-js/modules/es.promise.js\");\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react?dca2\"));\nvar _immutable = __webpack_require__(/*! immutable */ \"webpack/sharing/consume/default/immutable/immutable?f2ca\");\nvar _VisibleLockWrap = _interopRequireDefault(__webpack_require__(/*! ../common/VisibleLockWrap */ \"./src/component/common/VisibleLockWrap.js\"));\nvar _AttachDataWrap = _interopRequireDefault(__webpack_require__(/*! ../common/AttachDataWrap */ \"./src/component/common/AttachDataWrap.js\"));\nvar _FloatingPanelWarp = _interopRequireDefault(__webpack_require__(/*! ../common/FloatingPanelWarp */ \"./src/component/common/FloatingPanelWarp.js\"));\nvar _memoryCacher = __webpack_require__(/*! @/model/memoryCacher */ \"./src/model/memoryCacher.js\");\nvar _componentutil = __webpack_require__(/*! ../../util/componentutil */ \"./src/util/componentutil.js\");\nvar _customCtrlUtil = __webpack_require__(/*! ../../util/customCtrlUtil */ \"./src/util/customCtrlUtil.js\");\nvar _BaseCustomCtrl = _interopRequireDefault(__webpack_require__(/*! ./base/CustomCtrl/BaseCustomCtrl */ \"./src/component/mobile/base/CustomCtrl/BaseCustomCtrl.js\"));\nvar _commonUtils = _interopRequireDefault(__webpack_require__(/*! ../common/commonUtils */ \"./src/component/common/commonUtils.js\"));\nvar _customctrlaction = __webpack_require__(/*! ../../action/customctrlaction */ \"./src/action/customctrlaction.js\");\nvar _const = __webpack_require__(/*! @/constant/const */ \"./src/constant/const.js\");\nvar _ControlInfoCollect = _interopRequireDefault(__webpack_require__(/*! @/component/common/ControlInfoCollect */ \"./src/component/common/ControlInfoCollect.js\"));\nvar _customComponentManage = __webpack_require__(/*! ../common/customComponentManage */ \"./src/component/common/customComponentManage.js\");\nvar _appModelFunction = __webpack_require__(/*! @/model/appModelFunction */ \"./src/model/appModelFunction.js\");\nvar _global = __webpack_require__(/*! @/global */ \"./src/global/index.js\");\nvar _excluded = [\"data\", \"configItems\", \"lock\", \"lang\", \"themeColor\", \"themeNum\", \"cardRowData\", \"gridRowData\", \"subFormsArry\"];\nvar _dec, _class;\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n// import { getRootPageId, getThemeColor } from '@/model/appModelFunction'\nvar KDCustom = (_dec = (0, _VisibleLockWrap[\"default\"])(false), (0, _AttachDataWrap[\"default\"])(_class = (0, _FloatingPanelWarp[\"default\"])(_class = _dec(_class = (0, _ControlInfoCollect[\"default\"])(_class = /*#__PURE__*/function (_Component) {\n  _inherits(KDCustom, _Component);\n  function KDCustom(props) {\n    var _this;\n    _classCallCheck(this, KDCustom);\n    _this = _callSuper(this, KDCustom, [props]);\n    _this.getCustomInfo = function (model) {\n      // data, configItems, lock, locale, themeNum, subFormsArray\n      var pageId = model.pageId,\n        key = model.key;\n      var metaData = model.meta && model.meta.toJS();\n      var data = model.getDataValue();\n      if (data && data.toJS) {\n        data = data.toJS();\n      }\n      var configItems = (0, _componentutil.getComponentDataProperty)(model, 'ci', 'ci', false);\n      configItems = configItems && configItems.toJS();\n      var lock = _this.props.isLocked;\n      var locale = model.getUserLocale();\n      var _getCurrentTheme = (0, _customCtrlUtil.getCurrentTheme)(),\n        themeNum = _getCurrentTheme.themeNum,\n        themeColor = _getCurrentTheme.themeColor;\n      var state = model.state;\n      var subFormsArry = (0, _componentutil.getCustomControlSubForms)(model.pageId, model.meta.get('id'), state);\n      var cardRowData = (0, _customCtrlUtil.getCardRowData)(_this.props, model);\n\n      // 扩展字段或者控件，字段获取schemaInfo需要从item里面获取，控件则直接从meta获取\n      var schemaInfo = model.getMetaProperty(['item', 'schemaInfo']) || model.getMetaProperty('schemaInfo') || (0, _immutable.Map)({});\n      var schemaId = schemaInfo.get('schemaId'); // 方案id\n      var isvId = schemaInfo.get('isvId'); // 开发商id\n      var moduleId = schemaInfo.get('moduleId'); // 领域英文简写\n      // 文件服务器路径\n      var fileServer = model.getFormConfig() && model.getFormConfig().fileserver;\n      return {\n        pageId: pageId,\n        controlKey: key,\n        data: data,\n        metaData: metaData,\n        schemaId: schemaId,\n        isvId: isvId,\n        moduleId: moduleId,\n        configItems: configItems,\n        lock: lock,\n        lang: locale,\n        themeColor: themeColor,\n        themeNum: themeNum,\n        cardRowData: cardRowData,\n        subFormsArry: subFormsArry,\n        fileServer: fileServer\n      };\n    };\n    _this.invokeCustomMethod = function (model) {\n      var pageId = model.pageId,\n        key = model.key;\n      var dispatch = _this.props.dispatch;\n      return function (method) {\n        var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n        var isNoClearPostData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n        args = Array.isArray(args) ? args : [args];\n        dispatch((0, _customctrlaction.invokeCustomMethod)(pageId, key, method, args, isNoClearPostData));\n      };\n    };\n    _this.setPostData = function (model) {\n      var pageId = model.pageId,\n        key = model.key;\n      var type = 'controls';\n      var item = model.getMetaProperty(['item']);\n      // 元数据存在item，则证明是字段的扩展，否则是控件\n      if (item) {\n        type = 'fields';\n      }\n      return function (postData) {\n        // setPageData(pageId, ['post', type, key], postData)\n        type === 'controls' ? (0, _appModelFunction.setControlPostValue)(pageId, key, postData)((0, _global.getGlobalState)()) : (0, _appModelFunction.setFieldPostValue)(pageId, key, postData)((0, _global.getGlobalState)());\n      };\n    };\n    _this.state = {\n      pageLoad: (0, _memoryCacher.getPageData)(props.model.pageId, _const.PAGE_LOAD)\n    };\n    _this.attachDataInstance = new _customComponentManage.InjectAttachData();\n    return _this;\n  }\n  _createClass(KDCustom, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      var _this2 = this;\n      var pageLoad = this.state.pageLoad;\n      if (!pageLoad) {\n        var model = this.props.model;\n        var pageId = model.pageId;\n        this.removePageLoadDataChangeListener = (0, _memoryCacher.addDataChangeListener)(pageId, _const.PAGE_LOAD, function (isPageLoad) {\n          _this2.setState({\n            pageLoad: isPageLoad\n          });\n        });\n      }\n    }\n  }, {\n    key: \"shouldComponentUpdate\",\n    value: function shouldComponentUpdate(nextProps, nextState) {\n      var model = this.props.model;\n      var nextModel = nextProps.model;\n      var oldData = model.getDataValue();\n      var nextData = nextModel.getDataValue();\n      var oldConfigItems = (0, _componentutil.getComponentDataProperty)(model, 'ci', 'ci', false);\n      var newConfigItems = (0, _componentutil.getComponentDataProperty)(nextModel, 'ci', 'ci', false);\n      var lock = this.props.isLocked;\n      var nextLock = nextProps.isLocked;\n      var cardRowData = (0, _customCtrlUtil.getCardRowData)(this.props, model);\n      var newCardRowData = (0, _customCtrlUtil.getCardRowData)(nextProps, nextModel);\n      var locale = model.getUserLocale();\n      var newLocale = nextModel.getUserLocale();\n      var subFormsArry = model.getDataProperty('subForms');\n      var newSubFormsArray = nextModel.getDataProperty('subForms');\n      var oldPageLoad = this.state.pageLoad;\n      var newPageLoad = nextState.pageLoad;\n\n      // data，配置项，锁定性，卡片行数据，语言\n      return oldPageLoad !== newPageLoad || !(0, _immutable.is)(nextData, oldData) || !(0, _immutable.is)(oldConfigItems, newConfigItems) || lock !== nextLock || !(0, _immutable.is)((0, _immutable.fromJS)(cardRowData), (0, _immutable.fromJS)(newCardRowData)) || locale !== newLocale || !(0, _immutable.is)(subFormsArry, newSubFormsArray);\n    }\n  }, {\n    key: \"componentWillUnmount\",\n    value: function componentWillUnmount() {\n      this.removePageLoadDataChangeListener && this.removePageLoadDataChangeListener();\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this$props = this.props,\n        model = _this$props.model,\n        style = _this$props.style,\n        attachData = _this$props.attachData;\n      var pageLoad = this.state.pageLoad;\n      // const { pageId } = model\n      /**\n       * 移动端和PC端的页面初始化加载方案不一样：\n       * PC端：延迟加载，当后端业务数据到达后，和元数据一起组合之后，控件才开始mount\n       * 移动端：非延迟加载，控件拿到元数据后直接mount，当后端业务数据到达之后，再执行shouldComponentUpdate\n       *\n       * 基于以上差异，在移动端中的自定义控件，需要等待loadData完成之后，才会去请求自定义控件index.js，进而执行自定义控件init钩子\n       */\n      // const isLoadData = getPageData(pageId, PAGE_LOAD)\n      if (!pageLoad) return null;\n      var customMeta = this.getCustomInfo(model);\n      var _style = Object.assign({}, (0, _componentutil.getCommonStyle)(model), style);\n      var className = (0, _commonUtils[\"default\"])((0, _componentutil.getCommonClass)(model));\n      var schemaInfo = model.getMetaProperty(['item', 'isCustom']) || model.getMetaProperty('schemaInfo');\n      if (!schemaInfo) {\n        var _customMeta$subFormsA = customMeta.subFormsArry.outerForms,\n          outerForms = _customMeta$subFormsA === void 0 ? [] : _customMeta$subFormsA;\n        return /*#__PURE__*/_react[\"default\"].createElement(\"div\", {\n          style: _style,\n          className: className\n        }, outerForms.length && _react[\"default\"].Children.toArray(outerForms));\n      }\n      var data = customMeta.data,\n        configItems = customMeta.configItems,\n        lock = customMeta.lock,\n        lang = customMeta.lang,\n        themeColor = customMeta.themeColor,\n        themeNum = customMeta.themeNum,\n        cardRowData = customMeta.cardRowData,\n        gridRowData = customMeta.gridRowData,\n        subFormsArry = customMeta.subFormsArry,\n        others = _objectWithoutProperties(customMeta, _excluded);\n      var customProps = {\n        data: data,\n        configItems: configItems,\n        lock: lock,\n        lang: lang,\n        themeColor: themeColor,\n        themeNum: themeNum,\n        cardRowData: cardRowData,\n        gridRowData: gridRowData\n      };\n      return /*#__PURE__*/_react[\"default\"].createElement(_BaseCustomCtrl[\"default\"], _extends({\n        setPostData: this.setPostData(model),\n        invokeCustomMethod: this.invokeCustomMethod(model),\n        model: model,\n        style: _style,\n        className: className\n      }, attachData, others, {\n        outerForms: subFormsArry.outerForms,\n        innerForms: subFormsArry.innerForms,\n        customProps: customProps,\n        attachDataInstance: this.attachDataInstance\n      }));\n    }\n  }]);\n  return KDCustom;\n}(_react.Component)) || _class) || _class) || _class) || _class);\nvar _default = exports[\"default\"] = KDCustom;\n\n//# sourceURL=webpack://bos-platform/./src/component/mobile/KDCustom.js?");

/***/ }),

/***/ "./src/component/mobile/base/CustomCtrl/BaseCustomCtrl.js":
/*!****************************************************************!*\
  !*** ./src/component/mobile/base/CustomCtrl/BaseCustomCtrl.js ***!
  \****************************************************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {

eval("\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"../../node_modules/core-js/modules/es.symbol.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"../../node_modules/core-js/modules/es.symbol.description.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"../../node_modules/core-js/modules/es.symbol.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.symbol.to-primitive.js */ \"../../node_modules/core-js/modules/es.symbol.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"../../node_modules/core-js/modules/es.array.from.js\");\n__webpack_require__(/*! core-js/modules/es.array.index-of.js */ \"../../node_modules/core-js/modules/es.array.index-of.js\");\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"../../node_modules/core-js/modules/es.array.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"../../node_modules/core-js/modules/es.array.slice.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ \"../../node_modules/core-js/modules/es.date.to-primitive.js\");\n__webpack_require__(/*! core-js/modules/es.date.to-string.js */ \"../../node_modules/core-js/modules/es.date.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.function.bind.js */ \"../../node_modules/core-js/modules/es.function.bind.js\");\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"../../node_modules/core-js/modules/es.function.name.js\");\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"../../node_modules/core-js/modules/es.number.constructor.js\");\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"../../node_modules/core-js/modules/es.object.assign.js\");\n__webpack_require__(/*! core-js/modules/es.object.define-properties.js */ \"../../node_modules/core-js/modules/es.object.define-properties.js\");\n__webpack_require__(/*! core-js/modules/es.object.define-property.js */ \"../../node_modules/core-js/modules/es.object.define-property.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"../../node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ \"../../node_modules/core-js/modules/es.object.get-own-property-descriptors.js\");\n__webpack_require__(/*! core-js/modules/es.object.keys.js */ \"../../node_modules/core-js/modules/es.object.keys.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"../../node_modules/core-js/modules/es.regexp.exec.js\");\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"../../node_modules/core-js/modules/es.regexp.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"../../node_modules/core-js/modules/es.string.iterator.js\");\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"../../node_modules/core-js/modules/es.weak-map.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"../../node_modules/core-js/modules/web.dom-collections.iterator.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n  value: true\n}));\nexports[\"default\"] = BaseCustomCtrl;\nexports.domChangeCallback = domChangeCallback;\nexports.initCustomComponentInstance = initCustomComponentInstance;\nexports.subscribeCallback = subscribeCallback;\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"../../node_modules/core-js/modules/es.array.filter.js\");\n__webpack_require__(/*! core-js/modules/es.array.for-each.js */ \"../../node_modules/core-js/modules/es.array.for-each.js\");\n__webpack_require__(/*! core-js/modules/es.array.is-array.js */ \"../../node_modules/core-js/modules/es.array.is-array.js\");\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"../../node_modules/core-js/modules/es.object.to-string.js\");\n__webpack_require__(/*! core-js/modules/es.promise.js */ \"../../node_modules/core-js/modules/es.promise.js\");\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"../../node_modules/core-js/modules/web.dom-collections.for-each.js\");\nvar _react = _interopRequireWildcard(__webpack_require__(/*! react */ \"webpack/sharing/consume/default/react/react?dca2\"));\nvar _customComponentManage = __webpack_require__(/*! ../../../common/customComponentManage */ \"./src/component/common/customComponentManage.js\");\nvar _customCtrlUtil = __webpack_require__(/*! ../../../../util/customCtrlUtil */ \"./src/util/customCtrlUtil.js\");\nvar _immutable = __webpack_require__(/*! immutable */ \"webpack/sharing/consume/default/immutable/immutable?f2ca\");\nvar _memoryCacher = __webpack_require__(/*! @/model/memoryCacher */ \"./src/model/memoryCacher.js\");\nvar _symbolConst = __webpack_require__(/*! @/constant/symbolConst */ \"./src/constant/symbolConst.js\");\nvar _GlobalDataCacher = __webpack_require__(/*! @/model/GlobalDataCacher */ \"./src/model/GlobalDataCacher.js\");\nvar _useThemeChange2 = _interopRequireDefault(__webpack_require__(/*! @/use/useThemeChange */ \"./src/use/useThemeChange.js\"));\nvar _global = _interopRequireWildcard(__webpack_require__(/*! @/global */ \"./src/global/index.js\"));\nvar _excluded = [\"pageId\", \"controlKey\", \"metaData\", \"schemaId\", \"isvId\", \"moduleId\", \"invokeCustomMethod\", \"innerForms\", \"outerForms\", \"customProps\", \"fileServer\", \"style\", \"className\", \"setPostData\", \"attachDataInstance\", \"model\"]; // import useThemeContext from '@/use/useThemeContext'\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\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 _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(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) { _defineProperty(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; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : String(i); }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nvar TABLE_NAME = 'cusctrl_action'; // 自定义控件用户行为数据表\n\nfunction BaseCustomCtrl(props) {\n  var _attachDataInstance$g;\n  // extendData：表格或者卡片中传给自定义控件的数据\n  var pageId = props.pageId,\n    controlKey = props.controlKey,\n    metaData = props.metaData,\n    schemaId = props.schemaId,\n    isvId = props.isvId,\n    moduleId = props.moduleId,\n    invokeCustomMethod = props.invokeCustomMethod,\n    innerForms = props.innerForms,\n    outerForms = props.outerForms,\n    customProps = props.customProps,\n    fileServer = props.fileServer,\n    style = props.style,\n    className = props.className,\n    setPostData = props.setPostData,\n    attachDataInstance = props.attachDataInstance,\n    model = props.model,\n    others = _objectWithoutProperties(props, _excluded);\n  // const theme = useThemeContext()\n  // 主题参数改为在主题切换hook中提取\n  var _useThemeChange = (0, _useThemeChange2[\"default\"])(),\n    theme = _useThemeChange.themeNum,\n    themeColor = _useThemeChange.themeColor;\n  var _useState = (0, _react.useState)(null),\n    _useState2 = _slicedToArray(_useState, 2),\n    customComponent = _useState2[0],\n    setCustomComponent = _useState2[1];\n  var customComponentRef = (0, _react.useRef)(null);\n  var customDomRef = (0, _react.useRef)(null);\n  var controlMethodDataCache = (0, _react.useRef)([]);\n  var customChildRendered = (0, _react.useRef)(false);\n  var _useState3 = (0, _react.useState)(innerForms),\n    _useState4 = _slicedToArray(_useState3, 2),\n    forms = _useState4[0],\n    setForms = _useState4[1];\n  (0, _react.useEffect)(function () {\n    // 存储moduleId,isvId,schemaId到KDApi\n    (0, _customComponentManage.saveModel)({\n      schemaId: schemaId,\n      isvId: isvId,\n      moduleId: moduleId,\n      pageId: pageId,\n      lang: lang,\n      controlKey: controlKey\n    }, schemaId);\n    var cardRowData = customProps.cardRowData,\n      gridRowData = customProps.gridRowData,\n      lang = customProps.lang;\n    var indexpath = window.KDApi.nameSpace({\n      schemaId: schemaId,\n      isvId: isvId,\n      moduleId: moduleId,\n      pageId: pageId,\n      controlKey: controlKey,\n      lang: lang\n    }) + 'index.js';\n    var customModel = (0, _customComponentManage.createCustomModel)({\n      pageId: pageId,\n      controlKey: controlKey,\n      dom: customDomRef.current,\n      schemaId: schemaId,\n      isvId: isvId,\n      moduleId: moduleId,\n      fileServer: fileServer,\n      metaData: metaData,\n      cardRowData: cardRowData,\n      gridRowData: gridRowData,\n      lang: lang,\n      invokeCustomMethod: invokeCustomMethod,\n      setPostData: setPostData,\n      injectAttachData: attachDataInstance === null || attachDataInstance === void 0 ? void 0 : attachDataInstance.setAttachData\n    });\n    (0, _customCtrlUtil.getCurrentCustomComponent)(customModel, schemaId, indexpath, isvId).then(function (CustomComponent) {\n      customComponentRef.current = new CustomComponent(customModel);\n      setCustomComponent(customComponentRef.current);\n    })[\"catch\"](function (err) {\n      console.log(err);\n    });\n    return function () {\n      if (!customComponentRef.current) {\n        // 没有custom则不进行\n        return;\n      }\n      // 这里的destoryed单词可能拼错了，正确的应该是destroyed，但很多业务和客户都在用了，不好改，只能将错就错\n      (0, _customCtrlUtil.executeCustomCtrlMethod)(customComponentRef.current, 'destoryed');\n    };\n  }, []);\n  (0, _react.useEffect)(function () {\n    var removeCustomDomObserver;\n    try {\n      if (customComponent) {\n        var _customDomRef$current;\n        // 通过isImmediateUpdate标识，判断update是否需要立即更新\n        var isImmediateUpdate = (0, _customCtrlUtil.executeCustomCtrlMethod)(customComponentRef.current, 'init', customProps) !== true;\n        isImmediateUpdate && (0, _customCtrlUtil.executeCustomCtrlMethod)(customComponentRef.current, 'update', customProps); // 这里将错就错，前人留下的坑，埋不掉\n        // 监听自定义控件里节点变化\n        if ((_customDomRef$current = customDomRef.current) !== null && _customDomRef$current !== void 0 && (_customDomRef$current = _customDomRef$current.children) !== null && _customDomRef$current !== void 0 && _customDomRef$current.length) {\n          domChangeCallback(innerForms, setForms, filterInnerForms, customChildRendered, controlMethodDataCache, subscribeControlMethodCallback);\n        }\n        removeCustomDomObserver = (0, _customCtrlUtil.customDomObserver)(customDomRef.current, function (mutations) {\n          domChangeCallback(innerForms, setForms, filterInnerForms, customChildRendered, controlMethodDataCache, subscribeControlMethodCallback);\n        });\n        // LOAD_FILE\n        var isLoadFile = (0, _GlobalDataCacher.getData)(_symbolConst.KEY_CUSTOM_CTRL_INIT);\n        if (!isLoadFile) {\n          (0, _GlobalDataCacher.setData)(_symbolConst.KEY_CUSTOM_CTRL_INIT, true);\n          (0, _GlobalDataCacher.setData)(_symbolConst.KEY_UI_ACTION, {\n            pageId: pageId,\n            key: controlKey,\n            schemaId: schemaId,\n            isvId: isvId,\n            moduleId: moduleId,\n            lang: customProps.lang,\n            methodName: 'KDApi.register(init)',\n            tableName: TABLE_NAME\n          });\n        }\n      }\n    } catch (e) {\n      console.log(e);\n    }\n    return function () {\n      removeCustomDomObserver && removeCustomDomObserver.disconnect();\n    };\n  }, [customComponent]);\n  (0, _react.useEffect)(function () {\n    try {\n      var _getCurrentTheme = (0, _customCtrlUtil.getCurrentTheme)(),\n        _themeColor = _getCurrentTheme.themeColor;\n      (0, _customCtrlUtil.executeCustomCtrlMethod)(customComponentRef.current, 'update', _objectSpread(_objectSpread({}, customProps), {}, {\n        themeColor: _themeColor,\n        themeNum: theme\n      }));\n    } catch (e) {\n      console.log(e);\n    }\n  }, [(0, _immutable.fromJS)(customProps).hashCode(), theme, themeColor]);\n  (0, _react.useEffect)(function () {\n    var removeSubscribeControlMethod = (0, _memoryCacher.subscribeControlMethod)(pageId, controlKey, 'directives', function () {\n      var results = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n      // 当自定义控件dom子元素还没有加载成功的时候，直接执行，会导致自定义控件拿不到数据\n      // 解决：先把数据缓存起来，等到自定义控件内部的元素加载完的时候才去执行\n      if (customChildRendered.current) {\n        subscribeControlMethodCallback(results);\n      } else {\n        var _controlMethodDataCac;\n        (_controlMethodDataCac = controlMethodDataCache.current) === null || _controlMethodDataCac === void 0 || _controlMethodDataCac.push(results);\n      }\n    });\n    return function () {\n      removeSubscribeControlMethod();\n    };\n  }, []);\n  (0, _react.useEffect)(function () {\n    // 监听自定义控件里节点变化\n    if (innerForms.length) {\n      if (filterInnerForms(innerForms).length) {\n        setForms(filterInnerForms(innerForms));\n      } else {\n        (0, _customCtrlUtil.customDomObserver)(customDomRef.current, function (mutations) {\n          setForms(filterInnerForms(innerForms));\n        });\n      }\n    }\n  }, [(0, _immutable.fromJS)(innerForms).hashCode()]);\n  var filterInnerForms = function filterInnerForms() {\n    var innerForms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n    return innerForms.filter(function (formInfo) {\n      var elementId = formInfo.elementId;\n      return elementId && document.getElementById(elementId);\n    });\n  };\n\n  // 订阅回调\n  var subscribeControlMethodCallback = function subscribeControlMethodCallback(results) {\n    subscribeCallback(results, customComponentRef, customProps);\n  };\n  var innerFormsRootElement = attachDataInstance === null || attachDataInstance === void 0 || (_attachDataInstance$g = attachDataInstance.getAttachData()) === null || _attachDataInstance$g === void 0 ? void 0 : _attachDataInstance$g.innerFormsRootElement;\n  return /*#__PURE__*/_react[\"default\"].createElement(\"div\", _extends({\n    ref: customDomRef,\n    style: style,\n    className: className\n  }, others), outerForms.length ? _react[\"default\"].Children.toArray(outerForms) : null, innerForms.length ? _react[\"default\"].Children.toArray((0, _customCtrlUtil.parseInnerForms)(customDomRef, forms, innerFormsRootElement)) : null);\n}\nfunction initCustomComponentInstance(props) {\n  var pageId = props.pageId,\n    controlKey = props.controlKey,\n    schemaId = props.schemaId,\n    isvId = props.isvId,\n    moduleId = props.moduleId,\n    invokeCustomMethod = props.invokeCustomMethod,\n    fileServer = props.fileServer,\n    customProps = props.customProps;\n  var lang = customProps.lang;\n  var customComponent = (0, _customComponentManage.getCustomComponent)(schemaId);\n  if (customComponent) {\n    return new Promise(function (resolve) {\n      resolve(customComponent);\n    });\n  }\n  var indexpath = window.KDApi.nameSpace({\n    schemaId: schemaId,\n    isvId: isvId,\n    moduleId: moduleId,\n    pageId: pageId,\n    controlKey: controlKey,\n    lang: lang\n  }) + 'index.js'; // 'https://localhost:8443/ierp/dev/helloworld/index.js'\n  var customModel = (0, _customComponentManage.createCustomModel)({\n    pageId: pageId,\n    controlKey: controlKey,\n    schemaId: schemaId,\n    isvId: isvId,\n    moduleId: moduleId,\n    fileServer: fileServer,\n    lang: lang,\n    invokeCustomMethod: invokeCustomMethod\n  });\n  return (0, _customCtrlUtil.getCurrentCustomComponent)(customModel, schemaId, indexpath, isvId);\n}\nfunction domChangeCallback(innerForms, setForms, filterInnerForms, customChildRendered, controlMethodDataCache, subscribeControlMethodCallback) {\n  innerForms.length && setForms(filterInnerForms(innerForms));\n  customChildRendered.current = true;\n  if (Array.isArray(controlMethodDataCache.current) && controlMethodDataCache.current.length > 0) {\n    controlMethodDataCache.current.forEach(function (results) {\n      subscribeControlMethodCallback(results);\n    });\n    controlMethodDataCache.current = [];\n  }\n}\nfunction subscribeCallback(results, customComponentRef, customProps) {\n  if (Array.isArray(results)) {\n    results.forEach(function (_ref) {\n      var methodname = _ref.methodname,\n        args = _ref.args;\n      if (methodname) {\n        (0, _customCtrlUtil.executeCustomCtrlMethod)(customComponentRef.current, 'handleDirective', customProps, methodname, args);\n      }\n    });\n  }\n}\n\n//# sourceURL=webpack://bos-platform/./src/component/mobile/base/CustomCtrl/BaseCustomCtrl.js?");

/***/ })

}]);