mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-04-06 21:40:23 +08:00
fix(validator): add expression keywords list
This commit is contained in:
parent
5f8da1bc0e
commit
158c462a95
@ -1,4 +1,5 @@
|
||||
import { get, has } from 'lodash';
|
||||
import { ExpressionKeywords } from '@sunmao-ui/shared';
|
||||
import { ComponentId, ModuleId } from '../../AppModel/IAppModel';
|
||||
import {
|
||||
PropertiesValidatorRule,
|
||||
@ -104,8 +105,11 @@ class ExpressionValidatorRule implements PropertiesValidatorRule {
|
||||
} else if (dependencyNames.includes(id)) {
|
||||
// case 4: id is from dependency
|
||||
// do nothing
|
||||
} else if (ExpressionKeywords.includes(id)) {
|
||||
// case 5: id is from expression keywords
|
||||
// do nothing
|
||||
} else {
|
||||
// case 5: id doesn't exist
|
||||
// case 6: id doesn't exist
|
||||
results.push({
|
||||
message: `Cannot find '${id}' in store or window.`,
|
||||
componentId: component.id,
|
||||
|
@ -4,5 +4,14 @@ export const EXPRESSION = {
|
||||
};
|
||||
export const LIST_ITEM_EXP = '$listItem';
|
||||
export const LIST_ITEM_INDEX_EXP = '$i';
|
||||
export const SLOT_PROPS_EXP = '$slot';
|
||||
export const GLOBAL_UTIL_METHOD_ID = '$utils';
|
||||
export const GLOBAL_MODULE_ID = '$module';
|
||||
|
||||
export const ExpressionKeywords = [
|
||||
LIST_ITEM_EXP,
|
||||
LIST_ITEM_INDEX_EXP,
|
||||
SLOT_PROPS_EXP,
|
||||
GLOBAL_UTIL_METHOD_ID,
|
||||
GLOBAL_MODULE_ID,
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user