mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 修复修改 勾选框、富文本编辑器、下拉选择 等组件标题报错
fix: 修复不存在组件无法选中问题
This commit is contained in:
parent
e591abacec
commit
8ba26ee880
@ -58,13 +58,12 @@ export class BorderDetecting extends Component<{ host: BuiltinSimulatorHost }> {
|
||||
@computed get current() {
|
||||
const { host } = this.props;
|
||||
const doc = host.currentDocument;
|
||||
console.info(doc);
|
||||
if (!doc) {
|
||||
return null;
|
||||
}
|
||||
const { selection } = doc;
|
||||
const { current } = host.designer.detecting;
|
||||
|
||||
const { current } = host.designer.detecting;
|
||||
|
||||
if (!current || current.document !== doc || selection.has(current.id)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -327,10 +327,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
|
||||
const nodeInst = this.getNodeInstanceFromElement(downEvent.target as Element);
|
||||
const node = nodeInst?.node || documentModel?.rootNode;
|
||||
if (!node?.isValidComponent()) {
|
||||
// 对于未注册组件直接返回
|
||||
return;
|
||||
}
|
||||
// if (!node?.isValidComponent()) {
|
||||
// // 对于未注册组件直接返回
|
||||
// return;
|
||||
// }
|
||||
const isLeftButton = downEvent.which === 1 || downEvent.button === 0;
|
||||
const checkSelect = (e: MouseEvent) => {
|
||||
doc.removeEventListener('mouseup', checkSelect, true);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { isJSBlock, isJSExpression, isJSSlot, isI18nData } from '@ali/lowcode-types';
|
||||
import { isPlainObject, hasOwnProperty, cloneDeep } from '@ali/lowcode-utils';
|
||||
import { isJSBlock, isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
import { isPlainObject, hasOwnProperty, cloneDeep, isI18NObject, isUseI18NSetter, convertToI18NObject } from '@ali/lowcode-utils';
|
||||
import { globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||
import { Designer, LiveEditing, TransformStage, Node, getConvertedExtraKey } from '@ali/lowcode-designer';
|
||||
import Outline, { OutlineBackupPane, getTreeMaster } from '@ali/lowcode-plugin-outline-pane';
|
||||
@ -123,6 +123,10 @@ designer.addPropsReducer((props, node) => {
|
||||
if (ov === undefined && v !== undefined) {
|
||||
newProps[item.name] = v;
|
||||
}
|
||||
// 兼容 props 中的属性为 i18n 类型,但是仅提供了一个值
|
||||
if (isUseI18NSetter(node.componentMeta.prototype, item.name) && !isI18NObject(ov)) {
|
||||
newProps[item.name] = v;
|
||||
}
|
||||
} catch (e) {
|
||||
if (hasOwnProperty(props, item.name)) {
|
||||
newProps[item.name] = props[item.name];
|
||||
|
||||
@ -20,3 +20,4 @@ export * from './svg-icon';
|
||||
export * from './unique-id';
|
||||
export * from './build-components';
|
||||
export * from './appHelper';
|
||||
export * from './misc';
|
||||
15
packages/utils/src/misc.ts
Normal file
15
packages/utils/src/misc.ts
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
export function isUseI18NSetter(prototype: any, propName: string) {
|
||||
const configure = prototype?.options?.configure;
|
||||
if (Array.isArray(configure)) {
|
||||
return configure.some(c => {
|
||||
return c.name === propName && c?.setter?.type?.displayName === 'I18nSetter';
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function convertToI18NObject(v: string, locale: string = 'zh_CN') {
|
||||
return { type: 'i18n', use: locale, [locale]: v };
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user