UNPKG

@alilc/lowcode-shell

Version:

Shell Layer for AliLowCodeEngine

156 lines (143 loc) 3.9 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.ComponentMeta = void 0; var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _symbols = require("../symbols"); var ComponentMeta = exports.ComponentMeta = /*#__PURE__*/function () { function ComponentMeta(componentMeta) { this[_symbols.componentMetaSymbol] = void 0; this.isComponentMeta = true; this[_symbols.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[_symbols.componentMetaSymbol].setNpm(npm); } /** * 获取元数据 * @returns */; _proto.getMetadata = function getMetadata() { return this[_symbols.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[_symbols.nodeSymbol] : my; return this[_symbols.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[_symbols.nodeSymbol] : my; return this[_symbols.componentMetaSymbol].checkNestingDown(curNode, target[_symbols.nodeSymbol] || target); }; _proto.refreshMetadata = function refreshMetadata() { this[_symbols.componentMetaSymbol].refreshMetadata(); }; return (0, _createClass2["default"])(ComponentMeta, [{ key: "componentName", get: function get() { return this[_symbols.componentMetaSymbol].componentName; } /** * 是否是「容器型」组件 */ }, { key: "isContainer", get: function get() { return this[_symbols.componentMetaSymbol].isContainer; } /** * 是否是最小渲染单元。 * 当组件需要重新渲染时: * 若为最小渲染单元,则只渲染当前组件, * 若不为最小渲染单元,则寻找到上层最近的最小渲染单元进行重新渲染,直至根节点。 */ }, { key: "isMinimalRenderUnit", get: function get() { return this[_symbols.componentMetaSymbol].isMinimalRenderUnit; } /** * 是否为「模态框」组件 */ }, { key: "isModal", get: function get() { return this[_symbols.componentMetaSymbol].isModal; } /** * 元数据配置 */ }, { key: "configure", get: function get() { return this[_symbols.componentMetaSymbol].configure; } /** * 标题 */ }, { key: "title", get: function get() { return this[_symbols.componentMetaSymbol].title; } /** * 图标 */ }, { key: "icon", get: function get() { return this[_symbols.componentMetaSymbol].icon; } /** * 组件 npm 信息 */ }, { key: "npm", get: function get() { return this[_symbols.componentMetaSymbol].npm; } /** * @deprecated */ }, { key: "prototype", get: function get() { return this[_symbols.componentMetaSymbol].prototype; } }, { key: "availableActions", get: function get() { return this[_symbols.componentMetaSymbol].availableActions; } }, { key: "advanced", get: function get() { return this[_symbols.componentMetaSymbol].advanced; } }]); }();