Skip to content

Commit

Permalink
Merge branch 'main' into fix_bug_Check_newChats_array_length_before_a…
Browse files Browse the repository at this point in the history
…ccessing_last_chat_status
  • Loading branch information
fankaiLiu authored Dec 5, 2024
2 parents 3f4d28c + ccb86ae commit bc6ffd3
Show file tree
Hide file tree
Showing 22 changed files with 210 additions and 191 deletions.
4 changes: 3 additions & 1 deletion content/start/changelog/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Version:Major.Minor.Patch (follow the **Semver** specification)
- **Patch version**: Only include bug fix, the release time is not limited

---

#### 🎉 2.70.2 (2024-12-04)
- 【Fix】
- Fixed the issue that when the Datepicker type is monthRange, the default selected year and month in the panel cannot be selected across the year

#### 🎉 2.70.1 (2024-11-25)
- 【Fix】
Expand Down
3 changes: 3 additions & 0 deletions content/start/changelog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Semi 版本号遵循 **Semver** 规范(主版本号-次版本号-修订版本
- 修订版本号(patch):仅会进行 bugfix,发布时间不限
- 不同版本间的详细关系,可查阅 [FAQ](/zh-CN/start/faq)

#### 🎉 2.70.2 (2024-12-04)
- 【Fix】
- 修复 Datepicker 类型为 monthRange 时,面板默认选中的年月无法选中跨年情况 [#2608](https://github.com/DouyinFE/semi-design/pull/2608)

#### 🎉 2.70.1 (2024-11-25)
- 【Fix】
Expand Down
15 changes: 7 additions & 8 deletions cypress/e2e/datePicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,14 +817,13 @@ describe('DatePicker', () => {
cy.get('.semi-scrolllist-item-sel').eq(0).contains(`${year}年`);
cy.get('.semi-scrolllist-item-sel').eq(1).contains(`${month}月`);

// TODO: need to fix here, When it is December, the New Year's Eve, the assertion here does not hold
// cy.get('body').click('right');
// cy.get('.semi-datepicker .semi-input').eq(-1).click();
// cy.get('.semi-datepicker .semi-input-clearbtn').click();
// cy.get('.semi-scrolllist-item-sel').eq(0).contains(`${year}年`);
// cy.get('.semi-scrolllist-item-sel').eq(2).contains(`${year}年`);
// cy.get('.semi-scrolllist-item-sel').eq(1).contains(`${month}月`);
// cy.get('.semi-scrolllist-item-sel').eq(3).contains(`${month+1}月`);
cy.get('body').click('right');
cy.get('.semi-datepicker .semi-input').eq(-1).click();
cy.get('.semi-datepicker .semi-input-clearbtn').click();
cy.get('.semi-scrolllist-item-sel').eq(0).contains(`${year}年`);
cy.get('.semi-scrolllist-item-sel').eq(2).contains(`${month+1 <= 12 ? year : year + 1}年`);
cy.get('.semi-scrolllist-item-sel').eq(1).contains(`${month}月`);
cy.get('.semi-scrolllist-item-sel').eq(3).contains(`${month+1 <= 12 ? month+1 : 1}月`);
});

it('test split first inset input + dateTimeRange', () => {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"useWorkspaces": true,
"npmClient": "yarn",
"version": "2.70.1"
"version": "2.70.2"
}
6 changes: 3 additions & 3 deletions packages/semi-animation-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-animation-react",
"version": "2.70.1",
"version": "2.70.2",
"description": "motion library for semi-ui-react",
"keywords": [
"motion",
Expand All @@ -25,8 +25,8 @@
"prepublishOnly": "npm run build:lib"
},
"dependencies": {
"@douyinfe/semi-animation": "2.70.1",
"@douyinfe/semi-animation-styled": "2.70.1",
"@douyinfe/semi-animation": "2.70.2",
"@douyinfe/semi-animation-styled": "2.70.2",
"classnames": "^2.2.6"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-animation-styled/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-animation-styled",
"version": "2.70.1",
"version": "2.70.2",
"description": "semi styled animation",
"keywords": [
"semi",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-animation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-animation",
"version": "2.70.1",
"version": "2.70.2",
"description": "animation base library for semi-ui",
"keywords": [
"animation",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-semi-design",
"version": "2.70.1",
"version": "2.70.2",
"description": "semi ui eslint plugin",
"keywords": [
"semi",
Expand Down
12 changes: 12 additions & 0 deletions packages/semi-foundation/datePicker/_utils/getYearAndMonth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function getYearAndMonth(year: { left: number; right: number }, month: { left: number; right: number }) {
const nowYear = new Date().getFullYear();
const nowMonth = new Date().getMonth();

const rightMonth = month.right || (nowMonth + 2);
const rightYear = year.right || (rightMonth <= 12 ? nowYear : nowYear + 1);

return {
year: { left: year.left || nowYear, right: rightYear },
month: { left: month.left || nowMonth + 1, right: rightMonth <= 12 ? rightMonth : 1 },
};
}
4 changes: 3 additions & 1 deletion packages/semi-foundation/datePicker/_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import getDefaultFormatToken from './getDefaultFormatToken';
import getYears from './getYears';
import getMonthsInYear from './getMonthsInYear';
import getFullDateOffset from './getFullDateOffset';
import getYearAndMonth from './getYearAndMonth';

export {
isAfter,
Expand All @@ -24,5 +25,6 @@ export {
getDefaultFormatToken,
getYears,
getMonthsInYear,
getFullDateOffset
getFullDateOffset,
getYearAndMonth
};
4 changes: 2 additions & 2 deletions packages/semi-foundation/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@douyinfe/semi-foundation",
"version": "2.70.1",
"version": "2.70.2",
"description": "",
"scripts": {
"build:lib": "node ./scripts/compileLib.js",
"prepublishOnly": "npm run build:lib"
},
"dependencies": {
"@douyinfe/semi-animation": "2.70.1",
"@douyinfe/semi-animation": "2.70.2",
"@mdx-js/mdx": "^3.0.1",
"async-validator": "^3.5.0",
"classnames": "^2.2.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-icons-lab/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-icons-lab",
"version": "2.70.1",
"version": "2.70.2",
"description": "semi icons lab",
"keywords": [
"semi",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-icons",
"version": "2.70.1",
"version": "2.70.2",
"description": "semi icons",
"keywords": [
"semi",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-illustrations/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-illustrations",
"version": "2.70.1",
"version": "2.70.2",
"description": "semi illustrations",
"keywords": [
"semi",
Expand Down
4 changes: 2 additions & 2 deletions packages/semi-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-next",
"version": "2.70.1",
"version": "2.70.2",
"description": "Plugin that support Semi Design in Next.js",
"author": "伍浩威 <wuhaowei.whw@bytedance.com>",
"homepage": "",
Expand All @@ -22,7 +22,7 @@
"typescript": "^4"
},
"dependencies": {
"@douyinfe/semi-webpack-plugin": "2.70.1"
"@douyinfe/semi-webpack-plugin": "2.70.2"
},
"gitHead": "eb34a4f25f002bb4cbcfa51f3df93bed868c831a"
}
2 changes: 1 addition & 1 deletion packages/semi-rspack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-rspack-plugin",
"version": "2.70.1",
"version": "2.70.2",
"description": "",
"homepage": "",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-scss-compile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-scss-compile",
"version": "2.70.1",
"version": "2.70.2",
"description": "compile semi scss to css",
"author": "daiqiang@bytedance.com",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-theme-default/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-theme-default",
"version": "2.70.1",
"version": "2.70.2",
"description": "semi-theme-default",
"keywords": [
"semi-theme",
Expand Down
15 changes: 8 additions & 7 deletions packages/semi-ui/datePicker/yearAndMonth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import YearAndMonthFoundation, { MonthScrollItem, YearAndMonthAdapter, YearAndMo
import BaseComponent, { BaseProps } from '../_base/baseComponent';
import ScrollList from '../scrollList/index';
import ScrollItem from '../scrollList/scrollItem';
import { getYears } from '@douyinfe/semi-foundation/datePicker/_utils/index';
import { getYearAndMonth, getYears } from '@douyinfe/semi-foundation/datePicker/_utils/index';

import IconButton from '../iconButton';
import { IconChevronLeft } from '@douyinfe/semi-icons';
Expand Down Expand Up @@ -63,6 +63,8 @@ class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonthState> {

let { currentYear, currentMonth } = props;

const { year, month } = getYearAndMonth(currentYear, currentMonth);

this.state = {
years: getYears(props.startYear, props.endYear).map(year => ({
value: year,
Expand All @@ -74,8 +76,8 @@ class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonthState> {
value: idx + 1,
month: idx + 1,
})),
currentYear: { left: currentYear.left || now.getFullYear(), right: currentYear.right || now.getFullYear() },
currentMonth: { left: currentMonth.left || now.getMonth() + 1, right: currentMonth.right || now.getMonth() + 2 },
currentYear: year,
currentMonth: month,
};

this.yearRef = React.createRef();
Expand Down Expand Up @@ -112,15 +114,14 @@ class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonthState> {

static getDerivedStateFromProps(props: YearAndMonthProps, state: YearAndMonthState) {
const willUpdateStates: Partial<YearAndMonthState> = {};
const { year, month } = getYearAndMonth(props.currentYear, props.currentMonth);

if (!isEqual(props.currentYear, state.currentYear)) {
const nowYear = new Date().getFullYear();
willUpdateStates.currentYear = { left: props.currentYear.left || nowYear, right: props.currentYear.right || nowYear };
willUpdateStates.currentYear = year;
}

if (!isEqual(props.currentMonth, state.currentMonth)) {
const nowMonth = new Date().getMonth();
willUpdateStates.currentMonth = { left: props.currentMonth.left || nowMonth + 1, right: props.currentMonth.right || nowMonth + 2 };
willUpdateStates.currentMonth = month;
}

return willUpdateStates;
Expand Down
14 changes: 7 additions & 7 deletions packages/semi-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-ui",
"version": "2.70.1",
"version": "2.70.2",
"description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
"main": "lib/cjs/index.js",
"module": "lib/es/index.js",
Expand All @@ -20,12 +20,12 @@
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.1",
"@douyinfe/semi-animation": "2.70.1",
"@douyinfe/semi-animation-react": "2.70.1",
"@douyinfe/semi-foundation": "2.70.1",
"@douyinfe/semi-icons": "2.70.1",
"@douyinfe/semi-illustrations": "2.70.1",
"@douyinfe/semi-theme-default": "2.70.1",
"@douyinfe/semi-animation": "2.70.2",
"@douyinfe/semi-animation-react": "2.70.2",
"@douyinfe/semi-foundation": "2.70.2",
"@douyinfe/semi-icons": "2.70.2",
"@douyinfe/semi-illustrations": "2.70.2",
"@douyinfe/semi-theme-default": "2.70.2",
"async-validator": "^3.5.0",
"classnames": "^2.2.6",
"copy-text-to-clipboard": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/semi-webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@douyinfe/semi-webpack-plugin",
"version": "2.70.1",
"version": "2.70.2",
"description": "",
"author": "伍浩威 <wuhaowei.whw@bytedance.com>",
"homepage": "",
Expand Down
Loading

0 comments on commit bc6ffd3

Please sign in to comment.