Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6dbf6ad

Browse files
authored
Merge branch 'dev' into deployment_updates
2 parents2c6c810 +d6fde12 commit6dbf6ad

File tree

25 files changed

+258
-457
lines changed

25 files changed

+258
-457
lines changed

‎client/packages/lowcoder-comps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name":"lowcoder-comps",
3-
"version":"2.6.6",
3+
"version":"2.7.0",
44
"type":"module",
55
"license":"MIT",
66
"dependencies": {

‎client/packages/lowcoder/src/components/ResCreatePanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { Datasource } from "constants/datasourceConstants";
1717
import{
1818
QUICK_GRAPHQL_ID,
1919
QUICK_REST_API_ID,
20+
JS_CODE_ID,
2021
}from"../constants/datasourceConstants";
2122
import{ResourceType}from"constants/queryConstants";
2223
import{defaultasUpload}from"antd/es/upload";
@@ -25,7 +26,6 @@ import { getUser } from "../redux/selectors/usersSelectors";
2526
importDataSourceIconfrom"./DataSourceIcon";
2627
import{genRandomKey}from"comps/utils/idGenerator";
2728
import{isPublicApplication}from"@lowcoder-ee/redux/selectors/applicationSelector";
28-
import{JS_CODE_ID}from"constants/datasourceConstants";
2929

3030
constWrapper=styled.div<{$placement:PageType}>`
3131
width: 100%;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ const childrenMap = {
134134
style:ButtonStyleControl,
135135
animationStyle:styleControl(AnimationStyle,'animationStyle'),
136136
viewRef:RefControl<HTMLElement>,
137+
tooltip:StringControl
137138
};
138139

139140
typeChildrenType=NewChildren<RecordConstructorToComp<typeofchildrenMap>>;
@@ -146,6 +147,7 @@ const ButtonPropertyView = React.memo((props: {
146147
<>
147148
<Sectionname={sectionNames.basic}>
148149
{props.children.text.propertyView({label:trans("text")})}
150+
{props.children.tooltip.propertyView({label:trans("labelProp.tooltip")})}
149151
</Section>
150152

151153
{(editorModeStatus==="logic"||editorModeStatus==="both")&&(
@@ -204,7 +206,7 @@ const ButtonView = React.memo((props: ToViewReturn<ChildrenType>) => {
204206
<ButtonCompWrapper$disabled={props.disabled}>
205207
<EditorContext.Consumer>
206208
{(editorState)=>(
207-
<Tooltiptitle={props.text}>
209+
<Tooltiptitle={props.tooltip}>
208210
<Button100
209211
ref={props.viewRef}
210212
$buttonStyle={props.style}

‎client/packages/lowcoder/src/comps/comps/buttonComp/toggleButtonComp.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const ToggleTmpComp = (function () {
6666
animationStyle:styleControl(AnimationStyle,'animationStyle'),
6767
showBorder:withDefault(BoolControl,true),
6868
viewRef:RefControl<HTMLElement>,
69+
tooltip:StringControl,
6970
};
7071
returnnewUICompBuilder(childrenMap,(props)=>{
7172
consttext=props.showText
@@ -79,7 +80,7 @@ const ToggleTmpComp = (function () {
7980
$showBorder={props.showBorder}
8081
$animationStyle={props.animationStyle}
8182
>
82-
<Tooltiptitle={props.value.value ?props.trueText :props.falseText}>
83+
<Tooltiptitle={props.tooltip}>
8384
<Button100
8485
ref={props.viewRef}
8586
$buttonStyle={props.style}
@@ -117,6 +118,7 @@ const ToggleTmpComp = (function () {
117118
</Section>
118119
<Sectionname={sectionNames.advanced}>
119120
{children.showText.propertyView({label:trans("toggleButton.showText")})}
121+
{children.tooltip.propertyView({label:trans("labelProp.tooltip")})}
120122
{children.showText.getView()&&
121123
children.trueText.propertyView({label:trans("toggleButton.trueLabel")})}
122124
{children.showText.getView()&&

‎client/packages/lowcoder/src/comps/comps/meetingComp/controlButton.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ const childrenMap = {
201201
iconScoutAsset:IconscoutControl(AssetType.ICON),
202202
style:ButtonStyleControl,
203203
viewRef:RefControl<HTMLElement>,
204-
restrictPaddingOnRotation:withDefault(StringControl,'controlButton')
204+
restrictPaddingOnRotation:withDefault(StringControl,'controlButton'),
205+
tooltip:StringControl
205206
};
206207

207208
letButtonTmpComp=(function(){
@@ -259,7 +260,7 @@ let ButtonTmpComp = (function () {
259260
:undefined
260261
}
261262
>
262-
<Tooltiptitle={trans("meeting.meetingControlCompName")}>
263+
<Tooltiptitle={props.tooltip}>
263264
<Button100
264265
ref={props.viewRef}
265266
$buttonStyle={props.style}
@@ -323,6 +324,9 @@ let ButtonTmpComp = (function () {
323324
{children.sourceMode.getView()==='asset-library'&&children.iconScoutAsset.propertyView({
324325
label:trans("button.icon"),
325326
})}
327+
{children.tooltip.propertyView({
328+
label:trans("labelProp.tooltip"),
329+
})}
326330
</Section>
327331

328332
{(useContext(EditorContext).editorModeStatus==="logic"||

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,7 @@ let CheckboxBasicComp = (function () {
231231
returnprops.options
232232
.filter((option)=>option.value!==undefined&&!option.hidden)
233233
.map((option)=>({
234-
label:(
235-
<Tooltiptitle={option.label}>
236-
<span>{option.label}</span>
237-
</Tooltip>
238-
),
234+
label:option.label,
239235
value:option.value,
240236
disabled:option.disabled,
241237
}));

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,7 @@ const MemoizedRadio = memo(({
134134
returnoptions
135135
.filter((option)=>option.value!==undefined&&!option.hidden)
136136
.map((option)=>({
137-
label:(
138-
<Tooltiptitle={option.label}>
139-
<span>{option.label}</span>
140-
</Tooltip>
141-
),
137+
label:option.label,
142138
value:option.value,
143139
disabled:option.disabled,
144140
}));

‎client/packages/lowcoder/src/comps/queries/libraryQuery.tsx

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { default as LoadingOutlined } from "@ant-design/icons/LoadingOutlined";
22
import{defaultasSpin}from"antd/es/spin";
33
importDataSourceIconfrom"components/DataSourceIcon";
44
import{ContextControlType,ContextJsonControl}from"comps/controls/contextCodeControl";
5+
import{FunctionControl}from"comps/controls/codeControl";
56
import{trans}from"i18n";
67
import{
78
CompAction,
@@ -10,6 +11,7 @@ import {
1011
isMyCustomAction,
1112
MultiBaseComp,
1213
wrapChildAction,
14+
evalFunc,
1315
}from"lowcoder-core";
1416
import{
1517
Dropdown,
@@ -34,6 +36,9 @@ import {
3436
ToInstanceType,
3537
}from"../generators/multi";
3638
import{toQueryView}from"./queryCompUtils";
39+
import{getGlobalSettings}from"comps/utils/globalSettings";
40+
import{QUERY_EXECUTION_ERROR,QUERY_EXECUTION_OK}from"../../constants/queryConstants";
41+
importtype{SandBoxOption}from"lowcoder-core/src/eval/utils/evalScript";
3742

3843
constNoInputsWrapper=styled.div`
3944
color:${GreyTextColor};
@@ -133,13 +138,70 @@ export const LibraryQuery = class extends LibraryQueryBase {
133138
readonlyisReady:boolean=false;
134139

135140
privatevalue:DataType|undefined;
141+
privatequeryInfo:any=null;
136142

137143
constructor(params:CompParams<DataType>){
138144
super(params);
139145
this.value=params.value;
140146
}
141147

142148
overridegetView(){
149+
// Check if this is a JS query
150+
if(this.queryInfo?.query?.compType==="js"){
151+
returnasync(props:any)=>{
152+
try{
153+
const{ orgCommonSettings}=getGlobalSettings();
154+
construnInHost=!!orgCommonSettings?.runJavaScriptInHost;
155+
consttimer=performance.now();
156+
constscript=this.queryInfo.query.comp.script||"";
157+
constoptions:SandBoxOption={disableLimit:runInHost};
158+
159+
// Get input values from the inputs component and resolve any variables
160+
constinputValues=Object.entries(this.children.inputs.children).reduce((acc,[name,input])=>{
161+
// Get the raw value from the input component's text property
162+
letvalue=input.children.text.getView();
163+
164+
// Resolve any variables in the value
165+
if(typeofvalue==='string'){
166+
value=value.replace(/\{\{([^}]+)\}\}/g,(match,path)=>{
167+
constparts=path.split('.');
168+
letcurrent=props.args||{};
169+
for(constpartofparts){
170+
if(current&&typeofcurrent==='object'){
171+
current=current[part];
172+
}else{
173+
returnmatch;// Return original if path not found
174+
}
175+
}
176+
returncurrent?.value??match;
177+
});
178+
}
179+
180+
acc[name]=value;
181+
returnacc;
182+
},{}asRecord<string,any>);
183+
184+
console.log("script: "+script);
185+
console.log("inputValues: ",inputValues);
186+
187+
constdata=awaitevalFunc(script,inputValues,undefined,options);
188+
return{
189+
data:data,
190+
code:QUERY_EXECUTION_OK,
191+
success:true,
192+
runTime:Number((performance.now()-timer).toFixed()),
193+
};
194+
}catch(e){
195+
return{
196+
success:false,
197+
data:"",
198+
code:QUERY_EXECUTION_ERROR,
199+
message:(easany).message||"",
200+
};
201+
}
202+
};
203+
}
204+
143205
returntoQueryView(
144206
Object.entries(this.children.inputs.children).map(([name,input])=>({
145207
key:name,
@@ -161,6 +223,7 @@ export const LibraryQuery = class extends LibraryQueryBase {
161223

162224
overridereduce(action:CompAction): this{
163225
if(isMyCustomAction<QueryLibraryUpdateAction>(action,"queryLibraryUpdate")){
226+
this.queryInfo=action.value?.dsl;
164227
constinputs=this.children.inputs.setInputs(action.value?.dsl?.["inputs"]??[]);
165228
returnsetFieldsNoTypeCheck(this,{
166229
children:{ ...this.children,inputs:inputs},
@@ -258,7 +321,7 @@ const PropertyView = (props: { comp: InstanceType<typeof LibraryQuery> }) => {
258321
<QueryTutorialButton
259322
label={trans("queryLibrary.viewQuery")}
260323
url={`/query-library?forwardQueryId=${queryId}`}
261-
styleName={"dropdownRight"}
324+
styleName="dropdownRight"
262325
/>
263326
</QueryConfigWrapper>
264327

@@ -284,4 +347,4 @@ const PropertyView = (props: { comp: InstanceType<typeof LibraryQuery> }) => {
284347
constQueryLabelWrapper=styled.div`
285348
display: flex;
286349
align-items: center;
287-
`;
350+
`;

‎client/packages/lowcoder/src/comps/queries/queryComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ QueryCompTmp = class extends QueryCompTmp {
487487
args:action.args,
488488
variables:action.args,
489489
timeout:this.children.timeout,
490-
callback:(result)=>this.processResult(result,action,startTime)
490+
callback:(result:QueryResult)=>this.processResult(result,action,startTime)
491491
});
492492
},getTriggerType(this)==="manual")
493493
.then(

‎client/packages/lowcoder/src/comps/queries/queryCompUtils.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { Fragment } from "react";
77
import{ParamsControlType,ValueFunction}from"../controls/paramsControl";
88
import{getGlobalSettings}from"comps/utils/globalSettings";
99
import{ResourceType}from"@lowcoder-ee/constants/queryConstants";
10+
import{evalFunc}from"lowcoder-core";
11+
import{QUERY_EXECUTION_ERROR,QUERY_EXECUTION_OK}from"../../constants/queryConstants";
12+
importtype{SandBoxOption}from"lowcoder-core/src/eval/utils/evalScript";
1013

1114
exporttypeFunctionProperty={
1215
key:string;
@@ -30,6 +33,32 @@ export function toQueryView(params: FunctionProperty[]) {
3033
}):Promise<QueryResult>=>{
3134
const{ applicationId, isViewMode}=getGlobalSettings();
3235

36+
// Check if this is a JS query
37+
constisJsQuery=props.queryId?.startsWith("js:");
38+
if(isJsQuery){
39+
try{
40+
const{ orgCommonSettings}=getGlobalSettings();
41+
construnInHost=!!orgCommonSettings?.runJavaScriptInHost;
42+
consttimer=performance.now();
43+
constscript=props.args?.script||"";
44+
constoptions:SandBoxOption={disableLimit:runInHost};
45+
constdata=awaitevalFunc(`return (${script}\n);`,props.args||{},undefined,options);
46+
return{
47+
data:data,
48+
code:QUERY_EXECUTION_OK,
49+
success:true,
50+
runTime:Number((performance.now()-timer).toFixed()),
51+
};
52+
}catch(e){
53+
return{
54+
success:false,
55+
data:"",
56+
code:QUERY_EXECUTION_ERROR,
57+
message:(easany).message||"",
58+
};
59+
}
60+
}
61+
3362
letmappedVariables:Array<{key:string,value:string}>=[];
3463
Object.keys(props.variables)
3564
.filter(k=>k!=="$queryName")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp