Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
YannLynn committed Nov 18, 2024
2 parents 2ac586b + ea57b6c commit 5283509
Show file tree
Hide file tree
Showing 27 changed files with 293 additions and 284 deletions.
6 changes: 6 additions & 0 deletions content/start/changelog/index-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ Version:Major.Minor.Patch (follow the **Semver** specification)

---

#### 🎉 2.69.1 (2024-11-15)
- 【Fix】
- fix the issue that MonthRange DatePicker does not jump when clicking on a non-disabled year when there is a disabledDate
- Fixed the problem that when ArrayField is conditionally rendered, the first click of add fails to add rows correctly.
- fixed incorrect translation of Table pageText in Japanese scenarios

#### 🎉 2.69.0 (2024-11-08)
- 【Fix】
- The clip-rule & stroke-width in the @douyinfe/semi-illustrations package are modified to clipRule & strokeWidth
Expand Down
6 changes: 6 additions & 0 deletions content/start/changelog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Semi 版本号遵循 **Semver** 规范(主版本号-次版本号-修订版本
- 修订版本号(patch):仅会进行 bugfix,发布时间不限
- 不同版本间的详细关系,可查阅 [FAQ](/zh-CN/start/faq)

#### 🎉 2.69.1 (2024-11-15)
- 【Fix】
- 修复 MonthRange DatePicker 在存在 disabledDate 情况下点击非禁用年份不跳转问题 [#2569](https://github.com/DouyinFE/semi-design/pull/2569)
- 修复 ArrayField 被条件渲染时,add第一次点击未能正确添加行的问题 [#2568](https://github.com/DouyinFE/semi-design/pull/2568)
- 修复日语场景下 Table pageText 翻译不正确问题 [#2573](https://github.com/DouyinFE/semi-design/pull/2573)

#### 🎉 2.69.0 (2024-11-08)
- 【Fix】
- 插画包 @douyinfe/semi-illustrations 中的 clip-rule & stroke-width 修改为 clipRule & strokeWidth
Expand Down
17 changes: 17 additions & 0 deletions cypress/e2e/datePicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,4 +910,21 @@ describe('DatePicker', () => {
cy.get('.semi-popover .semi-datepicker-day-selected-start').contains('15');
cy.get('.semi-popover .semi-datepicker-day-selected-end').contains('20');
});

it('auto Correction month under month range', () => {
cy.visit('http://localhost:6006/iframe.html?args=&id=datepicker--fix-2567&viewMode=story');
cy.get('.semi-input').eq(0).click();
cy.get('.semi-scrolllist').eq(1).contains('2024').click();
cy.get('.semi-input').eq(0).should("have.value", "2024-11 ~ 2024-11");
cy.root().click('right');

cy.get('.semi-input').eq(1).click();
cy.get('.semi-scrolllist').eq(1).contains('2024').click();
cy.get('.semi-input').eq(1).should("have.value", "2024-11 ~ 2024-11");
cy.root().click('right');

cy.get('.semi-input').eq(2).click();
cy.get('.semi-scrolllist').eq(0).contains('2025').click();
cy.get('.semi-input').eq(2).should("have.value", "2025-01 ~ 2025-01");
})
});
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.69.0"
"version": "2.69.1"
}
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.69.0",
"version": "2.69.1",
"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.69.0",
"@douyinfe/semi-animation-styled": "2.69.0",
"@douyinfe/semi-animation": "2.69.1",
"@douyinfe/semi-animation-styled": "2.69.1",
"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.69.0",
"version": "2.69.1",
"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.69.0",
"version": "2.69.1",
"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.69.0",
"version": "2.69.1",
"description": "semi ui eslint plugin",
"keywords": [
"semi",
Expand Down
38 changes: 29 additions & 9 deletions packages/semi-foundation/datePicker/yearAndMonthFoundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
const month = copy(currentMonth);
month[panelType] = item.month;

// make sure the right panel time is always less than the left panel time
// Make sure the time on the right panel is always greater than or equal to the time on the left panel
if (type === 'monthRange' && panelType === left && currentYear[left] === currentYear[right] && item.value > month[right]) {
month[right] = item.month + 1;
month[right] = item.month ;
}

this._adapter.setCurrentMonth(month);
Expand All @@ -121,8 +121,19 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
const { disabledDate, locale } = this._adapter.getProps();
const { months, currentMonth } = this._adapter.getStates();

const oppositeType = panelType === strings.PANEL_TYPE_LEFT ? 'right' : 'left';

const currentDate = setYear(Date.now(), item.year);
const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth[panelType] - 1));
// whether the date on the opposite is legal
const isOppositeMonthDisabled = disabledDate(setMonth(setYear(Date.now(), year[oppositeType]), currentMonth[oppositeType] - 1));

if (!isCurrentMonthDisabled && !isOppositeMonthDisabled) {
// all panel Date is legal
return;
}
let finalYear = year;
let finalMonth = currentMonth;
if (isCurrentMonthDisabled) {
const currentIndex = months.findIndex(({ month }) => month === currentMonth[panelType]);
let validMonth: typeof months[number];
Expand All @@ -131,15 +142,24 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
if (!validMonth) {
validMonth = months.slice(0, currentIndex).find(({ month }) => !disabledDate(setMonth(currentDate, month - 1)));
}
if (validMonth) {
const month = copy(currentMonth);
month[panelType] = validMonth.month;

// change year and month same time
this._adapter.setCurrentYearAndMonth(year, month);
this._adapter.notifySelectYearAndMonth(year, month);
if (validMonth && !isOppositeMonthDisabled) {
// only currentPanel Date is illegal
// just need to modify the month of the current panel
finalMonth[panelType] = validMonth.month;
} else if (validMonth && isOppositeMonthDisabled) {
// all panel Date is illegal
// change the value to the legal value calculated by the current panel
finalYear = { 'left': item.year, 'right': item.year };
finalMonth = { 'left': validMonth.month, 'right': validMonth.month };
}
} else if (!isCurrentMonthDisabled && isOppositeMonthDisabled) {
// only opposite panel Date is illegal
// change the value to the legal value in the current panel
finalYear = { 'left': item.year, 'right': item.year };
finalMonth = { 'left': currentMonth[panelType], 'right': currentMonth[panelType] };
}
this._adapter.setCurrentYearAndMonth(finalYear, finalMonth);
this._adapter.notifySelectYearAndMonth(finalYear, finalMonth);
}

backToMain() {
Expand Down
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.69.0",
"version": "2.69.1",
"description": "",
"scripts": {
"build:lib": "node ./scripts/compileLib.js",
"prepublishOnly": "npm run build:lib"
},
"dependencies": {
"@douyinfe/semi-animation": "2.69.0",
"@douyinfe/semi-animation": "2.69.1",
"@mdx-js/mdx": "^3.0.1",
"async-validator": "^3.5.0",
"classnames": "^2.2.6",
Expand Down
1 change: 1 addition & 0 deletions packages/semi-foundation/transfer/transfer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ $module: #{$prefix}-transfer;
margin-bottom: $spacing-transfer_header-marginBottom;
margin-left: $spacing-transfer_header-marginLeft;
color: $color-transfer_header-text;
flex-shrink: 0;

&-all {
font-weight: $font-transfer_header_all-fontWeight;
Expand Down
5 changes: 4 additions & 1 deletion packages/semi-foundation/treeSelect/treeSelect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ $module: #{$prefix}-tree-select;

&-placeholder {
opacity: .6;
z-index: -1;
}

&-disabled {
Expand All @@ -174,6 +173,10 @@ $module: #{$prefix}-tree-select;
}
}

.#{$module}-triggerSingleSearch-upper {
z-index: 1;
}

.#{$module}-triggerSingleSearch-wrapper{
width: 100%;

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.69.0",
"version": "2.69.1",
"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.69.0",
"version": "2.69.1",
"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.69.0",
"version": "2.69.1",
"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.69.0",
"version": "2.69.1",
"description": "Plugin that support Semi Design in Next.js",
"author": "伍浩威 <[email protected]>",
"homepage": "",
Expand All @@ -22,7 +22,7 @@
"typescript": "^4"
},
"dependencies": {
"@douyinfe/semi-webpack-plugin": "2.69.0"
"@douyinfe/semi-webpack-plugin": "2.69.1"
},
"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.69.0",
"version": "2.69.1",
"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.69.0",
"version": "2.69.1",
"description": "compile semi scss to css",
"author": "[email protected]",
"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.69.0",
"version": "2.69.1",
"description": "semi-theme-default",
"keywords": [
"semi-theme",
Expand Down
33 changes: 33 additions & 0 deletions packages/semi-ui/datePicker/_story/datePicker.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,12 @@ export const MonthRangePicker = () => {
return date.getTime() < deadDate.getTime();
};

const disabledRangeDate = date => {
const deadDate = new Date('2025/3/1 00:00:00');
const startDate = new Date('2024/11/1 00:00:00');
return date.getTime() < startDate.getTime() || date.getTime() > deadDate.getTime();
};

return (
<>
<div>
Expand Down Expand Up @@ -640,6 +646,8 @@ export const MonthRangePicker = () => {
<br />
<div>年月禁用:禁用2023年3月前的所有年月</div>
<DatePicker type="monthRange" disabledDate={disabledDate}/>
<div>年月禁用:禁用2024年11月前 & 2025年2月后的所有年月</div>
<DatePicker type="monthRange" disabledDate={disabledRangeDate}/>
<br />
<br />
<div>validateStatus</div>
Expand Down Expand Up @@ -1190,3 +1198,28 @@ CashedSelectedValue.storyName = "cashedSelectedValue";
export const Fix1982 = () => {
return <DatePicker type="monthRange" style={{ width: 200 }} />
}


export const Fix2567 = () => {
const disabledDate = (date) => {
const deadDate = new Date('2025/3/1 00:00:00');
const startDate = new Date('2024/11/1 00:00:00');
return date.getTime() < startDate.getTime() || date.getTime() > deadDate.getTime();
}
return (
<div>
<div>datePicker monthRange 对于三种需要矫正日期的处理</div>
<br />
<div>点击右侧面板 2024</div>
<DatePicker defaultValue={['2024-11', '2025-01']}type="monthRange" disabledDate={disabledDate} />
<br />
<br />
<div>点击右侧面板 2024</div>
<DatePicker defaultValue={['2024-12', '2025-01']}type="monthRange" disabledDate={disabledDate} />
<br />
<br />
<div>点击左侧面板 2025</div>
<DatePicker defaultValue={['2024-11', '2025-01']}type="monthRange" disabledDate={disabledDate} />
</div>
)
}
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.69.0",
"version": "2.69.1",
"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.69.0",
"@douyinfe/semi-animation-react": "2.69.0",
"@douyinfe/semi-foundation": "2.69.0",
"@douyinfe/semi-icons": "2.69.0",
"@douyinfe/semi-illustrations": "2.69.0",
"@douyinfe/semi-theme-default": "2.69.0",
"@douyinfe/semi-animation": "2.69.1",
"@douyinfe/semi-animation-react": "2.69.1",
"@douyinfe/semi-foundation": "2.69.1",
"@douyinfe/semi-icons": "2.69.1",
"@douyinfe/semi-illustrations": "2.69.1",
"@douyinfe/semi-theme-default": "2.69.1",
"async-validator": "^3.5.0",
"classnames": "^2.2.6",
"copy-text-to-clipboard": "^2.1.1",
Expand Down
Loading

0 comments on commit 5283509

Please sign in to comment.