UNPKG

@alilc/lowcode-shell

Version:

Shell Layer for AliLowCodeEngine

426 lines (402 loc) 12.5 kB
import _extends from "@babel/runtime/helpers/extends"; import _createClass from "@babel/runtime/helpers/createClass"; import { editorSymbol, skeletonSymbol, designerCabinSymbol, designerSymbol, settingFieldSymbol, editorCabinSymbol, skeletonCabinSymbol } from '../symbols'; import { isFormEvent as innerIsFormEvent, compatibleLegaoSchema as innerCompatibleLegaoSchema, getNodeSchemaById as innerGetNodeSchemaById, transactionManager, isNodeSchema as innerIsNodeSchema, isDragNodeDataObject as innerIsDragNodeDataObject, isDragNodeObject as innerIsDragNodeObject, isDragAnyObject as innerIsDragAnyObject, isLocationChildrenDetail as innerIsLocationChildrenDetail, isNode as innerIsNode, isSettingField as _isSettingField, isSettingField as innerIsSettingField } from '@alilc/lowcode-utils'; import { IPublicEnumTransitionType, IPublicEnumTransformStage as InnerTransitionStage, IPublicEnumDragObjectType as InnerDragObjectType, IPublicTypeLocationDetailType as InnerLocationDetailType } from '@alilc/lowcode-types'; import { SettingField as InnerSettingField, LiveEditing as InnerLiveEditing, isShaken as innerIsShaken, contains as innerContains, ScrollTarget as InnerScrollTarget, getConvertedExtraKey as innerGetConvertedExtraKey, getOriginalExtraKey as innerGetOriginalExtraKey, DropLocation as InnerDropLocation, Designer as InnerDesigner, Node as InnerNode, LowCodePluginManager as InnerLowCodePluginManager, DesignerView as InnerDesignerView } from '@alilc/lowcode-designer'; import { Skeleton as InnerSkeleton, createSettingFieldView as innerCreateSettingFieldView, PopupContext as InnerPopupContext, PopupPipe as InnerPopupPipe, Workbench as InnerWorkbench, SettingsPrimaryPane as InnerSettingsPrimaryPane, registerDefaults as InnerRegisterDefaults } from '@alilc/lowcode-editor-skeleton'; import { Editor, Title as InnerTitle, Tip as InnerTip, shallowIntl as innerShallowIntl, createIntl as innerCreateIntl, intl as innerIntl, globalLocale as innerGlobalLocale, obx as innerObx, observable as innerObservable, makeObservable as innerMakeObservable, untracked as innerUntracked, computed as innerComputed, observer as innerObserver, action as innerAction, runInAction as innerRunInAction, engineConfig as innerEngineConfig, globalContext } from '@alilc/lowcode-editor-core'; import { Dragon as ShellDragon } from '../model'; var DesignerCabin = /*#__PURE__*/function () { function DesignerCabin(editor) { this[editorSymbol] = void 0; /** * @deprecated */ this[designerCabinSymbol] = void 0; this[editorSymbol] = editor; this[designerCabinSymbol] = { isDragNodeObject: innerIsDragNodeObject, isDragAnyObject: innerIsDragAnyObject, isShaken: innerIsShaken, contains: innerContains, LocationDetailType: InnerLocationDetailType, isLocationChildrenDetail: innerIsLocationChildrenDetail, ScrollTarget: InnerScrollTarget, isSettingField: innerIsSettingField, TransformStage: InnerTransitionStage, SettingField: InnerSettingField, LiveEditing: InnerLiveEditing, DragObjectType: InnerDragObjectType, isDragNodeDataObject: innerIsDragNodeDataObject, isNode: innerIsNode, DropLocation: InnerDropLocation, Designer: InnerDesigner, Node: InnerNode, LowCodePluginManager: InnerLowCodePluginManager, DesignerView: InnerDesignerView }; } /** * 是否是 SettingField 实例 * @deprecated use same function from @alilc/lowcode-utils directly */ var _proto = DesignerCabin.prototype; _proto.isSettingField = function isSettingField(obj) { return _isSettingField(obj); } /** * 转换类型枚举对象,包含 init / upgrade / render 等类型 * [参考](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/transform-stage.ts) * @deprecated use { TransformStage } from '@alilc/lowcode-types' instead */; /** * @deprecated */ _proto.isDragNodeDataObject = function isDragNodeDataObject(obj) { return innerIsDragNodeDataObject(obj); } /** * @deprecated */; _proto.isNode = function isNode(node) { return innerIsNode(node); } /** * @deprecated please use canvas.dragon */; return _createClass(DesignerCabin, [{ key: designerSymbol, get: function get() { return this[editorSymbol].get('designer'); } }, { key: "TransformStage", get: function get() { return InnerTransitionStage; } /** * @deprecated */ }, { key: "SettingField", get: function get() { return InnerSettingField; } /** * @deprecated */ }, { key: "LiveEditing", get: function get() { return InnerLiveEditing; } /** * @deprecated */ }, { key: "DragObjectType", get: function get() { return InnerDragObjectType; } }, { key: "dragon", get: function get() { return ShellDragon.create(this[designerSymbol].dragon, false); } }]); }(); var SkeletonCabin = /*#__PURE__*/function () { function SkeletonCabin(skeleton) { this[skeletonSymbol] = void 0; this[skeletonCabinSymbol] = void 0; this[skeletonSymbol] = skeleton; this[skeletonCabinSymbol] = { Workbench: InnerWorkbench, createSettingFieldView: this.createSettingFieldView, PopupContext: InnerPopupContext, PopupPipe: InnerPopupPipe, SettingsPrimaryPane: InnerSettingsPrimaryPane, registerDefaults: InnerRegisterDefaults, Skeleton: InnerSkeleton }; } var _proto2 = SkeletonCabin.prototype; /** * @deprecated */ _proto2.createSettingFieldView = function createSettingFieldView(field, fieldEntry) { return innerCreateSettingFieldView(field[settingFieldSymbol] || field, fieldEntry); } /** * @deprecated */; return _createClass(SkeletonCabin, [{ key: "Workbench", get: function get() { var innerSkeleton = this[skeletonSymbol]; return function (props) { return /*#__PURE__*/React.createElement(InnerWorkbench, _extends({}, props, { skeleton: innerSkeleton })); }; } }, { key: "PopupContext", get: function get() { return InnerPopupContext; } /** * @deprecated */ }, { key: "PopupPipe", get: function get() { return InnerPopupPipe; } }]); }(); var Utils = /*#__PURE__*/function () { function Utils() {} var _proto3 = Utils.prototype; _proto3.isNodeSchema = function isNodeSchema(data) { return innerIsNodeSchema(data); }; _proto3.isFormEvent = function isFormEvent(e) { return innerIsFormEvent(e); } /** * @deprecated this is a legacy api, do not use this if not using is already */; _proto3.compatibleLegaoSchema = function compatibleLegaoSchema(props) { return innerCompatibleLegaoSchema(props); }; _proto3.getNodeSchemaById = function getNodeSchemaById(schema, nodeId) { return innerGetNodeSchemaById(schema, nodeId); }; _proto3.getConvertedExtraKey = function getConvertedExtraKey(key) { return innerGetConvertedExtraKey(key); }; _proto3.getOriginalExtraKey = function getOriginalExtraKey(key) { return innerGetOriginalExtraKey(key); }; _proto3.executeTransaction = function executeTransaction(fn, type) { if (type === void 0) { type = IPublicEnumTransitionType.REPAINT; } transactionManager.executeTransaction(fn, type); }; _proto3.createIntl = function createIntl(instance) { return innerCreateIntl(instance); }; _proto3.intl = function intl(data, params) { return innerIntl(data, params); }; return Utils; }(); var EditorCabin = /*#__PURE__*/function () { function EditorCabin(editor) { var _this = this; this[editorSymbol] = void 0; /** * @deprecated */ this[editorCabinSymbol] = void 0; /** * @deprecated */ this.createSetterContent = function (setter, props) { var setters = _this[editorSymbol].get('setters'); return setters.createSetterContent(setter, props); }; this[editorSymbol] = editor; this[editorCabinSymbol] = { Editor: Editor, globalContext: globalContext, runInAction: innerRunInAction, Title: InnerTitle, Tip: InnerTip, shallowIntl: innerShallowIntl, createIntl: innerCreateIntl, intl: innerIntl, createSetterContent: this.createSetterContent.bind(this), globalLocale: innerGlobalLocale, obx: innerObx, action: innerAction, engineConfig: innerEngineConfig, observable: innerObservable, makeObservable: innerMakeObservable, untracked: innerUntracked, computed: innerComputed, observer: innerObserver }; } /** * Title 组件 * @experimental unstable API, pay extra caution when trying to use this */ var _proto4 = EditorCabin.prototype; /** * @deprecated */ _proto4.shallowIntl = function shallowIntl(data) { return innerShallowIntl(data); } /** * @deprecated use common.utils.createIntl instead */; _proto4.createIntl = function createIntl(instance) { return innerCreateIntl(instance); } /** * @deprecated */; _proto4.intl = function intl(data, params) { return innerIntl(data, params); }; /** * @deprecated */ _proto4.makeObservable = function makeObservable(target, annotations, options) { return innerMakeObservable(target, annotations, options); } /** * @deprecated */; _proto4.untracked = function untracked(action) { return innerUntracked(action); } /** * @deprecated */; /** * @deprecated */ _proto4.observer = function observer(component) { return innerObserver(component); }; return _createClass(EditorCabin, [{ key: "Title", get: function get() { return InnerTitle; } /** * Tip 组件 * @experimental unstable API, pay extra caution when trying to use this */ }, { key: "Tip", get: function get() { return InnerTip; } }, { key: "globalLocale", get: /** * @deprecated use common.utils.createIntl instead */ function get() { return innerGlobalLocale; } /** * @deprecated */ }, { key: "obx", get: function get() { return innerObx; } /** * @deprecated */ }, { key: "action", get: function get() { return innerAction; } /** * @deprecated */ }, { key: "engineConfig", get: function get() { return innerEngineConfig; } /** * @deprecated */ }, { key: "runInAction", get: function get() { return innerRunInAction; } /** * @deprecated */ }, { key: "observable", get: function get() { return innerObservable; } }, { key: "computed", get: function get() { return innerComputed; } }]); }(); export var Common = /*#__PURE__*/function () { function Common(editor, skeleton) { this.__designerCabin = void 0; this.__skeletonCabin = void 0; this.__editorCabin = void 0; this.__utils = void 0; this.__designerCabin = new DesignerCabin(editor); this.__skeletonCabin = new SkeletonCabin(skeleton); this.__editorCabin = new EditorCabin(editor); this.__utils = new Utils(); } return _createClass(Common, [{ key: "utils", get: function get() { return this.__utils; } /** * 历史原因导致此处设计不合理,慎用。 * this load of crap will be removed in some future versions, don`t use it. * @deprecated */ }, { key: "editorCabin", get: function get() { return this.__editorCabin; } /** * 历史原因导致此处设计不合理,慎用。 * this load of crap will be removed in some future versions, don`t use it. * @deprecated use canvas api instead */ }, { key: "designerCabin", get: function get() { return this.__designerCabin; } }, { key: "skeletonCabin", get: function get() { return this.__skeletonCabin; } /** * 历史原因导致此处设计不合理,慎用。 * this load of crap will be removed in some future versions, don`t use it. * @deprecated use { TransformStage } from '@alilc/lowcode-types' instead */ }, { key: "objects", get: function get() { return { TransformStage: InnerTransitionStage }; } }]); }();