UNPKG

@alilc/lowcode-shell

Version:

Shell Layer for AliLowCodeEngine

151 lines (139 loc) 3.51 kB
import _createClass from "@babel/runtime/helpers/createClass"; import { componentMetaSymbol, nodeSymbol } from '../symbols'; export var ComponentMeta = /*#__PURE__*/function () { function ComponentMeta(componentMeta) { this[componentMetaSymbol] = void 0; this.isComponentMeta = true; this[componentMetaSymbol] = componentMeta; } ComponentMeta.create = function create(componentMeta) { if (!componentMeta) { return null; } return new ComponentMeta(componentMeta); } /** * 组件名 */; var _proto = ComponentMeta.prototype; /** * 设置 npm 信息 * @param npm */ _proto.setNpm = function setNpm(npm) { this[componentMetaSymbol].setNpm(npm); } /** * 获取元数据 * @returns */; _proto.getMetadata = function getMetadata() { return this[componentMetaSymbol].getMetadata(); } /** * check if the current node could be placed in parent node * @param my * @param parent * @returns */; _proto.checkNestingUp = function checkNestingUp(my, parent) { var curNode = my.isNode ? my[nodeSymbol] : my; return this[componentMetaSymbol].checkNestingUp(curNode, parent); } /** * check if the target node(s) could be placed in current node * @param my * @param parent * @returns */; _proto.checkNestingDown = function checkNestingDown(my, target) { var curNode = my !== null && my !== void 0 && my.isNode ? my[nodeSymbol] : my; return this[componentMetaSymbol].checkNestingDown(curNode, target[nodeSymbol] || target); }; _proto.refreshMetadata = function refreshMetadata() { this[componentMetaSymbol].refreshMetadata(); }; return _createClass(ComponentMeta, [{ key: "componentName", get: function get() { return this[componentMetaSymbol].componentName; } /** * 是否是「容器型」组件 */ }, { key: "isContainer", get: function get() { return this[componentMetaSymbol].isContainer; } /** * 是否是最小渲染单元。 * 当组件需要重新渲染时: * 若为最小渲染单元,则只渲染当前组件, * 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。 */ }, { key: "isMinimalRenderUnit", get: function get() { return this[componentMetaSymbol].isMinimalRenderUnit; } /** * 是否为「模态框」组件 */ }, { key: "isModal", get: function get() { return this[componentMetaSymbol].isModal; } /** * 元数据配置 */ }, { key: "configure", get: function get() { return this[componentMetaSymbol].configure; } /** * 标题 */ }, { key: "title", get: function get() { return this[componentMetaSymbol].title; } /** * 图标 */ }, { key: "icon", get: function get() { return this[componentMetaSymbol].icon; } /** * 组件 npm 信息 */ }, { key: "npm", get: function get() { return this[componentMetaSymbol].npm; } /** * @deprecated */ }, { key: "prototype", get: function get() { return this[componentMetaSymbol].prototype; } }, { key: "availableActions", get: function get() { return this[componentMetaSymbol].availableActions; } }, { key: "advanced", get: function get() { return this[componentMetaSymbol].advanced; } }]); }();