diff --git a/components/date-picker2/__tests__/index-spec.js b/components/date-picker2/__tests__/index-spec.js
index 4c15e0afe5..5ea28490ae 100644
--- a/components/date-picker2/__tests__/index-spec.js
+++ b/components/date-picker2/__tests__/index-spec.js
@@ -919,6 +919,26 @@ describe('Picker', () => {
wrapper.unmount();
wrapper = null;
}
+ });
+ // fix: https://github.com/alibaba-fusion/next/issues/3877
+ it('should not select default endDate',()=>{
+ const currentDate = dayjs();
+ const currentDateStr = currentDate.format('YYYY-MM-DD');
+ const disabledDate = function (date, mode) {
+ return currentDate.date() !== date.date();
+ };
+ wrapper = mount();
+ clickDate(currentDateStr);
+ clickTime('12');
+ clickTime('12', 'minute');
+ clickTime('12', 'second');
+ assert.deepEqual(getStrValue(), [`${currentDateStr} 12:12:12`, '']);
+ clickOk();
+ clickTime('16');
+ clickTime('16', 'minute');
+ clickTime('35', 'second');
+ clickOk();
+ assert.deepEqual(getStrValue(), [`${currentDateStr} 12:12:12`, `${currentDateStr} 16:16:35`]);
});
// https://github.com/alibaba-fusion/next/issues/2641
it('value controlled issue', () => {
diff --git a/components/date-picker2/panels/range-panel.jsx b/components/date-picker2/panels/range-panel.jsx
index 960ce5cd5f..c41eadca28 100644
--- a/components/date-picker2/panels/range-panel.jsx
+++ b/components/date-picker2/panels/range-panel.jsx
@@ -163,9 +163,9 @@ class RangePanel extends React.Component {
if (!curDateVal) {
curDateVal =
inputType === BEGIN && end
- ? end.subtract(1, 'day')
+ ? end
: inputType === END && begin
- ? begin.add(1, 'day')
+ ? begin
: datejs();
}
curDateVal = setTime(curDateVal, v);
diff --git a/components/field/utils.js b/components/field/utils.js
index 1010903f1f..5a89f0810e 100644
--- a/components/field/utils.js
+++ b/components/field/utils.js
@@ -33,6 +33,8 @@ export function scrollToFirstError({ errorsGroup, options, instance }) {
window.scrollTo(offsetLeft, firstTop + options.scrollToFirstError);
} else if (firstNode.scrollIntoViewIfNeeded) {
firstNode.scrollIntoViewIfNeeded(true);
+ } else {
+ firstNode.scrollIntoView({ block: 'center' });
}
}
}
diff --git a/components/form/form.jsx b/components/form/form.jsx
index f22970703d..0087c83670 100644
--- a/components/form/form.jsx
+++ b/components/form/form.jsx
@@ -291,7 +291,7 @@ export default class Form extends React.Component {
dir={rtl ? 'rtl' : undefined}
onSubmit={onSubmit}
>
- {responsive ? {newChildren} : newChildren}
+ {responsive ? {newChildren} : newChildren}
);
}
diff --git a/components/rating/main.scss b/components/rating/main.scss
index ff630c86a7..75a990b05f 100644
--- a/components/rating/main.scss
+++ b/components/rating/main.scss
@@ -99,7 +99,7 @@
top: calc(100% + #{$s-1});
left: 0;
border: 1px solid $color-fill1-4;
- background: $color-white;
+ background: $rating-grade-background;
padding: 4px 8px 3px;
font-size: 12px;
white-space: nowrap;
diff --git a/components/rating/scss/variable.scss b/components/rating/scss/variable.scss
index cd93b52a41..a296f1eee5 100644
--- a/components/rating/scss/variable.scss
+++ b/components/rating/scss/variable.scss
@@ -80,3 +80,7 @@ $rating-grade-high-overlay-hover-color: $color-brand1-6 !default;
/// rating icon
/// @namespace statement/normal
$rating-grade-icon-content: $icon-content-favorites-filling !default;
+
+/// rating tip background
+/// @namespace statement/normal
+$rating-grade-background: $color-white !default;
diff --git a/tools/serve/demo.tsx b/tools/serve/demo.tsx
index 6557ee642f..22d347e4f3 100644
--- a/tools/serve/demo.tsx
+++ b/tools/serve/demo.tsx
@@ -3,8 +3,8 @@ import React from 'react';
import doc from '__doc';
// @ts-expect-error __demos
import demos from '__demos';
+import '__scss';
import './demo.css';
-import '../../index.scss';
function DemoItem({ id, doc, render }: { id: string; doc: string; render(): void }) {
React.useEffect(() => {
@@ -39,14 +39,6 @@ export default function Demo() {
>
{nextLang}
-
diff --git a/tools/serve/index.ts b/tools/serve/index.ts
index 312cafe5a1..6874caf9a9 100644
--- a/tools/serve/index.ts
+++ b/tools/serve/index.ts
@@ -13,7 +13,8 @@ import { existsSync, readFileSync, readdirSync } from 'fs-extra';
import createDocParser from '@alifd/doc-parser';
import MagicString from 'magic-string';
import { kebabCase } from 'lodash';
-import { ARGV, SRC_DIR_PATH, TARGETS, findFile, logger, parseImportDeclarations } from '../utils';
+import { glob } from 'glob';
+import { ARGV, SRC_DIR_PATH, TARGETS, findFile, logger, parseImportDeclarations, warn } from '../utils';
import { marked } from '../build/docs/utils';
import { parseDemoMd } from '../build/docs/generate-docs';
@@ -80,8 +81,15 @@ const demoPlugin = (dirName: string): VitePlugin => {
cssEntry: existsSync(cssEntryPath) ? cssEntryPath : undefined,
jsEntry: existsSync(demoEntryPath) ? demoEntryPath : undefined,
};
+ }).filter(t => {
+ if (!t.jsEntry) {
+ warn(`Not found demo index.tsx: ${t.id}`)
+ }
+ return !!t.jsEntry
});
}
+ const SCSS_REG = /^__scss/;
+ const SCSS_VIRTUAL_REG = /^\0__scss\.scss/;
const DOC_REG = /^__doc/;
const DEMOS_REG = /^__demos/;
const DOC_VIRTUAL_REG = /^\0__doc/;
@@ -112,11 +120,22 @@ const demoPlugin = (dirName: string): VitePlugin => {
return html.replace(/\$name/g, dirName);
},
resolveId(source) {
+ if (SCSS_REG.test(source)) {
+ return `\0${source}.scss`;
+ }
if (DOC_REG.test(source) || DEMOS_REG.test(source)) {
return `\0${source}`;
}
},
load(id) {
+ if (SCSS_VIRTUAL_REG.test(id)) {
+ const fixedFiles: string[] = [resolve(SRC_DIR_PATH, 'core/reset.scss')];
+ const mainFiles = glob.sync('*/main.scss', { cwd: SRC_DIR_PATH, absolute: true });
+ return fixedFiles
+ .concat(mainFiles)
+ .map(f => `@import "${f}";`)
+ .join('\n');
+ }
if (DOC_VIRTUAL_REG.test(id)) {
const { doc, files } = loadComponentDoc(dirName);
files.forEach(f => this.addWatchFile(f));