Skip to content

Commit

Permalink
Merge branch 'versions-for-datasources' into feature/spec_version
Browse files Browse the repository at this point in the history
  • Loading branch information
FalkWolsky committed Aug 9, 2024
2 parents 03688bf + b1f1ede commit 1ca3b02
Show file tree
Hide file tree
Showing 28 changed files with 3,782 additions and 4,548 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ application-lowcoder.yml
application-debug.yaml
application-dev-localhost.yaml
.vscode/settings.json
.vscode/launch.json
.vscode/launch.json
server/api-service/lowcoder-server/src/main/resources/application-local-dev.yaml
2 changes: 1 addition & 1 deletion client/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.4
2.4.5
2 changes: 1 addition & 1 deletion client/packages/lowcoder-comps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-comps",
"version": "2.4.10",
"version": "2.4.13",
"type": "module",
"license": "MIT",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let childrenMap: any = {
resourcesEvents: jsonValueExposingStateControl("resourcesEvents", resourcesEventsDefaultData),
resources: jsonValueExposingStateControl("resources", resourcesDefaultData),
resourceName: withDefault(StringControl, trans("calendar.resourcesDefault")),
onEvent: CalendarEventHandlerControl,
onEvent: CalendarEventHandlerControl ? CalendarEventHandlerControl : ChangeEventHandlerControl,
// onDropEvent: safeDragEventHandlerControl,
editable: withDefault(BoolControl, true),
showEventTime: withDefault(BoolControl, true),
Expand Down Expand Up @@ -124,10 +124,10 @@ let CalendarBasicComp = (function () {
currentPremiumView?: string;
}, dispatch: any) => {

const comp = useContext(EditorContext).getUICompByName(
useContext(CompNameContext)
const comp = useContext(EditorContext).getUICompByName(
useContext(CompNameContext)
);
const onEventVal = comp?.toJsonValue().comp.onEvent;
const onEventVal = comp?.toJsonValue()?.comp?.onEvent;


const theme = useContext(ThemeContext);
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lowcoder-sdk",
"version": "2.4.10",
"version": "2.4.11",
"type": "module",
"files": [
"src",
Expand Down
7 changes: 3 additions & 4 deletions client/packages/lowcoder/src/api/subscriptionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type ResponseType = {
response: any;
};

const apiUrl = "https://flow.lowcoder.cloud/webhook/secure";
const apiUrl = "http://localhost:8080/api/flow";
const authHeader = "96a99c7b-3758-4c48-b4b1-a8cbf59e7d6c";

const currentPage = 1;
Expand All @@ -41,7 +41,7 @@ const getAxiosInstance = (clientSecret?: string) => {

const headers: Record<string, string> = {
"Content-Type": "application/json",
"Lowcoder-Token": authHeader,
// "Lowcoder-Token": authHeader,
}

const apiRequestConfig: AxiosRequestConfig = {
Expand All @@ -55,13 +55,12 @@ const getAxiosInstance = (clientSecret?: string) => {

class SubscriptionApi extends Api {

static async createCustomer(body: Customer): Promise<any> {
static async createCustomer(body: any): Promise<any> {
console.log("createCustomerCall", body);

let response;
try {
response = await getAxiosInstance().request({
url: '/create-customer',
method: "POST",
withCredentials: true,
data: body,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Section, sectionNames } from "lowcoder-design";
import { ScrollBar, Section, sectionNames } from "lowcoder-design";
import { UICompBuilder } from "../../generators";
import { NameConfigHidden, NameConfig, withExposingConfigs } from "../../generators/withExposing";
import { defaultData } from "./jsonConstants";
Expand All @@ -21,17 +21,18 @@ import {
import { useExtensions } from "base/codeEditor/extensions";
import { EditorContext } from "comps/editorState";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";

/**
* JsonEditor Comp
*/

const Wrapper = styled.div`
const Wrapper = styled.div<{$height: boolean; $showVerticalScrollbar: boolean}>`
background-color: #fff;
border: 1px solid #d7d9e0;
border-radius: 4px;
overflow: auto;
height: 100%;
overflow-y: ${props => (props.$showVerticalScrollbar ? 'scroll' : 'auto')};
`;

/**
Expand Down Expand Up @@ -63,11 +64,13 @@ function fixOldDataSecond(oldData: any) {
}

const childrenMap = {
value: jsonValueExposingStateControl("value", defaultData),
value: jsonValueExposingStateControl('value', defaultData),
onEvent: ChangeEventHandlerControl,
label: withDefault(LabelControl, { position: "column" }),
autoHeight: withDefault(AutoHeightControl,'auto'),
showVerticalScrollbar:BoolControl,
label: withDefault(LabelControl, {position: 'column'}),
style: styleControl(JsonEditorStyle, 'style'),
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
...formDataChildren,
};

Expand All @@ -77,6 +80,8 @@ let JsonEditorTmpComp = (function () {

const wrapperRef = useRef<HTMLDivElement>(null);
const view = useRef<EditorViewType | null>(null);
const initialized = useRef(false);
const state = useRef<EditorState | null>(null);
const editContent = useRef<string>();
const { extensions } = useExtensions({
codeType: "PureJSON",
Expand All @@ -99,15 +104,21 @@ let JsonEditorTmpComp = (function () {
});

useEffect(() => {
if (wrapperRef.current && !view.current) {
const state = EditorState.create({
if (!initialized.current && wrapperRef.current) {
state.current = EditorState.create({
doc: JSON.stringify(props.value.value, null, 2),
extensions,
});
view.current = new EditorView({ state, parent: wrapperRef.current });
}
}, [wrapperRef.current]);

useEffect(() => {
if (state.current&&wrapperRef.current) {
view.current = new EditorView({ state: state.current, parent: wrapperRef.current });
initialized.current = true;
}
}, [props.showVerticalScrollbar])

if (wrapperRef.current && view.current && !editContent.current) {
const state = EditorState.create({
doc: JSON.stringify(props.value.value, null, 2),
Expand All @@ -121,7 +132,16 @@ let JsonEditorTmpComp = (function () {
return props.label({
style: props.style,
animationStyle: props.animationStyle,
children: <Wrapper ref={wrapperRef} onFocus={() => (editContent.current = "focus")} />,
children: (
<ScrollBar hideScrollbar={!props.showVerticalScrollbar}>
<Wrapper
ref={wrapperRef}
onFocus={() => (editContent.current = 'focus')}
$height={props.autoHeight}
$showVerticalScrollbar={props.showVerticalScrollbar}
/>
</ScrollBar>
),
});
})
.setPropertyViewFn((children) => {
Expand All @@ -139,7 +159,13 @@ let JsonEditorTmpComp = (function () {
{hiddenPropertyView(children)}
</Section>
)}

<Section name={trans('prop.height')}>
{children.autoHeight.propertyView({ label: trans('prop.height') })}
</Section>
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({label: trans('prop.showVerticalScrollbar')})}

</Section>}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && ( children.label.getPropertyView() )}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
Expand All @@ -160,7 +186,7 @@ JsonEditorTmpComp = migrateOldData(JsonEditorTmpComp, fixOldDataSecond);

JsonEditorTmpComp = class extends JsonEditorTmpComp {
override autoHeight(): boolean {
return false;
return this.children.autoHeight.getView();
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Section, sectionNames } from "lowcoder-design";
import { ScrollBar, Section, sectionNames } from "lowcoder-design";
import { UICompBuilder, withDefault } from "../../generators";
import { NameConfigHidden, NameConfig, withExposingConfigs } from "../../generators/withExposing";
import ReactJson, { type ThemeKeys } from "react-json-view";
Expand All @@ -14,6 +14,7 @@ import { useContext, useEffect } from "react";
import { AnimationStyle, AnimationStyleType } from "@lowcoder-ee/comps/controls/styleControlConstants";
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
import { AutoHeightControl } from "@lowcoder-ee/index.sdk";

/**
* JsonExplorer Comp
Expand Down Expand Up @@ -44,7 +45,7 @@ const JsonExplorerContainer = styled.div<{
${(props) => props.$animationStyle}
height: 100%;
overflow-y: scroll;
background-color: ${(props) => bgColorMap[props.$theme] || "#ffffff"};
background-color: ${(props) => bgColorMap[props.$theme] || '#ffffff'};
border: 1px solid #d7d9e0;
border-radius: 4px;
padding: 10px;
Expand All @@ -53,6 +54,8 @@ const JsonExplorerContainer = styled.div<{
let JsonExplorerTmpComp = (function () {
const childrenMap = {
value: withDefault(ArrayOrJSONObjectControl, JSON.stringify(defaultData, null, 2)),
autoHeight: withDefault(AutoHeightControl, 'auto'),
showVerticalScrollbar:BoolControl,
indent: withDefault(NumberControl, 4),
expandToggle: BoolControl.DEFAULT_TRUE,
theme: dropdownControl(themeOptions, 'shapeshifter:inverted'),
Expand All @@ -66,22 +69,24 @@ let JsonExplorerTmpComp = (function () {
$theme={props.theme as keyof typeof bgColorMap}
$animationStyle={props.animationStyle}
>
<ReactJson
name={false}
src={props.value}
theme={props.theme as ThemeKeys}
collapsed={!props.expandToggle}
displayDataTypes={false}
indentWidth={props.indent}
/>
<ScrollBar hideScrollbar={!props.showVerticalScrollbar}>
<ReactJson
name={false}
src={props.value}
theme={props.theme as ThemeKeys}
collapsed={!props.expandToggle}
displayDataTypes={false}
indentWidth={props.indent}
/>
</ScrollBar>
</JsonExplorerContainer>
)
);
})
.setPropertyViewFn((children) => {
return (
<>
<Section name={sectionNames.basic}>
{children.value.propertyView({ label: trans("export.jsonEditorDesc") })}
{children.value.propertyView({ label: trans("export.jsonEditorDesc") })}
</Section>

{(useContext(EditorContext).editorModeStatus === "logic" || useContext(EditorContext).editorModeStatus === "both") && (
Expand All @@ -96,7 +101,14 @@ let JsonExplorerTmpComp = (function () {
{children.indent.propertyView({ label: trans("jsonExplorer.indent") })}
</Section>
)}

<Section name={trans('prop.height')}>
{children.autoHeight.propertyView({label: trans('prop.height')})}
</Section>
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({
label: trans('prop.showVerticalScrollbar'),
})}
</Section>}
{(useContext(EditorContext).editorModeStatus === 'layout' ||
useContext(EditorContext).editorModeStatus === 'both') && (
<>
Expand All @@ -118,7 +130,7 @@ let JsonExplorerTmpComp = (function () {

JsonExplorerTmpComp = class extends JsonExplorerTmpComp {
override autoHeight(): boolean {
return false;
return this.children.autoHeight.getView();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const BackgroundWrapper = styled.div<{
$tableAutoHeight: boolean;
$showHorizontalScrollbar: boolean;
$showVerticalScrollbar: boolean;
$fixedToolbar: boolean;
}>`
display: flex;
flex-direction: column;
Expand All @@ -158,8 +159,15 @@ const BackgroundWrapper = styled.div<{
overflow: hidden;
> div.table-scrollbar-wrapper {
height: auto;
overflow: auto;
${(props) => props.$fixedToolbar && `height: auto`};
${(props) => (props.$showHorizontalScrollbar || props.$showVerticalScrollbar) && `
.simplebar-content-wrapper {
overflow: auto !important;
}
`}
${(props) => !props.$showHorizontalScrollbar && `
div.simplebar-horizontal {
visibility: hidden !important;
Expand Down Expand Up @@ -847,6 +855,7 @@ export function TableCompView(props: {
return <EmptyContent text={trans("table.emptyColumns")} />;
}

const hideScrollbar = !showHorizontalScrollbar && !showVerticalScrollbar;
return (
<BackgroundColorContext.Provider value={style.background} >
<BackgroundWrapper
Expand All @@ -855,14 +864,15 @@ export function TableCompView(props: {
$tableAutoHeight={tableAutoHeight}
$showHorizontalScrollbar={showHorizontalScrollbar}
$showVerticalScrollbar={showVerticalScrollbar}
$fixedToolbar={toolbar.fixedToolbar}
>
{toolbar.position === "above" && toolbar.fixedToolbar && toolbarView}
{toolbar.position === "above" && (toolbar.fixedToolbar || (tableAutoHeight && showHorizontalScrollbar)) && toolbarView}
<ScrollBar
className="table-scrollbar-wrapper"
style={{ height: "100%", margin: "0px", padding: "0px" }}
hideScrollbar={!showHorizontalScrollbar && !showVerticalScrollbar}
prefixNode={toolbar.position === "above" && !toolbar.fixedToolbar && toolbarView}
suffixNode={toolbar.position === "below" && !toolbar.fixedToolbar && toolbarView}
hideScrollbar={hideScrollbar}
prefixNode={toolbar.position === "above" && !toolbar.fixedToolbar && !(tableAutoHeight && showHorizontalScrollbar) && toolbarView}
suffixNode={toolbar.position === "below" && !toolbar.fixedToolbar && !(tableAutoHeight && showHorizontalScrollbar) && toolbarView}
>
<TableWrapper
$style={style}
Expand Down Expand Up @@ -926,7 +936,7 @@ export function TableCompView(props: {
</SlotConfigContext.Provider>
</TableWrapper>
</ScrollBar>
{toolbar.position === "below" && toolbar.fixedToolbar && toolbarView}
{toolbar.position === "below" && (toolbar.fixedToolbar || (tableAutoHeight && showHorizontalScrollbar)) && toolbarView}
</BackgroundWrapper>

</BackgroundColorContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import isEqual from "fast-deep-equal";
import { trans } from "i18n";
import log from "loglevel";

const APP_STORE_NAMESPACE = "TACO_APP_LOCAL_STORE";
const APP_STORE_NAMESPACE = "lowcoder_app_local_storage";

const LocalStorageCompBase = withViewFn(
simpleMultiComp({ values: stateComp<JSONObject>({}) }),
Expand Down
10 changes: 10 additions & 0 deletions client/packages/lowcoder/src/constants/themeConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ const checkbox = {
}
}

const tree = {
...input.inputFieldStyle,
labelStyle: {
borderWidth: '0px',
},
style: { background: theme.primarySurface }

}


export const defaultTheme: ThemeDetail = {
...theme,
Expand Down Expand Up @@ -197,5 +206,6 @@ export const defaultTheme: ThemeDetail = {
select: select,
multiSelect: select,
treeSelect: select,
tree:tree
},
};
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const en = {
"toggleClose": "Enable Close Button",
"showMask": "Show Mask",
"textOverflow": "Text Overflow",
"scrollbar" : "Show Scrollbars",
"scrollbar": "Show Scrollbars",
"siderScrollbar" : "Show Scrollbars in Sider",
"siderRight" : "Show sider on the Right",
"siderWidth" : "Sider Width",
Expand Down
Loading

0 comments on commit 1ca3b02

Please sign in to comment.