Skip to content

Commit

Permalink
Merge pull request #27 from ipuppet/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ipuppet authored Jun 27, 2022
2 parents 8abc454 + 7e4c24b commit d412067
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"info": {
"name": "WAIO",
"version": "1.6.6",
"version": "1.6.7",
"author": "ipuppet",
"module": false
},
Expand Down
6 changes: 5 additions & 1 deletion scripts/libs/easy-jsbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ class View {
}

setProp(key, prop) {
if (key === "id") {
this.id = prop
}
this.props[key] = prop
return this
}
Expand Down Expand Up @@ -847,7 +850,8 @@ class BarButtonItem extends View {
imageEdgeInsets: $insets(0, 0, 0, 0)
},
this.menu ? { menu: this.menu } : {},
this.title?.length > 0 ? { title: this.title } : {}
this.title?.length > 0 ? { title: this.title } : {},
this.props
),
views: [
{
Expand Down
22 changes: 15 additions & 7 deletions scripts/widget/Calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,14 @@ class Calendar {
/**
* 周指示器模板
*/
weekIndexTemplate() {
weekIndexTemplate(props = {}) {
const title = []
for (let i = 0; i < 7; i++) {
title.push(this.singleContentDayTemplate({
text: {
font: $font(14),
text: Object.assign({
text: this.localizedWeek(i),
color: this.colorTone
}
}, props)
}))
}
return title
Expand All @@ -441,6 +440,7 @@ class Calendar {
views.push({
type: "text",
props: {
font: $font(this.setting.get("title.fontsize")),
text: leftText,
lineLimit: 1,
color: this.colorTone,
Expand All @@ -458,6 +458,7 @@ class Calendar {
views.push({
type: "text",
props: {
font: $font(this.setting.get("title.fontsize")),
text: rightText,
lineLimit: 1,
color: this.colorTone,
Expand All @@ -482,7 +483,7 @@ class Calendar {
}
}

calendarTemplate(calendarInfo, dayStyleModifier, dayTemplate, vSpacing = 5) {
calendarTemplate(calendarInfo, weekIndexTemplate, dayStyleModifier, dayTemplate, vSpacing = 5) {
const days = []
for (let line of calendarInfo.calendar) { // 设置不同日期显示不同样式
for (let dayInfo of line) {
Expand All @@ -506,7 +507,7 @@ class Calendar {
maxHeight: Infinity
}
},
views: this.weekIndexTemplate().concat(days)
views: weekIndexTemplate.concat(days)
}
const titleBar = this.titleBarTemplate(calendarInfo)

Expand Down Expand Up @@ -535,8 +536,14 @@ class Calendar {
const calendarInfo = this.getCalendar(false)
return this.calendarTemplate(
calendarInfo,
this.weekIndexTemplate({ font: $font(this.setting.get("2x2.fontsize")) }),
(dayInfo, calendarInfo) => this.singleContentDayStyleModifier(dayInfo, calendarInfo),
props => this.singleContentDayTemplate(props),
props => {
if (props.text) {
Object.assign(props.text, { font: $font(this.setting.get("2x2.fontsize")) })
}
return this.singleContentDayTemplate(props)
},
0
)
}
Expand All @@ -545,6 +552,7 @@ class Calendar {
const calendarInfo = this.getCalendar(true, family === this.setting.family.medium)
return this.calendarTemplate(
calendarInfo,
this.weekIndexTemplate(),
(dayInfo, calendarInfo) => this.multipleContentDayStyleModifier(dayInfo, calendarInfo),
props => this.multipleContentDayTemplate(props)
)
Expand Down
25 changes: 25 additions & 0 deletions scripts/widget/Calendar/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,31 @@
"type": "switch",
"key": "title.lunarYear",
"value": true
},
{
"icon": [
"slider.horizontal.3",
"#FF9933"
],
"title": "FONT_SIZE",
"type": "number",
"key": "title.fontsize",
"value": 15
}
]
},
{
"title": "2x2",
"items": [
{
"icon": [
"slider.horizontal.3",
"#FF9933"
],
"title": "FONT_SIZE",
"type": "number",
"key": "2x2.fontsize",
"value": 13
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion strings/en.strings
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
"CLEAR_IMAGE" = "Clear Image";

"CLASSIC" = "Classic";
"MODERN" = "Modern";
"MODERN" = "Modern";

"FONT_SIZE" = "Font Size";
4 changes: 3 additions & 1 deletion strings/zh-Hans.strings
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
"CLEAR_IMAGE" = "清除图片";

"CLASSIC" = "经典";
"MODERN" = "现代";
"MODERN" = "现代";

"FONT_SIZE" = "字体大小";

0 comments on commit d412067

Please sign in to comment.