Skip to content

Commit 6139a55

Browse files
committed
feature(2.2.2)
1 parent d126926 commit 6139a55

12 files changed

Lines changed: 36 additions & 20 deletions

File tree

entry/src/main/ets/entryability/EntryAbility.ets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class EntryAbility extends UIAbility {
2121
// 注册自定义字体图标
2222
mainWindow.getUIContext().getFont().registerFont({
2323
familyName: 'testFont',
24-
familySrc: $rawfile('iconfont.woff')
24+
familySrc: $rawfile('iconfont.ttf')
2525
})
2626
IBestSetUIGlobalConfig({
2727
fontNames: ['testFont']

entry/src/main/ets/pages/base/Icon.ets

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ struct IconsPage {
5757
ListItem() {
5858
ComponentShowContainer({ title: "使用自定义图标" }) {
5959
Row({ space: SPACE.SM }) {
60-
IBestIcon({ fontName: "testFont", name: "\ue953" })
60+
IBestIcon({ fontName: "testFont", name: "\ue6d4" })
6161
IBestIcon({ fontName: "testFont", name: "\ue963" })
62+
IBestIcon({ fontName: "testFont", name: "\ue971" })
6263
IBestIcon({ fontName: "testFont", name: "\ue973" })
6364
}
6465
}
2.82 KB
Binary file not shown.
-1.7 KB
Binary file not shown.

library/BuildProfile.ets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Use these variables when you tailor your ArkTS code. They must be of the const type.
33
*/
4-
export const HAR_VERSION = '2.2.1';
4+
export const HAR_VERSION = '2.2.2';
55
export const BUILD_MODE_NAME = 'release';
66
export const DEBUG = false;
77
export const TARGET_NAME = 'default';

library/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 版本记录
22

3-
## 2.2.1
3+
## 2.2.2
44
#### 新增:
55
1. 新增 IBestTree 树形控件;
66
2. 全局配置新增 fontNames 属性,支持在包含图标的组件上使用自定义图标;

library/oh-package.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ibestservices/ibest-ui",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "一个轻量、简单易用、可定制主题、支持深色模式和浅色模式的鸿蒙开源UI组件库, 包含Button、Calendar、Form、Field、Picker、Popup、Toast、Dialog、ImageCropper等60+个优质组件。",
55
"main": "Index.ets",
66
"keywords": [

library/src/main/ets/components/icon/index.ets

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ export struct IBestIcon {
4141
isOnlineImage(): boolean {
4242
return (this.name as string).startsWith("http")
4343
}
44+
isSingleUnicodeEscape(str: string) {
45+
return str.length == 1 && /^[\u0000-\uFFFF]$/.test(str)
46+
}
4447
getFontFamily(){
45-
let arr = ["ibestFont", getResourceStr(this.fontName)].concat(this.config.fontNames.map(e => getResourceStr(e)))
46-
return Array.from<string>(new Set(arr.filter(e => e))).join(",")
48+
let name = this.name as string
49+
if(this.isSingleUnicodeEscape(name)){
50+
let arr = this.config.fontNames.map(e => getResourceStr(e)).concat([getResourceStr(this.fontName)])
51+
return Array.from<string>(new Set(arr.filter(e => e))).join(",")
52+
}else {
53+
return "ibestFont"
54+
}
4755
}
4856
build() {
4957
if (typeof this.name == "string" && !this.isOnlineImage()) {

library/src/main/ets/theme-chalk/src/index.ets

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { IBestStorageKey } from '../../model/Global.type'
2-
import { convertDimensionsWidthUnit } from '../../utils/utils'
2+
import { convertDimensionsWidthUnit, mergeObject } from '../../utils/utils'
33
import { BORDER_RADIUS } from './border'
44
import { COLOR_OPACITY, THEME_COLOR } from './color'
55
import { FONT_SIZE } from './font'
@@ -56,12 +56,8 @@ export function getDefaultBaseStyle(): IBestUIBaseStyleObjType {
5656
*/
5757
export function setIBestUIBaseStyle(styleData?: Partial<IBestUIBaseStyleType>) {
5858
const newStyleData = getDefaultBaseStyle()
59-
if (typeof styleData === 'object' && styleData !== null) {
60-
Object.keys(styleData).forEach(item => {
61-
if (newStyleData[item]) {
62-
newStyleData[item] = (styleData as IBestUIBaseStyleObjType)[item] ?? newStyleData[item]
63-
}
64-
})
59+
if (styleData) {
60+
mergeObject(newStyleData, styleData)
6561
}
6662
AppStorage.setOrCreate(IBestStorageKey.BASE_STYLE, newStyleData)
6763
}

library/src/main/ets/utils/utils.ets

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ export function random(min: number, max: number) {
118118
}
119119
return 0
120120
}
121+
/**
122+
* 合并对象
123+
*/
124+
export function mergeObject(target: AnyType, source: AnyType) {
125+
if(!source){
126+
return
127+
}
128+
for (let key of Object.keys(source)) {
129+
target[key] = source[key]
130+
}
131+
}
121132
/**
122133
* 获取组件信息
123134
* @param {context} UIContext

0 commit comments

Comments
 (0)