@next-bricks/vs 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +2 -2
- package/dist/chunks/{1646.6b7b0122.js → 1646.f8f50bc2.js} +2 -2
- package/dist/chunks/{1646.6b7b0122.js.map → 1646.f8f50bc2.js.map} +1 -1
- package/dist/chunks/{3494.889ae9b7.js → 3494.1738aae9.js} +2 -2
- package/dist/chunks/{3494.889ae9b7.js.map → 3494.1738aae9.js.map} +1 -1
- package/dist/chunks/{4131.372f9262.js → 4131.60666d95.js} +2 -2
- package/dist/chunks/4131.60666d95.js.map +1 -0
- package/dist/chunks/4717.b46d0750.js +2 -0
- package/dist/chunks/4717.b46d0750.js.map +1 -0
- package/dist/chunks/{1429.190fe2a2.js → 7379.58598777.js} +3 -3
- package/dist/chunks/{1429.190fe2a2.js.map → 7379.58598777.js.map} +1 -1
- package/dist/chunks/7746.cdb0f0ae.js +2 -0
- package/dist/chunks/{7746.4add12e3.js.map → 7746.cdb0f0ae.js.map} +1 -1
- package/dist/chunks/{7822.ef9a70d6.js → 7822.76ab7541.js} +2 -2
- package/dist/chunks/{7822.ef9a70d6.js.map → 7822.76ab7541.js.map} +1 -1
- package/dist/chunks/9549.08993ffb.js +2 -0
- package/dist/chunks/9549.08993ffb.js.map +1 -0
- package/dist/chunks/9918.74fcf479.js +2 -0
- package/dist/chunks/9918.74fcf479.js.map +1 -0
- package/dist/chunks/code-editor.edbe5199.js +2 -0
- package/dist/chunks/code-editor.edbe5199.js.map +1 -0
- package/dist/chunks/main.d062d4ec.js +2 -0
- package/dist/chunks/main.d062d4ec.js.map +1 -0
- package/dist/index.a02ebece.js +2 -0
- package/dist/index.a02ebece.js.map +1 -0
- package/dist/manifest.json +11 -0
- package/dist/types.json +120 -1
- package/dist-types/code-editor/index.d.ts +10 -1
- package/dist-types/code-editor/utils/brickNextYaml.d.ts +5 -0
- package/dist-types/code-editor/utils/constants.d.ts +2 -0
- package/docs/code-editor.md +49 -1
- package/package.json +3 -3
- package/dist/chunks/2664.daee4a68.js +0 -2
- package/dist/chunks/2664.daee4a68.js.map +0 -1
- package/dist/chunks/4131.372f9262.js.map +0 -1
- package/dist/chunks/4717.5787165f.js +0 -2
- package/dist/chunks/4717.5787165f.js.map +0 -1
- package/dist/chunks/7746.4add12e3.js +0 -2
- package/dist/chunks/9549.e88bfd27.js +0 -2
- package/dist/chunks/9549.e88bfd27.js.map +0 -1
- package/dist/chunks/code-editor.62bbd340.js +0 -2
- package/dist/chunks/code-editor.62bbd340.js.map +0 -1
- package/dist/chunks/main.39589678.js +0 -2
- package/dist/chunks/main.39589678.js.map +0 -1
- package/dist/index.2f09a499.js +0 -2
- package/dist/index.2f09a499.js.map +0 -1
- /package/dist/chunks/{1429.190fe2a2.js.LICENSE.txt → 7379.58598777.js.LICENSE.txt} +0 -0
package/dist/types.json
CHANGED
|
@@ -77,6 +77,16 @@
|
|
|
77
77
|
"value": "number"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
+
{
|
|
81
|
+
"name": "completers",
|
|
82
|
+
"annotation": {
|
|
83
|
+
"type": "reference",
|
|
84
|
+
"typeName": {
|
|
85
|
+
"type": "identifier",
|
|
86
|
+
"name": "Completers"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
80
90
|
{
|
|
81
91
|
"name": "maxLines",
|
|
82
92
|
"annotation": {
|
|
@@ -119,8 +129,117 @@
|
|
|
119
129
|
"value": "string"
|
|
120
130
|
}
|
|
121
131
|
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "highlight.click",
|
|
135
|
+
"detail": {
|
|
136
|
+
"annotation": {
|
|
137
|
+
"type": "keyword",
|
|
138
|
+
"value": "string"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
122
141
|
}
|
|
123
142
|
],
|
|
124
|
-
"methods": []
|
|
143
|
+
"methods": [],
|
|
144
|
+
"types": [
|
|
145
|
+
{
|
|
146
|
+
"type": "typeAlias",
|
|
147
|
+
"name": "Completers",
|
|
148
|
+
"annotation": {
|
|
149
|
+
"type": "reference",
|
|
150
|
+
"typeName": {
|
|
151
|
+
"type": "identifier",
|
|
152
|
+
"name": "Record"
|
|
153
|
+
},
|
|
154
|
+
"typeParameters": {
|
|
155
|
+
"type": "typeParameterInstantiation",
|
|
156
|
+
"params": [
|
|
157
|
+
{
|
|
158
|
+
"type": "keyword",
|
|
159
|
+
"value": "string"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"type": "union",
|
|
163
|
+
"types": [
|
|
164
|
+
{
|
|
165
|
+
"type": "array",
|
|
166
|
+
"elementType": {
|
|
167
|
+
"type": "reference",
|
|
168
|
+
"typeName": {
|
|
169
|
+
"type": "qualifiedName",
|
|
170
|
+
"left": {
|
|
171
|
+
"type": "qualifiedName",
|
|
172
|
+
"left": {
|
|
173
|
+
"type": "identifier",
|
|
174
|
+
"name": "monaco"
|
|
175
|
+
},
|
|
176
|
+
"right": {
|
|
177
|
+
"type": "identifier",
|
|
178
|
+
"name": "languages"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"right": {
|
|
182
|
+
"type": "identifier",
|
|
183
|
+
"name": "CompletionItem"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"type": "typeLiteral",
|
|
190
|
+
"members": [
|
|
191
|
+
{
|
|
192
|
+
"type": "propertySignature",
|
|
193
|
+
"key": {
|
|
194
|
+
"type": "identifier",
|
|
195
|
+
"name": "triggerCharacter"
|
|
196
|
+
},
|
|
197
|
+
"annotation": {
|
|
198
|
+
"type": "keyword",
|
|
199
|
+
"value": "string"
|
|
200
|
+
},
|
|
201
|
+
"computed": false
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"type": "propertySignature",
|
|
205
|
+
"key": {
|
|
206
|
+
"type": "identifier",
|
|
207
|
+
"name": "list"
|
|
208
|
+
},
|
|
209
|
+
"annotation": {
|
|
210
|
+
"type": "array",
|
|
211
|
+
"elementType": {
|
|
212
|
+
"type": "reference",
|
|
213
|
+
"typeName": {
|
|
214
|
+
"type": "qualifiedName",
|
|
215
|
+
"left": {
|
|
216
|
+
"type": "qualifiedName",
|
|
217
|
+
"left": {
|
|
218
|
+
"type": "identifier",
|
|
219
|
+
"name": "monaco"
|
|
220
|
+
},
|
|
221
|
+
"right": {
|
|
222
|
+
"type": "identifier",
|
|
223
|
+
"name": "languages"
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"right": {
|
|
227
|
+
"type": "identifier",
|
|
228
|
+
"name": "CompletionItem"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"computed": false
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
]
|
|
125
244
|
}
|
|
126
245
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormItemElementBase } from "@next-shared/form";
|
|
3
|
+
import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
|
|
3
4
|
import "@next-core/theme";
|
|
5
|
+
import "./index.css";
|
|
6
|
+
export type Completers = Record<string, monaco.languages.CompletionItem[] | {
|
|
7
|
+
triggerCharacter: string;
|
|
8
|
+
list: monaco.languages.CompletionItem[];
|
|
9
|
+
}>;
|
|
4
10
|
export interface CodeEditorProps {
|
|
5
11
|
name?: string;
|
|
6
12
|
label?: string;
|
|
@@ -13,6 +19,7 @@ export interface CodeEditorProps {
|
|
|
13
19
|
minLines?: number;
|
|
14
20
|
maxLines?: number;
|
|
15
21
|
height?: string | number;
|
|
22
|
+
completers?: Completers;
|
|
16
23
|
}
|
|
17
24
|
/**
|
|
18
25
|
* 构件 code-editor
|
|
@@ -40,6 +47,7 @@ export declare class CodeEditor extends FormItemElementBase implements CodeEdito
|
|
|
40
47
|
* @default 3
|
|
41
48
|
*/
|
|
42
49
|
accessor minLines: number | undefined;
|
|
50
|
+
accessor completers: Completers | undefined;
|
|
43
51
|
/**
|
|
44
52
|
* @default Infinity
|
|
45
53
|
*/
|
|
@@ -48,6 +56,7 @@ export declare class CodeEditor extends FormItemElementBase implements CodeEdito
|
|
|
48
56
|
connectedCallback(): void;
|
|
49
57
|
render(): JSX.Element;
|
|
50
58
|
}
|
|
51
|
-
export declare function CodeEditorComponent({ value: _value, language: _language, theme: _theme, minLines: _minLines, maxLines: _maxLines, height: _height, automaticLayout, onChange, }: CodeEditorProps & {
|
|
59
|
+
export declare function CodeEditorComponent({ value: _value, language: _language, theme: _theme, minLines: _minLines, maxLines: _maxLines, height: _height, automaticLayout, completers, onChange, onHighlightClick, }: CodeEditorProps & {
|
|
52
60
|
onChange(value: string, isFlush: boolean): void;
|
|
61
|
+
onHighlightClick(word: string): void;
|
|
53
62
|
}): JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";
|
|
2
|
+
import { Completers } from "../index.jsx";
|
|
3
|
+
export declare const isInEvaluateBody: (model: monaco.editor.ITextModel, position: monaco.Position) => boolean;
|
|
4
|
+
export declare const brickNextYAMLProvideCompletionItems: (completers?: Completers) => (model: monaco.editor.ITextModel, position: monaco.Position, context: monaco.languages.CompletionContext, _token: monaco.CancellationToken) => monaco.languages.ProviderResult<monaco.languages.CompletionList>;
|
|
5
|
+
export declare const setDecoractions: (editor: monaco.editor.IStandaloneCodeEditor, decorationsCollection: monaco.editor.IEditorDecorationsCollection, completers?: Completers) => void;
|
package/docs/code-editor.md
CHANGED
|
@@ -53,7 +53,7 @@ children:
|
|
|
53
53
|
# Enhanced yaml for Brick Next
|
|
54
54
|
brick: button
|
|
55
55
|
properties:
|
|
56
|
-
textContent: '<% CTX.error ? "
|
|
56
|
+
textContent: '<% CTX.error ? "CTX.error": "Hello" %>'
|
|
57
57
|
automaticLayout: fit-content
|
|
58
58
|
- brick: vs.code-editor
|
|
59
59
|
properties:
|
|
@@ -67,3 +67,51 @@ children:
|
|
|
67
67
|
style:
|
|
68
68
|
marginTop: 2em
|
|
69
69
|
```
|
|
70
|
+
|
|
71
|
+
### Brick Next YAML with highlight
|
|
72
|
+
|
|
73
|
+
```yaml preview
|
|
74
|
+
- brick: vs.code-editor
|
|
75
|
+
events:
|
|
76
|
+
highlight.click:
|
|
77
|
+
- action: console.log
|
|
78
|
+
properties:
|
|
79
|
+
language: brick_next_yaml
|
|
80
|
+
value: |
|
|
81
|
+
# Enhanced yaml for Brick Next with completers
|
|
82
|
+
brick: button
|
|
83
|
+
properties:
|
|
84
|
+
buttonName: test
|
|
85
|
+
textContent: '<% CTX.error ? "CTX.error": "Hello" %>'
|
|
86
|
+
a: CTX.test
|
|
87
|
+
b: <% CTX.b %>
|
|
88
|
+
c: <% STATE.e %>
|
|
89
|
+
d: <% PATH.instanceId %>
|
|
90
|
+
e:
|
|
91
|
+
action: console.log
|
|
92
|
+
args:
|
|
93
|
+
- <% FN.getPageDetail(APP.id, CTX.pageTitle) %>
|
|
94
|
+
- <% `${ CTX.name }` %>
|
|
95
|
+
automaticLayout: fit-content
|
|
96
|
+
completers:
|
|
97
|
+
custom:
|
|
98
|
+
- label: buttonName
|
|
99
|
+
detail: string
|
|
100
|
+
- label: buttonType
|
|
101
|
+
detail: "primary|default|link|danger"
|
|
102
|
+
- label: buttonSize
|
|
103
|
+
insertText: size
|
|
104
|
+
target:
|
|
105
|
+
triggerCharacter: ":"
|
|
106
|
+
list:
|
|
107
|
+
- label: a
|
|
108
|
+
- label: b
|
|
109
|
+
CTX:
|
|
110
|
+
- label: pageTitle
|
|
111
|
+
- label: name
|
|
112
|
+
FN:
|
|
113
|
+
- label: getPageDetail
|
|
114
|
+
- label: getInstance
|
|
115
|
+
PATH:
|
|
116
|
+
- label: instanceId
|
|
117
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-bricks/vs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/vs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"postpublish": "mv package.json.bak package.json"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@next-core/build-next-bricks": "^1.
|
|
37
|
+
"@next-core/build-next-bricks": "^1.13.0",
|
|
38
38
|
"@next-core/test-next": "^1.0.6",
|
|
39
39
|
"resize-observer-polyfill": "^1.5.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "2473585d600a9df03bfb59ba823ea1303f3dd4bb"
|
|
42
42
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_next_bricks_vs=self.webpackChunk_next_bricks_vs||[]).push([[2664],{52664:(e,t,r)=>{r.r(t);var n,i,a=r(53395),s=r(40381),u=r(70687),h=r(25303),l=r(48657),o=r.n(l),c=r(80018),d=r(90196),m=r(11773),{method:g}=(0,c.createDecorators)();n=g();var f=new WeakMap,v=new WeakMap,Z=new WeakMap,p=new WeakMap,w=new WeakMap,b=new WeakMap;class k extends d.ReactNextElement{constructor(){super(...arguments),(0,a.Z)(this,b,{get:E,set:S}),(0,a.Z)(this,p,{get:L,set:W}),(0,a.Z)(this,v,{get:y,set:M}),(0,a.Z)(this,f,{writable:!0,value:!1}),(0,a.Z)(this,Z,{writable:!0,value:"normal"}),(0,a.Z)(this,w,{writable:!0,value:!1}),i(this)}get isFormItemElement(){return!0}set validateState(e){(0,s.Z)(this,p,e),this._render()}get validateState(){return(0,u.Z)(this,p)}set notRender(e){this.hidden=e,(0,s.Z)(this,v,e),this._render()}get notRender(){return(0,u.Z)(this,v)}get $bindFormItem(){return(0,u.Z)(this,b)}set $bindFormItem(e){(0,s.Z)(this,b,e),this._render()}getFormElement(){for(var e=this;(e=e.parentNode)&&e&&!e.isFormElement;);return e}}function y(){return(0,u.Z)(this,f)}function M(e){(0,s.Z)(this,f,e)}function L(){return(0,u.Z)(this,Z)}function W(e){(0,s.Z)(this,Z,e)}function E(){return(0,u.Z)(this,w)}function S(e){(0,s.Z)(this,w,e)}[i]=(0,h.Z)(k,[[n,2,"getFormElement"]],[]).e;var z,x,C,R,_,B,F,O,q,H,N,D,I,T,V,$,j,A,G,J,K,P,Q,U,X,Y,ee,te,re,ne,ie,ae,se,ue=r(46475),he=r(73701),le=r(47637),oe=r(64167),ce=r(27680),de=(r(65254),18),me=12,ge=12;(0,he.z2)(),(0,le.z2)(),(0,oe.z2)("brick_next_yaml"),(0,ce.z2)();var fe,{defineElement:ve,property:Ze,event:pe}=(0,c.createDecorators)(),we=(0,d.wrapBrick)("form.general-form-item");x=ve("vs.code-editor",{shadowOptions:!1}),C=Ze(),_=Ze(),F=Ze({attribute:!1}),q=Ze(),N=Ze(),I=Ze({type:Boolean}),V=Ze({type:Boolean}),j=Ze(),G=Ze({type:Number}),K=Ze({type:Number}),Q=Ze({attribute:!1}),X=pe({type:"code.change"}),re=pe({type:"user.input"});var be=new WeakMap,ke=new WeakMap,ye=new WeakMap,Me=new WeakMap,Le=new WeakMap,We=new WeakMap,Ee=new WeakMap,Se=new WeakMap,ze=new WeakMap,xe=new WeakMap,Ce=new WeakMap,Re=new WeakMap,_e=new WeakMap,Be=new WeakMap,Fe=new WeakMap,Oe=new WeakMap;function qe(e){te(this,e)}function He(){return ee(this)}function Ne(e){ae(this,e)}function De(){return ie(this)}function Ie(e){var{value:t,language:r,theme:n,minLines:i,maxLines:a,height:s,automaticLayout:u,onChange:h}=e,c=null!=t?t:"",d=null!=r?r:"plaintext",g=null!=n?n:"auto",f=null!=i?i:3,v=null!=a?a:1/0,Z=null!=s?s:500,p=(0,l.useRef)(null),w=(0,l.useRef)(),b=(0,l.useRef)({width:300,height:Te(c,f,v)}),[k,y]=(0,l.useState)(),M=(0,l.useRef)(u),L=(0,m.useCurrentTheme)();return(0,l.useEffect)((()=>{ue.editor.setTheme("auto"===g?"dark"===L||"dark-v2"===L?"vs-dark":"vs":g)}),[L,g]),(0,l.useEffect)((()=>{if(w.current){var e=w.current.getModel();ue.editor.setModelLanguage(e,d),e.setValue(c)}}),[c,d]),(0,l.useLayoutEffect)((()=>{var e;if("fit-content"===M.current&&p.current){b.current.width=p.current.getBoundingClientRect().width,null===(e=w.current)||void 0===e||e.layout(b.current);var t=new ResizeObserver((e=>{for(var t of e)if(t.target===p.current){var r,n=t.contentBoxSize?t.contentBoxSize[0].inlineSize:t.contentRect.width;n!==b.current.width&&(b.current.width=n,null===(r=w.current)||void 0===r||r.layout(b.current));break}}));return t.observe(p.current),()=>{t.disconnect()}}}),[]),(0,l.useLayoutEffect)((()=>{if("fit-container"===M.current){var e=function(e){for(var t=e;t;){var r="vs.code-editor"===t.tagName.toLowerCase();if(t=t.parentElement,r)return t}}(p.current);if(e){var t=new ResizeObserver((()=>{y(e.offsetHeight)}));return t.observe(e),()=>{t.disconnect()}}}}),[]),(0,l.useEffect)((()=>{"fit-container"!==M.current&&"fit-content"!==M.current&&y(Z)}),[Z]),(0,l.useEffect)((()=>{if(!w.current&&p.current){var e=ue.editor.createModel(c,d);w.current=ue.editor.create(p.current,{model:e,minimap:{enabled:!1},scrollBeyondLastLine:!1,tabSize:2,insertSpaces:!0,automaticLayout:"fit-content"!==M.current,fontSize:12,lineHeight:de,scrollbar:{horizontalScrollbarSize:me,verticalScrollbarSize:me,horizontalSliderSize:8,verticalSliderSize:8,alwaysConsumeMouseWheel:!1},padding:{top:ge,bottom:"fit-content"==M.current?void 0:ge},overviewRulerBorder:!1,mouseWheelScrollSensitivity:.5})}}),[c,d]),(0,l.useEffect)((()=>{var e=w.current;if(e&&p.current&&"fit-content"===M.current){var t=e.onDidContentSizeChange((t=>{if(t.contentHeightChanged){var r=Ve(t.contentHeight,f,v);r!==b.current.height&&(b.current.height=r,e.layout(b.current))}})),r=Ve(e.getContentHeight(),f,v);return r!==b.current.height&&(b.current.height=r,e.layout(b.current)),()=>{t.dispose()}}}),[v,f]),(0,l.useEffect)((()=>{if(w.current){var e=w.current.getModel(),t=e.onDidChangeContent((t=>{h(e.getValue(),t.isFlush)}));return()=>{t.dispose()}}}),[h]),(0,l.useEffect)((()=>()=>{var e,t,r;null===(e=w.current)||void 0===e||null===(t=e.getModel())||void 0===t||t.dispose(),null===(r=w.current)||void 0===r||r.dispose()}),[]),o().createElement("div",{ref:p,style:{height:k}})}function Te(e,t,r){return $e(Math.min(r,Math.max(t,e.split("\n").length)))}function Ve(e,t,r){var n=e;return(e-ge)%de==0&&(n=e+me),Math.min($e(r),Math.max(n,$e(t)))}function $e(e){return e*de+me+ge}({e:[R,B,O,H,D,T,$,A,J,P,U,Y,ee,te,ne,ie,ae,se],c:[fe,z]}=(0,h.Z)(class extends k{constructor(){super(...arguments),(0,a.Z)(this,Fe,{get:De,set:Ne}),(0,a.Z)(this,_e,{get:He,set:qe}),(0,a.Z)(this,be,{writable:!0,value:(se(this),R(this))}),(0,a.Z)(this,ke,{writable:!0,value:B(this)}),(0,a.Z)(this,ye,{writable:!0,value:O(this)}),(0,a.Z)(this,Me,{writable:!0,value:H(this)}),(0,a.Z)(this,Le,{writable:!0,value:D(this)}),(0,a.Z)(this,We,{writable:!0,value:T(this)}),(0,a.Z)(this,Ee,{writable:!0,value:$(this)}),(0,a.Z)(this,Se,{writable:!0,value:A(this)}),(0,a.Z)(this,ze,{writable:!0,value:J(this)}),(0,a.Z)(this,xe,{writable:!0,value:P(this)}),(0,a.Z)(this,Ce,{writable:!0,value:U(this)}),(0,a.Z)(this,Re,{writable:!0,value:Y(this)}),(0,a.Z)(this,Be,{writable:!0,value:ne(this)}),(0,a.Z)(this,Oe,{writable:!0,value:(e,t)=>{(0,u.Z)(this,_e).emit(e),t||(0,u.Z)(this,Fe).emit(e)}})}get name(){return(0,u.Z)(this,be)}set name(e){(0,s.Z)(this,be,e)}get label(){return(0,u.Z)(this,ke)}set label(e){(0,s.Z)(this,ke,e)}get value(){return(0,u.Z)(this,ye)}set value(e){(0,s.Z)(this,ye,e)}get language(){return(0,u.Z)(this,Me)}set language(e){(0,s.Z)(this,Me,e)}get theme(){return(0,u.Z)(this,Le)}set theme(e){(0,s.Z)(this,Le,e)}get required(){return(0,u.Z)(this,We)}set required(e){(0,s.Z)(this,We,e)}get readOnly(){return(0,u.Z)(this,Ee)}set readOnly(e){(0,s.Z)(this,Ee,e)}get automaticLayout(){return(0,u.Z)(this,Se)}set automaticLayout(e){(0,s.Z)(this,Se,e)}get minLines(){return(0,u.Z)(this,ze)}set minLines(e){(0,s.Z)(this,ze,e)}get maxLines(){return(0,u.Z)(this,xe)}set maxLines(e){(0,s.Z)(this,xe,e)}get height(){return(0,u.Z)(this,Ce)}set height(e){(0,s.Z)(this,Ce,e)}connectedCallback(){this.style.display||(this.style.display="block"),super.connectedCallback()}render(){return o().createElement(we,{curElement:this,formElement:this.getFormElement(),name:this.name,label:this.label,required:this.required},o().createElement(Ie,{value:this.value,language:this.language,theme:this.theme,automaticLayout:this.automaticLayout,minLines:this.minLines,maxLines:this.maxLines,height:this.height,onChange:(0,u.Z)(this,Oe)}))}},[[C,1,"name"],[_,1,"label"],[F,1,"value"],[q,1,"language"],[N,1,"theme"],[I,1,"required"],[V,1,"readOnly"],[j,1,"automaticLayout"],[G,1,"minLines"],[K,1,"maxLines"],[Q,1,"height"],[X,1,"codeChange",function(){return(0,u.Z)(this,Re)},function(e){(0,s.Z)(this,Re,e)}],[re,1,"userInput",function(){return(0,u.Z)(this,Be)},function(e){(0,s.Z)(this,Be,e)}]],[x])),z()}}]);
|
|
2
|
-
//# sourceMappingURL=2664.daee4a68.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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E,IAAAX,EAAAA,EAAAA,GAAA,KAAAmD,GAAAxC,EAAA,CAGRkE,aAAM,OAAA1E,EAAAA,EAAAA,GAAA,KAAAiD,GAAA,CAANyB,WAAMlE,IAAAX,EAAAA,EAAAA,GAAA,KAAAoD,GAAAzC,EAAA,CAefoL,oBAGO9L,KAAKgK,MAAM+B,UACd/L,KAAKgK,MAAM+B,QAAU,SAEvBC,MAAMF,mBACR,CAEAG,SACE,OACEnC,IAAAA,cAACtI,GAAe,CACd0K,WAAYlM,KACZmM,YAAanM,KAAKM,iBAClBoL,KAAM1L,KAAK0L,KACXC,MAAO3L,KAAK2L,MACZC,SAAU5L,KAAK4L,UAEf9B,IAAAA,cAAC7F,GAAmB,CAClBtE,MAAOK,KAAKL,MACZyE,SAAUpE,KAAKoE,SACfE,MAAOtE,KAAKsE,MACZQ,gBAAiB9E,KAAK8E,gBACtBN,SAAUxE,KAAKwE,SACfE,SAAU1E,KAAK0E,SACfE,OAAQ5E,KAAK4E,OACbG,UAAQ7E,EAAAA,EAAAA,GAAEF,KAAIwD,MAItB,GACD,EAAA7B,EAAA,WAAAC,EAAA,YAAAC,EAAA,YAAAE,EAAA,eAAAC,EAAA,YAAAC,EAAA,eAAAG,EAAA,eAAAC,EAAA,sBAAAC,EAAA,eAAAE,EAAA,eAAAC,EAAA,aAAAC,EAAA,iCAAAxC,EAAAA,EAAAA,GAAA,KAAAkD,GAAA,WAAAzD,IAAAI,EAAAA,EAAAA,GAAA,KAAAqD,GAAAzD,EAAA,IAAAgD,GAAA,gCAAAzC,EAAAA,EAAAA,GAAA,KAAAoD,GAAA,WAAA3D,IAAAI,EAAAA,EAAAA,GAAA,KAAAuD,GAAA3D,EAAA,KAAAtB,KAAAmN,G","sources":["webpack:///../../src/FormItemElement.tsx","webpack:///./src/code-editor/constants.ts","webpack:///./src/code-editor/index.tsx"],"sourcesContent":["import { createDecorators } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport type { AbstractForm } from \"./Form.js\";\n\nconst { method } = createDecorators();\n\nexport abstract class FormItemElementBase extends ReactNextElement {\n accessor #_notRender = false;\n accessor #validate = \"normal\";\n accessor #bindFormItem = false;\n\n get isFormItemElement(): true {\n return true;\n }\n\n set validateState(value: string) {\n this.#validate = value;\n this._render();\n }\n get validateState() {\n return this.#validate;\n }\n\n /**\n * 控制该表单项是否隐藏\n * @default false\n * @group ui\n */\n set notRender(value: boolean) {\n this.hidden = value;\n this.#_notRender = value;\n this._render();\n }\n get notRender(): boolean {\n return this.#_notRender;\n }\n\n get $bindFormItem() {\n return this.#bindFormItem;\n }\n set $bindFormItem(value: boolean) {\n this.#bindFormItem = value;\n this._render();\n }\n\n @method()\n getFormElement(): AbstractForm | null {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let element: AbstractForm | null = this as unknown as AbstractForm;\n while ((element = element.parentNode as AbstractForm | null)) {\n if (!element || element.isFormElement) {\n break;\n }\n }\n return element as AbstractForm | null;\n }\n}\n","export const EDITOR_FONT_SIZE = 12;\nexport const EDITOR_LINE_HEIGHT = 18;\nexport const EDITOR_SCROLLBAR_SIZE = 12;\nexport const EDITOR_PADDING_VERTICAL = 12;\n","import React, { useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { EventEmitter, createDecorators } from \"@next-core/element\";\nimport { wrapBrick } from \"@next-core/react-element\";\nimport { useCurrentTheme } from \"@next-core/react-runtime\";\nimport { FormItemElementBase } from \"@next-shared/form\";\nimport type { FormItem, FormItemProps } from \"@next-bricks/form/form-item\";\nimport * as monaco from \"monaco-editor/esm/vs/editor/editor.api.js\";\nimport { register as registerJavaScript } from \"@next-core/monaco-contributions/javascript\";\nimport { register as registerTypeScript } from \"@next-core/monaco-contributions/typescript\";\nimport { register as registerYaml } from \"@next-core/monaco-contributions/yaml\";\nimport { register as registerHtml } from \"@next-core/monaco-contributions/html\";\nimport \"@next-core/theme\";\nimport {\n EDITOR_SCROLLBAR_SIZE,\n EDITOR_PADDING_VERTICAL,\n EDITOR_LINE_HEIGHT,\n EDITOR_FONT_SIZE,\n} from \"./constants.js\";\n\nregisterJavaScript();\nregisterTypeScript();\nregisterYaml(\"brick_next_yaml\");\nregisterHtml();\n\nconst { defineElement, property, event } = createDecorators();\n\nconst WrappedFormItem = wrapBrick<FormItem, FormItemProps>(\n \"form.general-form-item\"\n);\n\nexport interface CodeEditorProps {\n name?: string;\n label?: string;\n value?: string;\n language?: string;\n theme?: string;\n required?: boolean;\n readOnly?: boolean;\n automaticLayout?: \"fit-container\" | \"fit-content\" | \"none\";\n minLines?: number;\n maxLines?: number;\n height?: string | number;\n}\n\n/**\n * 构件 code-editor\n */\nexport\n@defineElement(\"vs.code-editor\", {\n // There are a few issues for monaco-editor with shadow DOM.\n // So we use light DOM for now.\n // See https://github.com/microsoft/monaco-editor/issues?q=is%3Aissue+is%3Aopen+shadow+dom\n shadowOptions: false,\n})\nclass CodeEditor extends FormItemElementBase implements CodeEditorProps {\n @property()\n accessor name: string | undefined;\n\n @property()\n accessor label: string | undefined;\n\n @property({ attribute: false })\n accessor value: string | undefined;\n\n /**\n * @default \"plaintext\"\n */\n @property()\n accessor language: string | undefined;\n\n /**\n * 主题,支持 `\"auto\" | \"vs\" | \"vs-dark\"`\n *\n * @default \"auto\"\n * @group ui\n */\n @property() accessor theme: string | undefined;\n\n @property({\n type: Boolean,\n })\n accessor required: boolean | undefined;\n\n @property({\n type: Boolean,\n })\n accessor readOnly: boolean | undefined;\n\n @property()\n accessor automaticLayout:\n | \"fit-container\"\n | \"fit-content\"\n | \"none\"\n | undefined;\n\n /**\n * @default 3\n */\n @property({ type: Number })\n accessor minLines: number | undefined;\n\n /**\n * @default Infinity\n */\n @property({ type: Number })\n accessor maxLines: number | undefined;\n\n @property({ attribute: false })\n accessor height: string | number | undefined;\n\n @event({ type: \"code.change\" })\n accessor #codeChange!: EventEmitter<string>;\n\n @event({ type: \"user.input\" })\n accessor #userInput!: EventEmitter<string>;\n\n #handleChange = (value: string, isFlush: boolean) => {\n this.#codeChange.emit(value);\n if (!isFlush) {\n this.#userInput.emit(value);\n }\n };\n\n connectedCallback(): void {\n // Don't override user's style settings.\n // istanbul ignore else\n if (!this.style.display) {\n this.style.display = \"block\";\n }\n super.connectedCallback();\n }\n\n render() {\n return (\n <WrappedFormItem\n curElement={this}\n formElement={this.getFormElement()}\n name={this.name}\n label={this.label}\n required={this.required}\n >\n <CodeEditorComponent\n value={this.value}\n language={this.language}\n theme={this.theme}\n automaticLayout={this.automaticLayout}\n minLines={this.minLines}\n maxLines={this.maxLines}\n height={this.height}\n onChange={this.#handleChange}\n />\n </WrappedFormItem>\n );\n }\n}\n\nexport function CodeEditorComponent({\n value: _value,\n language: _language,\n theme: _theme,\n minLines: _minLines,\n maxLines: _maxLines,\n height: _height,\n automaticLayout,\n onChange,\n}: CodeEditorProps & { onChange(value: string, isFlush: boolean): void }) {\n const value = _value ?? \"\";\n const language = _language ?? \"plaintext\";\n const theme = _theme ?? \"auto\";\n const minLines = _minLines ?? 3;\n const maxLines = _maxLines ?? Infinity;\n const height = _height ?? 500;\n\n const containerRef = useRef<HTMLDivElement>(null);\n const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();\n const size = useRef<monaco.editor.IDimension>({\n width: 300,\n height: getContentHeightByCode(value, minLines, maxLines),\n });\n const [actualHeight, setActualHeight] = useState<string | number>();\n // `automaticLayout` should never change\n const automaticLayoutRef = useRef(automaticLayout);\n const systemTheme = useCurrentTheme();\n\n useEffect(() => {\n // Currently theme is configured globally.\n // See https://github.com/microsoft/monaco-editor/issues/338\n monaco.editor.setTheme(\n theme === \"auto\"\n ? systemTheme === \"dark\" || systemTheme === \"dark-v2\"\n ? \"vs-dark\"\n : \"vs\"\n : theme\n );\n }, [systemTheme, theme]);\n\n useEffect(() => {\n if (editorRef.current) {\n const currentModel = editorRef.current.getModel()!;\n monaco.editor.setModelLanguage(currentModel, language);\n currentModel.setValue(value);\n }\n }, [value, language]);\n\n useLayoutEffect(() => {\n if (automaticLayoutRef.current !== \"fit-content\" || !containerRef.current) {\n return;\n }\n\n size.current.width = containerRef.current.getBoundingClientRect().width;\n editorRef.current?.layout(size.current);\n\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (entry.target === containerRef.current) {\n const newWidth = entry.contentBoxSize\n ? entry.contentBoxSize[0].inlineSize\n : entry.contentRect.width;\n if (newWidth !== size.current.width) {\n size.current.width = newWidth;\n editorRef.current?.layout(size.current);\n }\n break;\n }\n }\n });\n observer.observe(containerRef.current);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n useLayoutEffect(() => {\n if (automaticLayoutRef.current !== \"fit-container\") {\n return;\n }\n\n const container = getDOMContainer(containerRef.current);\n if (!container) {\n return;\n }\n // Manually layout the editor once the container resized.\n const observer = new ResizeObserver((): void => {\n setActualHeight(container.offsetHeight);\n });\n observer.observe(container);\n return () => {\n observer.disconnect();\n };\n }, []);\n\n useEffect(() => {\n if (\n automaticLayoutRef.current !== \"fit-container\" &&\n automaticLayoutRef.current !== \"fit-content\"\n ) {\n setActualHeight(height);\n }\n }, [height]);\n\n useEffect(() => {\n if (editorRef.current || !containerRef.current) {\n return;\n }\n const model = monaco.editor.createModel(value, language);\n editorRef.current = monaco.editor.create(containerRef.current, {\n model,\n minimap: {\n enabled: false,\n },\n scrollBeyondLastLine: false,\n tabSize: 2,\n insertSpaces: true,\n automaticLayout: automaticLayoutRef.current !== \"fit-content\",\n fontSize: EDITOR_FONT_SIZE,\n lineHeight: EDITOR_LINE_HEIGHT,\n scrollbar: {\n horizontalScrollbarSize: EDITOR_SCROLLBAR_SIZE,\n verticalScrollbarSize: EDITOR_SCROLLBAR_SIZE,\n horizontalSliderSize: 8,\n verticalSliderSize: 8,\n alwaysConsumeMouseWheel: false,\n },\n padding: {\n top: EDITOR_PADDING_VERTICAL,\n // When use `fit-content`, we always plus the height with the vertical padding.\n // Thus the possible x-scrollbar will not take extra space at the bottom.\n bottom:\n automaticLayoutRef.current == \"fit-content\"\n ? undefined\n : EDITOR_PADDING_VERTICAL,\n },\n overviewRulerBorder: false,\n mouseWheelScrollSensitivity: 0.5,\n });\n }, [value, language]);\n\n useEffect(() => {\n const editor = editorRef.current;\n if (\n !editor ||\n !containerRef.current ||\n automaticLayoutRef.current !== \"fit-content\"\n ) {\n return;\n }\n\n const listener = editor.onDidContentSizeChange((e) => {\n if (e.contentHeightChanged) {\n const newHeight = fixEditorHeightWithScrollBar(\n e.contentHeight,\n minLines,\n maxLines\n );\n if (newHeight !== size.current.height) {\n size.current.height = newHeight;\n editor.layout(size.current);\n }\n }\n });\n\n const newHeight = fixEditorHeightWithScrollBar(\n editor.getContentHeight(),\n minLines,\n maxLines\n );\n if (newHeight !== size.current.height) {\n size.current.height = newHeight;\n editor.layout(size.current);\n }\n\n return () => {\n listener.dispose();\n };\n }, [maxLines, minLines]);\n\n useEffect(() => {\n if (!editorRef.current) {\n return;\n }\n const currentModel = editorRef.current.getModel()!;\n const listener = currentModel.onDidChangeContent((e) => {\n onChange(currentModel.getValue(), e.isFlush);\n });\n return () => {\n listener.dispose();\n };\n }, [onChange]);\n\n useEffect(() => {\n return () => {\n editorRef.current?.getModel()?.dispose();\n editorRef.current?.dispose();\n };\n }, []);\n\n return <div ref={containerRef} style={{ height: actualHeight }} />;\n}\n\nfunction getContentHeightByCode(\n code: string,\n minLines: number,\n maxLines: number\n): number {\n return getContentHeightByLines(\n Math.min(maxLines, Math.max(minLines, code.split(\"\\n\").length))\n );\n}\n\nfunction fixEditorHeightWithScrollBar(\n contentHeight: number,\n minLines: number,\n maxLines: number\n): number {\n let fixedHeight = contentHeight;\n if ((contentHeight - EDITOR_PADDING_VERTICAL) % EDITOR_LINE_HEIGHT === 0) {\n fixedHeight = contentHeight + EDITOR_SCROLLBAR_SIZE;\n }\n return Math.min(\n getContentHeightByLines(maxLines),\n Math.max(fixedHeight, getContentHeightByLines(minLines))\n );\n}\n\nfunction getContentHeightByLines(lines: number): number {\n return (\n lines * EDITOR_LINE_HEIGHT + EDITOR_SCROLLBAR_SIZE + EDITOR_PADDING_VERTICAL\n );\n}\n\n/** Get the direct DOM container of `vs.code-editor` */\nfunction getDOMContainer(element: HTMLElement | null) {\n let brick = element;\n while (brick) {\n const found = brick.tagName.toLowerCase() === \"vs.code-editor\";\n brick = brick.parentElement;\n if (found) {\n return brick;\n }\n }\n}\n"],"names":["method","createDecorators","_dec","_A","WeakMap","_notRender","_B","_validate","_C","_bindFormItem","FormItemElementBase","ReactNextElement","constructor","arguments","_classPrivateFieldInitSpec","get","_get_bindFormItem","set","_set_bindFormItem","_get_validate","_set_validate","_get__notRender","_set__notRender","writable","value","_initProto","isFormItemElement","validateState","_classPrivateFieldSet","this","_render","_classPrivateFieldGet","notRender","hidden","$bindFormItem","getFormElement","element","parentNode","isFormElement","v","_applyDecs2203R","e","EDITOR_LINE_HEIGHT","EDITOR_SCROLLBAR_SIZE","EDITOR_PADDING_VERTICAL","registerJavaScript","registerTypeScript","registerYaml","registerHtml","_CodeEditor","defineElement","property","event","WrappedFormItem","wrapBrick","shadowOptions","_dec2","_dec3","_dec4","attribute","_dec5","_dec6","_dec7","type","Boolean","_dec8","_dec9","_dec10","Number","_dec11","_dec12","_dec13","_dec14","_D","_E","_F","_G","_H","_I","_J","_K","_L","_codeChange","_M","_userInput","_handleChange","_set_codeChange2","_set_codeChange","_get_codeChange2","_get_codeChange","_set_userInput2","_set_userInput","_get_userInput2","_get_userInput","CodeEditorComponent","_ref","_value","language","_language","theme","_theme","minLines","_minLines","maxLines","_maxLines","height","_height","automaticLayout","onChange","Infinity","containerRef","useRef","editorRef","size","width","getContentHeightByCode","actualHeight","setActualHeight","useState","automaticLayoutRef","systemTheme","useCurrentTheme","useEffect","monaco","current","currentModel","getModel","setValue","useLayoutEffect","_editorRef$current","getBoundingClientRect","layout","observer","ResizeObserver","entries","entry","target","_editorRef$current2","newWidth","contentBoxSize","inlineSize","contentRect","observe","disconnect","container","brick","found","tagName","toLowerCase","parentElement","getDOMContainer","offsetHeight","model","minimap","enabled","scrollBeyondLastLine","tabSize","insertSpaces","fontSize","lineHeight","scrollbar","horizontalScrollbarSize","verticalScrollbarSize","horizontalSliderSize","verticalSliderSize","alwaysConsumeMouseWheel","padding","top","bottom","undefined","overviewRulerBorder","mouseWheelScrollSensitivity","editor","listener","onDidContentSizeChange","contentHeightChanged","newHeight","fixEditorHeightWithScrollBar","contentHeight","getContentHeight","dispose","onDidChangeContent","getValue","isFlush","_editorRef$current3","_editorRef$current3$g","_editorRef$current4","React","ref","style","code","getContentHeightByLines","Math","min","max","split","length","fixedHeight","lines","_init_name","_init_label","_init_value","_init_language","_init_theme","_init_required","_init_readOnly","_init_automaticLayout","_init_minLines","_init_maxLines","_init_height","_init_codeChange","_init_userInput","c","_initClass","emit","name","label","required","readOnly","connectedCallback","display","super","render","curElement","formElement"],"sourceRoot":""}
|