diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index 32611c864a304561c39ce714762bb5d2618fd18c..c6aab55b0bc16e7c61e6acae174d2fc5f7d4b274 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -145,11 +145,6 @@ export const GLOBAL_THIS_REQUIRE_NATIVE_MODULE: string = 'globalThis.requireNati export const GLOBAL_THIS_REQUIRE_NAPI: string = 'globalThis.requireNapi'; export const COMPONENT_BUTTON: string = 'Button'; -export const COMPONENT_COUNTER: string = 'Counter'; -export const COMPONENT_DIVIDER: string = 'Divider'; -export const COMPONENT_PROGRESS: string = 'Progress'; -export const COMPONENT_QR_CODE: string = 'QRCode'; -export const COMPONENT_SCROLL_BAR: string = 'ScrollBar'; export const COMPONENT_FOREACH: string = 'ForEach'; export const COMPONENT_LAZYFOREACH: string = 'LazyForEach'; export const IS_RENDERING_IN_PROGRESS: string = 'isRenderingInProgress'; @@ -330,7 +325,6 @@ export const SELECT_LOW: string = 'select'; export const CHECKBOX_GROUP: string = 'CheckboxGroup'; export const SELECT_ALL: string = 'selectAll'; export const SELECTED: string = 'selected'; -export const MENU: string = 'Menu'; export const MENU_ITEM: string = 'MenuItem'; export const PANEL: string = 'Panel'; export const RATING_LOW: string = 'rating'; @@ -605,11 +599,3 @@ export const CONSTANT_STEP_3: number = 3; export const CONSTANT_STEP_4: number = 4; export const CONSTANT_VERSION_10: number = 10; -/* The alternative attributes for the Theme feature support. - */ -export const ATTRIBUTES_FOR_APPLY_THEME: Map> = new Map>([ - [ - SWIPER, ['indicator', 'displayArrow'] - ] -]); - diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 1a7df0d44c8e2eb4f1827c06ce77301e9cf39824..33124b17acd68ef5eb3b4f8c88929d33826a1b08 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -21,17 +21,8 @@ import { COMPONENT_CREATE_FUNCTION, COMPONENT_POP_FUNCTION, COMPONENT_BUTTON, - COMPONENT_COUNTER, - MENU, - MENU_ITEM, - TEXT_PICKER, - TEXT_INPUT, - DATE_PICKER, - SEARCH, - TIME_PICKER, COMPONENT_CREATE_LABEL_FUNCTION, COMPONENT_CREATE_CHILD_FUNCTION, - COMPONENT_PUSH_THEME_FUNCTION, COMPONENT_FOREACH, COMPONENT_LAZYFOREACH, IS_RENDERING_IN_PROGRESS, @@ -131,19 +122,7 @@ import { WRAPPEDBUILDER_CLASS, ALL_COMPONENTS, ATTRIBUTE_ATTRIBUTE_MODIFIER, - SLIDER, TITLE, - COMPONENT_DIVIDER, - COMPONENT_PROGRESS, - COMPONENT_QR_CODE, - COMPONENT_SCROLL_BAR, - TOGGLE, - RADIO, - CHECK_BOX, - CHECKBOX_GROUP, - SELECT, - SWIPER, - ATTRIBUTES_FOR_APPLY_THEME } from './pre_define'; import { INNER_COMPONENT_NAMES, @@ -194,35 +173,6 @@ import { } from './process_ui_syntax'; import { regularCollection } from './validate_ui_syntax'; -/** - * The list of ArkTS components that can apply Theme in create method - */ -const componentsCreateAndApplyTheme: Set = new Set([ - CHECK_BOX, - CHECKBOX_GROUP, - COMPONENT_COUNTER, - COMPONENT_DIVIDER, - COMPONENT_PROGRESS, - COMPONENT_QR_CODE, - COMPONENT_SCROLL_BAR, - DATE_PICKER, - MENU, - MENU_ITEM, - RADIO, - SEARCH, - SELECT, - SLIDER, - SWIPER, - TEXT_PICKER, - TEXT_INPUT, - TIME_PICKER, - TOGGLE -]); - -const componentsStyles: Set = new Set([ - ATTRIBUTE_ATTRIBUTE_MODIFIER -]); - export function processComponentBuild(node: ts.MethodDeclaration, log: LogInfo[]): ts.MethodDeclaration { let newNode: ts.MethodDeclaration; @@ -1875,7 +1825,6 @@ interface CreateResult { isContainerComponent: boolean; isButton: boolean; needPop: boolean; - ctorArgs: ts.Expression[]; } function createComponent(node: ts.ExpressionStatement, type: string): CreateResult { @@ -1885,7 +1834,6 @@ function createComponent(node: ts.ExpressionStatement, type: string): CreateResu isContainerComponent: false, isButton: false, needPop: false, - ctorArgs: null, }; let identifierNode: ts.Identifier = ts.factory.createIdentifier(type); let temp: any = node.expression; @@ -1894,7 +1842,6 @@ function createComponent(node: ts.ExpressionStatement, type: string): CreateResu } if (temp && temp.parent && (ts.isCallExpression(temp.parent) || ts.isEtsComponentExpression(temp.parent)) && ts.isIdentifier(temp)) { - let isApplyThemeComp = componentsCreateAndApplyTheme.has(temp.getText()) && type !== COMPONENT_POP_FUNCTION; if (temp.getText() === COMPONENT_BUTTON && type !== COMPONENT_POP_FUNCTION) { res.isButton = true; identifierNode = type === COMPONENT_CREATE_CHILD_FUNCTION ? @@ -1908,8 +1855,8 @@ function createComponent(node: ts.ExpressionStatement, type: string): CreateResu res.isContainerComponent = true; } - res.ctorArgs = type === COMPONENT_POP_FUNCTION ? null : checkArguments(temp, type) - res.newNode = ts.factory.createExpressionStatement(createFunction(temp, identifierNode, res.ctorArgs, isApplyThemeComp)); + const ctorArgs = type === COMPONENT_POP_FUNCTION ? null : checkArguments(temp, type) + res.newNode = ts.factory.createExpressionStatement(createFunction(temp, identifierNode, ctorArgs)); res.identifierNode = temp; } return res; @@ -2600,10 +2547,7 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, } else { temp = loopEtscomponent(temp, isStylesAttr); if (propName !== RECYCLE_REUSE_ID) { - let isAttributeModifier: boolean = componentsStyles.has(propName); - if (isThemeAttribute(identifierNode, node)) { - isAttributeModifier = true - } + let isAttributeModifier: boolean = propName === ATTRIBUTE_ATTRIBUTE_MODIFIER; const attrStatement = ts.factory.createExpressionStatement( createFunction(identifierNode, node, temp.arguments, isAttributeModifier)); statements.push(attrStatement); @@ -3251,10 +3195,4 @@ function checkNonspecificParents(node: ts.ExpressionStatement, name: string, sav }); } } -} - -function isThemeAttribute(identifierNode: ts.Identifier, node: ts.Identifier): boolean { - const className: string | undefined = identifierNode?.escapedText?.toString(); - const attrName: string | undefined = node.getText(); - return ATTRIBUTES_FOR_APPLY_THEME.get(className)?.includes(attrName) ?? false; } \ No newline at end of file