Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2bba8b8

Browse files
fix lowcoder-comps baseUrl in embedded apps
1 parent fcf6596 commit 2bba8b8

File tree

9 files changed

+22
-11
lines changed

9 files changed

+22
-11
lines changed

‎client/packages/lowcoder/src/comps/comps/fileViewerComp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import { UICompBuilder, withDefault } from "../generators";
1010
import { NameConfig, NameConfigHidden, withExposingConfigs } from "../generators/withExposing";
1111
import { hiddenPropertyView } from "comps/utils/propertyUtils";
1212
import { trans } from "i18n";
13-
import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";
1413
import { useContext } from "react";
1514
import { EditorContext } from "comps/editorState";
15+
import { AutoHeightControl } from "../controls/autoHeightControl";
16+
import { BoolControl } from "../controls/boolControl";
1617

1718
const getStyle = (style: FileViewerStyleType) => {
1819
return css`

‎client/packages/lowcoder/src/comps/comps/jsonComp/jsonEditorComp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import {
2020
} from "base/codeEditor/codeMirror";
2121
import { useExtensions } from "base/codeEditor/extensions";
2222
import { EditorContext } from "comps/editorState";
23-
import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";
23+
import { AutoHeightControl } from "@lowcoder-ee/comps/controls/autoHeightControl";
24+
import { BoolControl } from "@lowcoder-ee/comps/controls/boolControl";
2425

2526
/**
2627
* JsonEditor Comp

‎client/packages/lowcoder/src/comps/comps/jsonComp/jsonExplorerComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { EditorContext } from "comps/editorState";
1313
import { useContext, useEffect } from "react";
1414
import { AnimationStyle, AnimationStyleType } from "@lowcoder-ee/comps/controls/styleControlConstants";
1515
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
16-
import { AutoHeightControl } from "@lowcoder-ee/index.sdk";
16+
import { AutoHeightControl } from "@lowcoder-ee/comps/controls/autoHeightControl";
1717

1818
/**
1919
* JsonExplorer Comp

‎client/packages/lowcoder/src/comps/comps/remoteComp/loaders.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { NPM_PLUGIN_ASSETS_BASE_URL } from "constants/npmPlugins";
1+
import { sdkConfig } from "@lowcoder-ee/constants/sdkConfig";
2+
import { ASSETS_BASE_URL, NPM_PLUGIN_ASSETS_BASE_URL } from "constants/npmPlugins";
23
import { trans } from "i18n";
34
import { CompConstructor } from "lowcoder-core";
45
import {
@@ -17,7 +18,13 @@ async function npmLoader(
1718
// Falk: removed "packageVersion = "latest" as default value fir packageVersion - to ensure no automatic version jumping.
1819
const localPackageVersion = remoteInfo.packageVersion || "latest";
1920
const { packageName, packageVersion, compName } = remoteInfo;
20-
const entry = `${NPM_PLUGIN_ASSETS_BASE_URL}/${appId}/${packageName}@${localPackageVersion}/index.js`;
21+
22+
console.log('baseUrl', sdkConfig.baseURL);
23+
const pluginBaseUrl = REACT_APP_BUNDLE_TYPE === 'sdk' && sdkConfig.baseURL
24+
? `${sdkConfig.baseURL}/${ASSETS_BASE_URL}`
25+
: NPM_PLUGIN_ASSETS_BASE_URL;
26+
27+
const entry = `${pluginBaseUrl}/${appId}/${packageName}@${localPackageVersion}/index.js`;
2128

2229
try {
2330
const module = await import(

‎client/packages/lowcoder/src/comps/comps/selectInputComp/stepControl.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { RefControl } from "comps/controls/refControl";
1818
import { dropdownControl } from "comps/controls/dropdownControl";
1919
import { useContext, useState, useEffect } from "react";
2020
import { EditorContext } from "comps/editorState";
21-
import { AutoHeightControl } from "@lowcoder-ee/index.sdk";
2221
import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils";
22+
import { AutoHeightControl } from "@lowcoder-ee/comps/controls/autoHeightControl";
2323

2424
const sizeOptions = [
2525
{

‎client/packages/lowcoder/src/comps/comps/textComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { clickEvent, eventHandlerControl } from "../controls/eventHandlerControl
2424
import { NewChildren } from "../generators/uiCompBuilder";
2525
import { RecordConstructorToComp } from "lowcoder-core";
2626
import { ToViewReturn } from "../generators/multi";
27-
import { BoolControl } from "@lowcoder-ee/index.sdk";
27+
import { BoolControl } from "../controls/boolControl";
2828

2929
const EventOptions = [clickEvent] as const;
3030

‎client/packages/lowcoder/src/comps/comps/treeComp/treeComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { SelectEventHandlerControl } from "comps/controls/eventHandlerControl";
2828
import { trans } from "i18n";
2929
import { useContext } from "react";
3030
import { EditorContext } from "comps/editorState";
31-
import { AutoHeightControl } from "@lowcoder-ee/index.sdk";
31+
import { AutoHeightControl } from "@lowcoder-ee/comps/controls/autoHeightControl";
3232

3333
type TreeStyleType = StyleConfigType<typeof TreeStyle>;
3434

‎client/packages/lowcoder/src/constants/npmPlugins.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// export const NPM_REGISTRY_URL = `${SERVER_HOST}/node-service/api/npm/registry`;
33
// export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/node-service/api/npm/package`;
44

5+
export const REGISTRY_URL = `api/npm/registry`;
6+
export const ASSETS_BASE_URL = `api/npm/package`;
57
export const SERVER_HOST = `${REACT_APP_API_SERVICE_URL ?? ""}`;
6-
export const NPM_REGISTRY_URL = `${SERVER_HOST}/api/npm/registry`;
7-
export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/api/npm/package`;
8+
export const NPM_REGISTRY_URL = `${SERVER_HOST}/${REGISTRY_URL}`;
9+
export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/${ASSETS_BASE_URL}`;

‎client/packages/lowcoder/src/pages/editor/right/PluginPanel/PluginCompItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { LowcoderCompMeta } from "types/remoteComp";
1111
import { TransparentImg } from "util/commonUtils";
1212
import { ModuleIcon } from "lowcoder-design";
1313
import { NPM_PLUGIN_ASSETS_BASE_URL } from "constants/npmPlugins";
14-
import { useApplicationId } from "@lowcoder-ee/index.sdk";
14+
import { useApplicationId } from "@lowcoder-ee/util/hooks";
1515

1616
const ItemWrapper = styled.div`
1717
display: flex;

0 commit comments

Comments
 (0)