Skip to content

Commit b6fb85b

Browse files
authored
Merge pull request #702 from lowcoder-org/dev
Dev - update
2 parents 2286a21 + f42e8e7 commit b6fb85b

Some content is hidden

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

47 files changed

+1003
-97
lines changed

client/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.3.1

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
},
7171
"dependencies": {
7272
"@lottiefiles/react-lottie-player": "^3.5.3",
73+
"@remixicon/react": "^4.1.1",
7374
"@testing-library/react": "^14.1.2",
7475
"@testing-library/user-event": "^14.5.1",
7576
"@types/styled-components": "^5.1.34",
Lines changed: 99 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,100 @@
1-
# lowcoder comp lib
1+
# Lowcoder Extra Components
2+
3+
This is the workspace for Lowcoder Extra Components like Calendar, Image Editor, Mermaid Charts and eCharts.
4+
5+
## Local Development preparation
6+
7+
Navigate your terminal or bash to your /root folder (lowcoder repository) to install Lowcoder Extra Components dependencies and the Lowcoder SDK
8+
9+
To develop with the Lowcoder Extra Components after you clone the Lowcoder Repository, first make sure the Lowcoder SDK is local built.
10+
11+
```bash
12+
cd client/packages/lowcoder-sdk
13+
yarn build
14+
```
215

316
## Start
417

5-
Start dev server to develop your comp lib.
18+
Now you can start the local dev server for Lowcoder Extra Components to develop and add your Component Plugin
619

720
```bash
21+
cd client/packages/lowcoder-comps
822
yarn start
23+
```
924

10-
# or
25+
The local dev server will build for roughly a minute and open then a Browser Window on http://localhost:9000/ with the Lowcoder Component Builder.
26+
27+
## Local development
28+
29+
After the local dev server is started, the Lowcoder Component Builder is prepared. A new browser window should open at http://localhost:9000 This is the Components Preview, which allows you to see your new component in action, as it would work in the Lowcoder Editor.
30+
31+
Data, methods and properties are visible and interactive, so you can test your Component during development. The view will get automatically refreshed.
32+
33+
The Lowcoder Component Builder makes the development & publishing of multiple individual components as bundle possible. Find the /src/comps folder in /lowcoder-comps. Here are existing components to find. It is suggested for new components to create a new folder. In the left navigation of the Components Preview you can switch between your components.
34+
35+
to see your component and include it in the processing on the development server, you have to do the folloiwing steps:
36+
37+
### modify /lowcoder-comps/package.json
38+
39+
```JSON
40+
"yournewcomponent": {
41+
"name": "Your new Component name",
42+
"icon": "./icons/your-icon.svg",
43+
"description": "A Component Plugin to ...",
44+
"category": "itemHandling",
45+
"layoutInfo": {
46+
"w": 6,
47+
"h": 30
48+
}
49+
}
50+
```
1151

12-
npm start
52+
53+
Please choose one category out of:
54+
55+
- dashboards
56+
- layout
57+
- forms
58+
- collaboration
59+
- projectmanagement
60+
- scheduling
61+
- documents
62+
- itemHandling
63+
- multimedia
64+
- integration
65+
66+
layoutInfo helps you to define the size (in grid-cells) of your Component in the grid for the very first moment, when a user drags your Component out of the components display on the right side in the Lowcoder Editor.
67+
68+
### modify /lowcoder-comps/src/index.ts
69+
70+
```JavaScript
71+
Add your Component for the exported members of Lowcoder Extra Components
72+
73+
import { ChartCompWithDefault } from "./comps/chartComp/chartComp";
74+
import { ImageEditorComp } from "./comps/imageEditorComp/index";
75+
import { CalendarComp } from "./comps/calendarComp/calendarComp";
76+
import { MermaidComp } from "comps/mermaidComp";
77+
78+
import { YourComponent } from "comps/yourComponentFolder/yourComponent";
79+
80+
export default {
81+
chart: ChartCompWithDefault,
82+
imageEditor: ImageEditorComp,
83+
calendar: CalendarComp,
84+
mermaid: MermaidComp,
85+
86+
yourcomponent: YourComponent,
87+
};
1388
```
89+
Now your Plugin should be visibe and displayed in the Lowcoder Component Builder at http://localhost:9000/
1490

1591
## Build
1692

17-
Build current comp lib into a .tgz file that you can upload it to the Lowcoder Comp Market.
93+
When you finish development and all tests, you can build the Components to use it in runtime.
1894

19-
Before build you should change the version in package.json file.
95+
This will build the current Component Plugins into a .tgz file that you can upload.
96+
97+
**Before build you should change the version in package.json file.**
2098

2199
```bash
22100
yarn build
@@ -25,3 +103,18 @@ yarn build
25103

26104
npm run build
27105
```
106+
107+
## How to publish a Component Plugin
108+
109+
With the following command you can publish the script to the NPM repository:
110+
111+
```bash
112+
yarn build --publish
113+
```
114+
115+
This command will publis the whole Lowcoder Extra Components bundle to [NPMjs](https://www.npmjs.com/)
116+
Make sure, you updated the Version of Lowcoder Comps before in /lowcoder-comps/package.json
117+
118+
## Contribute your Plugin
119+
120+
If you wish to contribute your plugin and persist it as general Lowcoder Extra Component, please raise a PR to our /dev branch in the Lowcoder Community-Edition Repository https://github.com/lowcoder-org/lowcoder

client/packages/lowcoder-comps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
},
7070
"devDependencies": {
7171
"jest": "29.3.0",
72-
"vite": "^4.5.2",
72+
"vite": "^5.0.12",
7373
"vite-tsconfig-paths": "^3.6.0"
7474
}
7575
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ export const Wrapper = styled.div<{
205205
flex-direction: inherit;
206206
}
207207
.fc-day-today .fc-daygrid-day-number {
208-
background-color: ${(props) => props.$theme.primary};
208+
background-color: ${(props) => props.$theme?.primary ? props.$theme.primary : props.$style.background};
209209
color: ${(props) =>
210-
contrastText(props.$theme.primary || "", props.$theme.textDark, props.$theme.textLight)};
210+
contrastText(props.$theme?.primary || "", props.$theme?.textDark || "#000000", props.$theme?.textLight || "#ffffff")};
211211
}
212212
.fc-daygrid-day-events {
213213
padding: 1px 0 5px 0;
@@ -585,10 +585,10 @@ export const Wrapper = styled.div<{
585585
}
586586
.fc-day-today.fc-col-header-cell {
587587
background-color: ${(props) =>
588-
isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.$theme.primary!) + "19"};
588+
isDarkColor(props.$style.background) ? "#ffffff19" : toHex(props.$theme?.primary!) + "19"};
589589
a {
590590
color: ${(props) =>
591-
!isDarkColor(props.$style.background) && darkenColor(props.$theme.primary!, 0.1)};
591+
!isDarkColor(props.$style.background) && darkenColor(props.$theme?.primary!, 0.1)};
592592
}
593593
}
594594
.fc-col-header-cell-cushion {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const TextInput = styled(Input)<InputProps & { $hasPrefix?: boolean }>`
6868
border: none;
6969
padding: 0 8px 0 4px;
7070
padding-left: ${(props) => (props.$hasPrefix ? "28px" : "4px")};
71-
color: #ffffff;
71+
color: #444444;
7272
line-height: 28px;
7373
font-size: 14px;
7474

client/packages/lowcoder/src/comps/comps/timelineComp/antIcon.tsx renamed to client/packages/lowcoder-design/src/icons/antIcon.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,3 +1581,24 @@ export const ANTDICON = {
15811581
zoominoutlined: <ZoomInOutlined />,
15821582
zoomoutoutlined: <ZoomOutOutlined />,
15831583
};
1584+
1585+
1586+
// Function to dynamically import icons
1587+
export const loadAntDIcon = async (iconName: string) => {
1588+
if (!iconName) return null;
1589+
1590+
try {
1591+
const module = await import(`@ant-design/icons`);
1592+
const IconComponent = (module as any)[iconName];
1593+
if (IconComponent) {
1594+
// Return the icon component if found
1595+
return <IconComponent />;
1596+
} else {
1597+
console.error(`Icon ${iconName} not found in @ant-design/icons`);
1598+
return null;
1599+
}
1600+
} catch (error) {
1601+
console.error(`Error loading icon ${iconName}:`, error);
1602+
return null;
1603+
}
1604+
};
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 12 additions & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Loading

client/packages/lowcoder-design/src/icons/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ export { ReactComponent as HomeModuleIcon } from "./icon-application-module.svg"
176176
export { ReactComponent as HomeQueryLibraryIcon } from "./icon-application-query-library.svg";
177177
export { ReactComponent as HomeDataSourceIcon } from "./icon-application-datasource.svg";
178178
export { ReactComponent as RecyclerIcon } from "./icon-application-recycler.svg";
179+
export { ReactComponent as MarketplaceIcon } from "./icon-application-marketplace.svg";
179180
export { ReactComponent as HomeActiveIcon } from "./icon-application-home-active.svg";
180181
export { ReactComponent as HomeModuleActiveIcon } from "./icon-application-module-active.svg";
181182
export { ReactComponent as HomeQueryLibraryActiveIcon } from "./icon-application-query-library-active.svg";
182183
export { ReactComponent as HomeDataSourceActiveIcon } from "./icon-application-datasource-active.svg";
183184
export { ReactComponent as RecyclerActiveIcon } from "./icon-application-recycler-active.svg";
185+
export { ReactComponent as MarketplaceActiveIcon } from "./icon-application-marketplace-active.svg";
184186
export { ReactComponent as FavoritesIcon } from "./icon-application-favorites.svg";
185187
export { ReactComponent as HomeSettingIcon } from "./icon-application-setting.svg";
186188
export { ReactComponent as FolderIcon } from "./icon-application-folder.svg";

client/packages/lowcoder-design/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@ export * from "./components/toolTip";
4949
export * from "./components/video";
5050

5151
export * from "./icons";
52+
53+
export * from "./icons/antIcon";

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class ApplicationApi extends Api {
7878
static newURLPrefix = "/applications";
7979
static fetchHomeDataURL = "/v1/applications/home";
8080
static createApplicationURL = "/v1/applications";
81+
static fetchAllMarketplaceAppsURL = "/v1/applications/marketplace-apps";
8182
static deleteApplicationURL = (applicationId: string) => `/v1/applications/${applicationId}`;
8283
static getAppPublishInfoURL = (applicationId: string) => `/v1/applications/${applicationId}/view`;
8384
static getAppEditingInfoURL = (applicationId: string) => `/v1/applications/${applicationId}`;
@@ -92,6 +93,9 @@ class ApplicationApi extends Api {
9293
`/v1/applications/${applicationId}/permissions/${permissionId}`;
9394
static createFromTemplateURL = `/v1/applications/createFromTemplate`;
9495
static publicToAllURL = (applicationId: string) => `/applications/${applicationId}/public-to-all`;
96+
static publicToMarketplaceURL = (applicationId: string) => `/v1/applications/${applicationId}/public-to-marketplace`;
97+
static getMarketplaceAppURL = (applicationId: string) => `/v1/applications/${applicationId}/view_marketplace`;
98+
9599

96100
static fetchHomeData(request: HomeDataPayload): AxiosPromise<HomeDataResponse> {
97101
return Api.get(ApplicationApi.fetchHomeDataURL, request);
@@ -167,7 +171,9 @@ class ApplicationApi extends Api {
167171
const url =
168172
type === "published"
169173
? ApplicationApi.getAppPublishInfoURL(applicationId)
170-
: ApplicationApi.getAppEditingInfoURL(applicationId);
174+
: type === "view_marketplace"
175+
? ApplicationApi.getMarketplaceAppURL(applicationId)
176+
: ApplicationApi.getAppEditingInfoURL(applicationId);
171177
return Api.get(url);
172178
}
173179

@@ -211,6 +217,20 @@ class ApplicationApi extends Api {
211217
publicToAll: publicToAll,
212218
});
213219
}
220+
221+
static publicToMarketplace(appId: string, publicToMarketplace: boolean) {
222+
return Api.put(ApplicationApi.publicToMarketplaceURL(appId), {
223+
publicToMarketplace,
224+
});
225+
}
226+
227+
static fetchAllMarketplaceApps() {
228+
return Api.get(ApplicationApi.fetchAllMarketplaceAppsURL);
229+
}
230+
231+
static getMarketplaceApp(appId: string) {
232+
return Api.get(ApplicationApi.getMarketplaceAppURL(appId));
233+
}
214234
}
215235

216236
export default ApplicationApi;

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export interface CreateOrgResponse extends ApiResponse {
2929
data: { orgId: string };
3030
}
3131

32+
export interface OrgAPIUsageResponse extends ApiResponse {
33+
data: number;
34+
}
35+
3236
export class OrgApi extends Api {
3337
static createGroupURL = "/v1/groups";
3438
static updateGroupURL = (groupId: string) => `/v1/groups/${groupId}/update`;
@@ -47,6 +51,7 @@ export class OrgApi extends Api {
4751
static createOrgURL = "/v1/organizations";
4852
static deleteOrgURL = (orgId: string) => `/v1/organizations/${orgId}`;
4953
static updateOrgURL = (orgId: string) => `/v1/organizations/${orgId}/update`;
54+
static fetchUsage = (orgId: string) => `/v1/organizations/${orgId}/api-usage`;
5055

5156
static createGroup(request: { name: string }): AxiosPromise<GenericApiResponse<OrgGroup>> {
5257
return Api.post(OrgApi.createGroupURL, request);
@@ -127,6 +132,10 @@ export class OrgApi extends Api {
127132
static updateOrg(request: UpdateOrgPayload): AxiosPromise<ApiResponse> {
128133
return Api.put(OrgApi.updateOrgURL(request.id), request);
129134
}
135+
136+
static fetchAPIUsage(orgId: string, lastMonthOnly?: boolean): AxiosPromise<ApiResponse> {
137+
return Api.get(OrgApi.fetchUsage(orgId), lastMonthOnly);
138+
}
130139
}
131140

132141
export default OrgApi;

client/packages/lowcoder/src/app.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
IMPORT_APP_FROM_TEMPLATE_URL,
1515
INVITE_LANDING_URL,
1616
isAuthUnRequired,
17+
MARKETPLACE_URL,
1718
ORG_AUTH_LOGIN_URL,
1819
ORG_AUTH_REGISTER_URL,
1920
QUERY_LIBRARY_URL,
@@ -138,6 +139,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
138139
FOLDER_URL,
139140
TRASH_URL,
140141
SETTING,
142+
MARKETPLACE_URL,
141143
]}
142144
// component={ApplicationListPage}
143145
component={ApplicationHome}
Loading

0 commit comments

Comments
 (0)