mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-03 07:47:18 +00:00
use undef for null
This commit is contained in:
parent
9c8f492d03
commit
bb698e7b99
@ -109,11 +109,11 @@ export class Prop implements IPropParent {
|
|||||||
}
|
}
|
||||||
return this.items!.map((prop) => {
|
return this.items!.map((prop) => {
|
||||||
const v = prop.export(stage);
|
const v = prop.export(stage);
|
||||||
return v === UNSET ? null : v;
|
return v === UNSET ? undefined : v;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _code: string | null = null;
|
private _code: string | null = null;
|
||||||
@ -176,7 +176,7 @@ export class Prop implements IPropParent {
|
|||||||
this._code = null;
|
this._code = null;
|
||||||
const t = typeof val;
|
const t = typeof val;
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
this._value = null;
|
this._value = undefined;
|
||||||
this._type = 'literal';
|
this._type = 'literal';
|
||||||
} else if (t === 'string' || t === 'number' || t === 'boolean') {
|
} else if (t === 'string' || t === 'number' || t === 'boolean') {
|
||||||
this._type = 'literal';
|
this._type = 'literal';
|
||||||
@ -192,7 +192,6 @@ export class Prop implements IPropParent {
|
|||||||
} else {
|
} else {
|
||||||
this._type = 'map';
|
this._type = 'map';
|
||||||
}
|
}
|
||||||
this._type = 'map';
|
|
||||||
} else {
|
} else {
|
||||||
this._type = 'expression';
|
this._type = 'expression';
|
||||||
this._value = {
|
this._value = {
|
||||||
@ -206,7 +205,7 @@ export class Prop implements IPropParent {
|
|||||||
@computed getValue(): CompositeValue {
|
@computed getValue(): CompositeValue {
|
||||||
const v = this.export(TransformStage.Serilize);
|
const v = this.export(TransformStage.Serilize);
|
||||||
if (v === UNSET) {
|
if (v === UNSET) {
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ export class Props implements IPropParent {
|
|||||||
this.items.forEach(item => {
|
this.items.forEach(item => {
|
||||||
let value = item.export(stage);
|
let value = item.export(stage);
|
||||||
if (value === UNSET) {
|
if (value === UNSET) {
|
||||||
value = null;
|
value = undefined;
|
||||||
}
|
}
|
||||||
let name = item.key as string;
|
let name = item.key as string;
|
||||||
if (name && typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
|
if (name && typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
|
||||||
@ -129,7 +129,7 @@ export class Props implements IPropParent {
|
|||||||
}
|
}
|
||||||
let value = item.export(stage);
|
let value = item.export(stage);
|
||||||
if (value === UNSET) {
|
if (value === UNSET) {
|
||||||
value = null;
|
value = undefined;
|
||||||
}
|
}
|
||||||
if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
|
if (typeof name === 'string' && name.startsWith(EXTRA_KEY_PREFIX)) {
|
||||||
name = getOriginalExtraKey(name);
|
name = getOriginalExtraKey(name);
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export interface JSBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// JSON 基本类型
|
// JSON 基本类型
|
||||||
export type JSONValue = boolean | string | number | null | JSONArray | JSONObject;
|
export type JSONValue = boolean | string | number | null | undefined | JSONArray | JSONObject;
|
||||||
export type JSONArray = JSONValue[];
|
export type JSONArray = JSONValue[];
|
||||||
export interface JSONObject {
|
export interface JSONObject {
|
||||||
[key: string]: JSONValue;
|
[key: string]: JSONValue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user