mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
refactor: rename internalToShell to internalToShellField
This commit is contained in:
parent
64e7093053
commit
ffaf58b5b5
@ -73,7 +73,7 @@ INode
|
|||||||
|
|
||||||
onEffect(action: () => void): IPublicTypeDisposable;
|
onEffect(action: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
internalToShell(): IPublicModelSettingField;
|
internalToShellField(): IPublicModelSettingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingField extends SettingPropEntry implements ISettingField {
|
export class SettingField extends SettingPropEntry implements ISettingField {
|
||||||
@ -143,7 +143,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
}
|
}
|
||||||
if (isDynamicSetter(this._setter)) {
|
if (isDynamicSetter(this._setter)) {
|
||||||
return untracked(() => {
|
return untracked(() => {
|
||||||
const shellThis = this.internalToShell();
|
const shellThis = this.internalToShellField();
|
||||||
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis!);
|
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internalToShell() {
|
internalToShellField() {
|
||||||
return this.designer!.shellModelFactory.createSettingField(this);
|
return this.designer!.shellModelFactory.createSettingField(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export interface ISettingPropEntry extends ISettingEntry {
|
|||||||
|
|
||||||
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void;
|
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void;
|
||||||
|
|
||||||
internalToShell(): IPublicModelSettingField;
|
internalToShellField(): IPublicModelSettingField;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SettingPropEntry implements ISettingPropEntry {
|
export class SettingPropEntry implements ISettingPropEntry {
|
||||||
@ -157,7 +157,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
if (this.type !== 'field') {
|
if (this.type !== 'field') {
|
||||||
const { getValue } = this.extraProps;
|
const { getValue } = this.extraProps;
|
||||||
return getValue
|
return getValue
|
||||||
? getValue(this.internalToShell()!, undefined) === undefined
|
? getValue(this.internalToShellField()!, undefined) === undefined
|
||||||
? 0
|
? 0
|
||||||
: 1
|
: 1
|
||||||
: 0;
|
: 0;
|
||||||
@ -196,7 +196,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
}
|
}
|
||||||
const { getValue } = this.extraProps;
|
const { getValue } = this.extraProps;
|
||||||
try {
|
try {
|
||||||
return getValue ? getValue(this.internalToShell()!, val) : val;
|
return getValue ? getValue(this.internalToShellField()!, val) : val;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
return val;
|
return val;
|
||||||
@ -215,7 +215,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue && !extraOptions?.disableMutator) {
|
if (setValue && !extraOptions?.disableMutator) {
|
||||||
try {
|
try {
|
||||||
setValue(this.internalToShell()!, val);
|
setValue(this.internalToShellField()!, val);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@ -238,7 +238,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
const { setValue } = this.extraProps;
|
const { setValue } = this.extraProps;
|
||||||
if (setValue) {
|
if (setValue) {
|
||||||
try {
|
try {
|
||||||
setValue(this.internalToShell()!, undefined);
|
setValue(this.internalToShellField()!, undefined);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
@ -394,7 +394,7 @@ export class SettingPropEntry implements ISettingPropEntry {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
internalToShell(): IPublicModelSettingField {
|
internalToShellField(): IPublicModelSettingField {
|
||||||
return this.designer!.shellModelFactory.createSettingField(this);;
|
return this.designer!.shellModelFactory.createSettingField(this);;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
const { extraProps } = this.field;
|
const { extraProps } = this.field;
|
||||||
const { condition } = extraProps;
|
const { condition } = extraProps;
|
||||||
try {
|
try {
|
||||||
return typeof condition === 'function' ? condition(this.field.internalToShell()) !== false : true;
|
return typeof condition === 'function' ? condition(this.field.internalToShellField()) !== false : true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('exception when condition (hidden) is excuted', error);
|
console.error('exception when condition (hidden) is excuted', error);
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
if (setter.props) {
|
if (setter.props) {
|
||||||
setterProps = setter.props;
|
setterProps = setter.props;
|
||||||
if (typeof setterProps === 'function') {
|
if (typeof setterProps === 'function') {
|
||||||
setterProps = setterProps(this.field.internalToShell());
|
setterProps = setterProps(this.field.internalToShellField());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (setter.initialValue != null) {
|
if (setter.initialValue != null) {
|
||||||
@ -190,7 +190,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
}
|
}
|
||||||
// 当前 field 没有 value 值时,将 initialValue 写入 field
|
// 当前 field 没有 value 值时,将 initialValue 写入 field
|
||||||
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
|
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
|
||||||
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShell()) : initialValue;
|
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShellField()) : initialValue;
|
||||||
this.field.setValue(_initialValue);
|
this.field.setValue(_initialValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +238,9 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
forceInline: extraProps.forceInline,
|
forceInline: extraProps.forceInline,
|
||||||
key: field.id,
|
key: field.id,
|
||||||
// === injection
|
// === injection
|
||||||
prop: field.internalToShell(), // for compatible vision
|
prop: field.internalToShellField(), // for compatible vision
|
||||||
selected: field.top?.getNode()?.internalToShellNode(),
|
selected: field.top?.getNode()?.internalToShellNode(),
|
||||||
field: field.internalToShell(),
|
field: field.internalToShellField(),
|
||||||
// === IO
|
// === IO
|
||||||
value, // reaction point
|
value, // reaction point
|
||||||
initialValue,
|
initialValue,
|
||||||
@ -257,7 +257,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
|
|||||||
if (initialValue == null) {
|
if (initialValue == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const value = typeof initialValue === 'function' ? initialValue(field.internalToShell()) : initialValue;
|
const value = typeof initialValue === 'function' ? initialValue(field.internalToShellField()) : initialValue;
|
||||||
this.setState({
|
this.setState({
|
||||||
// eslint-disable-next-line react/no-unused-state
|
// eslint-disable-next-line react/no-unused-state
|
||||||
value,
|
value,
|
||||||
@ -316,7 +316,7 @@ class SettingGroupView extends Component<SettingGroupViewProps> {
|
|||||||
const { field } = this.props;
|
const { field } = this.props;
|
||||||
const { extraProps } = field;
|
const { extraProps } = field;
|
||||||
const { condition, display } = extraProps;
|
const { condition, display } = extraProps;
|
||||||
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShell()) !== false : true;
|
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShellField()) !== false : true;
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -143,7 +143,7 @@ export class SettingField implements IPublicModelSettingField {
|
|||||||
if (isCustomView(item)) {
|
if (isCustomView(item)) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
return item.internalToShell();
|
return item.internalToShellField();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user