mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-20 19:47:44 -04:00
!850 add Refresh parameter refreshing 双向绑定
Merge pull request !850 from Bo Jiang/refresh
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user