diff --git a/advanced_ui_component/selectionmenu/interfaces/selectionmenu.js b/advanced_ui_component/selectionmenu/interfaces/selectionmenu.js index c02bc3a489d..c2a99fe4722 100644 --- a/advanced_ui_component/selectionmenu/interfaces/selectionmenu.js +++ b/advanced_ui_component/selectionmenu/interfaces/selectionmenu.js @@ -15,8 +15,8 @@ const pasteboard = requireNapi('pasteboard'); const hilog = requireNapi('hilog'); -if (!("finalizeConstruction" in ViewPU.prototype)) { - Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { }); +if (!('finalizeConstruction' in ViewPU.prototype)) { + Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); } const WITHOUT_BUILDER = -2; @@ -29,130 +29,130 @@ const defaultTheme = { expandedOptionPadding: 4, defaultMenuWidth: 224, menuItemPadding: { - "id": -1, - "type": 10002, + 'id': -1, + 'type': 10002, params: ['sys.float.padding_level1'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, imageFillColor: { - "id": -1, - "type": 10001, + 'id': -1, + 'type': 10001, params: ['sys.color.ohos_id_color_primary'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, backGroundColor: { - "id": -1, - "type": 10001, + 'id': -1, + 'type': 10001, params: ['sys.color.ohos_id_color_dialog_bg'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, iconBorderRadius: { - "id": -1, - "type": 10002, + 'id': -1, + 'type': 10002, params: ['sys.float.corner_radius_level2'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, containerBorderRadius: { - "id": -1, - "type": 10002, + 'id': -1, + 'type': 10002, params: ['sys.float.corner_radius_level4'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, borderWidth: { - "id": -1, - "type": 10002, + 'id': -1, + 'type': 10002, params: ['sys.float.ohos_id_menu_inner_border_width'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, borderColor: { - "id": -1, - "type": 10001, + 'id': -1, + 'type': 10001, params: ['sys.color.ohos_id_menu_inner_border_color'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, outlineWidth: { - "id": -1, - "type": 10002, + 'id': -1, + 'type': 10002, params: ['sys.float.ohos_id_menu_outer_border_width'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, outlineColor: { - "id": -1, - "type": 10001, + 'id': -1, + 'type': 10001, params: ['sys.color.ohos_id_menu_outer_border_color'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, cutIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_cut"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_cut'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, copyIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_copy"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_copy'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, pasteIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_paste"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_paste'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, selectAllIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_select_all"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_select_all'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, shareIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_share"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_share'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, translateIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_translate_c2e"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_translate_c2e'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, searchIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_search_filled"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_search_filled'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, arrowDownIcon: { - "id": -1, - "type": 20000, - params: ["sys.media.ohos_ic_public_arrow_down"], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_arrow_down'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, aiWriteIcon: { - "id": -1, - "type": 20000, + 'id': -1, + 'type': 20000, params: ['sys.media.ic_public_ai_write'], - "bundleName": "__harDefaultBundleName__", - "moduleName": "__harDefaultModuleName__" + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__' }, iconPanelShadowStyle: ShadowStyle.OUTER_DEFAULT_SM, }; @@ -160,7 +160,7 @@ const defaultTheme = { class SelectionMenuComponent extends ViewPU { constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { super(parent, __localStorage, elmtId, extraInfo); - if (typeof paramsLambda === "function") { + if (typeof paramsLambda === 'function') { this.paramsGenerator_ = paramsLambda; } this.editorMenuOptions = undefined; @@ -172,18 +172,18 @@ class SelectionMenuComponent extends ViewPU { this.onSelectAll = undefined; this.theme = defaultTheme; this.builder = this.CloserFun; - this.__showExpandedMenuOptions = new ObservedPropertySimplePU(false, this, "showExpandedMenuOptions"); - this.__showCustomerIndex = new ObservedPropertySimplePU(-1, this, "showCustomerIndex"); - this.__customerChange = new ObservedPropertySimplePU(false, this, "customerChange"); - this.__cutAndCopyEnable = new ObservedPropertySimplePU(false, this, "cutAndCopyEnable"); - this.__pasteEnable = new ObservedPropertySimplePU(false, this, "pasteEnable"); - this.__visibilityValue = new ObservedPropertySimplePU(Visibility.Visible, this, "visibilityValue"); - this.__fontScale = new ObservedPropertySimplePU(1, this, "fontScale"); - this.__customMenuWidth = new ObservedPropertySimplePU(this.theme.defaultMenuWidth, this, "customMenuWidth"); - this.__horizontalMenuHeight = new ObservedPropertySimplePU(0, this, "horizontalMenuHeight"); - this.__horizontalMenuWidth = new ObservedPropertySimplePU(this.theme.defaultMenuWidth, this, "horizontalMenuWidth"); - this.fontWeightTable = ["100", "200", "300", "400", "500", "600", "700", "800", "900", "bold", "normal", "bolder", "lighter", "medium", - "regular"]; + this.__showExpandedMenuOptions = new ObservedPropertySimplePU(false, this, 'showExpandedMenuOptions'); + this.__showCustomerIndex = new ObservedPropertySimplePU(-1, this, 'showCustomerIndex'); + this.__customerChange = new ObservedPropertySimplePU(false, this, 'customerChange'); + this.__cutAndCopyEnable = new ObservedPropertySimplePU(false, this, 'cutAndCopyEnable'); + this.__pasteEnable = new ObservedPropertySimplePU(false, this, 'pasteEnable'); + this.__visibilityValue = new ObservedPropertySimplePU(Visibility.Visible, this, 'visibilityValue'); + this.__fontScale = new ObservedPropertySimplePU(1, this, 'fontScale'); + this.__customMenuWidth = new ObservedPropertySimplePU(this.theme.defaultMenuWidth, this, 'customMenuWidth'); + this.__horizontalMenuHeight = new ObservedPropertySimplePU(0, this, 'horizontalMenuHeight'); + this.__horizontalMenuWidth = new ObservedPropertySimplePU(this.theme.defaultMenuWidth, this, 'horizontalMenuWidth'); + this.fontWeightTable = ['100', '200', '300', '400', '500', '600', '700', '800', '900', 'bold', 'normal', 'bolder', 'lighter', 'medium', + 'regular']; this.isFollowingSystemFontScale = false; this.appMaxFontScale = 3.2; this.setInitiallyProvidedValue(params); @@ -441,9 +441,9 @@ class SelectionMenuComponent extends ViewPU { } sysBoard.clearData(); sysBoard.setData(pasteData).then(() => { - hilog.info(0x3900, "Ace", 'SelectionMenu copy option, Succeeded in setting PasteData.'); + hilog.info(0x3900, 'Ace', 'SelectionMenu copy option, Succeeded in setting PasteData.'); }).catch((err) => { - hilog.info(0x3900, "Ace", 'SelectionMenu copy option, Failed to set PasteData. Cause:' + err.message); + hilog.info(0x3900, 'Ace', 'SelectionMenu copy option, Failed to set PasteData. Cause:' + err.message); }); } popDataFromPasteboard(richEditorSelection) { @@ -466,9 +466,9 @@ class SelectionMenuComponent extends ViewPU { fontSize: 16, fontColor: Color.Black, fontWeight: FontWeight.Normal, - fontFamily: "HarmonyOS Sans", + fontFamily: 'HarmonyOS Sans', fontStyle: FontStyle.Normal, - decoration: { type: TextDecorationType.None, color: "#FF000000" } + decoration: { type: TextDecorationType.None, color: '#FF000000' } }; if (data.getProperty() && data.getProperty().additions[i]) { const tmp = data.getProperty().additions[i]; @@ -687,7 +687,7 @@ class SelectionMenuComponent extends ViewPU { MenuItemGroup.create(); }, MenuItemGroup); this.observeComponentCreation2((elmtId, isInitialRender) => { - MenuItem.create({ startIcon: this.theme.cutIcon, content: "剪切", labelInfo: "Ctrl+X" }); + MenuItem.create({ startIcon: this.theme.cutIcon, content: '剪切', labelInfo: 'Ctrl+X' }); MenuItem.enabled(this.cutAndCopyEnable); MenuItem.height(this.fontScale > MAX_FONT_STANDARD ? 'auto' : this.theme.buttonSize); MenuItem.borderRadius(this.theme.iconBorderRadius); @@ -710,7 +710,7 @@ class SelectionMenuComponent extends ViewPU { }, MenuItem); MenuItem.pop(); this.observeComponentCreation2((elmtId, isInitialRender) => { - MenuItem.create({ startIcon: this.theme.copyIcon, content: "复制", labelInfo: "Ctrl+C" }); + MenuItem.create({ startIcon: this.theme.copyIcon, content: '复制', labelInfo: 'Ctrl+C' }); MenuItem.enabled(this.cutAndCopyEnable); MenuItem.height(this.fontScale > MAX_FONT_STANDARD ? 'auto' : this.theme.buttonSize); MenuItem.borderRadius(this.theme.iconBorderRadius); @@ -731,7 +731,7 @@ class SelectionMenuComponent extends ViewPU { }, MenuItem); MenuItem.pop(); this.observeComponentCreation2((elmtId, isInitialRender) => { - MenuItem.create({ startIcon: this.theme.pasteIcon, content: "粘贴", labelInfo: "Ctrl+V" }); + MenuItem.create({ startIcon: this.theme.pasteIcon, content: '粘贴', labelInfo: 'Ctrl+V' }); MenuItem.enabled(this.pasteEnable); MenuItem.height(this.fontScale > MAX_FONT_STANDARD ? 'auto' : this.theme.buttonSize); MenuItem.borderRadius(this.theme.iconBorderRadius); @@ -752,7 +752,7 @@ class SelectionMenuComponent extends ViewPU { }, MenuItem); MenuItem.pop(); this.observeComponentCreation2((elmtId, isInitialRender) => { - MenuItem.create({ startIcon: this.theme.selectAllIcon, content: "全选", labelInfo: "Ctrl+A" }); + MenuItem.create({ startIcon: this.theme.selectAllIcon, content: '全选', labelInfo: 'Ctrl+A' }); MenuItem.visibility(this.visibilityValue); MenuItem.height(this.fontScale > MAX_FONT_STANDARD ? 'auto' : this.theme.buttonSize); MenuItem.borderRadius(this.theme.iconBorderRadius); @@ -788,7 +788,7 @@ class SelectionMenuComponent extends ViewPU { this.expandedMenuOptions && this.expandedMenuOptions.length > 0) { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((elmtId, isInitialRender) => { - MenuItem.create({ content: "更多", endIcon: this.theme.arrowDownIcon }); + MenuItem.create({ content: '更多', endIcon: this.theme.arrowDownIcon }); MenuItem.height(this.fontScale > MAX_FONT_STANDARD ? 'auto' : this.theme.buttonSize); MenuItem.borderRadius(this.theme.iconBorderRadius); MenuItem.margin({ top: this.theme.menuItemPadding }); @@ -886,7 +886,7 @@ export function SelectionMenu(options, parent = null) { onCopy: options.onCopy, onCut: options.onCut, onSelectAll: options.onSelectAll - }, undefined, elmtId, () => { }, { page: "library/src/main/ets/components/selectionmenu.ets", line: 517, col: 3 }); + }, undefined, elmtId, () => { }, { page: 'library/src/main/ets/components/selectionmenu.ets', line: 517, col: 3 }); ViewPU.create(componentCall); let paramsLambda = () => { return { @@ -904,7 +904,7 @@ export function SelectionMenu(options, parent = null) { else { (parent ? parent : this).updateStateVarsOfChildByElmtId(elmtId, {}); } - }, { name: "SelectionMenuComponent" }); + }, { name: 'SelectionMenuComponent' }); } } export default { SelectionMenu }; \ No newline at end of file