Skip to content

Commit cc11cfc

Browse files
webpack bundling
1 parent e4a91e9 commit cc11cfc

File tree

279 files changed

+3211
-1134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+3211
-1134
lines changed

.DS_Store

0 Bytes
Binary file not shown.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"@testing-library/react": "^14.1.2",
7474
"@testing-library/user-event": "^14.5.1",
7575
"@types/styled-components": "^5.1.34",
76-
"antd-mobile": "^5.28.0",
76+
"antd-mobile": "^5.34.0",
7777
"chalk": "4",
7878
"number-precision": "^1.6.0",
7979
"react-player": "^2.11.0",

client/packages/lowcoder-comps/src/__test__/allComp.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import _ from "lodash";
1+
import { uniq } from "lodash";
22
import { CompConstructor, CustomAction } from "lowcoder-core";
33
import { evalAndReduce, isExposingMethodComp } from "lowcoder-sdk";
44
import { ChartCompWithDefault } from "comps/chartComp/chartComp";
@@ -56,6 +56,6 @@ test("comp exposing method duplicate name", () => {
5656
}
5757
});
5858
const allMethodName = methods.flatMap((m) => m.map((methodConfig) => methodConfig.name));
59-
expect(allMethodName.length).toEqual(_.uniq(allMethodName).length);
59+
expect(allMethodName.length).toEqual(uniq(allMethodName).length);
6060
});
6161
});

client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
import { AxisFormatterComp, EchartsAxisType } from "./chartConfigs/cartesianAxisConfig";
99
import { chartChildrenMap, ChartSize, getDataKeys } from "./chartConstants";
1010
import { chartPropertyView } from "./chartPropertyView";
11-
import _ from "lodash";
11+
import { noop, omit, isEqual } from "lodash";
1212
import { useContext, useEffect, useMemo, useRef, useState } from "react";
1313
import ReactResizeDetector from "react-resize-detector";
1414
import ReactECharts from "./reactEcharts";
@@ -79,7 +79,7 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
7979
// bind events
8080
const echartsCompInstance = echartsCompRef?.current?.getEchartsInstance();
8181
if (!echartsCompInstance) {
82-
return _.noop;
82+
return noop;
8383
}
8484
echartsCompInstance?.on("selectchanged", (param: any) => {
8585
const option: any = echartsCompInstance?.getOption();
@@ -96,7 +96,7 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
9696
return () => echartsCompInstance?.off("selectchanged");
9797
}, [mode, onUIEvent]);
9898

99-
const echartsConfigChildren = _.omit(comp.children, echartsConfigOmitChildren);
99+
const echartsConfigChildren = omit(comp.children, echartsConfigOmitChildren);
100100
const option = useMemo(() => {
101101
return getEchartsConfig(
102102
childrenToProps(echartsConfigChildren) as ToViewReturn<typeof echartsConfigChildren>,
@@ -111,7 +111,7 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
111111
const loadGoogleMapData = () => {
112112
const echartsCompInstance = echartsCompRef?.current?.getEchartsInstance();
113113
if (!echartsCompInstance) {
114-
return _.noop;
114+
return noop;
115115
}
116116

117117
comp.children.mapInstance.dispatch(changeValueAction(echartsCompInstance))
@@ -231,7 +231,7 @@ ChartTmpComp = class extends ChartTmpComp {
231231
};
232232
if (
233233
comp.children.chartConfig.children.comp.children.hasOwnProperty("itemColor") &&
234-
!_.isEqual(colorContextVal, comp.lastColorContext)
234+
!isEqual(colorContextVal, comp.lastColorContext)
235235
) {
236236
comp.lastColorContext = colorContextVal;
237237
resultComp = resultComp.setChild(

client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
isNumeric,
1212
} from "lowcoder-sdk";
1313
import { i18nObjs, trans } from "i18n/comps";
14-
import _, { isNil } from "lodash";
14+
import { min, max, isNil } from "lodash";
1515
import { xAxisTypeUrl } from "./chartUrls";
1616

1717
const XAxisTypeOptions = [
@@ -222,7 +222,7 @@ function calcTimeInterval(xAxisData: Array<JSONValue | undefined>) {
222222
return 1;
223223
}
224224
});
225-
return _.min(minIntervals);
225+
return min(minIntervals);
226226
}
227227

228228
let measureCanvas: HTMLCanvasElement;
@@ -257,7 +257,7 @@ export function calcXYConfig(
257257
if (resXConfig.type === "category" && chartSize) {
258258
const xAxisDataLenList = getXAxisDataLength(xAxisData);
259259
// get x-axis single data's max width
260-
const maxDataWidth = _.max(xAxisDataLenList);
260+
const maxDataWidth = max(xAxisDataLenList);
261261
const lastDataWidth = xAxisDataLenList[xAxisDataLenList.length - 1];
262262
// grid width
263263
let eachDataWidth = chartSize.w / xAxisData.length;

client/packages/lowcoder-comps/src/comps/chartComp/chartUtils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "comps/chartComp/chartConstants";
88
import { getPieRadiusAndCenter } from "comps/chartComp/chartConfigs/pieChartConfig";
99
import { EChartsOptionWithMap } from "./reactEcharts/types";
10-
import _ from "lodash";
10+
import { isArray, findIndex } from "lodash";
1111
import { chartColorPalette, isNumeric, JSONObject, loadScript } from "lowcoder-sdk";
1212
import { calcXYConfig } from "comps/chartComp/chartConfigs/cartesianAxisConfig";
1313
import Big from "big.js";
@@ -236,7 +236,7 @@ export function getEchartsConfig(props: EchartsConfigProps, chartSize?: ChartSiz
236236

237237
export function getSelectedPoints(param: any, option: any) {
238238
const series = option.series;
239-
const dataSource = _.isArray(option.dataset) && option.dataset[0]?.source;
239+
const dataSource = isArray(option.dataset) && option.dataset[0]?.source;
240240
if (series && dataSource) {
241241
return param.selected.flatMap((selectInfo: any) => {
242242
const seriesInfo = series[selectInfo.seriesIndex];
@@ -270,12 +270,12 @@ export function loadGoogleMapsScript(apiKey: string) {
270270
const mapsUrl = `${googleMapsApiUrl}?key=${apiKey}`;
271271
const scripts = document.getElementsByTagName('script');
272272
// is script already loaded
273-
let scriptIndex = _.findIndex(scripts, (script) => script.src.endsWith(mapsUrl));
273+
let scriptIndex = findIndex(scripts, (script) => script.src.endsWith(mapsUrl));
274274
if(scriptIndex > -1) {
275275
return scripts[scriptIndex];
276276
}
277277
// is script loaded with diff api_key, remove the script and load again
278-
scriptIndex = _.findIndex(scripts, (script) => script.src.startsWith(googleMapsApiUrl));
278+
scriptIndex = findIndex(scripts, (script) => script.src.startsWith(googleMapsApiUrl));
279279
if(scriptIndex > -1) {
280280
scripts[scriptIndex].remove();
281281
}

client/packages/lowcoder-comps/src/comps/chartComp/reactEcharts/core.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ECharts } from "echarts";
22
import { PureComponent } from "react";
33
import isEqual from "fast-deep-equal";
44
import { EChartsReactProps, EChartsInstance } from "./types";
5-
import _ from "lodash";
5+
import { pick } from "lodash";
66
import log from "loglevel";
77

88
function isString(v: any): boolean {
@@ -75,7 +75,7 @@ export default class EChartsReactCore extends PureComponent<EChartsReactProps> {
7575

7676
// when these props are not isEqual, update echarts
7777
const pickKeys = ["option", "notMerge", "lazyUpdate", "showLoading", "loadingOption"];
78-
if (!isEqual(_.pick(this.props, pickKeys), _.pick(prevProps, pickKeys))) {
78+
if (!isEqual(pick(this.props, pickKeys), pick(prevProps, pickKeys))) {
7979
this.updateEChartsOption();
8080
}
8181
}

client/packages/lowcoder-comps/src/comps/imageEditorComp/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
} from "lowcoder-sdk";
1515
import { useRef } from "react";
1616
import ReactResizeDetector from "react-resize-detector";
17-
import _ from "lodash";
1817
import { RecordConstructorToView } from "lowcoder-core";
1918
import { Container, customTheme, EmbeddedButton, saveEvent } from "./imageEditorConstants";
2019
import { ImageEditor } from "./imageEditorClass";

client/packages/lowcoder-core/src/actions/actions.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CompConstructor } from "baseComps/comp";
2-
import _ from "lodash";
2+
import { get, isNil } from "lodash";
33
import { JSONValue } from "util/jsonTypes";
44
import {
55
ActionContextType,
@@ -55,7 +55,7 @@ export function isMyCustomAction<T>(action: CompAction, type: string): action is
5555
}
5656

5757
export function isCustomAction<T>(action: CompAction, type: string): action is CustomAction<T> {
58-
return action.type === CompActionTypes.CUSTOM && _.get(action.value, "type") === type;
58+
return action.type === CompActionTypes.CUSTOM && get(action.value, "type") === type;
5959
}
6060

6161
/**
@@ -100,7 +100,7 @@ export function isBroadcastAction<T extends CompAction>(
100100
action: CompAction,
101101
type: T["type"]
102102
): action is BroadcastAction<T> {
103-
return action.type === CompActionTypes.BROADCAST && _.get(action.action, "type") === type;
103+
return action.type === CompActionTypes.BROADCAST && get(action.action, "type") === type;
104104
}
105105

106106
export function renameAction(oldName: string, name: string): BroadcastAction<RenameAction> {
@@ -133,7 +133,7 @@ export function multiChangeAction(changes: Record<string, CompAction>): MultiCha
133133
const editDSL = Object.values(changes).some((action) => !!action.editDSL);
134134
console.assert(
135135
Object.values(changes).every(
136-
(action) => !_.isNil(action.editDSL) && action.editDSL === editDSL
136+
(action) => !isNil(action.editDSL) && action.editDSL === editDSL
137137
),
138138
`multiChangeAction should wrap actions with the same editDSL value in property. editDSL: ${editDSL}\nchanges:`,
139139
changes

client/packages/lowcoder-core/src/baseComps/multiBaseComp.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
wrapChildAction,
88
} from "actions";
99
import { fromRecord, Node } from "eval";
10-
import _ from "lodash";
10+
import { mapValues, isEqual, omit, omitBy } from "lodash";
1111
import log from "loglevel";
1212
import { CACHE_PREFIX } from "util/cacheUtils";
1313
import { JSONValue } from "util/jsonTypes";
@@ -86,7 +86,7 @@ export abstract class MultiBaseComp<
8686
// log.debug("reduceOrUndefined. action: ", action, " this: ", this);
8787
// must handle DELETE in the parent level
8888
if (action.type === CompActionTypes.DELETE_COMP && action.path.length === 1) {
89-
return this.setChildren(_.omit(this.children, action.path[0]));
89+
return this.setChildren(omit(this.children, action.path[0]));
9090
}
9191
if (action.type === CompActionTypes.REPLACE_COMP && action.path.length === 1) {
9292
const NextComp = action.compFactory;
@@ -121,7 +121,7 @@ export abstract class MultiBaseComp<
121121
case CompActionTypes.MULTI_CHANGE: {
122122
const { changes } = action;
123123
// handle DELETE in the parent level
124-
let mcChildren = _.omitBy(this.children, (comp, childName) => {
124+
let mcChildren = omitBy(this.children, (comp, childName) => {
125125
const innerAction = changes[childName];
126126
return (
127127
innerAction &&
@@ -130,7 +130,7 @@ export abstract class MultiBaseComp<
130130
);
131131
});
132132
// CHANGE
133-
mcChildren = _.mapValues(mcChildren, (comp, childName) => {
133+
mcChildren = mapValues(mcChildren, (comp, childName) => {
134134
const innerAction = changes[childName];
135135
if (innerAction) {
136136
return comp.reduce(innerAction);
@@ -150,7 +150,7 @@ export abstract class MultiBaseComp<
150150
// console.info("inside: UPDATE_NODE_V2 cache hit. action: ", action, "\nvalue: ", value, "\nthis: ", this);
151151
return this;
152152
}
153-
const children = _.mapValues(this.children, (comp, childName) => {
153+
const children = mapValues(this.children, (comp, childName) => {
154154
if (value.hasOwnProperty(childName)) {
155155
return comp.reduce(updateNodesV2Action(value[childName]));
156156
}
@@ -180,7 +180,7 @@ export abstract class MultiBaseComp<
180180
}
181181
case CompActionTypes.BROADCAST: {
182182
return this.setChildren(
183-
_.mapValues(this.children, (comp) => {
183+
mapValues(this.children, (comp) => {
184184
return comp.reduce(action);
185185
})
186186
);
@@ -240,7 +240,7 @@ export abstract class MultiBaseComp<
240240
}
241241

242242
override changeDispatch(dispatch: DispatchType): this {
243-
const newChildren = _.mapValues(this.children, (comp, childName) => {
243+
const newChildren = mapValues(this.children, (comp, childName) => {
244244
return comp.changeDispatch(wrapDispatch(dispatch, childName));
245245
});
246246
return super.changeDispatch(dispatch).setChildren(newChildren, { keepCacheKeys: ["node"] });
@@ -261,7 +261,7 @@ export abstract class MultiBaseComp<
261261
return;
262262
}
263263
const value = comp.toJsonValue();
264-
if (ignore && _.isEqual(value, (comp as any)["IGNORABLE_DEFAULT_VALUE"])) {
264+
if (ignore && isEqual(value, (comp as any)["IGNORABLE_DEFAULT_VALUE"])) {
265265
return;
266266
}
267267
result[key] = value;

0 commit comments

Comments
 (0)