"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireWildcard(require("react")); var _Context = _interopRequireDefault(require("./Context")); var _indexModule = _interopRequireDefault(require("./index.module.less")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _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; } function getSections(api) { var ConfigForm = api.ConfigForm, _api$getBasicUI = api.getBasicUI, getBasicUI = _api$getBasicUI === void 0 ? function () { return {}; } : _api$getBasicUI; var basicUI = getBasicUI(); var sections = [{ key: 'project', title: 'org.umi.ui.configuration.project.config.title', icon: /*#__PURE__*/_react.default.createElement("img", { src: "https://img.alicdn.com/tfs/TB1aqdSeEY1gK0jSZFMXXaWcVXa-64-64.png", width: api.mini ? 24 : 32, height: api.mini ? 24 : 32 }), description: function description() { return api.intl({ id: 'org.umi.ui.configuration.project.config.desc' }, { library: basicUI.name || 'Umi' }); }, component: function component() { return /*#__PURE__*/_react.default.createElement(ConfigForm, { title: "org.umi.ui.configuration.project.config.title", list: "org.umi.config.list", edit: "org.umi.config.edit" }); } }].concat(_toConsumableArray(api.service.configSections)); return sections; } var ConfigManager = function ConfigManager(_ref) { var api = _ref.api; var TwoColumnPanel = api.TwoColumnPanel, getContext = api.getContext, debug = api.debug, intl = api.intl; var _useContext = (0, _react.useContext)(getContext()), theme = _useContext.theme; return /*#__PURE__*/_react.default.createElement(_Context.default.Provider, { value: { api: api, debug: debug.extend('configuration'), theme: theme } }, /*#__PURE__*/_react.default.createElement(TwoColumnPanel, { disableRightOverflow: true, className: _indexModule.default.configuration, sections: getSections(api) })); }; var _default = ConfigManager; exports.default = _default;