!850 add Refresh parameter refreshing 双向绑定

Merge pull request !850 from Bo Jiang/refresh
This commit is contained in:
openharmony_ci
2022-07-28 04:45:20 +00:00
committed by Gitee
2 changed files with 21 additions and 8 deletions
+17 -6
View File
@@ -17,9 +17,9 @@ import fs from 'fs';
import path from 'path';
import * as ts from 'typescript';
import {
import {
projectConfig,
systemModules
systemModules
} from '../main';
import {
processSystemApi,
@@ -33,7 +33,8 @@ import {
COMPONENT_BUILD_FUNCTION,
STYLE_ADD_DOUBLE_DOLLAR,
$$,
PROPERTIES_ADD_DOUBLE_DOLLAR
PROPERTIES_ADD_DOUBLE_DOLLAR,
$$_BLOCK_INTERFACE
} from './pre_define';
import { JS_BIND_COMPONENTS } from './component_map';
import { getName } from './process_component_build';
@@ -274,7 +275,8 @@ function traverseBuild(node: ts.Node, index: number): void {
parentComponentName = node.parent.statements[index - 1].expression.expression.escapedText;
}
node = node.expression;
if (ts.isEtsComponentExpression(node) && node.body && ts.isBlock(node.body)) {
if (ts.isEtsComponentExpression(node) && node.body && ts.isBlock(node.body) &&
!$$_BLOCK_INTERFACE.has(node.expression.escapedText.toString())) {
node.body.statements.forEach((item, indexBlock) => {
traverseBuild(item, indexBlock);
});
@@ -295,6 +297,16 @@ function traverseBuild(node: ts.Node, index: number): void {
}
}
function isPropertiesAddDoubleDollar(node: ts.Node): boolean {
if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.arguments && node.arguments.length) {
return true;
} else if (ts.isEtsComponentExpression(node) && node.body && ts.isBlock(node.body) &&
$$_BLOCK_INTERFACE.has(node.expression.escapedText.toString())) {
return true;
} else {
return false;
}
}
function loopNodeFindDoubleDollar(node: ts.Node, parentComponentName: string): void {
while (node) {
if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
@@ -305,8 +317,7 @@ function loopNodeFindDoubleDollar(node: ts.Node, parentComponentName: string): v
doubleDollarCollection(item);
});
}
} else if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.arguments
&& node.arguments.length) {
} else if (isPropertiesAddDoubleDollar(node)) {
node.arguments.forEach((item: ts.Node) => {
if (ts.isObjectLiteralExpression(item) && item.properties && item.properties.length) {
item.properties.forEach((param: ts.Node) => {
+4 -2
View File
@@ -216,6 +216,8 @@ export const RADIO: string = 'Radio';
export const $$_VALUE: string = 'value';
export const $$_CHANGE_EVENT: string = 'changeEvent';
export const TEXT_TIMER: string = 'TextTimer';
export const REFRESH: string = 'Refresh';
export const REFRESHING: string = 'refreshing';
export const FORMAT: string = 'format';
export const IS_COUNT_DOWN: string = 'isCountDown';
export const COUNT: string = 'count';
@@ -223,10 +225,10 @@ export const $$_THIS: string = '$$this';
export const $$_NEW_VALUE: string = 'newValue';
export const $$: string = '$$';
export const $$_VISIBILITY: string = 'visibility';
export const $$_BLOCK_INTERFACE: Set<string> = new Set([REFRESH]);
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])]
[RADIO, new Set([CHECKED])], [TEXT_TIMER, new Set([FORMAT, COUNT, IS_COUNT_DOWN])], [REFRESH, new Set([REFRESHING])]
]);
export const INTERFACE_NAME_SUFFIX:string = '_Params';