Skip to content

Commit

Permalink
feat: lodash-es instead of lodash (#2040)
Browse files Browse the repository at this point in the history
* feat: lodash-es instead of lodash

* feat: up
  • Loading branch information
zhangpaopao0609 authored Jan 25, 2025
1 parent 58ffcb1 commit e23ad04
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 68 deletions.
3 changes: 1 addition & 2 deletions js/color-picker/gradient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import isString from 'lodash/isString';
import isNull from 'lodash/isNull';
import { isString, isNull } from 'lodash-es';
/* eslint-disable no-param-reassign */
/**
* 用于反解析渐变字符串为对象
Expand Down
2 changes: 1 addition & 1 deletion js/date-picker/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isString from 'lodash/isString';
import { isString } from 'lodash-es';
import dayjs from 'dayjs';
import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear';
import isLeapYear from 'dayjs/plugin/isLeapYear';
Expand Down
3 changes: 1 addition & 2 deletions js/date-picker/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isFunction from 'lodash/isFunction';
import { isFunction, chunk } from 'lodash-es';
import dayjs from 'dayjs';
import dayJsIsBetween from 'dayjs/plugin/isBetween';
import weekOfYear from 'dayjs/plugin/weekOfYear';
Expand All @@ -7,7 +7,6 @@ import localeData from 'dayjs/plugin/localeData';
import quarterOfYear from 'dayjs/plugin/quarterOfYear';
import advancedFormat from 'dayjs/plugin/advancedFormat';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import chunk from 'lodash/chunk';
import { parseToDayjs } from './format';

dayjs.extend(weekOfYear);
Expand Down
4 changes: 1 addition & 3 deletions js/input-number/large-number.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import isString from 'lodash/isString';
import isNumber from 'lodash/isNumber';
import isObject from 'lodash/isObject';
import { isString, isNumber, isObject } from 'lodash-es';
import log from '../log/log';

export type InputNumberDecimalPlaces = number | { enableRound: boolean, places: number };
Expand Down
4 changes: 1 addition & 3 deletions js/input-number/number.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import isUndefined from 'lodash/isUndefined';
import { isUndefined, isString, isNumber } from 'lodash-es';
/** 普通数相关方法 */
import isString from 'lodash/isString';
import isNumber from 'lodash/isNumber';
import {
compareNumber,
formatENumber,
Expand Down
2 changes: 1 addition & 1 deletion js/slider/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isString from 'lodash/isString';
import { isString } from 'lodash-es';

/**
* 计算刻度区间值停止坐标
Expand Down
4 changes: 1 addition & 3 deletions js/table/tree-store.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import isUndefined from 'lodash/isUndefined';
import { isUndefined, get, set } from 'lodash-es';
/* eslint-disable class-methods-use-this */
/* eslint-disable no-param-reassign */
/* eslint-disable no-use-before-define */
import get from 'lodash/get';
import set from 'lodash/set';
import { isRowSelectedDisabled } from './utils';
import { PrimaryTableCol, TableRowState, TableRowValue, TableRowData } from './types';
import log from '../log';
Expand Down
4 changes: 1 addition & 3 deletions js/table/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import get from 'lodash/get';
import { isFunction, isNumber, get } from 'lodash-es';
import { BaseTableCol } from './types';

export function filterDataByIds(
Expand Down
6 changes: 1 addition & 5 deletions js/tree-v1/tree-node-model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import isUndefined from 'lodash/isUndefined';
import isBoolean from 'lodash/isBoolean';
import pick from 'lodash/pick';
import omit from 'lodash/omit';
import get from 'lodash/get';
import { isUndefined, isBoolean, pick, omit } from 'lodash-es';
import { TreeNode } from './tree-node';
import { OptionData } from '../common';
import {
Expand Down
8 changes: 1 addition & 7 deletions js/tree-v1/tree-node.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import isNull from 'lodash/isNull';
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import uniqueId from 'lodash/uniqueId';
import isBoolean from 'lodash/isBoolean';
import isNil from 'lodash/isNil';
import get from 'lodash/get';
import { isNull, isFunction, isNumber, uniqueId, isBoolean, isNil, get } from 'lodash-es';
import { TreeStore } from './tree-store';
import {
TreeNodeValue,
Expand Down
8 changes: 1 addition & 7 deletions js/tree-v1/tree-store.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import isArray from 'lodash/isArray';
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import isString from 'lodash/isString';
import difference from 'lodash/difference';
import camelCase from 'lodash/camelCase';
import isPlainObject from 'lodash/isPlainObject';
import { isArray, isFunction, isNumber, isString, difference, camelCase, isPlainObject } from 'lodash-es';
import mitt from 'mitt';

import { TreeNode } from './tree-node';
Expand Down
5 changes: 1 addition & 4 deletions js/tree/tree-node-model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import isUndefined from 'lodash/isUndefined';
import isBoolean from 'lodash/isBoolean';
import omit from 'lodash/omit';
import get from 'lodash/get';
import { isUndefined, isBoolean, omit, get } from 'lodash-es';
import { TreeNode } from './tree-node';
import { OptionData } from '../common';
import {
Expand Down
8 changes: 1 addition & 7 deletions js/tree/tree-node.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import isNull from 'lodash/isNull';
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import uniqueId from 'lodash/uniqueId';
import isBoolean from 'lodash/isBoolean';
import isNil from 'lodash/isNil';
import get from 'lodash/get';
import { isNull, isFunction, isNumber, uniqueId, isBoolean, isNil, get } from 'lodash-es';
import { TreeStore } from './tree-store';
import {
TreeNodeValue,
Expand Down
8 changes: 1 addition & 7 deletions js/tree/tree-store.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import isArray from 'lodash/isArray';
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import isString from 'lodash/isString';
import difference from 'lodash/difference';
import camelCase from 'lodash/camelCase';
import isPlainObject from 'lodash/isPlainObject';
import { isArray, isFunction, isNumber, isString, difference, camelCase, isPlainObject } from 'lodash-es';
import mitt from 'mitt';

import { TreeNode, privateKey } from './tree-node';
Expand Down
3 changes: 1 addition & 2 deletions js/upload/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import isFunction from 'lodash/isFunction';
import isNumber from 'lodash/isNumber';
import { isFunction, isNumber } from 'lodash-es';
/* eslint-disable no-param-reassign */
import { getCurrentDate, isOverSizeLimit } from './utils';
import xhr from './xhr';
Expand Down
2 changes: 1 addition & 1 deletion js/upload/xhr.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isFunction from 'lodash/isFunction';
import { isFunction } from 'lodash-es';
/* eslint-disable no-param-reassign */
import log from '../log/log';
import { UploadFile, XhrOptions } from './types';
Expand Down
2 changes: 1 addition & 1 deletion js/utils/calcTextareaHeight.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isNull from 'lodash/isNull';
import { isNull } from 'lodash-es';
import { calculateNodeSize } from './helper';

type CalculateStyleType = {
Expand Down
6 changes: 1 addition & 5 deletions js/utils/helper.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import isString from 'lodash/isString';
import isNull from 'lodash/isNull';
import isUndefined from 'lodash/isUndefined';
import isNumber from 'lodash/isNumber';
import isArray from 'lodash/isArray';
import { isString, isNull, isUndefined, isNumber, isArray } from 'lodash-es';

export function omit(obj: object, fields: string[]): object {
const shallowCopy = {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@babel/preset-flow": "^7.12.1",
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.0.3",
"@types/lodash": "4.17.13",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/experimental-utils": "^2.24.0",
Expand Down Expand Up @@ -80,7 +80,7 @@
}
},
"dependencies": {
"lodash": "^4.17.15",
"lodash-es": "^4.17.21",
"mitt": "^3.0.0",
"tinycolor2": "^1.4.2"
},
Expand Down
4 changes: 2 additions & 2 deletions test/script/generate-demo-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const path = require('path');
const camelCase = require('lodash/camelCase');
const upperFirst = require('lodash/upperFirst');
const { camelCase } = require('lodash-es');
const { upperFirst } = require('lodash-es');

function resolveCwd(...args) {
args.unshift(process.cwd());
Expand Down

0 comments on commit e23ad04

Please sign in to comment.