Skip to content

Commit 3e4fa6f

Browse files
Merge branch 'dev' into add/lineHeight
2 parents 32dc4ec + f8f2872 commit 3e4fa6f

File tree

17 files changed

+186634
-41068
lines changed

17 files changed

+186634
-41068
lines changed

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
hiddenPropertyView,
3333
ChangeEventHandlerControl,
3434
DragEventHandlerControl,
35+
CalendarEventHandlerControl,
3536
Section,
3637
sectionNames,
3738
dropdownControl,
@@ -45,7 +46,9 @@ import {
4546
CalendarDeleteIcon,
4647
Tooltip,
4748
useMergeCompStyles,
48-
} from "lowcoder-sdk";
49+
EditorContext,
50+
CompNameContext,
51+
} from 'lowcoder-sdk';
4952

5053
import {
5154
DefaultWithFreeViewOptions,
@@ -76,7 +79,7 @@ let childrenMap: any = {
7679
resourcesEvents: jsonValueExposingStateControl("resourcesEvents", resourcesEventsDefaultData),
7780
resources: jsonValueExposingStateControl("resources", resourcesDefaultData),
7881
resourceName: withDefault(StringControl, trans("calendar.resourcesDefault")),
79-
onEvent: ChangeEventHandlerControl,
82+
onEvent: CalendarEventHandlerControl,
8083
// onDropEvent: safeDragEventHandlerControl,
8184
editable: withDefault(BoolControl, true),
8285
showEventTime: withDefault(BoolControl, true),
@@ -120,6 +123,12 @@ let CalendarBasicComp = (function () {
120123
currentFreeView?: string;
121124
currentPremiumView?: string;
122125
}, dispatch: any) => {
126+
127+
const comp = useContext(EditorContext).getUICompByName(
128+
useContext(CompNameContext)
129+
);
130+
const onEventVal = comp?.toJsonValue().comp.onEvent;
131+
123132

124133
const theme = useContext(ThemeContext);
125134
const ref = createRef<HTMLDivElement>();
@@ -303,7 +312,12 @@ let CalendarBasicComp = (function () {
303312
};
304313
showModal(eventInfo, true);
305314
} else {
306-
showModal(editEvent.current, false);
315+
if (onEventVal && onEventVal.some((e: any) => e.name === 'doubleClick')) {
316+
// Check if 'doubleClick' is included in the array
317+
props.onEvent('doubleClick');
318+
} else {
319+
showModal(editEvent.current as EventType, false);
320+
}
307321
}
308322
};
309323

@@ -433,7 +447,6 @@ let CalendarBasicComp = (function () {
433447
props.onDropEvent("dropEvent");
434448
}
435449
};
436-
437450
return (
438451
<Wrapper
439452
ref={ref}

client/packages/lowcoder/src/components/PageSkeleton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ export default function PageSkeleton(props: IProps) {
8383

8484
return (
8585
<Layout>
86-
{!hideHeader && isHeaderReady && (
86+
{/* {!hideHeader && isHeaderReady && (
8787
<Header
8888
headerStart={<StyledLogoWithName branding={true} />}
8989
style={{ backgroundColor: brandingConfig?.headerColor, ...props.headStyle }}
9090
/>
91-
)}
91+
)} */}
9292
<Layout>
9393
{!hideSideBar && <SideBar>{skeleton}</SideBar>}
9494
<MainContent>{!hideContent && skeleton}</MainContent>

client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const TableWrapper = styled.div<{
189189
190190
.ant-table.ant-table-middle .ant-table-cell-with-append .ant-table-row-expand-icon {
191191
top: 14px;
192+
margin-right:5px;
192193
}
193194
194195
.ant-table {

client/packages/lowcoder/src/comps/controls/eventHandlerControl.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,11 @@ export const DragEventHandlerControl = eventHandlerControl([
700700
dropEvent,
701701
] as const);
702702

703+
export const CalendarEventHandlerControl = eventHandlerControl([
704+
changeEvent,
705+
doubleClickEvent,
706+
] as const);
707+
703708
export const ElementEventHandlerControl = eventHandlerControl([
704709
openEvent,
705710
editedEvent,

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,9 @@ export const de: typeof en = {
20792079
"preloadLibsAddBtn": "Eine Bibliothek hinzufügen",
20802080
"saveSuccess": "Erfolgreich gerettet",
20812081
"AuthOrgTitle": "Willkommensbildschirm des Arbeitsbereichs",
2082-
"AuthOrgDescrition": "Die URL, unter der sich deine Nutzer beim aktuellen Arbeitsbereich anmelden können."
2082+
"AuthOrgDescrition": "Die URL, unter der sich deine Nutzer beim aktuellen Arbeitsbereich anmelden können.",
2083+
"showHeaderInPublicApps": "Kopfzeile öffentlich anzeigen",
2084+
"showHeaderInPublicAppsHelp": "Legen Sie die Sichtbarkeit des Headers in der öffentlichen Ansicht für alle Apps fest",
20832085
},
20842086
"branding": {
20852087
...en.branding,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,8 +2601,9 @@ export const en = {
26012601
"APIConsumption": "API Consumption",
26022602
"APIConsumptionDescription": "Here you can see the API Consumption for All Apps in the Current Workspace.",
26032603
"overallAPIConsumption": "Overall API Consumption in this Workspace till now",
2604-
"lastMonthAPIConsumption": "Last Month API Consumption, in this Workspace"
2605-
2604+
"lastMonthAPIConsumption": "Last Month API Consumption, in this Workspace",
2605+
"showHeaderInPublicApps": "Show Header In Public View",
2606+
"showHeaderInPublicAppsHelp": "Set visibility of header in public view for all apps",
26062607
},
26072608

26082609

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,9 @@ export const pt: typeof en = {
26602660
"APIConsumption": "Consumo de API",
26612661
"APIConsumptionDescription": "Aqui você pode ver o consumo de API para todas as aplicações no espaço de trabalho atual.",
26622662
"overallAPIConsumption": "Consumo geral de API neste espaço de trabalho até o momento",
2663-
"lastMonthAPIConsumption": "Consumo de API do último mês, neste espaço de trabalho"
2663+
"lastMonthAPIConsumption": "Consumo de API do último mês, neste espaço de trabalho",
2664+
"showHeaderInPublicApps": "Mostrar cabeçalho em exibição pública",
2665+
"showHeaderInPublicAppsHelp": "Defina a visibilidade do cabeçalho em exibição pública para todos os aplicativos",
26642666
},
26652667

26662668

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,8 @@ export const zh: typeof en = {
20682068
"APIConsumptionDescription": "API 消耗是指当前工作空间中所有应用程序的 API 消耗情况,包括调用次数和调用时间.",
20692069
"overallAPIConsumption": "总体 API 消耗",
20702070
"lastMonthAPIConsumption": "上个月 API 消耗",
2071+
"showHeaderInPublicApps": "在公共视图中显示标题",
2072+
"showHeaderInPublicAppsHelp": "设置所有应用程序的标题在公共视图中的可见性",
20712073
},
20722074
branding: {
20732075
...en.branding,

client/packages/lowcoder/src/pages/editor/editorView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
} from "util/localStorageUtil";
5454
import { isAggregationApp } from "util/appUtils";
5555
import EditorSkeletonView from "./editorSkeletonView";
56+
import { getCommonSettings } from "@lowcoder-ee/redux/selectors/commonSettingSelectors";
5657

5758
const LeftContent = lazy(
5859
() => import('./LeftContent')
@@ -278,6 +279,7 @@ function EditorView(props: EditorViewProps) {
278279
const editorState = useContext(EditorContext);
279280
const { readOnly, hideHeader } = useContext(ExternalEditorContext);
280281
const application = useSelector(currentApplication);
282+
const commonSettings = useSelector(getCommonSettings);
281283
const locationState = useLocation<UserGuideLocationState>().state;
282284
const showNewUserGuide = locationState?.showNewUserGuide;
283285
const showAppSnapshot = useSelector(showAppSnapshotSelector);
@@ -369,11 +371,10 @@ function EditorView(props: EditorViewProps) {
369371
return () => window.removeEventListener(eventType, updateSize);
370372
}, []);
371373

372-
const hideBodyHeader = useTemplateViewMode() || (isViewMode && !showHeaderInPublic);
374+
const hideBodyHeader = useTemplateViewMode() || (isViewMode && (!showHeaderInPublic || !commonSettings.showHeaderInPublicApps));
373375

374376
// we check if we are on the public cloud
375377
const isLowCoderDomain = window.location.hostname === 'app.lowcoder.cloud';
376-
377378
if (readOnly && hideHeader) {
378379
return (
379380
<CustomShortcutWrapper>

client/packages/lowcoder/src/pages/setting/advanced/AdvancedSetting.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { getGlobalSettings } from "comps/utils/globalSettings";
2525
import { fetchJSLibrary } from "util/jsLibraryUtils";
2626
import { evalFunc } from "lowcoder-core";
2727
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
28+
import { default as Switch } from "antd/es/switch";
2829

2930
const CodeEditor = lazy(
3031
() => import("base/codeEditor/codeEditor")
@@ -186,6 +187,34 @@ export function AdvancedSetting() {
186187
{trans("advanced.saveBtn")}
187188
</SaveButton>
188189
</div>
190+
<div className="section-title">{trans("advanced.showHeaderInPublicApps")}</div>
191+
<HelpText style={{ marginBottom: 12 }}>{trans("advanced.showHeaderInPublicAppsHelp")}</HelpText>
192+
<div className="section-content">
193+
<Switch
194+
style={{ marginBottom: 12 }}
195+
checked={
196+
settings.hasOwnProperty('showHeaderInPublicApps')
197+
? settings.showHeaderInPublicApps
198+
: true
199+
}
200+
onChange={(value: boolean) => {
201+
setSettings((v) => ({ ...v, showHeaderInPublicApps: value }));
202+
}}
203+
/>
204+
<SaveButton
205+
buttonType="primary"
206+
disabled={commonSettings.showHeaderInPublicApps === settings.showHeaderInPublicApps}
207+
onClick={
208+
() => handleSave("showHeaderInPublicApps")(
209+
settings.hasOwnProperty('showHeaderInPublicApps')
210+
? settings.showHeaderInPublicApps
211+
: true
212+
)
213+
}
214+
>
215+
{trans("advanced.saveBtn")}
216+
</SaveButton>
217+
</div>
189218
<div className="section-title">{trans("advanced.preloadJSTitle")}</div>
190219
<HelpText style={{ marginBottom: 12 }}>{trans("advanced.preloadJSHelp")}</HelpText>
191220
<div className="section-content">

client/packages/lowcoder/src/redux/reducers/uiReducers/commonSettingsReducer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface CommonSettingsState {
1414
preloadLibs?: string[] | null;
1515
applyPreloadCSSToHomePage?: boolean | null;
1616
runJavaScriptInHost?: boolean | null;
17+
showHeaderInPublicApps?: boolean;
1718
};
1819
setResult: boolean;
1920

server/node-service/src/plugins/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import bigQueryPlugin from "./bigQuery";
3535
import appConfigPlugin from "./appconfig";
3636
import tursoPlugin from "./turso";
3737
import postmanEchoPlugin from "./postmanEcho";
38+
import lowcoderPlugin from "./lowcoder";
3839

3940
let plugins: (DataSourcePlugin | DataSourcePluginFactory)[] = [
4041
s3Plugin,
@@ -73,6 +74,7 @@ let plugins: (DataSourcePlugin | DataSourcePluginFactory)[] = [
7374
appConfigPlugin,
7475
tursoPlugin,
7576
postmanEchoPlugin,
77+
lowcoderPlugin,
7678
];
7779

7880
try {
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { readYaml } from "../../common/util";
2+
import _ from "lodash";
3+
import path from "path";
4+
import { OpenAPIV3, OpenAPI } from "openapi-types";
5+
import { ConfigToType, DataSourcePlugin } from "lowcoder-sdk/dataSource";
6+
import { runOpenApi } from "../openApi";
7+
import { parseOpenApi, ParseOpenApiOptions } from "../openApi/parse";
8+
9+
import spec from './lowcoder.spec.json';
10+
11+
const dataSourceConfig = {
12+
type: "dataSource",
13+
params: [
14+
{
15+
key: "serverURL",
16+
type: "textInput",
17+
label: "Lowcoder API Service URL",
18+
rules: [{ required: true }],
19+
placeholder: "https://<your-lowcoder-api-service>:port",
20+
tooltip: "Input the server url of your self-hosting instance or api-service.lowcoder.cloud if you are running your apps on the free public Community Edition Cloud Service.",
21+
},
22+
{
23+
"type": "groupTitle",
24+
"key": "API Key",
25+
"label": "Api Key Auth"
26+
},
27+
{
28+
type: "password",
29+
key: "bearerAuth.value",
30+
label: "Authorization",
31+
"tooltip": "API Key Authentication with a Bearer token. Copy your API Key here. (e.g. 'Bearer eyJhbGciO...')",
32+
"placeholder": "API Key Authentication with a Bearer token. Copy your API Key here. (e.g. 'Bearer eyJhbGciO...')"
33+
}
34+
]
35+
} as const;
36+
37+
const parseOptions: ParseOpenApiOptions = {
38+
actionLabel: (method: string, path: string, operation: OpenAPI.Operation) => {
39+
return _.upperFirst(operation.operationId || "");
40+
},
41+
};
42+
43+
type DataSourceConfigType = ConfigToType<typeof dataSourceConfig>;
44+
45+
const lowcoderPlugin: DataSourcePlugin<any, DataSourceConfigType> = {
46+
id: "lowcoder",
47+
name: "Lowcoder API",
48+
icon: "lowcoder.svg",
49+
category: "api",
50+
dataSourceConfig,
51+
queryConfig: async () => {
52+
const { actions, categories } = await parseOpenApi(spec as unknown as OpenAPI.Document, parseOptions);
53+
return {
54+
type: "query",
55+
label: "Action",
56+
categories: {
57+
label: "Resources",
58+
items: categories,
59+
},
60+
actions,
61+
};
62+
},
63+
run: function (actionData, dataSourceConfig): Promise<any> {
64+
const { serverURL, ...otherDataSourceConfig } = dataSourceConfig;
65+
console.log("Lowcoder API Plugin: run", serverURL, otherDataSourceConfig);
66+
const runApiDsConfig = {
67+
url: "",
68+
serverURL: serverURL,
69+
dynamicParamsConfig: otherDataSourceConfig,
70+
};
71+
return runOpenApi(actionData, runApiDsConfig, spec as OpenAPIV3.Document);
72+
},
73+
};
74+
75+
export default lowcoderPlugin;

0 commit comments

Comments
 (0)