!609 add visibility $$

Merge pull request !609 from 蒲亚军/pyjvisible200
This commit is contained in:
openharmony_ci
2022-05-11 08:09:54 +00:00
committed by Gitee
3 changed files with 12 additions and 6 deletions
+5 -2
View File
@@ -28,7 +28,7 @@ import {
COMPONENT_IF,
COMPONENT_DECORATORS_PARAMS,
COMPONENT_BUILD_FUNCTION,
BIND_POPUP,
STYLE_ADD_DOUBLE_DOLLAR,
$$,
PROPERTIES_ADD_DOUBLE_DOLLAR
} from './pre_define';
@@ -307,6 +307,9 @@ function loopNodeFindDoubleDollar(node: ts.Node, parentComponentName: string): v
}
});
}
if (STYLE_ADD_DOUBLE_DOLLAR.has(node.expression.getText()) && ts.isPropertyAccessExpression(item)) {
doubleDollarCollection(item);
}
});
}
node = node.expression;
@@ -331,7 +334,7 @@ function isObjectPram(param: ts.Node, parentComponentName:string): boolean {
function isCanAddDoubleDollar(propertyName: string, parentComponentName: string): boolean {
return PROPERTIES_ADD_DOUBLE_DOLLAR.has(parentComponentName) &&
PROPERTIES_ADD_DOUBLE_DOLLAR.get(parentComponentName).has(propertyName) ||
propertyName === BIND_POPUP;
STYLE_ADD_DOUBLE_DOLLAR.has(propertyName);
}
function isDecoratorCollection(item: ts.Decorator, decoratorName: string): boolean {
+2
View File
@@ -214,7 +214,9 @@ export const COUNT: string = 'count';
export const $$_THIS: string = '$$this';
export const $$_NEW_VALUE: string = 'newValue';
export const $$: string = '$$';
export const $$_VISIBILITY: string = 'visibility';
export const STYLE_ADD_DOUBLE_DOLLAR: Set<string> = new Set([BIND_POPUP, $$_VISIBILITY])
export const PROPERTIES_ADD_DOUBLE_DOLLAR: Map<string, Set<string>> = new Map([
[RADIO, new Set([CHECKED])], [TEXT_TIMER, new Set([FORMAT, COUNT, IS_COUNT_DOWN])],
]);;
+5 -4
View File
@@ -48,7 +48,7 @@ import {
THIS,
VISUAL_STATE,
VIEW_STACK_PROCESSOR,
BIND_POPUP,
STYLE_ADD_DOUBLE_DOLLAR,
$$_VALUE,
$$_CHANGE_EVENT,
$$_THIS,
@@ -961,7 +961,7 @@ function isDoubleDollarToChange(isStylesAttr: boolean, identifierNode: ts.Identi
return !isStylesAttr &&
PROPERTIES_ADD_DOUBLE_DOLLAR.has(identifierNode.escapedText.toString()) &&
PROPERTIES_ADD_DOUBLE_DOLLAR.get(identifierNode.escapedText.toString()).has(propName) ||
propName === BIND_POPUP && temp.arguments.length && temp.arguments[0] ?
STYLE_ADD_DOUBLE_DOLLAR.has(propName) && temp.arguments.length && temp.arguments[0] ?
temp.arguments[0].getText().match(/^\$\$(.|\n)+/) !== null ? true : false
: false;
}
@@ -1013,11 +1013,12 @@ function changeEtsComponentKind(node: ts.Node): ts.Node {
function classifyArgumentsNum(args: any, argumentsArr: ts.Expression[], propName: string,
identifierNode: ts.Identifier): void {
if (propName === BIND_POPUP && args.length === 2) {
if (STYLE_ADD_DOUBLE_DOLLAR.has(propName) && args.length === 2) {
const varExp: ts.Expression = updateArgumentFor$$(args[0]);
argumentsArr.push(generateObjectFor$$(varExp), args[1]);
} else if (PROPERTIES_ADD_DOUBLE_DOLLAR.has(identifierNode.getText()) && args.length === 1 &&
PROPERTIES_ADD_DOUBLE_DOLLAR.get(identifierNode.getText()).has(propName)) {
PROPERTIES_ADD_DOUBLE_DOLLAR.get(identifierNode.getText()).has(propName) ||
STYLE_ADD_DOUBLE_DOLLAR.has(propName) && args.length === 1) {
const varExp: ts.Expression = updateArgumentFor$$(args[0]);
argumentsArr.push(varExp, createArrowFunctionFor$$(varExp));
}