mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 08:58:15 +00:00
Merge branch 'master' into react-renderer-umd
This commit is contained in:
commit
f6cfd6a4bf
@ -28,6 +28,8 @@ module.exports = {
|
||||
'eol-last': 0,
|
||||
'react/no-find-dom-node': 0,
|
||||
'no-case-declarations': 0,
|
||||
'@typescript-eslint/indent': 0
|
||||
'@typescript-eslint/indent': 0,
|
||||
'import/no-cycle': 0,
|
||||
'@typescript-eslint/no-shadow': 0,
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"lerna": "2.11.0",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"npmClient": "tnpm",
|
||||
"registry": "http://registry.antfin-inc.com",
|
||||
"useWorkspaces": true,
|
||||
|
||||
17
package.json
17
package.json
@ -25,23 +25,20 @@
|
||||
"test": "lerna run test --stream",
|
||||
"test:snapshot": "lerna run test:snapshot",
|
||||
"watchdog:build": "node ./scripts/watchdog.js",
|
||||
"xima:fix": "xima fix",
|
||||
"xima:scan": "xima scan --quiet"
|
||||
"f2elint:scan": "f2elint scan -q -i ./packages/*/src",
|
||||
"f2elint:fix": "f2elint fix -i ./packages/*/src"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "xima exec lint-staged",
|
||||
"commit-msg": "xima exec commitlint -E HUSKY_GIT_PARAMS"
|
||||
"pre-commit": "f2elint commit-file-scan",
|
||||
"commit-msg": "f2elint commit-msg-scan"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"**/*.{css,scss,less}": "xima exec stylelint",
|
||||
"**/*.{js,jsx,ts,tsx}": "xima exec eslint"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ali/lerna": "^1",
|
||||
"typescript": "^3.2.2",
|
||||
"xima": "^0.3.0"
|
||||
"f2elint": "^2.0.1",
|
||||
"husky": "^7.0.4",
|
||||
"typescript": "^3.2.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
编排模块
|
||||
|
||||
|
||||
simulator/renderer 发 CDN
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-designer",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Designer for Ali LowCode Engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -15,9 +15,9 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ali/lowcode-editor-core": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-editor-core": "1.0.76",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
|
||||
@ -47,9 +47,9 @@ function getTitle(title: string | I18nData | ReactElement) {
|
||||
|
||||
@observer
|
||||
export class BorderContainer extends Component<{
|
||||
host: BuiltinSimulatorHost,
|
||||
host: BuiltinSimulatorHost;
|
||||
}, {
|
||||
target?: ParentalNode,
|
||||
target?: ParentalNode;
|
||||
}> {
|
||||
|
||||
state = {} as any;
|
||||
|
||||
@ -1004,7 +1004,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
if (!domNode) return;
|
||||
if (isElementNode(domNode) && !isDOMNodeVisible(domNode, this.viewport)) {
|
||||
const { left, top } = domNode.getBoundingClientRect();
|
||||
const { scrollTop = 0, scrollLeft = 0 } = this.contentDocument?.documentElement!;
|
||||
const { scrollTop = 0, scrollLeft = 0 } = this.contentDocument?.documentElement || {};
|
||||
opt.left = left + scrollLeft;
|
||||
opt.top = top + scrollTop;
|
||||
scroll = true;
|
||||
|
||||
@ -62,7 +62,7 @@ export class LiveEditing {
|
||||
|
||||
let setterPropElement = getSetterPropElement(targetElement, rootElement);
|
||||
let propTarget = setterPropElement?.dataset.setterProp;
|
||||
let matched: (LiveTextEditingConfig & { propElement?: HTMLElement; }) | undefined | null;
|
||||
let matched: (LiveTextEditingConfig & { propElement?: HTMLElement }) | undefined | null;
|
||||
if (liveTextEditing) {
|
||||
if (propTarget) {
|
||||
// 已埋点命中 data-setter-prop="proptarget", 从 liveTextEditing 读取配置(mode|onSaveContent)
|
||||
@ -196,7 +196,8 @@ export interface SaveHandler {
|
||||
}
|
||||
|
||||
function setCaret(event: MouseEvent) {
|
||||
const doc = event.view?.document!;
|
||||
const doc = event.view?.document;
|
||||
if (!doc) return;
|
||||
const range = doc.caretRangeFromPoint(event.clientX, event.clientY);
|
||||
if (range) {
|
||||
selectRange(doc, range);
|
||||
|
||||
@ -14,6 +14,7 @@ export const getClosestClickableNode = (
|
||||
while (node) {
|
||||
// 判断当前节点是否可点击
|
||||
let canClick = canClickNode(node, event);
|
||||
// eslint-disable-next-line no-loop-func
|
||||
const lockedNode = getClosestNode(node!, (n) => {
|
||||
// 假如当前节点就是 locked 状态,要从当前节点的父节点开始查找
|
||||
return !!(node?.isLocked ? n.parent?.isLocked : n.isLocked);
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
LiveTextEditingConfig,
|
||||
FieldConfig,
|
||||
} from '@ali/lowcode-types';
|
||||
import { computed, engineConfig } from '@ali/lowcode-editor-core';
|
||||
import { makeObservable, obx, computed, engineConfig } from '@ali/lowcode-editor-core';
|
||||
import EventEmitter from 'events';
|
||||
|
||||
import { isNode, Node, ParentalNode } from './document';
|
||||
@ -130,7 +130,7 @@ export class ComponentMeta {
|
||||
|
||||
private childWhitelist?: NestingFilter | null;
|
||||
|
||||
private _title?: TitleContent;
|
||||
@obx private _title?: TitleContent;
|
||||
|
||||
private _isMinimalRenderUnit?: boolean;
|
||||
|
||||
@ -162,6 +162,7 @@ export class ComponentMeta {
|
||||
}
|
||||
|
||||
constructor(readonly designer: Designer, metadata: ComponentMetadata) {
|
||||
makeObservable(this);
|
||||
this.parseMetadata(metadata);
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ hotkey.bind(['command+z', 'ctrl+z'], (e) => {
|
||||
|
||||
e.preventDefault();
|
||||
const selection = focusing.focusDesigner?.currentSelection;
|
||||
const curSelected = Array.from(selection?.selected!);
|
||||
const curSelected = Array.from(selection?.selected || []);
|
||||
his.back();
|
||||
selection?.selectAll(curSelected);
|
||||
});
|
||||
@ -193,7 +193,7 @@ hotkey.bind(['command+y', 'ctrl+y', 'command+shift+z'], (e) => {
|
||||
}
|
||||
e.preventDefault();
|
||||
const selection = focusing.focusDesigner?.currentSelection;
|
||||
const curSelected = Array.from(selection?.selected!);
|
||||
const curSelected = Array.from(selection?.selected || []);
|
||||
his.forward();
|
||||
selection?.selectAll(curSelected);
|
||||
});
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
align-items: center;
|
||||
pointer-events: none;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
//opacity: 0.9;
|
||||
box-shadow: 0 0 6px grey;
|
||||
transform: translate(-10%, -50%);
|
||||
.lc-ghost {
|
||||
|
||||
@ -7,6 +7,8 @@ import { Node, DocumentModel } from '../document';
|
||||
import { ISimulatorHost, isSimulatorHost, NodeInstance, ComponentInstance } from '../simulator';
|
||||
import { Designer } from './designer';
|
||||
|
||||
export type DragObjectReducer = (dragObject: DragObject) => DragObject;
|
||||
|
||||
export interface LocateEvent {
|
||||
readonly type: 'LocateEvent';
|
||||
/**
|
||||
@ -193,7 +195,7 @@ function isDragEvent(e: any): e is DragEvent {
|
||||
*/
|
||||
export class Dragon {
|
||||
private sensors: ISensor[] = [];
|
||||
|
||||
private dragObjectTransducers: DragObjectReducer[] = [];
|
||||
/**
|
||||
* current active sensor, 可用于感应区高亮
|
||||
*/
|
||||
@ -243,16 +245,41 @@ export class Dragon {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* change dragObject 对外暴露的拖拽对象处理方法
|
||||
*
|
||||
* @param fn 拖拽对象处理函数
|
||||
*/
|
||||
addDragObjectReducer(fn: DragObjectReducer) {
|
||||
this.dragObjectTransducers.push(fn);
|
||||
}
|
||||
|
||||
transformDragObject(dragObject: DragObject) {
|
||||
if (!this.dragObjectTransducers?.length) {
|
||||
return dragObject;
|
||||
}
|
||||
|
||||
return this.dragObjectTransducers.reduce((preDragObject, reducer) => {
|
||||
try {
|
||||
return reducer(preDragObject);
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
return preDragObject;
|
||||
}
|
||||
}, dragObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* boost your dragObject for dragging(flying) 发射拖拽对象
|
||||
*
|
||||
* @param dragObject 拖拽对象
|
||||
* @param boostEvent 拖拽初始时事件
|
||||
*/
|
||||
boost(dragObject: DragObject, boostEvent: MouseEvent | DragEvent, fromRglNode?: Node) {
|
||||
boost(dragObjectWrap: DragObject, boostEvent: MouseEvent | DragEvent, fromRglNode?: Node) {
|
||||
const { designer } = this;
|
||||
const masterSensors = this.getMasterSensors();
|
||||
const handleEvents = makeEventsHandler(boostEvent, masterSensors);
|
||||
const dragObject = this.transformDragObject(dragObjectWrap);
|
||||
const newBie = !isDragNodeObject(dragObject);
|
||||
const forceCopyState =
|
||||
isDragNodeObject(dragObject) && dragObject.nodes.some((node) => node.isSlot());
|
||||
|
||||
@ -78,6 +78,9 @@ export function isRowContainer(container: Element | Text, win?: Window) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (/grid$/.test(display)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
||||
return this._config;
|
||||
}
|
||||
|
||||
private initItems(items: Array<FieldConfig | CustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void; }) {
|
||||
private initItems(items: Array<FieldConfig | CustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void }) {
|
||||
this._items = items.map((item) => {
|
||||
if (isCustomView(item)) {
|
||||
return item;
|
||||
|
||||
@ -292,7 +292,7 @@ export class SettingPropEntry implements SettingEntry {
|
||||
}
|
||||
}
|
||||
|
||||
notifyValueChange(oldValue: any, newValue:any) {
|
||||
notifyValueChange(oldValue: any, newValue: any) {
|
||||
this.editor.emit(GlobalEvent.Node.Prop.Change, { node: this.getNode(), prop: this, oldValue, newValue });
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ export class DocumentModel {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
private _addons: Array<{ name: string, exportData: any }> = [];
|
||||
private _addons: Array<{ name: string; exportData: any }> = [];
|
||||
|
||||
/**
|
||||
* 模拟器
|
||||
@ -634,7 +634,7 @@ export class DocumentModel {
|
||||
) {
|
||||
let visitorResult = {};
|
||||
if (!visitorName) {
|
||||
/* tslint:disable no-console */
|
||||
/* eslint-disable-next-line no-console */
|
||||
console.warn('Invalid or empty RootNodeVisitor name.');
|
||||
}
|
||||
try {
|
||||
@ -656,6 +656,7 @@ export class DocumentModel {
|
||||
const exsitingMap: { [componentName: string]: boolean } = {};
|
||||
for (const node of this._nodesMap.values()) {
|
||||
const { componentName } = node || {};
|
||||
if (componentName === 'Slot') continue;
|
||||
if (!exsitingMap[componentName]) {
|
||||
exsitingMap[componentName] = true;
|
||||
if (node.componentMeta?.npm?.package) {
|
||||
|
||||
@ -933,7 +933,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
||||
return this.props;
|
||||
}
|
||||
|
||||
onChildrenChange(fn: (param?: { type: string, node: Node }) => void): (() => void) | undefined {
|
||||
onChildrenChange(fn: (param?: { type: string; node: Node }) => void): (() => void) | undefined {
|
||||
const wrappedFunc = wrapWithEventSwitch(fn);
|
||||
return this.children?.onChange(wrappedFunc);
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import { TransformStage } from '../transform-stage';
|
||||
|
||||
const { set: mobxSet, isObservableArray } = mobx;
|
||||
export const UNSET = Symbol.for('unset');
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export type UNSET = typeof UNSET;
|
||||
|
||||
export interface IPropParent {
|
||||
@ -381,10 +382,11 @@ export class Prop implements IPropParent {
|
||||
@computed private get items(): Prop[] | null {
|
||||
if (this._items) return this._items;
|
||||
return runInAction(() => {
|
||||
let items: Prop[] | null = [];
|
||||
let items: Prop[] | null = null;
|
||||
if (this._type === 'list') {
|
||||
const data = this._value;
|
||||
for (const item of data) {
|
||||
items = items || [];
|
||||
items.push(new Prop(this, item));
|
||||
}
|
||||
this._maps = null;
|
||||
@ -394,6 +396,7 @@ export class Prop implements IPropParent {
|
||||
const keys = Object.keys(data);
|
||||
for (const key of keys) {
|
||||
const prop = new Prop(this, data[key], key);
|
||||
items = items || [];
|
||||
items.push(prop);
|
||||
maps.set(key, prop);
|
||||
}
|
||||
@ -526,7 +529,8 @@ export class Prop implements IPropParent {
|
||||
this.setValue([]);
|
||||
}
|
||||
const prop = new Prop(this, value);
|
||||
this.items!.push(prop);
|
||||
this._items = this._items || [];
|
||||
this._items.push(prop);
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import { BuiltinSimulatorRenderer } from './builtin-simulator/renderer';
|
||||
import { Node, ParentalNode } from './document';
|
||||
|
||||
export type AutoFit = '100%';
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export const AutoFit = '100%';
|
||||
|
||||
export interface IViewport extends IScrollable {
|
||||
|
||||
@ -2,6 +2,6 @@ import Logger, { Level } from 'zen-logger';
|
||||
|
||||
export { Logger };
|
||||
|
||||
export function getLogger(config: { level: Level, bizName: string }): Logger {
|
||||
export function getLogger(config: { level: Level; bizName: string }): Logger {
|
||||
return new Logger(config);
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@ Object {
|
||||
"__slot__extraContent": false,
|
||||
"__slot__logo": false,
|
||||
"__slot__tab": false,
|
||||
"__style__": Object {},
|
||||
"action": "",
|
||||
"content": "",
|
||||
"crumb": "",
|
||||
@ -94,6 +95,7 @@ Object {
|
||||
"condition": true,
|
||||
"id": "node_k1ow3cbf",
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"behavior": "NORMAL",
|
||||
"content": Object {
|
||||
"en_US": "Title",
|
||||
@ -142,6 +144,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -219,6 +222,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -292,6 +296,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -364,6 +369,7 @@ Object {
|
||||
"id": "node_k1ow3cbx",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"colSpan": "",
|
||||
"fieldId": "column_k1p1bnjm",
|
||||
},
|
||||
@ -380,6 +386,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -453,6 +460,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"autoWidth": true,
|
||||
"behavior": "NORMAL",
|
||||
@ -545,6 +553,7 @@ Object {
|
||||
"id": "node_k1ow3cby",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"colSpan": "",
|
||||
"fieldId": "column_k1p1bnjn",
|
||||
},
|
||||
@ -558,6 +567,7 @@ Object {
|
||||
"id": "node_k1ow3cbw",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"columnGap": "20",
|
||||
"fieldId": "columns_k1ow3h1v",
|
||||
"layout": "6:6",
|
||||
@ -628,6 +638,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -705,6 +716,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -777,6 +789,7 @@ Object {
|
||||
"id": "node_k1ow3cc6",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"colSpan": "",
|
||||
"fieldId": "column_k1p1bnjo",
|
||||
},
|
||||
@ -793,6 +806,7 @@ Object {
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__category__": "form",
|
||||
"__style__": Object {},
|
||||
"__useMediator": "value",
|
||||
"addonAfter": Object {
|
||||
"type": "i18n",
|
||||
@ -865,6 +879,7 @@ Object {
|
||||
"id": "node_k1ow3cc7",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"colSpan": "",
|
||||
"fieldId": "column_k1p1bnjp",
|
||||
},
|
||||
@ -878,6 +893,7 @@ Object {
|
||||
"id": "node_k1ow3cc5",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"columnGap": "20",
|
||||
"fieldId": "columns_k1ow3h22",
|
||||
"layout": "6:6",
|
||||
@ -1006,6 +1022,7 @@ Object {
|
||||
"value": Array [
|
||||
Object {
|
||||
"componentName": "Text",
|
||||
"props": Object {},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -1035,6 +1052,7 @@ Object {
|
||||
"behavior": "NORMAL",
|
||||
"className": "div_kgaqfbm9",
|
||||
"customClassName": "",
|
||||
"events": Object {},
|
||||
"fieldId": "div_k1ow3h1o",
|
||||
"useFieldIdAsDomId": false,
|
||||
},
|
||||
@ -1049,6 +1067,7 @@ Object {
|
||||
"id": "form",
|
||||
"isLocked": false,
|
||||
"props": Object {
|
||||
"__style__": Object {},
|
||||
"autoUnmount": true,
|
||||
"autoValidate": true,
|
||||
"behavior": "NORMAL",
|
||||
@ -1057,6 +1076,7 @@ Object {
|
||||
"variable": "state.formData",
|
||||
},
|
||||
"fieldId": "form",
|
||||
"fieldOptions": Object {},
|
||||
"labelAlign": "top",
|
||||
"obj": Object {
|
||||
"a": 1,
|
||||
@ -1117,6 +1137,7 @@ Object {
|
||||
"globalConfig": Object {
|
||||
"fit": Object {
|
||||
"compiled": "",
|
||||
"error": Object {},
|
||||
"source": "",
|
||||
"type": "js",
|
||||
},
|
||||
@ -1175,6 +1196,7 @@ Object.keys(module.exports).forEach(function(item) {
|
||||
},
|
||||
"props": Object {
|
||||
"className": "page_kgaqfbm4",
|
||||
"containerStyle": Object {},
|
||||
"extensions": Object {
|
||||
"启用页头": true,
|
||||
},
|
||||
|
||||
@ -247,6 +247,8 @@ describe('Prop 类测试', () => {
|
||||
type: 'JSExpression',
|
||||
value: 'state.a',
|
||||
},
|
||||
emptyArr: [],
|
||||
emptyObj: {},
|
||||
z: {
|
||||
z1: 1,
|
||||
z2: 'str',
|
||||
@ -258,7 +260,7 @@ describe('Prop 类测试', () => {
|
||||
});
|
||||
|
||||
it('items / get', async () => {
|
||||
expect(prop.size).toBe(5);
|
||||
expect(prop.size).toBe(7);
|
||||
|
||||
expect(prop.get('a').getValue()).toBe(1);
|
||||
expect(prop.get('b').getValue()).toBe('str');
|
||||
@ -289,6 +291,10 @@ describe('Prop 类测试', () => {
|
||||
const newlyCreatedNestedProp2 = prop.get('m.m2', true);
|
||||
// .m2 的值为 undefined,导出时将会被移除
|
||||
expect(prop.get('m').getValue()).toEqual({ m1: 'newlyCreatedNestedProp' });
|
||||
|
||||
// 对于空值的 list / map 类型,_items 应该为 null
|
||||
expect(prop.get('emptyArr')._items).toBeNull();
|
||||
expect(prop.get('emptyObj')._items).toBeNull();
|
||||
});
|
||||
|
||||
it('export', () => {
|
||||
@ -300,6 +306,8 @@ describe('Prop 类测试', () => {
|
||||
type: 'JSExpression',
|
||||
value: 'state.a',
|
||||
},
|
||||
emptyArr: [],
|
||||
emptyObj: {},
|
||||
z: {
|
||||
z1: 1,
|
||||
z2: 'str',
|
||||
@ -348,19 +356,19 @@ describe('Prop 类测试', () => {
|
||||
for (const item of prop) {
|
||||
mockedFn();
|
||||
}
|
||||
expect(mockedFn).toHaveBeenCalledTimes(5);
|
||||
expect(mockedFn).toHaveBeenCalledTimes(7);
|
||||
mockedFn.mockClear();
|
||||
|
||||
prop.forEach((item) => {
|
||||
mockedFn();
|
||||
});
|
||||
expect(mockedFn).toHaveBeenCalledTimes(5);
|
||||
expect(mockedFn).toHaveBeenCalledTimes(7);
|
||||
mockedFn.mockClear();
|
||||
|
||||
prop.map((item) => {
|
||||
return mockedFn();
|
||||
});
|
||||
expect(mockedFn).toHaveBeenCalledTimes(5);
|
||||
expect(mockedFn).toHaveBeenCalledTimes(7);
|
||||
mockedFn.mockClear();
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-editor-core",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Core Api for Ali lowCode engine",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@ -13,8 +13,8 @@
|
||||
"build": "build-scripts build --skip-demo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"@alifd/next": "^1.19.16",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-editor-skeleton",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "alibaba lowcode editor skeleton",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -17,10 +17,10 @@
|
||||
"editor"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ali/lowcode-designer": "1.0.74",
|
||||
"@ali/lowcode-editor-core": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-designer": "1.0.76",
|
||||
"@ali/lowcode-editor-core": "1.0.76",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"@alifd/next": "^1.20.12",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16.8.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-engine",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Universal API for AliLowCode engine",
|
||||
"main": "lib/engine-core.js",
|
||||
"module": "es/engine-core.js",
|
||||
@ -18,13 +18,13 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ali/lowcode-designer": "1.0.74",
|
||||
"@ali/lowcode-editor-core": "1.0.74",
|
||||
"@ali/lowcode-editor-skeleton": "1.0.74",
|
||||
"@ali/lowcode-designer": "1.0.76",
|
||||
"@ali/lowcode-editor-core": "1.0.76",
|
||||
"@ali/lowcode-editor-skeleton": "1.0.76",
|
||||
"@ali/lowcode-engine-ext": "^1.0.0",
|
||||
"@ali/lowcode-plugin-designer": "1.0.74",
|
||||
"@ali/lowcode-plugin-outline-pane": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-plugin-designer": "1.0.76",
|
||||
"@ali/lowcode-plugin-outline-pane": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"@alifd/next": "^1.19.12",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-ignitor",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "点火器,bootstrap lce project",
|
||||
"main": "lib/index.js",
|
||||
"private": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-plugin-designer",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "alibaba lowcode editor designer plugin",
|
||||
"files": [
|
||||
"es",
|
||||
@ -18,7 +18,7 @@
|
||||
],
|
||||
"author": "xiayang.xy",
|
||||
"dependencies": {
|
||||
"@ali/lowcode-editor-core": "1.0.74",
|
||||
"@ali/lowcode-editor-core": "1.0.76",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-plugin-outline-pane",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Outline pane for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
@ -12,10 +12,10 @@
|
||||
"build": "build-scripts build --skip-demo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-designer": "1.0.74",
|
||||
"@ali/lowcode-editor-core": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-designer": "1.0.76",
|
||||
"@ali/lowcode-editor-core": "1.0.76",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"@alifd/next": "^1.19.16",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16",
|
||||
|
||||
@ -11,7 +11,7 @@ export default class TreeNode {
|
||||
/**
|
||||
* 是否可以展开
|
||||
*/
|
||||
@computed get expandable(): boolean {
|
||||
get expandable(): boolean {
|
||||
if (this.locked) return false;
|
||||
return this.hasChildren() || this.hasSlots() || this.dropDetail?.index != null;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-rax-renderer",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Rax renderer for Ali lowCode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -30,8 +30,8 @@
|
||||
"build": "build-scripts build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-renderer-core": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-renderer-core": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"rax-find-dom-node": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-rax-simulator-renderer",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "rax simulator renderer for alibaba lowcode designer",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -11,10 +11,10 @@
|
||||
"cloud-build": "build-scripts build --skip-demo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-designer": "1.0.74",
|
||||
"@ali/lowcode-rax-renderer": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-designer": "1.0.76",
|
||||
"@ali/lowcode-rax-renderer": "1.0.76",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"classnames": "^2.2.6",
|
||||
"driver-universal": "^3.1.3",
|
||||
"history": "^5.0.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-react-renderer",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "react renderer for ali lowcode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -23,7 +23,7 @@
|
||||
"react"
|
||||
],
|
||||
"dependencies": {
|
||||
"@ali/lowcode-renderer-core": "1.0.74",
|
||||
"@ali/lowcode-renderer-core": "1.0.76",
|
||||
"@alifd/next": "^1.21.16"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-react-simulator-renderer",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "react simulator renderer for alibaba lowcode designer",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -13,10 +13,10 @@
|
||||
"cloud-build": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --skip-demo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-designer": "1.0.74",
|
||||
"@ali/lowcode-react-renderer": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-designer": "1.0.76",
|
||||
"@ali/lowcode-react-renderer": "1.0.76",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"classnames": "^2.2.6",
|
||||
"mobx": "^6.3.0",
|
||||
"mobx-react": "^7.2.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-renderer-core",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "renderer core",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@ -17,8 +17,8 @@
|
||||
"@ali/bzb-request": "^2.6.0-beta.13",
|
||||
"@ali/lib-mtop": "^2.5.1",
|
||||
"@ali/lowcode-datasource-engine": "^1.0.22",
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-utils": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@ali/lowcode-utils": "1.0.76",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
|
||||
@ -218,6 +218,8 @@ export function leafWrapper(Comp: types.IBaseRenderer, {
|
||||
nodeChildren: null,
|
||||
childrenInState: false,
|
||||
visible: !hidden,
|
||||
nodeCacheProps: {},
|
||||
nodeProps: {},
|
||||
};
|
||||
}
|
||||
|
||||
@ -349,11 +351,11 @@ export function leafWrapper(Comp: types.IBaseRenderer, {
|
||||
this.curEventLeaf = _leaf;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
nodeChildren: null,
|
||||
nodeProps: {},
|
||||
childrenInState: false,
|
||||
});
|
||||
const {
|
||||
visible,
|
||||
...resetState
|
||||
} = this.defaultState;
|
||||
this.setState(resetState);
|
||||
}
|
||||
|
||||
/** 监听参数变化 */
|
||||
@ -378,23 +380,22 @@ export function leafWrapper(Comp: types.IBaseRenderer, {
|
||||
return;
|
||||
}
|
||||
this.beforeRender(RerenderType.PropsChanged);
|
||||
const state = this.state;
|
||||
const nodeCacheProps = state.nodeCacheProps;
|
||||
const nodeProps = getProps(node?.export?.(TransformStage.Render) as types.ISchema, scope, Comp, componentInfo);
|
||||
const preNodeProps = this.state.nodeProps;
|
||||
const newNodeProps = {
|
||||
...preNodeProps,
|
||||
...nodeProps,
|
||||
};
|
||||
if (key && !(key in newNodeProps) && (key in this.props)) {
|
||||
if (key && !(key in nodeProps) && (key in this.props)) {
|
||||
// 当 key 在 this.props 中时,且不存在在计算值中,需要用 newValue 覆盖掉 this.props 的取值
|
||||
newNodeProps[key] = newValue;
|
||||
nodeCacheProps[key] = newValue;
|
||||
}
|
||||
__debug(`${leaf?.componentName}[${this.props.componentId}] component trigger onPropsChange!`, newNodeProps);
|
||||
__debug(`${leaf?.componentName}[${this.props.componentId}] component trigger onPropsChange!`, nodeProps, nodeCacheProps, key, newValue);
|
||||
this.setState('children' in nodeProps ? {
|
||||
nodeChildren: nodeProps.children,
|
||||
nodeProps: newNodeProps,
|
||||
nodeProps,
|
||||
childrenInState: true,
|
||||
nodeCacheProps,
|
||||
} : {
|
||||
nodeProps: newNodeProps,
|
||||
nodeProps,
|
||||
nodeCacheProps,
|
||||
});
|
||||
});
|
||||
|
||||
@ -497,6 +498,7 @@ export function leafWrapper(Comp: types.IBaseRenderer, {
|
||||
|
||||
const compProps = {
|
||||
...rest,
|
||||
...(this.state.nodeCacheProps || {}),
|
||||
...(this.state.nodeProps || {}),
|
||||
children: [],
|
||||
__id: this.props.componentId,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-types",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Types for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ali/lowcode-utils",
|
||||
"version": "1.0.74",
|
||||
"version": "1.0.76",
|
||||
"description": "Utils for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
@ -12,7 +12,7 @@
|
||||
"build": "build-scripts build --skip-demo"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ali/lowcode-types": "1.0.74",
|
||||
"@ali/lowcode-types": "1.0.76",
|
||||
"@alifd/next": "^1.19.16",
|
||||
"lodash": "^4.17.21",
|
||||
"react": "^16"
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
TODO
|
||||
---
|
||||
@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"./src/"
|
||||
]
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"plugins": [
|
||||
[
|
||||
"build-plugin-component"
|
||||
]
|
||||
]
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "@ali/lowcode-engine-",
|
||||
"version": "0.0.0",
|
||||
"description": "xxx for Ali lowCode engine",
|
||||
"main": "lib/index.js",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "ava",
|
||||
"test:snapshot": "ava --update-snapshots"
|
||||
},
|
||||
"ava": {
|
||||
"compileEnhancements": false,
|
||||
"snapshotDir": "test/fixtures/__snapshots__",
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
]
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
0
templates/src/index.d.ts
vendored
0
templates/src/index.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
//
|
||||
// # sourceMappingURL=index.js.map
|
||||
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,EAAE"}
|
||||
@ -1 +0,0 @@
|
||||
//
|
||||
@ -1,5 +0,0 @@
|
||||
import test from 'ava';
|
||||
|
||||
test('foobar', t => {
|
||||
t.pass();
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user