Skip to content

Commit 5cc7ebe

Browse files
authored
Merge branch 'dev' into subscription-handling
2 parents 88ec6f4 + b21c044 commit 5cc7ebe

File tree

43 files changed

+788
-295
lines changed

Some content is hidden

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

43 files changed

+788
-295
lines changed

client/packages/lowcoder-design/src/components/tacoInput.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,14 @@ const FormInput = (props: {
331331
check: (value: string) => boolean;
332332
};
333333
formName?: string;
334+
onBlur?: () => void;
334335
onChange?: (value: string, valid: boolean) => void;
335336
className?: string;
336337
inputRef?: Ref<InputRef>;
337338
msg?: string;
339+
defaultValue?: string;
338340
}) => {
339-
const { mustFill, checkRule, label, placeholder, onChange, formName, className, inputRef } =
341+
const { mustFill, checkRule, label, placeholder, onBlur, onChange, formName, className, inputRef, defaultValue } =
340342
props;
341343
const [valueValid, setValueValid] = useState(true);
342344
return (
@@ -350,6 +352,7 @@ const FormInput = (props: {
350352
ref={inputRef}
351353
name={formName}
352354
placeholder={placeholder}
355+
defaultValue={defaultValue}
353356
onChange={(e) => {
354357
let valid = true;
355358
if (checkRule) {
@@ -358,6 +361,7 @@ const FormInput = (props: {
358361
}
359362
onChange && onChange(e.target.value, valid);
360363
}}
364+
onBlur={() => onBlur?.()}
361365
/>
362366
</FormInputFiled>
363367
);

client/packages/lowcoder-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-sdk",
3-
"version": "2.4.14",
3+
"version": "2.4.16",
44
"type": "module",
55
"files": [
66
"src",

client/packages/lowcoder/src/api/applicationApi.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class ApplicationApi extends Api {
9898
static publicToMarketplaceURL = (applicationId: string) => `/applications/${applicationId}/public-to-marketplace`;
9999
static getMarketplaceAppURL = (applicationId: string) => `/applications/${applicationId}/view_marketplace`;
100100
static setAppEditingStateURL = (applicationId: string) => `/applications/editState/${applicationId}`;
101+
static serverSettingsURL = () => `/serverSettings`;
101102

102103
static fetchHomeData(request: HomeDataPayload): AxiosPromise<HomeDataResponse> {
103104
return Api.get(ApplicationApi.fetchHomeDataURL, request);
@@ -240,6 +241,10 @@ class ApplicationApi extends Api {
240241
editingFinished,
241242
});
242243
}
244+
245+
static fetchServerSettings(): AxiosPromise<any> {
246+
return Api.get(ApplicationApi.serverSettingsURL());
247+
}
243248
}
244249

245250
export default ApplicationApi;

client/packages/lowcoder/src/api/idSourceApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class IdSourceApi extends Api {
4444
return Api.post(IdSourceApi.saveConfigURL, request);
4545
}
4646

47-
static deleteConfig(id: string): AxiosPromise<ApiResponse> {
48-
return Api.delete(IdSourceApi.deleteConfigURL(id));
47+
static deleteConfig(id: string, deleteConfig?: boolean): AxiosPromise<ApiResponse> {
48+
return Api.delete(IdSourceApi.deleteConfigURL(id), {delete: deleteConfig});
4949
}
5050

5151
static syncManual(authType: string): AxiosPromise<ApiResponse> {

client/packages/lowcoder/src/api/orgApi.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export class OrgApi extends Api {
5252
static deleteOrgURL = (orgId: string) => `/organizations/${orgId}`;
5353
static updateOrgURL = (orgId: string) => `/organizations/${orgId}/update`;
5454
static fetchUsage = (orgId: string) => `/organizations/${orgId}/api-usage`;
55+
static fetchOrgsByEmailURL = (email: string) => `organizations/byuser/${email}`;
5556

5657
static createGroup(request: { name: string }): AxiosPromise<GenericApiResponse<OrgGroup>> {
5758
return Api.post(OrgApi.createGroupURL, request);
@@ -141,6 +142,9 @@ export class OrgApi extends Api {
141142
return Api.get(OrgApi.fetchUsage(orgId), { lastMonthOnly: true });
142143
}
143144

145+
static fetchOrgsByEmail(email: string): AxiosPromise<ApiResponse> {
146+
return Api.get(OrgApi.fetchOrgsByEmailURL(email));
147+
}
144148
}
145149

146150
export default OrgApi;

client/packages/lowcoder/src/app.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
ADMIN_APP_URL,
2929
ORG_AUTH_FORGOT_PASSWORD_URL,
3030
ORG_AUTH_RESET_PASSWORD_URL,
31+
ADMIN_AUTH_URL,
3132
} from "constants/routesURL";
3233
import React from "react";
3334
import { createRoot } from "react-dom/client";
@@ -55,7 +56,7 @@ import { getBrandingConfig } from "./redux/selectors/configSelectors";
5556
import { buildMaterialPreviewURL } from "./util/materialUtils";
5657
import GlobalInstances from 'components/GlobalInstances';
5758
// import posthog from 'posthog-js'
58-
import { fetchHomeData } from "./redux/reduxActions/applicationActions";
59+
import { fetchHomeData, fetchServerSettingsAction } from "./redux/reduxActions/applicationActions";
5960
import { getNpmPackageMeta } from "./comps/utils/remote";
6061
import { packageMetaReadyAction, setLowcoderCompsLoading } from "./redux/reduxActions/npmPluginActions";
6162

@@ -94,6 +95,7 @@ type AppIndexProps = {
9495
fetchHomeData: (currentUserAnonymous?: boolean | undefined) => void;
9596
fetchLowcoderCompVersions: () => void;
9697
getCurrentUser: () => void;
98+
fetchServerSettings: () => void;
9799
favicon: string;
98100
brandName: string;
99101
uiLanguage: string;
@@ -102,6 +104,7 @@ type AppIndexProps = {
102104
class AppIndex extends React.Component<AppIndexProps, any> {
103105
componentDidMount() {
104106
this.props.getCurrentUser();
107+
this.props.fetchServerSettings();
105108
// if (!this.props.currentUserAnonymous) {
106109
// this.props.fetchHomeData(this.props.currentUserAnonymous);
107110
// }
@@ -337,6 +340,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
337340
// component={ApplicationListPage}
338341
component={LazyApplicationHome}
339342
/>
343+
<LazyRoute exact path={ADMIN_AUTH_URL} component={LazyUserAuthComp} />
340344
<LazyRoute path={USER_AUTH_URL} component={LazyUserAuthComp} />
341345
<LazyRoute
342346
path={ORG_AUTH_LOGIN_URL}
@@ -437,6 +441,9 @@ const mapDispatchToProps = (dispatch: any) => ({
437441
dispatch(setLowcoderCompsLoading(false));
438442
}
439443
},
444+
fetchServerSettings: () => {
445+
dispatch(fetchServerSettingsAction());
446+
}
440447
});
441448

442449
const AppIndexWithProps = connect(mapStateToProps, mapDispatchToProps)(AppIndex);

client/packages/lowcoder/src/appView/AppViewInstance.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ export class AppViewInstance<I = any, O = any> {
105105
});
106106

107107
await DatasourceApi.fetchJsDatasourceByApp(this.appId).then((res) => {
108-
res.data.data.forEach((i) => {
108+
res.data?.data?.forEach((i) => {
109109
registryDataSourcePlugin(i.type, i.id, i.pluginDefinition);
110110
});
111111
});
112112

113113
setGlobalSettings({
114-
orgCommonSettings: data.data.orgCommonSettings,
114+
orgCommonSettings: data?.data?.orgCommonSettings,
115115
});
116116

117-
finalAppDsl = data.data.applicationDSL;
118-
finalModuleDslMap = data.data.moduleDSL;
117+
finalAppDsl = data?.data?.applicationDSL || {};
118+
finalModuleDslMap = data?.data?.moduleDSL || {};
119119
}
120120

121121
if (this.options.moduleInputs && this.isModuleDSL(finalAppDsl)) {

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: 8 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,12 @@ 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+
const pluginBaseUrl = REACT_APP_BUNDLE_TYPE === 'sdk' && sdkConfig.baseURL
23+
? `${sdkConfig.baseURL}/${ASSETS_BASE_URL}`
24+
: NPM_PLUGIN_ASSETS_BASE_URL;
25+
26+
const entry = `${pluginBaseUrl}/${appId}/${packageName}@${localPackageVersion}/index.js`;
2127

2228
try {
2329
const module = await import(

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { CompContext } from "@lowcoder-ee/comps/utils/compContext";
1616
import React from "react";
1717
import type { AppState } from "@lowcoder-ee/redux/reducers";
1818
import { useSelector } from "react-redux";
19-
import { useApplicationId } from "@lowcoder-ee/util/hooks";
19+
import { ExternalEditorContext } from "@lowcoder-ee/util/context/ExternalEditorContext";
2020

2121
const ViewError = styled.div`
2222
display: flex;
@@ -63,7 +63,8 @@ const RemoteCompView = React.memo((props: React.PropsWithChildren<RemoteCompView
6363
const [error, setError] = useState<any>("");
6464
const editorState = useContext(EditorContext);
6565
const compState = useContext(CompContext);
66-
const appId = useApplicationId();
66+
const externalEditorState = useContext(ExternalEditorContext);
67+
const appId = externalEditorState.applicationId;
6768
const lowcoderCompPackageVersion = editorState?.getAppSettings().lowcoderCompVersion || 'latest';
6869
const latestLowcoderCompsVersion = useSelector((state: AppState) => state.npmPlugin.packageVersion['lowcoder-comps']);
6970

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/comps/utils/remote.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export function parseCompType(compType: string) {
3939
}
4040

4141
export async function getNpmPackageMeta(packageName: string) {
42-
const res = await axios.get<NpmPackageMeta>(`${NPM_REGISTRY_URL}/none/${packageName}`);
42+
const axiosInstance = axios.create({
43+
baseURL: NPM_REGISTRY_URL,
44+
withCredentials: true,
45+
})
46+
const res = await axiosInstance.get<NpmPackageMeta>(
47+
`/none/${packageName}`,
48+
);
4349
if (res.status >= 400) {
4450
return null;
4551
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// export const SERVER_HOST = `${REACT_APP_NODE_SERVICE_URL ?? ""}`;
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`;
4-
4+
export const ASSETS_BASE_URL = `api/npm/package`;
55
export const SERVER_HOST = `${REACT_APP_API_SERVICE_URL ?? ""}`;
66
export const NPM_REGISTRY_URL = `${SERVER_HOST}/api/npm/registry`;
77
export const NPM_PLUGIN_ASSETS_BASE_URL = `${SERVER_HOST}/api/npm/package`;

client/packages/lowcoder/src/constants/reduxActionConstants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ export const ReduxActionTypes = {
145145
FETCH_ALL_MARKETPLACE_APPS: "FETCH_ALL_MARKETPLACE_APPS",
146146
FETCH_ALL_MARKETPLACE_APPS_SUCCESS: "FETCH_ALL_MARKETPLACE_APPS_SUCCESS",
147147
SET_APP_EDITING_STATE: "SET_APP_EDITING_STATE",
148+
FETCH_SERVER_SETTINGS: "FETCH_SERVER_SETTINGS",
149+
FETCH_SERVER_SETTINGS_SUCCESS: "FETCH_SERVER_SETTINGS_SUCCESS",
148150

149151
/* user profile */
150152
SET_USER_PROFILE_SETTING_MODAL_VISIBLE: "SET_USER_PROFILE_SETTING_MODAL_VISIBLE",

client/packages/lowcoder/src/constants/routesURL.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { UserGuideLocationState } from "pages/tutorials/tutorialsConstant";
44
import { DatasourceType } from "@lowcoder-ee/constants/queryConstants";
55

66
export const BASE_URL = "/";
7+
export const ADMIN_AUTH_URL = "/admin/login";
78
export const USER_AUTH_URL = "/user/auth";
89
export const USER_PROFILE_URL = "/user/profile";
910
export const NEWS_URL = "/news";

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,11 @@ export const en = {
30643064
"resetSuccessDesc": "Password Reset Succeeded. The New Password is: {password}",
30653065
"resetLostPasswordSuccess": "Password Reset Succeeded. Please login again.",
30663066
"copyPassword": "Copy Password",
3067-
"poweredByLowcoder": "Powered by: Lowcoder.cloud"
3067+
"poweredByLowcoder": "Powered by: Lowcoder.cloud",
3068+
"continue": "Continue",
3069+
"enterPassword": "Enter your password",
3070+
"selectAuthProvider": "Select Authentication Provider",
3071+
"selectWorkspace": "Select your workspace",
30683072
},
30693073
"preLoad": {
30703074
"jsLibraryHelpText": "Add JavaScript Libraries to Your Current Application via URL Addresses. lodash, day.js, uuid, numbro are Built into the System for Immediate Use. JavaScript Libraries are Loaded Before the Application is Initialized, Which Can Have an Impact on Application Performance.",
@@ -3598,12 +3602,13 @@ export const en = {
35983602
"formSelectPlaceholder": "Please Select the {label}",
35993603
"saveSuccess": "Saved Successfully",
36003604
"dangerLabel": "Danger Zone",
3601-
"dangerTip": "Disabling This ID Provider May Result in Some Users Being Unable to Log In. Proceed With Caution.",
3605+
"dangerTip": "Disabling or Deleting This ID Provider May Result in Some Users Being Unable to Log In. Proceed With Caution.",
3606+
"lastEnabledConfig": "You can't disable/delete config as this is the only enabled configuration.",
36023607
"disable": "Disable",
36033608
"disableSuccess": "Disabled Successfully",
36043609
"encryptedServer": "-------- Encrypted on the Server Side --------",
36053610
"disableTip": "Tips",
3606-
"disableContent": "Disabling This ID Provider May Result in Some Users Being Unable to Log In. Are You Sure to Proceed?",
3611+
"disableContent": "{action} This ID Provider May Result in Some Users Being Unable to Log In. Are You Sure to Proceed?",
36073612
"manualTip": "",
36083613
"lockTip": "The Content is Locked. To Make Changes, Please Click the {icon} to Unlock.",
36093614
"lockModalContent": "Changing the 'ID Attribute' Field Can Have Significant Impacts on User Identification. Please Confirm That You Understand the Implications of This Change Before Proceeding.",

client/packages/lowcoder/src/layout/gridLayout.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class GridLayout extends React.Component<GridLayoutProps, GridLayoutState> {
214214
*/
215215
containerHeight(): string {
216216
const { margin, rowHeight, fixedRowCount, isCanvas } = this.props as Required<GridLayoutProps>;
217-
const { extraHeight, emptyRows } = this.props;
217+
const { emptyRows } = this.props;
218218
const positionParams = genPositionParams(this.props);
219219
const { containerPadding } = positionParams;
220220
const layout = this.getUILayout(undefined, true);
@@ -227,9 +227,7 @@ class GridLayout extends React.Component<GridLayoutProps, GridLayoutState> {
227227
nbRow * rowHeight + (nbRow - 1) * margin[1] + containerPadding[1] * 2
228228
);
229229
// log.debug("layout: containerHeigh=", containerHeight, " minHeight: ", this.props.minHeight);
230-
const height = extraHeight
231-
? `calc(${containerHeight}px + ${extraHeight})`
232-
: containerHeight + "px";
230+
const height = `${containerHeight}px`;
233231
// log.log( "containerHeight. nbRow: ", nbRow, " containerPadding: ", containerPadding[1], " containerHeight: ", containerHeight, " height: ", height);
234232
return height;
235233
}

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)