update from yellow zone

Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: Ia2344d29ccce19adeb6fe7ffd3b3796e5f6c1163
This commit is contained in:
houhaoyu
2021-10-19 10:18:39 +08:00
parent 80c7a86483
commit adaf98e75d
3 changed files with 31 additions and 13 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ export class ResultStates {
}
logger.info(this.blue, 'COMPILE RESULT:' + result + `{${resultInfo}}`, this.reset);
} else {
logger.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset);
console.info(this.blue, 'COMPILE RESULT:SUCCESS ', this.reset);
}
}
+21 -5
View File
@@ -14,6 +14,12 @@
*/
export const COMPONENT_MAP: any = {
Search: {
atomic: true,
attrs: [
'searchButton', 'placeholderColor', 'placeholderFont', 'onSubmit', 'onChange'
]
},
FormComponent: {
atomic: true,
attrs: [
@@ -37,13 +43,14 @@ export const COMPONENT_MAP: any = {
},
Animator: {
atomic: true,
noDebugLine: true,
attrs: [
'state', 'duration', 'curve', 'delay', 'fillMode', 'iterations', 'playMode', 'motion', 'onStart',
'onPause', 'onRepeat', 'onCancel', 'onFinish', 'onFrame'
]
},
Refresh: {
atomic: true,
single: true,
attrs: [
'refreshing', 'offset', 'friction',
'onStateChange', 'onRefreshing'
@@ -241,10 +248,12 @@ export const COMPONENT_MAP: any = {
},
PageTransitionEnter: {
atomic: true,
noDebugLine: true,
attrs: ['onEnter']
},
PageTransitionExit: {
atomic: true,
noDebugLine: true,
attrs: ['onExit']
},
Blank: {
@@ -329,13 +338,13 @@ export const COMPONENT_MAP: any = {
TextInput: {
atomic: true,
attrs: [
'type', 'placeholderColor', 'placeholderFont', 'enterKeyType', 'caretColor', 'onEditChanged',
'type', 'placeholderColor', 'placeholderFont', 'enterKeyType', 'caretColor', 'maxLength', 'onEditChanged',
'onSubmit', 'onChange'
]
},
Marquee: {
atomic: true,
attrs: ['onStart', 'onBounce', 'onFinish']
attrs: ['fontColor', 'fontSize', 'allowScale', 'fontWeight', 'fontFamily', 'onStart', 'onBounce', 'onFinish']
},
Menu: {
children: ['Option'],
@@ -367,7 +376,7 @@ const COMMON_ATTRS: Set<string> = new Set([
'accessibilityGroup', 'accessibilityText', 'accessibilityDescription',
'accessibilityImportance', 'onAccessibility', 'grayscale', 'brightness', 'contrast',
'saturate', 'geometryTransition',
'bindPopup', 'colorBlend', 'invert', 'sepia', 'hueRotate'
'bindPopup', 'colorBlend', 'invert', 'sepia', 'hueRotate', 'bindMenu'
]);
const TRANSITION_COMMON_ATTRS: Set<string> = new Set([
'slide', 'translate', 'scale', 'opacity'
@@ -376,9 +385,13 @@ export const GESTURE_ATTRS: Set<string> = new Set([
'gesture', 'parallelGesture', 'priorityGesture'
]);
export const forbiddenUseStateType: Set<string> = new Set(['Scroller', 'SwiperScroller']);
export const forbiddenUseStateType: Set<string> = new Set(['Scroller', 'SwiperScroller',
'VideoController', 'CustomDialogController', 'SwiperController', 'TabsController',
'CalendarController', 'AbilityController'
]);
export const INNER_COMPONENT_NAMES: Set<string> = new Set();
export const NO_DEBUG_LINE_COMPONENT: Set<string> = new Set();
export const BUILDIN_CONTAINER_COMPONENT: Set<string> = new Set();
export const BUILDIN_STYLE_NAMES: Set<string> = new Set([
...COMMON_ATTRS, ...GESTURE_ATTRS, ...TRANSITION_COMMON_ATTRS
@@ -424,5 +437,8 @@ export const JS_BIND_COMPONENTS: Set<string> = new Set([
BUILDIN_STYLE_NAMES.add(item);
});
}
if (COMPONENT_MAP[componentName].noDebugLine) {
NO_DEBUG_LINE_COMPONENT.add(componentName);
}
});
})();
+9 -7
View File
@@ -53,7 +53,8 @@ import {
CUSTOM_BUILDER_METHOD,
GESTURE_ATTRS,
GESTURE_TYPE_NAMES,
EXTEND_ATTRIBUTE
EXTEND_ATTRIBUTE,
NO_DEBUG_LINE_COMPONENT
} from './component_map';
import { componentCollection } from './validate_ui_syntax';
import { processCustomComponent } from './process_custom_component';
@@ -145,9 +146,10 @@ function processComponentChild(node: ts.Block, newStatements: ts.Statement[],
if (node.statements.length) {
node.statements.forEach((item, index) => {
if (ts.isExpressionStatement(item)) {
switch (getComponentType(item, log)) {
const name: string = getName(item);
switch (getComponentType(item, log, name)) {
case ComponentType.innerComponent:
processInnerComponent(item, index, Array.from(node.statements), newStatements, log);
processInnerComponent(item, index, Array.from(node.statements), newStatements, log, name);
break;
case ComponentType.customComponent:
processCustomComponent(item, newStatements, log);
@@ -174,10 +176,10 @@ function processComponentChild(node: ts.Block, newStatements: ts.Statement[],
}
function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[],
newStatements: ts.Statement[], log: LogInfo[]): void {
newStatements: ts.Statement[], log: LogInfo[], name: string): void {
const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION);
newStatements.push(res.newNode);
if (projectConfig.isPreview) {
if (projectConfig.isPreview && !NO_DEBUG_LINE_COMPONENT.has(name)) {
const posOfNode: ts.LineAndCharacter =
transformLog.sourceFile.getLineAndCharacterOfPosition(getRealNodePos(node));
const projectPath: string = projectConfig.projectPath;
@@ -664,8 +666,8 @@ enum ComponentType {
customBuilderMethod
}
function getComponentType(node: ts.ExpressionStatement, log: LogInfo[]): ComponentType {
const name: string = getName(node);
function getComponentType(node: ts.ExpressionStatement, log: LogInfo[],
name: string): ComponentType {
if (INNER_COMPONENT_NAMES.has(name)) {
return ComponentType.innerComponent;
} else if (componentCollection.customComponents.has(name)) {