Skip to content

Commit ec47591

Browse files
committed
fix: 🐛 修复数据源参数若干问题
1 parent 15f4b6c commit ec47591

File tree

8 files changed

+156
-127
lines changed

8 files changed

+156
-127
lines changed

packages/base-monaco-editor/src/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ const SingleMonacoEditor = (props: ISingleMonacoEditorProps) => {
113113
return (
114114
<div className={className} style={props.style}>
115115
{loading && <span className="loading">{WORD_EDITOR_INITIALIZING}</span>}
116-
117-
<div
118-
ref={containerRef}
119-
className="react-monaco-editor-container"
120-
style={isFullScreen ? fullScreenStyle : style}
121-
>
122-
{supportFullScreen && <div className={fullScreenClassName} onClick={fullScreen}></div>}
123-
</div>
116+
117+
<div
118+
ref={containerRef}
119+
className="react-monaco-editor-container"
120+
style={isFullScreen ? fullScreenStyle : style}
121+
>
122+
{supportFullScreen && <div className={fullScreenClassName} onClick={fullScreen} />}
123+
</div>
124124
</div>
125125
);
126126
};

packages/plugin-datasource-pane/src/components/DataSourceForm/DataSourceForm.tsx

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -296,25 +296,18 @@ export class DataSourceForm extends PureComponent<DataSourceFormProps> {
296296
},
297297
'x-decorator': 'FormItem',
298298
items: {
299-
type: 'void',
300-
'x-component': 'Space',
299+
type: 'object',
300+
// 'x-component': 'Space',
301301
properties: {
302-
sort: {
303-
type: 'void',
304-
'x-decorator': 'FormItem',
305-
'x-component': 'ArrayItems.SortHandle',
306-
},
307-
params: {
302+
space: {
308303
type: 'void',
309304
'x-component': 'Space',
310-
'x-component-props': {
311-
/* direction: "vertical",
312-
align: "start",
313-
style: {
314-
alignItems: "flex-start",
315-
}, */
316-
},
317305
properties: {
306+
sort: {
307+
type: 'void',
308+
'x-decorator': 'FormItem',
309+
'x-component': 'ArrayItems.SortHandle',
310+
},
318311
name: {
319312
title: '',
320313
type: 'string',
@@ -334,19 +327,19 @@ export class DataSourceForm extends PureComponent<DataSourceFormProps> {
334327
// type: "string",
335328
'x-component': 'ParamValue',
336329
'x-component-props': {
337-
// types: ["string", "boolean", "expression", "number"],
338-
// placeholder: "value",
330+
types: ['string', 'boolean', 'expression'],
331+
placeholder: 'value',
339332
},
340333
},
334+
remove: {
335+
type: 'void',
336+
'x-decorator': 'FormItem',
337+
'x-component': 'ArrayItems.Remove',
338+
},
339+
},
341340
},
342-
},
343-
remove: {
344-
type: 'void',
345-
'x-decorator': 'FormItem',
346-
'x-component': 'ArrayItems.Remove',
347341
},
348342
},
349-
},
350343
properties: {
351344
addition: {
352345
type: 'void',
@@ -397,7 +390,7 @@ export class DataSourceForm extends PureComponent<DataSourceFormProps> {
397390
// type: "string",
398391
'x-component': 'ParamValue',
399392
'x-component-props': {
400-
// types: ["string", "boolean", "expression", "number"],
393+
types: ['string', 'boolean', 'expression'],
401394
// placeholder: "value",
402395
},
403396
},

packages/plugin-datasource-pane/src/components/Forms/jsFunction.tsx

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import React, { PureComponent } from 'react';
22
import { connect } from '@formily/react';
3+
import { JSFunction as IJSFunction } from '@alilc/lowcode-types';
34
import MonacoEditor from '@alilc/lowcode-plugin-base-monaco-editor';
45
import _noop from 'lodash/noop';
5-
import { editor } from 'monaco-editor';
6+
// import { editor } from 'monaco-editor';
67

78
export interface JSFunctionProps {
89
className: string;
9-
value: {
10-
type: 'JSFunction';
11-
value: string;
12-
};
10+
value: IJSFunction;
1311
onChange?: (val: any) => void;
1412
}
1513

@@ -25,37 +23,29 @@ export class JSFunctionComp extends PureComponent<
2523
onChange: _noop,
2624
};
2725

28-
private monacoRef: any = null;
26+
// private monacoRef: any = null;
2927

30-
handleEditorChange = (newValue) => {
31-
if (this.monacoRef) {
32-
if (
33-
!(this.monacoRef as any)
34-
.getModelMarkers()
35-
.find((marker: editor.IMarker) => marker.owner === 'json')
36-
) {
37-
this.props.onChange?.({
38-
type: 'JSFunction',
39-
value: newValue,
40-
});
41-
}
42-
}
28+
handleEditorChange = (newValue: string) => {
29+
this.props.onChange?.({
30+
type: 'JSFunction',
31+
value: newValue,
32+
});
4333
};
4434

45-
handleEditorDidMount = (isFullscreen, editor, monaco) => {
46-
this.monacoRef = monaco?.editor;
47-
};
35+
// handleEditorDidMount = (isFullscreen: boolean, editor, monaco) => {
36+
// this.monacoRef = monaco?.editor;
37+
// };
4838

4939
render() {
50-
const { value } = this.props;
40+
const { value, className } = this.props;
5141
return (
52-
<div>
42+
<div className={className}>
5343
<MonacoEditor
5444
theme="vs-vision"
5545
value={value?.value ?? ''}
5646
language="javascript"
5747
onChange={this.handleEditorChange}
58-
editorDidMount={this.handleEditorDidMount}
48+
// editorDidMount={this.handleEditorDidMount}
5949
/>
6050
</div>
6151
);

packages/plugin-datasource-pane/src/components/Forms/json.tsx

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import React, { PureComponent } from 'react';
22
import { connect } from '@formily/react';
33
import MonacoEditor from '@alilc/lowcode-plugin-base-monaco-editor';
44
import _noop from 'lodash/noop';
5-
import { editor } from 'monaco-editor';
5+
// import { editor } from 'monaco-editor';
66

77
export interface JSONProps {
8-
className: string;
8+
className?: string;
99
value: Record<string, any>;
1010
onChange?: (val: any) => void;
1111
}
@@ -19,37 +19,26 @@ export class JSONComp extends PureComponent<JSONProps, JSONState> {
1919
onChange: _noop,
2020
};
2121

22-
private monacoRef: any = null;
23-
24-
handleEditorChange = (newValue) => {
25-
if (this.monacoRef) {
26-
if (
27-
!(this.monacoRef as any)
28-
.getModelMarkers()
29-
.find((marker: editor.IMarker) => marker.owner === 'json')
30-
) {
31-
this.props.onChange?.({
32-
type: 'JSON',
33-
value: newValue,
34-
});
35-
}
36-
}
37-
};
22+
// private monacoRef: any = null;
3823

39-
handleEditorDidMount = (isFullscreen, editor, monaco) => {
40-
this.monacoRef = monaco?.editor;
24+
handleEditorChange = (newValue: string) => {
25+
this.props.onChange?.(newValue);
4126
};
4227

28+
// handleEditorDidMount = (editor) => {
29+
// this.monacoRef = editor;
30+
// };
31+
4332
render() {
44-
const { value } = this.props;
33+
const { value, className } = this.props;
4534
return (
46-
<div style={{ width: '100%', height: 150 }}>
35+
<div className={className} style={{ width: '100%', height: 150 }}>
4736
<MonacoEditor
4837
theme="vs-vision"
4938
value={value ?? ''}
5039
language="json"
5140
onChange={this.handleEditorChange}
52-
editorDidMount={this.handleEditorDidMount}
41+
// editorDidMount={this.handleEditorDidMount}
5342
/>
5443
</div>
5544
);

packages/plugin-datasource-pane/src/components/Forms/lowcode-expression.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export class LowcodeExpressionComp extends PureComponent<LowcodeExpressionProps>
2626
};
2727

2828
render() {
29-
const { value } = this.props;
29+
const { value, className } = this.props;
3030
return (
31-
<div>
31+
<div className={className}>
3232
<EditorContext.Consumer>
3333
{({ setters }) => {
3434
const ExpressionSetter = setters?.getSetter('ExpressionSetter').component;

packages/plugin-datasource-pane/src/components/Forms/param-value.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ $cls-prefix: "lowcode-plugin-datasource-pane";
1010
}
1111
}
1212

13+
// .#{$cls-prefix}-component-switchbtn{
14+
// position: absolute;
15+
// bottom: 0;
16+
// right: 0;
17+
// }
18+
1319
.#{$cls-prefix}-universal-value-typeswitch.next-btn-group {
1420
.next-btn {
1521
padding: 0 2px;
@@ -30,4 +36,4 @@ $cls-prefix: "lowcode-plugin-datasource-pane";
3036
.#{$cls-prefix}-universal-value-jsonstring,
3137
.#{$cls-prefix}-universal-value-json {
3238
width: 200px !important;
33-
}
39+
}

0 commit comments

Comments
 (0)