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/*"],
"version": "2.5.0"
"version": "2.5.1"
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ test('Renderer:InputQuarterRange click', async () => {
fireEvent.click(
await within(
document.querySelector('.cxd-DateRangePicker-end')!
document.querySelector('.cxd-DateRangePicker-start')!
).findByText('Q4')
);
@ -82,7 +82,7 @@ test('Renderer:InputQuarterRange with embed', async () => {
label: '季度范围',
embed: true,
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
.fn()
.mockImplementation((values: any, actions: any) => {
console.log({values: JSON.stringify(values), actions: actions});
return true;
});
const {container, getByText} = render(

View File

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

View File

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

View File

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

View File

@ -37,6 +37,7 @@ done
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/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
done
@ -44,6 +45,7 @@ done
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/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
done