Merge commit '745457279011a84807b41b2ffccf7cf6e434fe71' into def_releases_2022040810384040_ali-lowcode_ali-lowcode-engine/1.0.81

This commit is contained in:
tbfed 2022-04-18 21:04:43 +08:00
commit baa1c56a15
26 changed files with 137 additions and 42 deletions

View File

@ -5,6 +5,7 @@ import { TitleContent } from '@ali/lowcode-types';
import { getClosestNode } from '@ali/lowcode-utils'; import { getClosestNode } from '@ali/lowcode-utils';
import { BuiltinSimulatorHost } from '../host'; import { BuiltinSimulatorHost } from '../host';
import { intl } from '../../locale';
export class BorderDetectingInstance extends PureComponent<{ export class BorderDetectingInstance extends PureComponent<{
@ -37,7 +38,7 @@ export class BorderDetectingInstance extends PureComponent<{
<div className={className} style={style}> <div className={className} style={style}>
<Title title={title} className="lc-borders-title" /> <Title title={title} className="lc-borders-title" />
{ {
isLocked ? (<Title title="已锁定" className="lc-borders-status" />) : null isLocked ? (<Title title={intl('Locked')} className="lc-borders-status" />) : null
} }
</div> </div>
); );

View File

@ -5,5 +5,6 @@
"lock": "Lock", "lock": "Lock",
"unlock": "Unlock", "unlock": "Unlock",
"Condition Group": "Condition Group", "Condition Group": "Condition Group",
"No opened document": "No opened document, open some document to editing" "No opened document": "No opened document, open some document to editing",
"Locked": "Locked"
} }

View File

@ -5,5 +5,6 @@
"lock": "锁定", "lock": "锁定",
"unlock": "解锁", "unlock": "解锁",
"Condition Group": "条件组", "Condition Group": "条件组",
"No opened document": "没有打开的页面,请选择页面打开编辑" "No opened document": "没有打开的页面,请选择页面打开编辑",
"Locked": "已锁定"
} }

View File

@ -7,6 +7,7 @@ import { IEditor, TitleContent } from '@ali/lowcode-types';
import { PopupPipe, PopupContext } from '../popup'; import { PopupPipe, PopupContext } from '../popup';
import './index.less'; import './index.less';
import InlineTip from './inlinetip'; import InlineTip from './inlinetip';
import { intl } from '../../locale';
export interface FieldProps { export interface FieldProps {
className?: string; className?: string;
@ -105,22 +106,22 @@ export class Field extends Component<FieldProps> {
getTipContent(propName: string, tip?: any): any { getTipContent(propName: string, tip?: any): any {
let tipContent = ( let tipContent = (
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
</div> </div>
); );
if (isObject(tip)) { if (isObject(tip)) {
tipContent = ( tipContent = (
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
<div>{(tip as any).content}</div> <div>{intl('Explanation:')}{(tip as any).content}</div>
</div> </div>
); );
} else if (tip) { } else if (tip) {
tipContent = ( tipContent = (
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
<div>{tip}</div> <div>{intl('Explanation:')}{tip}</div>
</div> </div>
); );
} }

View File

@ -7,6 +7,7 @@ import { SettingsPane } from './settings-pane';
import { StageBox } from '../stage-box'; import { StageBox } from '../stage-box';
import { SkeletonContext } from '../../context'; import { SkeletonContext } from '../../context';
import { createIcon } from '@ali/lowcode-utils'; import { createIcon } from '@ali/lowcode-utils';
import { intl } from '../../locale';
@observer @observer
export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any }, { shouldIgnoreRoot: boolean }> { export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any }, { shouldIgnoreRoot: boolean }> {
@ -133,7 +134,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
return ( return (
<div className="lc-settings-main"> <div className="lc-settings-main">
<div className="lc-settings-notice"> <div className="lc-settings-notice">
<p></p> <p>{intl('Please select the node on the left canvas')}</p>
</div> </div>
</div> </div>
); );
@ -144,7 +145,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
return ( return (
<div className="lc-settings-main"> <div className="lc-settings-main">
<div className="lc-settings-notice"> <div className="lc-settings-notice">
<p></p> <p>{intl('Locked node cannot be configured')}</p>
</div> </div>
</div> </div>
); );
@ -153,7 +154,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
return ( return (
<div className="lc-settings-main"> <div className="lc-settings-main">
<div className="lc-settings-notice"> <div className="lc-settings-notice">
<p></p> <p>{intl('There is no configuration for this component')}</p>
</div> </div>
</div> </div>
); );
@ -164,7 +165,7 @@ export class SettingsPrimaryPane extends Component<{ editor: Editor; config: any
return ( return (
<div className="lc-settings-main"> <div className="lc-settings-main">
<div className="lc-settings-notice"> <div className="lc-settings-notice">
<p></p> <p>{intl('Please select the same type of node to edit')}</p>
</div> </div>
</div> </div>
); );

View File

@ -2,6 +2,7 @@ import { Component } from 'react';
import { isJSSlot } from '@ali/lowcode-types'; import { isJSSlot } from '@ali/lowcode-types';
import { Button, Input, Icon } from '@alifd/next'; import { Button, Input, Icon } from '@alifd/next';
import './index.less'; import './index.less';
import { intl } from '../../locale';
export default class SlotSetter extends Component<{ export default class SlotSetter extends Component<{
value: any; value: any;
@ -30,7 +31,7 @@ export default class SlotSetter extends Component<{
if (!isJSSlot(value)) { if (!isJSSlot(value)) {
return ( return (
<Button type="primary" onClick={this.handleInitial}> <Button type="primary" onClick={this.handleInitial}>
{intl('Open slot')}
</Button> </Button>
); );
} }
@ -46,13 +47,13 @@ export default class SlotSetter extends Component<{
}} }}
type="secondary" type="secondary"
> >
{intl('Close slot')}
</Button> </Button>
{hasParams ? ( {hasParams ? (
<Input <Input
className="lc-slot-params" className="lc-slot-params"
addonTextBefore="入参" addonTextBefore={intl('Parameter')}
placeholder="插槽入参,以逗号风格" placeholder={intl('ParameterPlaceholder')}
value={value.params!.join(',')} value={value.params!.join(',')}
autoFocus autoFocus
onChange={(val) => { onChange={(val) => {
@ -91,7 +92,7 @@ export default class SlotSetter extends Component<{
}); });
}} }}
> >
{intl('Add parameters')}
</Button> </Button>
) : null} ) : null}
</div> </div>

View File

@ -5,5 +5,16 @@
"Multiple Value, Click to Clear": "Multiple Value, Click to Clear", "Multiple Value, Click to Clear": "Multiple Value, Click to Clear",
"Required": "Required", "Required": "Required",
"Setted Value, Click to Clear": "Setted Value, Click to Clear", "Setted Value, Click to Clear": "Setted Value, Click to Clear",
"Multiple Value": "Multiple Value" "Multiple Value": "Multiple Value",
"Please select the node on the left canvas": "Please select the node on the left canvas",
"Locked node cannot be configured": "Locked node cannot be configured",
"There is no configuration for this component": "There is no configuration for this component",
"Please select the same type of node to edit": "Please select the same type of node to edit",
"PropName:": "Prop: ",
"Explanation:": "Explanation: ",
"Open slot": "Open slot",
"Close slot": "Close slot",
"Add parameters": "Add parameters",
"Parameter": "Parameter",
"ParameterPlaceholder": "Slot input parameters, separated by commas"
} }

View File

@ -5,5 +5,17 @@
"Multiple Value, Click to Clear": "多种值, 点击清除", "Multiple Value, Click to Clear": "多种值, 点击清除",
"Required": "必填项", "Required": "必填项",
"Setted Value, Click to Clear": "已设置值,点击清除", "Setted Value, Click to Clear": "已设置值,点击清除",
"Multiple Value": "多种值" "Multiple Value": "多种值",
"Please select the node on the left canvas": "请在左侧画布选中节点",
"The node is locked and cannot be configured": "该节点已被锁定,无法配置",
"Locked node cannot be configured": "该节点已被锁定,无法配置",
"There is no configuration for this component": "该组件暂无配置",
"Please select the same type of node to edit": "请选中同一类型节点编辑",
"PropName:": "属性:",
"Explanation:": "说明:",
"Open slot": "开启插槽",
"Close slot": "关闭插槽",
"Add parameters": "添加入参",
"Parameter": "入参",
"ParameterPlaceholder": "插槽入参,以逗号分隔"
} }

View File

@ -10,5 +10,6 @@
"Loop": "Loop", "Loop": "Loop",
"Slots": "Slots", "Slots": "Slots",
"Slot for {prop}": "Slot for {prop}", "Slot for {prop}": "Slot for {prop}",
"Outline Tree": "Outline Tree" "Outline Tree": "Outline Tree",
"Modal Views": "Modal Views"
} }

View File

@ -10,5 +10,6 @@
"Loop": "循环", "Loop": "循环",
"Slots": "插槽", "Slots": "插槽",
"Slot for {prop}": "属性 {prop} 的插槽", "Slot for {prop}": "属性 {prop} 的插槽",
"Outline Tree": "大纲树" "Outline Tree": "大纲树",
"Modal Views": "模态视图层"
} }

View File

@ -6,6 +6,7 @@ import TreeNode from '../tree-node';
import TreeTitle from './tree-title'; import TreeTitle from './tree-title';
import TreeBranches from './tree-branches'; import TreeBranches from './tree-branches';
import { IconEyeClose } from '../icons/eye-close'; import { IconEyeClose } from '../icons/eye-close';
import { intl } from '../locale';
@observer @observer
class ModalTreeNodeView extends Component<{ treeNode: TreeNode }> { class ModalTreeNodeView extends Component<{ treeNode: TreeNode }> {
@ -37,7 +38,7 @@ class ModalTreeNodeView extends Component<{ treeNode: TreeNode }> {
return ( return (
<div className="tree-node-modal"> <div className="tree-node-modal">
<div className="tree-node-modal-title"> <div className="tree-node-modal-title">
<span></span> <span>{intl('Modal Views')}</span>
<div <div
className="tree-node-modal-title-visible-icon" className="tree-node-modal-title-visible-icon"
onClick={this.hideAllNodes.bind(this)} onClick={this.hideAllNodes.bind(this)}

View File

@ -0,0 +1,3 @@
{
"Drag and drop components or templates here": "Drag and drop components or templates here"
}

View File

@ -0,0 +1,10 @@
import { createIntl } from '@ali/lowcode-editor-core';
import en_US from './en-US.json';
import zh_CN from './zh-CN.json';
const { intl, intlNode, getLocale, setLocale } = createIntl({
'en-US': en_US,
'zh-CN': zh_CN,
});
export { intl, intlNode, getLocale, setLocale };

View File

@ -0,0 +1,3 @@
{
"Drag and drop components or templates here": "拖拽组件或模板到这里"
}

View File

@ -7,6 +7,7 @@ import './renderer.less';
import { uniqueId } from '@ali/lowcode-utils'; import { uniqueId } from '@ali/lowcode-utils';
import { GlobalEvent } from '@ali/lowcode-types'; import { GlobalEvent } from '@ali/lowcode-types';
import { host } from './host'; import { host } from './host';
import { intl } from './locale';
// patch cloneElement avoid lost keyProps // patch cloneElement avoid lost keyProps
const originCloneElement = (window as any).Rax.cloneElement; const originCloneElement = (window as any).Rax.cloneElement;
@ -69,8 +70,8 @@ export default class SimulatorRendererView extends Component<{ rendererContainer
} }
export const Routes = (props: { export const Routes = (props: {
rendererContainer: SimulatorRendererContainer, rendererContainer: SimulatorRendererContainer;
history: History history: History;
}) => { }) => {
const { rendererContainer, history } = props; const { rendererContainer, history } = props;
const { documentInstances } = rendererContainer; const { documentInstances } = rendererContainer;
@ -238,7 +239,7 @@ class Renderer extends Component<{
) { ) {
children = ( children = (
<div className="lc-container-placeholder" style={viewProps.placeholderStyle}> <div className="lc-container-placeholder" style={viewProps.placeholderStyle}>
{viewProps.placeholder || '拖拽组件或模板到这里'} {viewProps.placeholder || intl('Drag and drop components or templates here')}
</div> </div>
); );
} }

View File

@ -0,0 +1,4 @@
{
"Drag and drop components or templates here": "Drag and drop components or templates here",
"Locked elements and child elements cannot be edited": "Locked elements and child elements cannot be edited"
}

View File

@ -0,0 +1,10 @@
import { createIntl } from '@ali/lowcode-editor-core';
import en_US from './en-US.json';
import zh_CN from './zh-CN.json';
const { intl, intlNode, getLocale, setLocale } = createIntl({
'en-US': en_US,
'zh-CN': zh_CN,
});
export { intl, intlNode, getLocale, setLocale };

View File

@ -0,0 +1,4 @@
{
"Drag and drop components or templates here": "拖拽组件或模板到这里",
"Locked elements and child elements cannot be edited": "锁定元素及子元素无法编辑"
}

View File

@ -8,6 +8,7 @@ import { getClosestNode, isFromVC } from '@ali/lowcode-utils';
import { GlobalEvent } from '@ali/lowcode-types'; import { GlobalEvent } from '@ali/lowcode-types';
import { SimulatorRendererContainer, DocumentInstance } from './renderer'; import { SimulatorRendererContainer, DocumentInstance } from './renderer';
import { host } from './host'; import { host } from './host';
import { intl } from './locale';
import './renderer.less'; import './renderer.less';
@ -206,12 +207,12 @@ class Renderer extends Component<{
(children == null || (Array.isArray(children) && !children.length)) && (children == null || (Array.isArray(children) && !children.length)) &&
(!viewProps.style || Object.keys(viewProps.style).length === 0) (!viewProps.style || Object.keys(viewProps.style).length === 0)
) { ) {
let defaultPlaceholder = '拖拽组件或模板到这里'; let defaultPlaceholder = intl('Drag and drop components or templates here');
const lockedNode = getClosestNode(leaf, (node) => { const lockedNode = getClosestNode(leaf, (node) => {
return node?.getExtraProp('isLocked')?.getValue() === true; return node?.getExtraProp('isLocked')?.getValue() === true;
}); });
if (lockedNode) { if (lockedNode) {
defaultPlaceholder = '锁定元素及子元素无法编辑'; defaultPlaceholder = intl('Locked elements and child elements cannot be edited');
} }
children = ( children = (
<div className={cn('lc-container-placeholder', { 'lc-container-locked': !!lockedNode })} style={viewProps.placeholderStyle}> <div className={cn('lc-container-placeholder', { 'lc-container-locked': !!lockedNode })} style={viewProps.placeholderStyle}>

View File

@ -421,7 +421,14 @@ export default function baseRendererFactory() {
if (!Comp) { if (!Comp) {
console.error(`${schema.componentName} is not found! component list is:`, components || this.props.__container?.components); console.error(`${schema.componentName} is not found! component list is:`, components || this.props.__container?.components);
Comp = engine.getNotFoundComponent(); return engine.createElement(
engine.getNotFoundComponent(),
{
componentName: schema.componentName,
componentId: schema.id,
},
this.__getSchemaChildrenVirtualDom(schema, scope, Comp),
);
} }
if (schema.hidden && (engine?.props?.designMode && engine?.props?.designMode !== 'design')) { if (schema.hidden && (engine?.props?.designMode && engine?.props?.designMode !== 'design')) {

View File

@ -13,6 +13,7 @@ import {
isJSExpression, isJSExpression,
} from '@ali/lowcode-types'; } from '@ali/lowcode-types';
import { editorCabin, designerCabin } from '@ali/lowcode-engine'; import { editorCabin, designerCabin } from '@ali/lowcode-engine';
import { intl } from '../locale';
const { SettingField } = designerCabin; const { SettingField } = designerCabin;
const { untracked } = editorCabin; const { untracked } = editorCabin;
@ -270,7 +271,7 @@ function getTipAttr(tip: Tip, attrName: string, decorator: (originalValue: strin
} }
function getTipContent(tip: Tip, name: string): string { function getTipContent(tip: Tip, name: string): string {
return getTipAttr(tip, 'content', (v) => `属性:${name} | 说明:${v}`); return getTipAttr(tip, 'content', (v) => `${intl('PropName:')}${name} | ${intl('Explanation:')}${v}`);
} }
export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollector) { export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollector) {
@ -802,10 +803,9 @@ export function upgradeMetadata(oldConfig: OldPrototypeConfig) {
schema, schema,
}; };
}); });
} } else if (defaultProps || initialChildren) {
// FIXME! defaultProps for initial input // FIXME! defaultProps for initial input
// initialChildren maybe a function // initialChildren maybe a function
else if (defaultProps || initialChildren) {
const snippet = { const snippet = {
screenshot: icon, screenshot: icon,
label: title, label: title,

View File

@ -3,6 +3,7 @@ import * as React from 'react';
import { Component } from 'react'; import { Component } from 'react';
import InlineTip from './inlinetip'; import InlineTip from './inlinetip';
import { isPlainObject } from '@ali/lowcode-utils'; import { isPlainObject } from '@ali/lowcode-utils';
import { intl } from '../locale';
interface IHelpTip { interface IHelpTip {
url?: string; url?: string;
@ -26,7 +27,7 @@ function getFieldTitle(title: string, tip: IHelpTip, compact?: boolean, propName
tipContent = ( tipContent = (
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
</div> </div>
); );
@ -34,15 +35,15 @@ function getFieldTitle(title: string, tip: IHelpTip, compact?: boolean, propName
tipUrl = tip.url; tipUrl = tip.url;
tipContent = ( tipContent = (
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
<div>{tip.content}</div> <div>{intl('Explanation:')}{tip.content}</div>
</div> </div>
); );
} else if (tip) { } else if (tip) {
tipContent = ( tipContent = (
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
<div>{tip}</div> <div>{intl('Explanation:')}{tip}</div>
</div> </div>
); );
} }

View File

@ -6,6 +6,7 @@ import VEField, { IVEFieldProps } from './field';
import { SettingField } from './setting-field'; import { SettingField } from './setting-field';
import VariableSwitcher from './variable-switcher'; import VariableSwitcher from './variable-switcher';
import popups from '@ali/ve-popups'; import popups from '@ali/ve-popups';
import { intl } from '../locale';
import './fields.less'; import './fields.less';
@ -29,8 +30,8 @@ function renderTip(tip: IHelpTip, prop?: { propName?: string }) {
return ( return (
<Icons.Tip position="top" url={tip.url} key="icon-tip" className="engine-field-tip-icon"> <Icons.Tip position="top" url={tip.url} key="icon-tip" className="engine-field-tip-icon">
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
<div>{tip.content}</div> <div>{intl('Explanation:')}{tip.content}</div>
</div> </div>
</Icons.Tip> </Icons.Tip>
); );
@ -38,8 +39,8 @@ function renderTip(tip: IHelpTip, prop?: { propName?: string }) {
return ( return (
<Icons.Tip position="top" key="icon" className="engine-field-tip-icon"> <Icons.Tip position="top" key="icon" className="engine-field-tip-icon">
<div> <div>
<div>{propName}</div> <div>{intl('PropName:')}{propName}</div>
<div>{tip}</div> <div>{intl('Explanation:')}{tip}</div>
</div> </div>
</Icons.Tip> </Icons.Tip>
); );

View File

@ -0,0 +1,4 @@
{
"PropName:": "Prop: ",
"Explanation:": "Explanation: "
}

View File

@ -0,0 +1,10 @@
import { createIntl } from '@ali/lowcode-editor-core';
import en_US from './en-US.json';
import zh_CN from './zh-CN.json';
const { intl, intlNode, getLocale, setLocale } = createIntl({
'en-US': en_US,
'zh-CN': zh_CN,
});
export { intl, intlNode, getLocale, setLocale };

View File

@ -0,0 +1,4 @@
{
"PropName:": "属性:",
"Explanation:": "说明:"
}