mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 修复从其他页面粘贴过来的 modal 位置不对
fix: 对于 vc 场景的组件, 才做 schema 兼容处理 refactor: eslint 统一收拢到根目录
This commit is contained in:
parent
84c0229489
commit
158b6a699f
25
.eslintrc.js
25
.eslintrc.js
@ -1,3 +1,28 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
ignorePatterns: [ 'tests/* '],
|
||||
rules: {
|
||||
'react/no-multi-comp': 0,
|
||||
'no-unused-expressions': 0,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
'no-useless-constructor': 1,
|
||||
'no-empty-function': 1,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
'lines-between-class-members': 0,
|
||||
'no-await-in-loop': 0,
|
||||
'no-plusplus': 0,
|
||||
'@typescript-eslint/no-parameter-properties': 0,
|
||||
'@typescript-eslint/no-unused-vars': 1,
|
||||
'no-multi-assign': 1,
|
||||
'no-dupe-class-members': 1,
|
||||
'react/no-deprecated': 1,
|
||||
'no-useless-escape': 1,
|
||||
'brace-style': 1,
|
||||
'@typescript-eslint/no-inferrable-types': 0,
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
ignorePatterns: [ 'tests/* '],
|
||||
rules: {
|
||||
'react/no-multi-comp': 0,
|
||||
'no-unused-expressions': 0,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
'no-useless-constructor': 1,
|
||||
'no-empty-function': 1,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
'lines-between-class-members': 0,
|
||||
'no-await-in-loop': 0,
|
||||
'no-plusplus': 0,
|
||||
}
|
||||
}
|
||||
@ -300,6 +300,11 @@ export class Designer {
|
||||
if (!activedDoc) {
|
||||
return null;
|
||||
}
|
||||
if (Array.isArray(insertNode) && isNodeSchema(insertNode[0]) && this.getComponentMeta(insertNode[0].componentName).isModal) {
|
||||
return {
|
||||
target: activedDoc.rootNode as ParentalNode,
|
||||
};
|
||||
}
|
||||
const nodes = activedDoc.selection.getNodes();
|
||||
let target;
|
||||
let index: number | undefined;
|
||||
|
||||
@ -75,7 +75,7 @@ export class Project {
|
||||
componentsTree: [],
|
||||
...schema,
|
||||
};
|
||||
this.config = schema?.config;
|
||||
this.config = schema?.config || this.config;
|
||||
|
||||
if (autoOpen) {
|
||||
if (autoOpen === true) {
|
||||
@ -146,16 +146,16 @@ export class Project {
|
||||
get(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
key:
|
||||
| 'version'
|
||||
| 'componentsTree'
|
||||
| 'componentsMap'
|
||||
| 'utils'
|
||||
| 'constants'
|
||||
| 'i18n'
|
||||
| 'css'
|
||||
| 'dataSource'
|
||||
| 'config'
|
||||
| string,
|
||||
| 'version'
|
||||
| 'componentsTree'
|
||||
| 'componentsMap'
|
||||
| 'utils'
|
||||
| 'constants'
|
||||
| 'i18n'
|
||||
| 'css'
|
||||
| 'dataSource'
|
||||
| 'config'
|
||||
| string,
|
||||
): any {
|
||||
if (key === 'config') {
|
||||
return this.config;
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 1,
|
||||
'no-unused-expressions': 1,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 1,
|
||||
'no-unused-expressions': 0,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
'@typescript-eslint/no-unused-vars': 1,
|
||||
'no-multi-assign': 1,
|
||||
'no-dupe-class-members': 1,
|
||||
'react/no-deprecated': 1,
|
||||
'no-useless-escape': 1,
|
||||
'brace-style': 1,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 0,
|
||||
'no-unused-expressions': 1,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
'no-confusing-arrow': 1,
|
||||
'no-case-declarations': 1,
|
||||
'lines-between-class-members': 0,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 1,
|
||||
'no-unused-expressions': 0,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
'@typescript-eslint/no-unused-vars': 1,
|
||||
'no-multi-assign': 1,
|
||||
'no-dupe-class-members': 1,
|
||||
'react/no-deprecated': 1,
|
||||
'no-useless-escape': 1,
|
||||
'brace-style': 1,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'no-proto': 1,
|
||||
'no-new-func': 1,
|
||||
'no-shadow': 1,
|
||||
'@typescript-eslint/no-unused-vars': 1,
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 1,
|
||||
'no-unused-expressions': 1,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
"react/no-multi-comp": 1,
|
||||
"no-shadow": 1,
|
||||
"no-nested-ternary": 1
|
||||
},
|
||||
};
|
||||
@ -1,17 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 0,
|
||||
'no-unused-expressions': 0,
|
||||
'implicit-arrow-linebreak': 0,
|
||||
'no-nested-ternary': 0,
|
||||
'no-mixed-operators': 0,
|
||||
'@typescript-eslint/no-parameter-properties': 0,
|
||||
'@typescript-eslint/ban-types': 0,
|
||||
'no-shadow': 0,
|
||||
'no-prototype-builtins': 0,
|
||||
'array-callback-return': 0,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
'react/no-find-dom-node': 0,
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
module.exports = {
|
||||
extends: '../../.eslintrc',
|
||||
rules: {
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'no-param-reassign': 0,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
indent: 0,
|
||||
},
|
||||
};
|
||||
@ -13,7 +13,7 @@ export function isUseI18NSetter(prototype: any, propName: string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function convertToI18NObject(v: string | object, locale: string = 'zh_CN') {
|
||||
export function convertToI18NObject(v: string | any, locale: string = 'zh_CN') {
|
||||
if (isI18NObject(v)) return v;
|
||||
return { type: 'i18n', use: locale, [locale]: v };
|
||||
}
|
||||
@ -51,4 +51,4 @@ export function waitForThing(obj: any, path: string): Promise<any> {
|
||||
*/
|
||||
export function isFromVC(meta: ComponentMeta) {
|
||||
return !!meta?.getMetadata()?.experimental;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
module.exports = {
|
||||
extends: 'eslint-config-ali/typescript/react',
|
||||
rules: {
|
||||
'react/no-multi-comp': 1,
|
||||
'no-unused-expressions': 0,
|
||||
'implicit-arrow-linebreak': 1,
|
||||
'no-nested-ternary': 1,
|
||||
'no-mixed-operators': 1,
|
||||
'@typescript-eslint/no-parameter-properties': 1,
|
||||
'@typescript-eslint/ban-types': 1,
|
||||
'no-shadow': 1,
|
||||
'no-prototype-builtins': 1,
|
||||
'@typescript-eslint/no-unused-vars': 1,
|
||||
'no-multi-assign': 1,
|
||||
'no-dupe-class-members': 1,
|
||||
'react/no-deprecated': 1,
|
||||
'no-useless-escape': 1,
|
||||
'brace-style': 1,
|
||||
'@typescript-eslint/member-ordering': 0,
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,13 @@ import {
|
||||
isPlainObject,
|
||||
} from '@ali/lowcode-utils';
|
||||
import { isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
import { Node } from '@ali/lowcode-designer';
|
||||
|
||||
export function compatibleReducer(props: any) {
|
||||
export function compatibleReducer(props: any, node: Node) {
|
||||
// 如果不是 vc 体系,不做这个兼容处理
|
||||
if (!node.componentMeta.prototype) {
|
||||
return props;
|
||||
}
|
||||
if (!props || !isPlainObject(props)) {
|
||||
return props;
|
||||
}
|
||||
@ -30,7 +35,7 @@ export function compatibleReducer(props: any) {
|
||||
}
|
||||
const newProps: any = {};
|
||||
Object.entries<any>(props).forEach(([key, val]) => {
|
||||
newProps[key] = compatibleReducer(val);
|
||||
newProps[key] = compatibleReducer(val, node);
|
||||
});
|
||||
return newProps;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import logger from '@ali/vu-logger';
|
||||
import { hasOwnProperty } from '@ali/lowcode-utils';
|
||||
import { Node } from '@ali/lowcode-designer';
|
||||
|
||||
export function filterReducer(props: any, node: Node): any {
|
||||
const filters = node.componentMeta.getMetadata().experimental?.filters;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import {
|
||||
cloneDeep,
|
||||
} from '@ali/lowcode-utils';
|
||||
import { Node } from '@ali/lowcode-designer';
|
||||
|
||||
// 清除空的 props value
|
||||
export function removeEmptyPropsReducer(props: any, node: Node) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import {
|
||||
isPlainObject,
|
||||
} from '@ali/lowcode-utils';
|
||||
import { Node } from '@ali/lowcode-designer';
|
||||
import { isJSBlock } from '@ali/lowcode-types';
|
||||
import { isVariable } from '../utils';
|
||||
import { designerCabin } from '@ali/lowcode-engine';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user