mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
perf(bundlesize): remove lodash padStart/padEnd (#39040)
This commit is contained in:
parent
38e413e600
commit
aae35a4d3c
@ -1,5 +1,4 @@
|
||||
import classNames from 'classnames';
|
||||
import padStart from 'lodash/padStart';
|
||||
import { PickerPanel as RCPickerPanel } from 'rc-picker';
|
||||
import type { GenerateConfig } from 'rc-picker/lib/generate';
|
||||
import type { Locale } from 'rc-picker/lib/interface';
|
||||
@ -198,7 +197,7 @@ function generateCalendar<DateType>(generateConfig: GenerateConfig<DateType>) {
|
||||
})}
|
||||
>
|
||||
<div className={`${calendarPrefixCls}-date-value`}>
|
||||
{padStart(String(generateConfig.getDate(date)), 2, '0')}
|
||||
{String(generateConfig.getDate(date)).padStart(2, '0')}
|
||||
</div>
|
||||
<div className={`${calendarPrefixCls}-date-content`}>
|
||||
{dateCellRender && dateCellRender(date)}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import padEnd from 'lodash/padEnd';
|
||||
import * as React from 'react';
|
||||
import type { FormatConfig, valueType } from './utils';
|
||||
|
||||
@ -30,7 +29,7 @@ const StatisticNumber: React.FC<NumberProps> = (props) => {
|
||||
int = int.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
|
||||
|
||||
if (typeof precision === 'number') {
|
||||
decimal = padEnd(decimal, precision, '0').slice(0, precision > 0 ? precision : 0);
|
||||
decimal = decimal.padEnd(precision, '0').slice(0, precision > 0 ? precision : 0);
|
||||
}
|
||||
|
||||
if (decimal) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import padStart from 'lodash/padStart';
|
||||
import type * as React from 'react';
|
||||
|
||||
export type valueType = number | string;
|
||||
@ -46,7 +45,7 @@ export function formatTimeStr(duration: number, format: string) {
|
||||
leftDuration -= value * unit;
|
||||
return current.replace(new RegExp(`${name}+`, 'g'), (match: string) => {
|
||||
const len = match.length;
|
||||
return padStart(value.toString(), len, '0');
|
||||
return value.toString().padStart(len, '0');
|
||||
});
|
||||
}
|
||||
return current;
|
||||
|
Loading…
Reference in New Issue
Block a user