GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(designer): fix i18n · euui/lowcode-engine@59cb9ef

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/designer/src
    • designer/setting
      • setting-field.ts
    • locale
      • en-US.json
      • zh-CN.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: packages/designer/src/designer/setting/setting-field.ts
+75-41Lines changed: 75 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
import { IPublicTypeTitleContent, IPublicTypeSetterType, IPublicTypeDynamicSetter, IPublicTypeFieldExtraProps, IPublicTypeFieldConfig, IPublicTypeCustomView, IPublicTypeSetValueOptions } from '@alilc/lowcode-types';
1+
import {
2+
IPublicTypeTitleContent,
3+
IPublicTypeSetterType,
4+
IPublicTypeDynamicSetter,
5+
IPublicTypeFieldExtraProps,
6+
IPublicTypeFieldConfig,
7+
IPublicTypeCustomView,
8+
IPublicTypeSetValueOptions,
9+
} from '@alilc/lowcode-types';
210
import { Transducer } from './utils';
311
import { SettingPropEntry } from './setting-prop-entry';
412
import { SettingEntry } from './setting-entry';
5-
import { computed, obx, makeObservable, action, untracked } from '@alilc/lowcode-editor-core';
13+
import { computed, obx, makeObservable, action, untracked, intl } from '@alilc/lowcode-editor-core';
614
import { cloneDeep, isCustomView, isDynamicSetter } from '@alilc/lowcode-utils';
715

816
function getSettingFieldCollectorKey(parent: SettingEntry, config: IPublicTypeFieldConfig) {
@@ -26,44 +34,32 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
2634

2735
private _config: IPublicTypeFieldConfig;
2836

37+
private hotValue: any;
38+
39+
parent: SettingEntry;
40+
2941
extraProps: IPublicTypeFieldExtraProps;
3042

3143
// ==== dynamic properties ====
3244
private _title?: IPublicTypeTitleContent;
3345

3446
get title() {
35-
// FIXME! intl
36-
return this._title || (typeof this.name === 'number' ? `项目 ${this.name}` : this.name);
47+
return (
48+
this._title || (typeof this.name === 'number' ? `${intl('Item')} ${this.name}` : this.name)
49+
);
3750
}
3851

3952
private _setter?: IPublicTypeSetterType | IPublicTypeDynamicSetter;
4053

41-
@computed get setter(): IPublicTypeSetterType | null {
42-
if (!this._setter) {
43-
return null;
44-
}
45-
if (isDynamicSetter(this._setter)) {
46-
return untracked(() => {
47-
const shellThis = this.internalToShellPropEntry();
48-
return this._setter.call(shellThis, shellThis);
49-
});
50-
}
51-
return this._setter;
52-
}
53-
5454
@obx.ref private _expanded = true;
5555

56-
get expanded(): boolean {
57-
return this._expanded;
58-
}
59-
60-
setExpanded(value: boolean) {
61-
this._expanded = value;
62-
}
63-
64-
parent: SettingEntry;
56+
private _items: Array<SettingField | IPublicTypeCustomView> = [];
6557

66-
constructor(parent: SettingEntry, config: IPublicTypeFieldConfig, settingFieldCollector?: (name: string | number, field: SettingField) => void) {
58+
constructor(
59+
parent: SettingEntry,
60+
config: IPublicTypeFieldConfig,
61+
settingFieldCollector?: (name: string | number, field: SettingField) => void,
62+
) {
6763
super(parent, config.name, config.type);
6864
makeObservable(this);
6965
const { title, items, setter, extraProps, ...rest } = config;
@@ -90,7 +86,26 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
9086
this.transducer = new Transducer(this, { setter });
9187
}
9288

93-
private _items: Array<SettingField | IPublicTypeCustomView> = [];
89+
@computed get setter(): IPublicTypeSetterType | null {
90+
if (!this._setter) {
91+
return null;
92+
}
93+
if (isDynamicSetter(this._setter)) {
94+
return untracked(() => {
95+
const shellThis = this.internalToShellPropEntry();
96+
return this._setter.call(shellThis, shellThis);
97+
});
98+
}
99+
return this._setter;
100+
}
101+
102+
get expanded(): boolean {
103+
return this._expanded;
104+
}
105+
106+
setExpanded(value: boolean) {
107+
this._expanded = value;
108+
}
94109

95110
get items(): Array<SettingField | IPublicTypeCustomView> {
96111
return this._items;
@@ -100,7 +115,13 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
100115
return this._config;
101116
}
102117

103-
private initItems(items: Array<IPublicTypeFieldConfig | IPublicTypeCustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void }) {
118+
private initItems(
119+
items: Array<IPublicTypeFieldConfig | IPublicTypeCustomView>,
120+
settingFieldCollector?: {
121+
(name: string | number, field: SettingField): void;
122+
(name: string, field: SettingField): void;
123+
},
124+
) {
104125
this._items = items.map((item) => {
105126
if (isCustomView(item)) {
106127
return item;
@@ -110,7 +131,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
110131
}
111132

112133
private disposeItems() {
113-
this._items.forEach(item => isSettingField(item) && item.purge());
134+
this._items.forEach((item) => isSettingField(item) && item.purge());
114135
this._items = [];
115136
}
116137

@@ -125,26 +146,33 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
125146

126147
// ======= compatibles for vision ======
127148

128-
getConfig<K extends keyof IPublicTypeFieldConfig>(configName?: K): IPublicTypeFieldConfig[K] | IPublicTypeFieldConfig {
149+
getConfig<K extends keyof IPublicTypeFieldConfig>(
150+
configName?: K,
151+
): IPublicTypeFieldConfig[K] | IPublicTypeFieldConfig {
129152
if (configName) {
130153
return this.config[configName];
131154
}
132155
return this._config;
133156
}
134157

135-
getItems(filter?: (item: SettingField | IPublicTypeCustomView) => boolean): Array<SettingField | IPublicTypeCustomView> {
136-
return this._items.filter(item => {
158+
getItems(
159+
filter?: (item: SettingField | IPublicTypeCustomView) => boolean,
160+
): Array<SettingField | IPublicTypeCustomView> {
161+
return this._items.filter((item) => {
137162
if (filter) {
138163
return filter(item);
139164
}
140165
return true;
141166
});
142167
}
143168

144-
private hotValue: any;
145-
146169
@action
147-
setValue(val: any, isHotValue?: boolean, force?: boolean, extraOptions?: IPublicTypeSetValueOptions) {
170+
setValue(
171+
val: any,
172+
isHotValue?: boolean,
173+
force?: boolean,
174+
extraOptions?: IPublicTypeSetValueOptions,
175+
) {
148176
if (isHotValue) {
149177
this.setHotValue(val, extraOptions);
150178
return;
@@ -189,11 +217,16 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
189217
}
190218
if (this.isUseVariable()) {
191219
const oldValue = this.getValue();
192-
this.setValue({
193-
type: 'JSExpression',
194-
value: oldValue.value,
195-
mock: value,
196-
}, false, false, options);
220+
this.setValue(
221+
{
222+
type: 'JSExpression',
223+
value: oldValue.value,
224+
mock: value,
225+
},
226+
false,
227+
false,
228+
options,
229+
);
197230
} else {
198231
this.setValue(value, false, false, options);
199232
}
@@ -210,6 +243,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
210243
return this.designer.autorun(action, true);
211244
}
212245
}
246+
213247
/**
214248
* @deprecated use same function from '@alilc/lowcode-utils' instead
215249
*/
Collapse file

‎packages/designer/src/locale/en-US.json‎

Copy file name to clipboardExpand all lines: packages/designer/src/locale/en-US.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"unlock": "Unlock",
77
"Condition Group": "Condition Group",
88
"No opened document": "No opened document, open some document to editing",
9-
"locked": "locked"
9+
"locked": "locked",
10+
"Item": "Item"
1011
}
Collapse file

‎packages/designer/src/locale/zh-CN.json‎

Copy file name to clipboardExpand all lines: packages/designer/src/locale/zh-CN.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
"unlock": "解锁",
77
"Condition Group": "条件组",
88
"No opened document": "没有打开的页面,请选择页面打开编辑",
9-
"locked": "已锁定"
9+
"locked": "已锁定",
10+
"Item": "项目"
1011
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.