Skip to content

Commit ffaf58b

Browse files
liujupingJackLian
authored andcommitted
refactor: rename internalToShell to internalToShellField
1 parent 64e7093 commit ffaf58b

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

packages/designer/src/designer/setting/setting-field.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ INode
7373

7474
onEffect(action: () => void): IPublicTypeDisposable;
7575

76-
internalToShell(): IPublicModelSettingField;
76+
internalToShellField(): IPublicModelSettingField;
7777
}
7878

7979
export class SettingField extends SettingPropEntry implements ISettingField {
@@ -143,7 +143,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
143143
}
144144
if (isDynamicSetter(this._setter)) {
145145
return untracked(() => {
146-
const shellThis = this.internalToShell();
146+
const shellThis = this.internalToShellField();
147147
return (this._setter as IPublicTypeDynamicSetter)?.call(shellThis, shellThis!);
148148
});
149149
}
@@ -296,7 +296,7 @@ export class SettingField extends SettingPropEntry implements ISettingField {
296296
}
297297

298298

299-
internalToShell() {
299+
internalToShellField() {
300300
return this.designer!.shellModelFactory.createSettingField(this);
301301
}
302302
}

packages/designer/src/designer/setting/setting-prop-entry.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface ISettingPropEntry extends ISettingEntry {
3535

3636
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions): void;
3737

38-
internalToShell(): IPublicModelSettingField;
38+
internalToShellField(): IPublicModelSettingField;
3939
}
4040

4141
export class SettingPropEntry implements ISettingPropEntry {
@@ -157,7 +157,7 @@ export class SettingPropEntry implements ISettingPropEntry {
157157
if (this.type !== 'field') {
158158
const { getValue } = this.extraProps;
159159
return getValue
160-
? getValue(this.internalToShell()!, undefined) === undefined
160+
? getValue(this.internalToShellField()!, undefined) === undefined
161161
? 0
162162
: 1
163163
: 0;
@@ -196,7 +196,7 @@ export class SettingPropEntry implements ISettingPropEntry {
196196
}
197197
const { getValue } = this.extraProps;
198198
try {
199-
return getValue ? getValue(this.internalToShell()!, val) : val;
199+
return getValue ? getValue(this.internalToShellField()!, val) : val;
200200
} catch (e) {
201201
console.warn(e);
202202
return val;
@@ -215,7 +215,7 @@ export class SettingPropEntry implements ISettingPropEntry {
215215
const { setValue } = this.extraProps;
216216
if (setValue && !extraOptions?.disableMutator) {
217217
try {
218-
setValue(this.internalToShell()!, val);
218+
setValue(this.internalToShellField()!, val);
219219
} catch (e) {
220220
/* istanbul ignore next */
221221
console.warn(e);
@@ -238,7 +238,7 @@ export class SettingPropEntry implements ISettingPropEntry {
238238
const { setValue } = this.extraProps;
239239
if (setValue) {
240240
try {
241-
setValue(this.internalToShell()!, undefined);
241+
setValue(this.internalToShellField()!, undefined);
242242
} catch (e) {
243243
/* istanbul ignore next */
244244
console.warn(e);
@@ -394,7 +394,7 @@ export class SettingPropEntry implements ISettingPropEntry {
394394
return v;
395395
}
396396

397-
internalToShell(): IPublicModelSettingField {
397+
internalToShellField(): IPublicModelSettingField {
398398
return this.designer!.shellModelFactory.createSettingField(this);;
399399
}
400400
}

packages/editor-skeleton/src/components/settings/settings-pane.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
8080
const { extraProps } = this.field;
8181
const { condition } = extraProps;
8282
try {
83-
return typeof condition === 'function' ? condition(this.field.internalToShell()) !== false : true;
83+
return typeof condition === 'function' ? condition(this.field.internalToShellField()) !== false : true;
8484
} catch (error) {
8585
console.error('exception when condition (hidden) is excuted', error);
8686
}
@@ -123,7 +123,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
123123
if (setter.props) {
124124
setterProps = setter.props;
125125
if (typeof setterProps === 'function') {
126-
setterProps = setterProps(this.field.internalToShell());
126+
setterProps = setterProps(this.field.internalToShellField());
127127
}
128128
}
129129
if (setter.initialValue != null) {
@@ -190,7 +190,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
190190
}
191191
// 当前 field 没有 value 值时,将 initialValue 写入 field
192192
// 之所以用 initialValue,而不是 defaultValue 是为了保持跟 props.onInitial 的逻辑一致
193-
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShell()) : initialValue;
193+
const _initialValue = typeof initialValue === 'function' ? initialValue(this.field.internalToShellField()) : initialValue;
194194
this.field.setValue(_initialValue);
195195
}
196196

@@ -238,9 +238,9 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
238238
forceInline: extraProps.forceInline,
239239
key: field.id,
240240
// === injection
241-
prop: field.internalToShell(), // for compatible vision
241+
prop: field.internalToShellField(), // for compatible vision
242242
selected: field.top?.getNode()?.internalToShellNode(),
243-
field: field.internalToShell(),
243+
field: field.internalToShellField(),
244244
// === IO
245245
value, // reaction point
246246
initialValue,
@@ -257,7 +257,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
257257
if (initialValue == null) {
258258
return;
259259
}
260-
const value = typeof initialValue === 'function' ? initialValue(field.internalToShell()) : initialValue;
260+
const value = typeof initialValue === 'function' ? initialValue(field.internalToShellField()) : initialValue;
261261
this.setState({
262262
// eslint-disable-next-line react/no-unused-state
263263
value,
@@ -316,7 +316,7 @@ class SettingGroupView extends Component<SettingGroupViewProps> {
316316
const { field } = this.props;
317317
const { extraProps } = field;
318318
const { condition, display } = extraProps;
319-
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShell()) !== false : true;
319+
const visible = field.isSingle && typeof condition === 'function' ? condition(field.internalToShellField()) !== false : true;
320320

321321
if (!visible) {
322322
return null;

packages/shell/src/model/setting-field.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class SettingField implements IPublicModelSettingField {
143143
if (isCustomView(item)) {
144144
return item;
145145
}
146-
return item.internalToShell();
146+
return item.internalToShellField();
147147
});
148148
}
149149

0 commit comments

Comments
 (0)