mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-22 17:38:12 +00:00
Merge branch 'fix/setting-field' into 'release/0.9.0'
Fix/setting field方法补齐 See merge request !914027
This commit is contained in:
commit
87c2e0b386
@ -21,6 +21,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
readonly isSettingField = true;
|
readonly isSettingField = true;
|
||||||
readonly isRequired: boolean;
|
readonly isRequired: boolean;
|
||||||
readonly transducer: Transducer;
|
readonly transducer: Transducer;
|
||||||
|
private _config: FieldConfig;
|
||||||
extraProps: FieldExtraProps;
|
extraProps: FieldExtraProps;
|
||||||
|
|
||||||
// ==== dynamic properties ====
|
// ==== dynamic properties ====
|
||||||
@ -53,6 +54,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
super(parent, config.name, config.type);
|
super(parent, config.name, config.type);
|
||||||
|
|
||||||
const { title, items, setter, extraProps, ...rest } = config;
|
const { title, items, setter, extraProps, ...rest } = config;
|
||||||
|
this._config = config;
|
||||||
this._title = title;
|
this._title = title;
|
||||||
this._setter = setter;
|
this._setter = setter;
|
||||||
this.extraProps = {
|
this.extraProps = {
|
||||||
@ -80,6 +82,10 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
return this._items;
|
return this._items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get config(): FieldConfig {
|
||||||
|
return this._config;
|
||||||
|
}
|
||||||
|
|
||||||
private initItems(items: Array<FieldConfig | CustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void; }) {
|
private initItems(items: Array<FieldConfig | CustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void; }) {
|
||||||
this._items = items.map((item) => {
|
this._items = items.map((item) => {
|
||||||
if (isCustomView(item)) {
|
if (isCustomView(item)) {
|
||||||
|
|||||||
@ -18,7 +18,13 @@ class SettingFieldView extends Component<{ field: SettingField }> {
|
|||||||
const { field } = this.props;
|
const { field } = this.props;
|
||||||
const { extraProps } = field;
|
const { extraProps } = field;
|
||||||
const { condition, defaultValue, display } = extraProps;
|
const { condition, defaultValue, display } = extraProps;
|
||||||
const visible = field.isSingle && typeof condition === 'function' ? condition(field) !== false : true;
|
let visible;
|
||||||
|
try {
|
||||||
|
visible = field.isSingle && typeof condition === 'function' ? condition(field) !== false : true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('exception when condition (hidden) is excuted', error);
|
||||||
|
}
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user