UNPKG

eapp-amis-theme-editor

Version:

amis主题编辑器

72 lines (66 loc) 1.76 kB
/** * amis-theme-editor v2.0.11-beta.2 * Copyright 2018-2023 @fex */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var tslib = require('tslib'); var lodash = require('lodash'); var i18nRuntime = require('i18n-runtime'); var componentFactory = {}; var componentGroup = [{ label: i18nRuntime.i18n("aa05fd09a619ddbf07d8d903e6d32c5e"), key: 'common', children: [] }, { label: i18nRuntime.i18n("5aefca559c5a41d10078e21e6d616825"), key: 'layout', children: [] }, { label: i18nRuntime.i18n("9f03503d5c6df67ce0f7a8942734f7ca"), key: 'data-entry', children: [] }, { label: i18nRuntime.i18n("b590af8d54b0b9151594c51239acffdc"), key: 'data-show', children: [] }, { label: i18nRuntime.i18n("1d50fa5b3a01d0b513df8f4b8be40158"), key: 'feedback', children: [] }]; function getComponent(key) { return componentFactory[key]; } function getAllComponent() { var allComponent = lodash.cloneDeep(componentGroup); allComponent.forEach(function (item) { for (var key in componentFactory) { if (componentFactory[key].type === item.key) { item.children.push(componentFactory[key]); } } }); return allComponent; } function hasComponent(name) { return !!getComponent(name); } function registerComponent(key, component) { componentFactory[key] = component; } function registerGroup(option) { if (lodash.find(componentGroup, function (item) { return item.key === option.key; })) { return; } componentGroup.push(tslib.__assign({ children: [] }, option)); } exports.getAllComponent = getAllComponent; exports.getComponent = getComponent; exports.hasComponent = hasComponent; exports.registerComponent = registerComponent; exports.registerGroup = registerGroup;