Merge remote-tracking branch 'baidu/master'

This commit is contained in:
liaoxuezhi 2022-12-05 16:41:47 +08:00
commit fee481eb05
15 changed files with 49 additions and 30 deletions

View File

@ -1,4 +1,4 @@
{ {
"packages": ["packages/*"], "packages": ["packages/*"],
"version": "2.5.0" "version": "2.5.1"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "amis-core", "name": "amis-core",
"version": "2.5.0", "version": "2.5.1",
"description": "amis-core", "description": "amis-core",
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",
@ -45,7 +45,7 @@
"esm" "esm"
], ],
"dependencies": { "dependencies": {
"amis-formula": "^2.5.0", "amis-formula": "^2.5.1",
"classnames": "2.3.1", "classnames": "2.3.1",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"hoist-non-react-statics": "^3.3.2", "hoist-non-react-statics": "^3.3.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "amis-formula", "name": "amis-formula",
"version": "2.5.0", "version": "2.5.1",
"description": "负责 amis 里面的表达式实现,内置公式,编辑器等", "description": "负责 amis 里面的表达式实现,内置公式,编辑器等",
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",

View File

@ -3,7 +3,7 @@
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"version": "2.5.0", "version": "2.5.1",
"description": "", "description": "",
"scripts": { "scripts": {
"build": "npm run clean-dist && NODE_ENV=production rollup -c ", "build": "npm run clean-dist && NODE_ENV=production rollup -c ",
@ -34,8 +34,9 @@
} }
}, },
"dependencies": { "dependencies": {
"amis-core": "^2.5.0", "@rc-component/mini-decimal": "^1.0.1",
"amis-formula": "^2.5.0", "amis-core": "^2.5.1",
"amis-formula": "^2.5.1",
"classnames": "2.3.1", "classnames": "2.3.1",
"codemirror": "^5.63.0", "codemirror": "^5.63.0",
"downshift": "6.1.12", "downshift": "6.1.12",

View File

@ -1604,7 +1604,7 @@ $remFactor: 16px;
--menu-font-color: #151b26; --menu-font-color: #151b26;
--menu-font-family: PingFangSC-Regular; --menu-font-family: PingFangSC-Regular;
--menu-border-color: #e8e9eb; // 默认的边框色 --menu-border-color: #e8e9eb; // 默认的边框色
--menu-active-color: var(--colors-brand-5) --menu-active-color: var(--colors-brand-5);
--menu-hover-bg-color: #e6f0ff; --menu-hover-bg-color: #e6f0ff;
--menu-disabled-color: #b8babf; // 禁用文字颜色 --menu-disabled-color: #b8babf; // 禁用文字颜色
--default-icon-color: #84868c; // 默认的icon颜色 --default-icon-color: #84868c; // 默认的icon颜色

View File

@ -5,7 +5,7 @@
*/ */
import React from 'react'; import React from 'react';
import moment from 'moment'; import moment, {unitOfTime} from 'moment';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
import kebabCase from 'lodash/kebabCase'; import kebabCase from 'lodash/kebabCase';
import {findDOMNode} from 'react-dom'; import {findDOMNode} from 'react-dom';
@ -1222,7 +1222,10 @@ export class DateRangePicker extends React.Component<
props.className += ' rdtActive rdtEndDay'; props.className += ' rdtActive rdtEndDay';
} }
const {className, ...others} = this.getDisabledElementProps(currentDate); const {className, ...others} = this.getDisabledElementProps(
currentDate,
'day'
);
props.className += className; props.className += className;
return ( return (
@ -1249,7 +1252,10 @@ export class DateRangePicker extends React.Component<
props.className += ' rdtBetween'; props.className += ' rdtBetween';
} }
const {className, ...others} = this.getDisabledElementProps(currentDate); const {className, ...others} = this.getDisabledElementProps(
currentDate,
'month'
);
props.className += className; props.className += className;
return ( return (
@ -1271,7 +1277,10 @@ export class DateRangePicker extends React.Component<
props.className += ' rdtBetween'; props.className += ' rdtBetween';
} }
const {className, ...others} = this.getDisabledElementProps(currentDate); const {className, ...others} = this.getDisabledElementProps(
currentDate,
'quarter'
);
props.className += className; props.className += className;
return ( return (
@ -1292,7 +1301,10 @@ export class DateRangePicker extends React.Component<
props.className += ' rdtBetween'; props.className += ' rdtBetween';
} }
const {className, ...others} = this.getDisabledElementProps(currentDate); const {className, ...others} = this.getDisabledElementProps(
currentDate,
'year'
);
props.className += className; props.className += className;
return ( return (
@ -1424,10 +1436,16 @@ export class DateRangePicker extends React.Component<
); );
} }
getDisabledElementProps(currentDate: moment.Moment) { getDisabledElementProps(
currentDate: moment.Moment,
granularity?: unitOfTime.StartOf
) {
const {endDateOpenedFirst, endDate, startDate, editState} = this.state; const {endDateOpenedFirst, endDate, startDate, editState} = this.state;
const afterEndDate = editState === 'start' && currentDate > endDate!; const afterEndDate =
const beforeStartDate = editState === 'end' && currentDate < startDate!; editState === 'start' && currentDate.isAfter(endDate!, granularity);
const beforeStartDate =
editState === 'end' &&
!currentDate.isSameOrAfter(startDate!, granularity);
if (afterEndDate || beforeStartDate) { if (afterEndDate || beforeStartDate) {
return { return {

View File

@ -4,12 +4,10 @@ import isInteger from 'lodash/isInteger';
import InputNumber from 'rc-input-number'; import InputNumber from 'rc-input-number';
import getMiniDecimal, { import getMiniDecimal, {
DecimalClass, DecimalClass,
toFixed toFixed,
} from 'rc-input-number/lib/utils/MiniDecimal';
import {
getNumberPrecision, getNumberPrecision,
num2str num2str
} from 'rc-input-number/lib/utils/numberUtil'; } from '@rc-component/mini-decimal';
import {Icon} from './icons'; import {Icon} from './icons';
import {ThemeProps, themeable} from 'amis-core'; import {ThemeProps, themeable} from 'amis-core';

View File

@ -344,7 +344,7 @@ exports[`Renderer:inputMonthRange with embed 1`] = `
</span> </span>
</td> </td>
<td <td
class="rdtMonth rdtActive rdtBetween is-disabled" class="rdtMonth rdtActive rdtBetween"
data-value="10" data-value="10"
> >
<span> <span>

View File

@ -99,7 +99,7 @@ exports[`Renderer:InputQuarterRange with embed 1`] = `
<th <th
class="rdtSwitch" class="rdtSwitch"
> >
2022 2021
</th> </th>
<th <th
class="rdtNext" class="rdtNext"
@ -176,7 +176,7 @@ exports[`Renderer:InputQuarterRange with embed 1`] = `
<th <th
class="rdtSwitch" class="rdtSwitch"
> >
2022 2021
</th> </th>
<th <th
class="rdtNext" class="rdtNext"

View File

@ -54,7 +54,7 @@ test('Renderer:InputQuarterRange click', async () => {
fireEvent.click( fireEvent.click(
await within( await within(
document.querySelector('.cxd-DateRangePicker-end')! document.querySelector('.cxd-DateRangePicker-start')!
).findByText('Q4') ).findByText('Q4')
); );
@ -82,7 +82,7 @@ test('Renderer:InputQuarterRange with embed', async () => {
label: '季度范围', label: '季度范围',
embed: true, embed: true,
format: 'YYYY-MM', format: 'YYYY-MM',
value: '2022-10,2022-12' value: '2021-10,2021-12'
} }
] ]
}, },

View File

@ -69,7 +69,6 @@ test('Renderer: input-table with default value column', async () => {
const onSubmitCallbackFn = jest const onSubmitCallbackFn = jest
.fn() .fn()
.mockImplementation((values: any, actions: any) => { .mockImplementation((values: any, actions: any) => {
console.log({values: JSON.stringify(values), actions: actions});
return true; return true;
}); });
const {container, getByText} = render( const {container, getByText} = render(

View File

@ -1,6 +1,6 @@
{ {
"name": "amis", "name": "amis",
"version": "2.5.0", "version": "2.5.1",
"description": "一种MIS页面生成工具", "description": "一种MIS页面生成工具",
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",
@ -41,8 +41,8 @@
] ]
}, },
"dependencies": { "dependencies": {
"amis-core": "^2.5.0", "amis-core": "^2.5.1",
"amis-ui": "^2.5.0", "amis-ui": "^2.5.1",
"attr-accept": "2.2.2", "attr-accept": "2.2.2",
"blueimp-canvastoblob": "2.1.0", "blueimp-canvastoblob": "2.1.0",
"classnames": "2.3.1", "classnames": "2.3.1",

View File

@ -28,6 +28,7 @@ const external = id => {
'react', 'react',
'react-dom', 'react-dom',
'rc-input-number', 'rc-input-number',
'@rc-component/mini-decimal',
'@babel/runtime' '@babel/runtime'
]) ])
.map(value => .map(value =>

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import {toFixed} from 'rc-input-number/lib/utils/MiniDecimal'; import {toFixed} from '@rc-component/mini-decimal';
import { import {
FormItem, FormItem,
FormControlProps, FormControlProps,

View File

@ -37,6 +37,7 @@ done
for f in $(find ./packages/*/lib -type f -name "*.[tj]s"); do for f in $(find ./packages/*/lib -type f -name "*.[tj]s"); do
sed -i '' -e "s/from \'amis/from \'@fex\/amis/g" $f sed -i '' -e "s/from \'amis/from \'@fex\/amis/g" $f
sed -i '' -e "s/import(\'amis/import(\'@fex\/amis/g" $f sed -i '' -e "s/import(\'amis/import(\'@fex\/amis/g" $f
sed -i '' -e "s/import[ ]*\'amis/import \'@fex\/amis/g" $f
sed -i '' -e "s/require(\'amis/require(\'@fex\/amis/g" $f sed -i '' -e "s/require(\'amis/require(\'@fex\/amis/g" $f
sed -i '' -e "s/require(\[\'amis/require(\[\'@fex\/amis/g" $f sed -i '' -e "s/require(\[\'amis/require(\[\'@fex\/amis/g" $f
done done
@ -44,6 +45,7 @@ done
for f in $(find ./packages/*/esm -type f -name "*.[tj]s"); do for f in $(find ./packages/*/esm -type f -name "*.[tj]s"); do
sed -i '' -e "s/from \'amis/from \'@fex\/amis/g" $f sed -i '' -e "s/from \'amis/from \'@fex\/amis/g" $f
sed -i '' -e "s/import(\'amis/import(\'@fex\/amis/g" $f sed -i '' -e "s/import(\'amis/import(\'@fex\/amis/g" $f
sed -i '' -e "s/import[ ]*\'amis/import \'@fex\/amis/g" $f
sed -i '' -e "s/require(\'amis/require(\'@fex\/amis/g" $f sed -i '' -e "s/require(\'amis/require(\'@fex\/amis/g" $f
sed -i '' -e "s/require(\[\'amis/require(\[\'@fex\/amis/g" $f sed -i '' -e "s/require(\[\'amis/require(\[\'@fex\/amis/g" $f
done done