@po-ui/ng-code-editor 19.26.0 → 20.0.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/index.d.ts +429 -3
- package/package.json +9 -9
- package/po-ui-ng-code-editor-20.0.0.tgz +0 -0
- package/schematics/ng-add/index.js +1 -1
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-options.interface.d.ts +0 -22
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface.d.ts +0 -37
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface.d.ts +0 -21
- package/lib/components/po-code-editor/interfaces/po-code-editor-registerable.interface.d.ts +0 -17
- package/lib/components/po-code-editor/po-code-editor-base.component.d.ts +0 -194
- package/lib/components/po-code-editor/po-code-editor-register.service.d.ts +0 -70
- package/lib/components/po-code-editor/po-code-editor-suggestion.service.d.ts +0 -10
- package/lib/components/po-code-editor/po-code-editor.component.d.ts +0 -61
- package/lib/components/po-code-editor/po-code-editor.module.d.ts +0 -16
- package/lib/index.d.ts +0 -7
- package/po-ui-ng-code-editor-19.26.0.tgz +0 -0
- package/public-api.d.ts +0 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,431 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { AfterViewInit, DoCheck, ElementRef, NgZone, ModuleWithProviders } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import * as i2 from '@angular/common';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
|
-
*
|
|
7
|
+
* @usedBy PoCodeEditorRegister, PoCodeEditorComponent
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
*
|
|
11
|
+
* Interface para configuração da lista de sugestão do autocomplete do code editor.
|
|
3
12
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
interface PoCodeEditorRegisterableSuggestion {
|
|
14
|
+
/** Texto que será exibido na lista de sugestões. */
|
|
15
|
+
label: string;
|
|
16
|
+
/** Texto que será inserido no editor ao selecionar a sugestão exibida pelo autocomplete. */
|
|
17
|
+
insertText: string;
|
|
18
|
+
/** Texto de ajuda que será exibido caso o usuário deseje ver mais informações sobre a sugestão. */
|
|
19
|
+
documentation?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @usedBy PoCodeEditorRegister, PoCodeEditorRegisterable
|
|
23
|
+
*
|
|
24
|
+
* @description
|
|
25
|
+
*
|
|
26
|
+
* Interface do objeto usado pelo monaco para lista de sugestão do autocomplete do code editor.
|
|
27
|
+
*/
|
|
28
|
+
interface PoCodeEditorRegisterableSuggestionType {
|
|
29
|
+
provideCompletionItems: () => {
|
|
30
|
+
suggestions: Array<PoCodeEditorRegisterableSuggestion>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @description
|
|
36
|
+
*
|
|
37
|
+
* O `po-code-editor` é um componente para edição de código fonte baseado no Monaco Editor da Microsoft.
|
|
38
|
+
*
|
|
39
|
+
* Sendo assim, algumas configurações presentes no Monaco podem ser utilizadas aqui, como a escolha da linguagem
|
|
40
|
+
* (utilizando o highlight syntax específico), escolha do tema e opção de diff, além de ser muito similar ao Visual
|
|
41
|
+
* Studio Code, com autocomplete e fechamento automático de brackets.
|
|
42
|
+
*
|
|
43
|
+
* Este componente pode ser usado em qualquer situação que necessite de adição de códigos, como por exemplo, criar
|
|
44
|
+
* receitas utilizando Terraform para gerenciar topologias.
|
|
45
|
+
* É importante ressaltar que este não é um componente para edição de textos comuns.
|
|
46
|
+
*
|
|
47
|
+
* O [(ngModel)] deve ser usado para manipular o conteúdo do po-code-editor, ou seja, tanto para incluir um conteúdo quanto
|
|
48
|
+
* para recuperar o conteúdo do po-code-editor, utiliza-se uma variável passada por [(ngModel)].
|
|
49
|
+
*
|
|
50
|
+
* #### Adicionando o pacote @po-ui/ng-code-editor
|
|
51
|
+
*
|
|
52
|
+
* Para instalar o pacote `po-code-editor` em sua aplicação execute:
|
|
53
|
+
*
|
|
54
|
+
* ```shell
|
|
55
|
+
* ng add @po-ui/ng-code-editor
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* O comando `ng add` do `Angular CLI`:
|
|
59
|
+
* - inclui o `po-code-editor` no seu projeto;
|
|
60
|
+
* - adiciona o módulo `PoCodeEditorModule`:;
|
|
61
|
+
*
|
|
62
|
+
* ```
|
|
63
|
+
* // app.module.ts
|
|
64
|
+
* ...
|
|
65
|
+
* import { PoModule } from '@po-ui/ng-components';
|
|
66
|
+
* import { PoCodeEditorModule } from '@po-ui/ng-code-editor';
|
|
67
|
+
* ...
|
|
68
|
+
* @NgModule({
|
|
69
|
+
* imports: [
|
|
70
|
+
* ...
|
|
71
|
+
* PoModule,
|
|
72
|
+
* PoCodeEditorModule
|
|
73
|
+
* ],
|
|
74
|
+
* ...
|
|
75
|
+
* })
|
|
76
|
+
* export class AppModule { }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* - adiciona o tema PO UI e também o *asset* do Monaco no arquivo `angular.json`, conforme abaixo:
|
|
80
|
+
*
|
|
81
|
+
* <pre ngNonBindable>
|
|
82
|
+
* ...
|
|
83
|
+
* "assets": [
|
|
84
|
+
* { "glob": "**/*", "input": "node_modules/monaco-editor/min", "output": "/assets/monaco/" }
|
|
85
|
+
* ],
|
|
86
|
+
* "styles": [
|
|
87
|
+
* "./node_modules/@po-ui/style/css/po-theme-default.min.css"
|
|
88
|
+
* ]
|
|
89
|
+
* ...
|
|
90
|
+
* </pre>
|
|
91
|
+
*/
|
|
92
|
+
declare abstract class PoCodeEditorBaseComponent implements ControlValueAccessor {
|
|
93
|
+
editor: any;
|
|
94
|
+
modifiedValue: string;
|
|
95
|
+
value: any;
|
|
96
|
+
private _height;
|
|
97
|
+
private _language;
|
|
98
|
+
private _readonly;
|
|
99
|
+
private _showDiff;
|
|
100
|
+
private _suggestions;
|
|
101
|
+
private _theme;
|
|
102
|
+
/**
|
|
103
|
+
* @optional
|
|
104
|
+
*
|
|
105
|
+
* @description
|
|
106
|
+
*
|
|
107
|
+
* Linguagem na qual será apresentado o código fonte.
|
|
108
|
+
* Para saber quais são as linguagens compatíveis, consulte a documentação oficial do
|
|
109
|
+
* [**Monaco Editor**](https://microsoft.github.io/monaco-editor/).
|
|
110
|
+
*
|
|
111
|
+
* Também é possível adicionar uma nova linguagem personalizada utilizando o serviço:
|
|
112
|
+
* [**po-code-editor-register**](https://po-ui.io/documentation/po-code-editor-register?view=doc).
|
|
113
|
+
*
|
|
114
|
+
* @default `plainText`
|
|
115
|
+
*/
|
|
116
|
+
set language(language: string);
|
|
117
|
+
get language(): string;
|
|
118
|
+
/**
|
|
119
|
+
* @optional
|
|
120
|
+
*
|
|
121
|
+
* @description
|
|
122
|
+
*
|
|
123
|
+
* Indica se o editor será aberto em modo de leitura.
|
|
124
|
+
*
|
|
125
|
+
* Neste caso, não é possível editar o código inserido.
|
|
126
|
+
*
|
|
127
|
+
* Obs: Esta propriedade não refletirá efeito se alterada após o carregamento do componente.
|
|
128
|
+
*
|
|
129
|
+
* @default `false`
|
|
130
|
+
*/
|
|
131
|
+
set readonly(readonly: boolean);
|
|
132
|
+
get readonly(): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* @optional
|
|
135
|
+
*
|
|
136
|
+
* @description
|
|
137
|
+
*
|
|
138
|
+
* Indica se o editor será aberto em modo de comparação.
|
|
139
|
+
*
|
|
140
|
+
* Caso esteja habilitada esta opção, então o [(ngModel)] deverá ser passado como um array, cuja primeira opção deve
|
|
141
|
+
* conter uma string com o código original e na segunda posição uma string código modificado para efeito de
|
|
142
|
+
* comparação. Neste caso, o usuário conseguirá editar apenas o código modificado e isso refletirá na segunda posição
|
|
143
|
+
* do array consequentemente.
|
|
144
|
+
*
|
|
145
|
+
* Obs: Esta propriedade não refletirá efeito se alterada após o carregamento do componente.
|
|
146
|
+
*
|
|
147
|
+
* @default `false`
|
|
148
|
+
*/
|
|
149
|
+
set showDiff(showDiff: boolean);
|
|
150
|
+
get showDiff(): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* @optional
|
|
153
|
+
*
|
|
154
|
+
* @description
|
|
155
|
+
*
|
|
156
|
+
* Lista de sugestões usadas pelo autocomplete dentro do editor.
|
|
157
|
+
*
|
|
158
|
+
* Para visualizar a lista de sugestões use o comando `CTRL + SPACE`.
|
|
159
|
+
*
|
|
160
|
+
* Caso o editor esteja usando uma linguagem que já tenha uma lista de sugestões predefinida, o valor passado será adicionado
|
|
161
|
+
* a lista preexistente, aumentando as opções para o usuário.
|
|
162
|
+
*
|
|
163
|
+
* Caso tenha mais de um editor da mesma linguagem na aplicação, as sugestões serão adicionadas para que todos os editores da mesma linguagem
|
|
164
|
+
* tenham as mesmas sugestões.
|
|
165
|
+
*
|
|
166
|
+
* ```
|
|
167
|
+
* <po-code-editor
|
|
168
|
+
* [p-suggestions]="[{ label: 'po', insertText: 'Portinari UI' }, { label: 'ng', insertText: 'Angular' }]">
|
|
169
|
+
* </po-code-editor>
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* Ao fornecer uma lista de sugestões é possível acelerar a escrita de scripts pelos usuários.
|
|
173
|
+
*/
|
|
174
|
+
set suggestions(values: Array<PoCodeEditorRegisterableSuggestion>);
|
|
175
|
+
get suggestions(): Array<PoCodeEditorRegisterableSuggestion>;
|
|
176
|
+
/**
|
|
177
|
+
* @optional
|
|
178
|
+
*
|
|
179
|
+
* @description
|
|
180
|
+
*
|
|
181
|
+
* Define um tema para o editor.
|
|
182
|
+
*
|
|
183
|
+
* Temas válidos:
|
|
184
|
+
* - `vs-dark`
|
|
185
|
+
* - `vs`
|
|
186
|
+
* - `hc-black`
|
|
187
|
+
*
|
|
188
|
+
* É importante salientar que o tema será aplicados a todos os componentes po-code-editor existentes na tela,
|
|
189
|
+
* ou seja, todas as instâncias do componente receberão o último tema atribuído ou o tema da última instância
|
|
190
|
+
* criada.
|
|
191
|
+
*
|
|
192
|
+
* @default `vs`
|
|
193
|
+
*/
|
|
194
|
+
set theme(theme: string);
|
|
195
|
+
get theme(): string;
|
|
196
|
+
/**
|
|
197
|
+
* @optional
|
|
198
|
+
*
|
|
199
|
+
* @description
|
|
200
|
+
*
|
|
201
|
+
* Define a altura do componente em pixels do po-code-editor.
|
|
202
|
+
* Esta propriedade não poderá ser alterada após o componente ter sido iniciado.
|
|
203
|
+
* A altura mínima é 150 pixels.
|
|
204
|
+
*/
|
|
205
|
+
set height(height: string);
|
|
206
|
+
get height(): string;
|
|
207
|
+
onTouched: (value: any) => void;
|
|
208
|
+
onChangePropagate: (value: any) => void;
|
|
209
|
+
getOptions(): {
|
|
210
|
+
language: string;
|
|
211
|
+
theme: string;
|
|
212
|
+
readOnly: boolean;
|
|
213
|
+
};
|
|
214
|
+
registerOnChange(fn: any): void;
|
|
215
|
+
registerOnTouched(fn: any): void;
|
|
216
|
+
protected convertToBoolean(val: any): boolean;
|
|
217
|
+
abstract writeValue(value: any): any;
|
|
218
|
+
abstract setLanguage(value: any): any;
|
|
219
|
+
abstract setTheme(value: any): any;
|
|
220
|
+
abstract setReadOnly(value: any): any;
|
|
221
|
+
abstract setSuggestions(value: any): any;
|
|
222
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorBaseComponent, never>;
|
|
223
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PoCodeEditorBaseComponent, never, never, { "language": { "alias": "p-language"; "required": false; }; "readonly": { "alias": "p-readonly"; "required": false; }; "showDiff": { "alias": "p-show-diff"; "required": false; }; "suggestions": { "alias": "p-suggestions"; "required": false; }; "theme": { "alias": "p-theme"; "required": false; }; "height": { "alias": "p-height"; "required": false; }; }, {}, never, never, true, never>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @usedBy PoCodeEditorRegister
|
|
228
|
+
*
|
|
229
|
+
* @description
|
|
230
|
+
*
|
|
231
|
+
* Interface para configuração de tokens de novas sintaxes ao code editor.
|
|
232
|
+
*/
|
|
233
|
+
interface PoCodeEditorRegisterableTokens {
|
|
234
|
+
/** Principal tokenizer da sintaxe customizada. */
|
|
235
|
+
root: Array<any>;
|
|
236
|
+
/** Tokenizer de comentários. */
|
|
237
|
+
comment?: Array<any>;
|
|
238
|
+
/** Tokenizer de strings. */
|
|
239
|
+
string?: Array<any>;
|
|
240
|
+
/** Tokenizer de whitespaces. */
|
|
241
|
+
whitespace?: Array<any>;
|
|
242
|
+
/** Sequência de interpolação. */
|
|
243
|
+
interpolated?: Array<any>;
|
|
244
|
+
/** Sequência de interpolação composta. */
|
|
245
|
+
interpolatedCompound?: Array<any>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @usedBy PoCodeEditorRegister
|
|
250
|
+
*
|
|
251
|
+
* @description
|
|
252
|
+
*
|
|
253
|
+
* Interface para configuração de Opções de novas sintaxes ao code editor.
|
|
254
|
+
*/
|
|
255
|
+
interface PoCodeEditorRegisterableOptions {
|
|
256
|
+
/** Palavras chaves da sintaxe. */
|
|
257
|
+
keywords: Array<string>;
|
|
258
|
+
/** Operadores específicos da sintaxe. */
|
|
259
|
+
operators: Array<string>;
|
|
260
|
+
/** Símbolos específicos da sintaxes. */
|
|
261
|
+
symbols: RegExp;
|
|
262
|
+
/** Escapes específicos da sintaxes. */
|
|
263
|
+
escapes: RegExp;
|
|
264
|
+
/** Interface para recebimento de token específicos da sintaxe. */
|
|
265
|
+
tokenizer: PoCodeEditorRegisterableTokens;
|
|
266
|
+
/** Define se a sintaxe será case sensitive ou não. */
|
|
267
|
+
ignoreCase?: boolean;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @usedBy PoCodeEditorRegister
|
|
272
|
+
*
|
|
273
|
+
* @description
|
|
274
|
+
*
|
|
275
|
+
* Interface para configuração de novas sintaxes ao code editor.
|
|
276
|
+
*/
|
|
277
|
+
interface PoCodeEditorRegisterable {
|
|
278
|
+
/** Nome da sintaxe a ser registrada no code editor. */
|
|
279
|
+
language: string;
|
|
280
|
+
/** Opções de configuração da sintaxe customizada. */
|
|
281
|
+
options: PoCodeEditorRegisterableOptions;
|
|
282
|
+
/** Lista de sugestões para a função de autocomplete. */
|
|
283
|
+
suggestions?: PoCodeEditorRegisterableSuggestionType;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @description
|
|
288
|
+
*
|
|
289
|
+
* Wrapper para registro de sintaxes customizadas para o po-code-editor.
|
|
290
|
+
*
|
|
291
|
+
* Para utilização do serviço de idiomas **PoCodeEditorRegister**,
|
|
292
|
+
* deve-se importar o módulo PoCodeEditorModule mesmo já tendo importado
|
|
293
|
+
* o módulo PoModule.
|
|
294
|
+
* Na importação opcionalmente pode ser invocado o método **forRegister** informando um objeto para configuração.
|
|
295
|
+
*
|
|
296
|
+
* Exemplo de configuração:
|
|
297
|
+
* ```
|
|
298
|
+
* import { PoCodeEditorModule, PoCodeEditorRegisterable } from '@po-ui/ng-code-editor';
|
|
299
|
+
*
|
|
300
|
+
* declare const monaco: any; // Importante para usar configurações com tipos definidos pelo Monaco
|
|
301
|
+
*
|
|
302
|
+
* // A função `provideCompletionItems` precisa ser exportada para ser compatível com AOT.
|
|
303
|
+
* export function provideCompletionItems() {
|
|
304
|
+
* const suggestions = [{
|
|
305
|
+
* label: 'terraform',
|
|
306
|
+
* insertText: '#terraform language'
|
|
307
|
+
* }, {
|
|
308
|
+
* label: 'server',
|
|
309
|
+
* insertText: 'server ${1:ip}'
|
|
310
|
+
* }];
|
|
311
|
+
*
|
|
312
|
+
* return { suggestions: suggestions };
|
|
313
|
+
* }
|
|
314
|
+
*
|
|
315
|
+
* const customEditor: PoCodeEditorRegisterable = {
|
|
316
|
+
* language: 'terraform',
|
|
317
|
+
* options: {
|
|
318
|
+
* keywords: ['resource', 'provider', 'variable', 'output', 'module', 'true', 'false'],
|
|
319
|
+
* operators: ['{', '}', '(', ')', '[', ']', '?', ':'],
|
|
320
|
+
* symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
|
321
|
+
* escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
322
|
+
* tokenizer: {
|
|
323
|
+
* ...
|
|
324
|
+
* }
|
|
325
|
+
* },
|
|
326
|
+
* suggestions: { provideCompletionItems: provideCompletionItems }
|
|
327
|
+
* };
|
|
328
|
+
*
|
|
329
|
+
* @NgModule({
|
|
330
|
+
* declarations: [],
|
|
331
|
+
* imports: [
|
|
332
|
+
* PoModule,
|
|
333
|
+
* PoCodeEditorModule.forRegister(customEditor)
|
|
334
|
+
* ],
|
|
335
|
+
* bootstrap: [AppComponent]
|
|
336
|
+
* })
|
|
337
|
+
* ```
|
|
338
|
+
*
|
|
339
|
+
* > As configurações para o registro de uma nova sintaxe no Monaco code editor podem ser encontradas em
|
|
340
|
+
* > [**Monaco Editor**](https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages).
|
|
341
|
+
*/
|
|
342
|
+
declare class PoCodeEditorRegister implements PoCodeEditorRegisterable {
|
|
343
|
+
/** Sintaxe a ser registrada. */
|
|
344
|
+
language: string;
|
|
345
|
+
/** Opções da sintaxe para registro no po-code-editor. */
|
|
346
|
+
options: PoCodeEditorRegisterableOptions;
|
|
347
|
+
/** Lista de sugestões para a função de autocomplete (CTRL + SPACE). */
|
|
348
|
+
suggestions?: PoCodeEditorRegisterableSuggestionType;
|
|
349
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorRegister, never>;
|
|
350
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PoCodeEditorRegister>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
declare class PoCodeEditorSuggestionService {
|
|
354
|
+
private suggestions;
|
|
355
|
+
constructor();
|
|
356
|
+
getSuggestion(language: string, newSuggestion: Array<PoCodeEditorRegisterableSuggestion>): PoCodeEditorRegisterableSuggestion[];
|
|
357
|
+
private deduplicateSuggestions;
|
|
358
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorSuggestionService, never>;
|
|
359
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PoCodeEditorSuggestionService>;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* @docsExtends PoCodeEditorBaseComponent
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
*
|
|
367
|
+
* <example name="po-code-editor-basic" title="PO Code Editor Basic">
|
|
368
|
+
* <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.html"> </file>
|
|
369
|
+
* <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.ts"> </file>
|
|
370
|
+
* </example>
|
|
371
|
+
*
|
|
372
|
+
* <example name="po-code-editor-labs" title="PO Code Editor Labs">
|
|
373
|
+
* <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.html"> </file>
|
|
374
|
+
* <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.ts"> </file>
|
|
375
|
+
* </example>
|
|
376
|
+
*
|
|
377
|
+
* <example name="po-code-editor-diff" title="PO Code Editor - Diff">
|
|
378
|
+
* <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.html"> </file>
|
|
379
|
+
* <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.ts"> </file>
|
|
380
|
+
* </example>
|
|
381
|
+
*
|
|
382
|
+
* <example name="po-code-editor-terraform" title="PO Code Editor - Terraform">
|
|
383
|
+
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.html"> </file>
|
|
384
|
+
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.ts"> </file>
|
|
385
|
+
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.constant.ts"> </file>
|
|
386
|
+
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.module.ts"> </file>
|
|
387
|
+
* </example>
|
|
388
|
+
*
|
|
389
|
+
* <example name="po-code-editor-suggestion" title="PO Code Editor Suggestion">
|
|
390
|
+
* <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.html"> </file>
|
|
391
|
+
* <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.ts"> </file>
|
|
392
|
+
* </example>
|
|
393
|
+
*/
|
|
394
|
+
declare class PoCodeEditorComponent extends PoCodeEditorBaseComponent implements AfterViewInit, DoCheck {
|
|
395
|
+
private zone;
|
|
396
|
+
private el;
|
|
397
|
+
private poCodeEditorSuggestionService;
|
|
398
|
+
private codeEditorRegister?;
|
|
399
|
+
editorContainer: ElementRef;
|
|
400
|
+
canLoad: boolean;
|
|
401
|
+
constructor(zone: NgZone, el: ElementRef, poCodeEditorSuggestionService: PoCodeEditorSuggestionService, codeEditorRegister?: PoCodeEditorRegister);
|
|
402
|
+
ngAfterViewInit(): void;
|
|
403
|
+
ngDoCheck(): void;
|
|
404
|
+
monacoCreateModel(value: string): any;
|
|
405
|
+
setValueInEditor(): void;
|
|
406
|
+
setLanguage(language: string): void;
|
|
407
|
+
setTheme(theme: string): void;
|
|
408
|
+
setReadOnly(readOnly: boolean): void;
|
|
409
|
+
setSuggestions(newSuggestions: Array<PoCodeEditorRegisterableSuggestion>, language?: string): void;
|
|
410
|
+
writeValue(value: any): void;
|
|
411
|
+
private initMonaco;
|
|
412
|
+
private setMonacoLanguage;
|
|
413
|
+
private registerCustomLanguage;
|
|
414
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorComponent, never>;
|
|
415
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PoCodeEditorComponent, "po-code-editor", never, {}, {}, never, never, false, never>;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @description
|
|
420
|
+
*
|
|
421
|
+
* Módulo do componente po-code-editor.
|
|
422
|
+
*/
|
|
423
|
+
declare class PoCodeEditorModule {
|
|
424
|
+
static forRegister(props: PoCodeEditorRegisterable): ModuleWithProviders<PoCodeEditorModule>;
|
|
425
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorModule, never>;
|
|
426
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<PoCodeEditorModule, [typeof PoCodeEditorComponent], [typeof i2.CommonModule], [typeof PoCodeEditorComponent]>;
|
|
427
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<PoCodeEditorModule>;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export { PoCodeEditorComponent, PoCodeEditorModule, PoCodeEditorRegister };
|
|
431
|
+
export type { PoCodeEditorRegisterable, PoCodeEditorRegisterableOptions, PoCodeEditorRegisterableSuggestion, PoCodeEditorRegisterableTokens };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@po-ui/ng-code-editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"description": "PO UI - Code Editor",
|
|
5
5
|
"author": "PO UI",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
},
|
|
12
12
|
"schematics": "./schematics/collection.json",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@po-ui/ng-components": "
|
|
15
|
-
"@po-ui/ng-schematics": "
|
|
14
|
+
"@po-ui/ng-components": "20.0.0",
|
|
15
|
+
"@po-ui/ng-schematics": "20.0.0",
|
|
16
16
|
"monaco-editor": "0.44.0",
|
|
17
17
|
"core-js": "^3.33.3",
|
|
18
18
|
"intl": "^1.2.5",
|
|
19
|
-
"tslib": "^2.
|
|
19
|
+
"tslib": "^2.3.0"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@angular/common": "^
|
|
23
|
-
"@angular/core": "^
|
|
24
|
-
"@angular/forms": "^
|
|
25
|
-
"@po-ui/ng-components": "
|
|
22
|
+
"@angular/common": "^20",
|
|
23
|
+
"@angular/core": "^20",
|
|
24
|
+
"@angular/forms": "^20",
|
|
25
|
+
"@po-ui/ng-components": "20.0.0",
|
|
26
26
|
"monaco-editor": "0.44.0",
|
|
27
27
|
"zone.js": "~0.15.0"
|
|
28
28
|
},
|
|
@@ -39,6 +39,6 @@
|
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"scripts": {
|
|
42
|
-
"prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled
|
|
42
|
+
"prepublishOnly": "node --eval \"console.error('ERROR: Trying to publish a package that has been compiled in full compilation mode. This is not allowed.\\nPlease delete and rebuild the package with partial compilation mode, before attempting to publish.\\n')\" && exit 1"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
Binary file
|
|
@@ -31,7 +31,7 @@ function default_1(options) {
|
|
|
31
31
|
}
|
|
32
32
|
function addPoPackageAndInstall() {
|
|
33
33
|
return (tree, context) => {
|
|
34
|
-
(0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-code-editor', '
|
|
34
|
+
(0, package_config_1.addPackageToPackageJson)(tree, '@po-ui/ng-code-editor', '20.0.0');
|
|
35
35
|
// install packages
|
|
36
36
|
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
37
37
|
};
|
package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-options.interface.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { PoCodeEditorRegisterableTokens } from './po-code-editor-registerable-tokens.interface';
|
|
2
|
-
/**
|
|
3
|
-
* @usedBy PoCodeEditorRegister
|
|
4
|
-
*
|
|
5
|
-
* @description
|
|
6
|
-
*
|
|
7
|
-
* Interface para configuração de Opções de novas sintaxes ao code editor.
|
|
8
|
-
*/
|
|
9
|
-
export interface PoCodeEditorRegisterableOptions {
|
|
10
|
-
/** Palavras chaves da sintaxe. */
|
|
11
|
-
keywords: Array<string>;
|
|
12
|
-
/** Operadores específicos da sintaxe. */
|
|
13
|
-
operators: Array<string>;
|
|
14
|
-
/** Símbolos específicos da sintaxes. */
|
|
15
|
-
symbols: RegExp;
|
|
16
|
-
/** Escapes específicos da sintaxes. */
|
|
17
|
-
escapes: RegExp;
|
|
18
|
-
/** Interface para recebimento de token específicos da sintaxe. */
|
|
19
|
-
tokenizer: PoCodeEditorRegisterableTokens;
|
|
20
|
-
/** Define se a sintaxe será case sensitive ou não. */
|
|
21
|
-
ignoreCase?: boolean;
|
|
22
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @usedBy PoCodeEditorRegister, PoCodeEditorComponent
|
|
3
|
-
*
|
|
4
|
-
* @description
|
|
5
|
-
*
|
|
6
|
-
* Interface para configuração da lista de sugestão do autocomplete do code editor.
|
|
7
|
-
*/
|
|
8
|
-
export interface PoCodeEditorRegisterableSuggestion {
|
|
9
|
-
/** Texto que será exibido na lista de sugestões. */
|
|
10
|
-
label: string;
|
|
11
|
-
/** Texto que será inserido no editor ao selecionar a sugestão exibida pelo autocomplete. */
|
|
12
|
-
insertText: string;
|
|
13
|
-
/** Texto de ajuda que será exibido caso o usuário deseje ver mais informações sobre a sugestão. */
|
|
14
|
-
documentation?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @usedBy PoCodeEditorRegister, PoCodeEditorRegisterable
|
|
18
|
-
*
|
|
19
|
-
* @description
|
|
20
|
-
*
|
|
21
|
-
* Interface do objeto usado pelo monaco para lista de sugestão do autocomplete do code editor.
|
|
22
|
-
*/
|
|
23
|
-
export interface PoCodeEditorRegisterableSuggestionType {
|
|
24
|
-
provideCompletionItems: () => {
|
|
25
|
-
suggestions: Array<PoCodeEditorRegisterableSuggestion>;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @description
|
|
31
|
-
*
|
|
32
|
-
* Interface do objeto usado pelo monaco para lista de sugestão do autocomplete do code editor.
|
|
33
|
-
* Utilizado internamente pelo serviço PoCodeEditorSuggestionService
|
|
34
|
-
*/
|
|
35
|
-
export interface PoCodeEditorSuggestionList {
|
|
36
|
-
[index: string]: Array<PoCodeEditorRegisterableSuggestion>;
|
|
37
|
-
}
|
package/lib/components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @usedBy PoCodeEditorRegister
|
|
3
|
-
*
|
|
4
|
-
* @description
|
|
5
|
-
*
|
|
6
|
-
* Interface para configuração de tokens de novas sintaxes ao code editor.
|
|
7
|
-
*/
|
|
8
|
-
export interface PoCodeEditorRegisterableTokens {
|
|
9
|
-
/** Principal tokenizer da sintaxe customizada. */
|
|
10
|
-
root: Array<any>;
|
|
11
|
-
/** Tokenizer de comentários. */
|
|
12
|
-
comment?: Array<any>;
|
|
13
|
-
/** Tokenizer de strings. */
|
|
14
|
-
string?: Array<any>;
|
|
15
|
-
/** Tokenizer de whitespaces. */
|
|
16
|
-
whitespace?: Array<any>;
|
|
17
|
-
/** Sequência de interpolação. */
|
|
18
|
-
interpolated?: Array<any>;
|
|
19
|
-
/** Sequência de interpolação composta. */
|
|
20
|
-
interpolatedCompound?: Array<any>;
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PoCodeEditorRegisterableOptions } from './po-code-editor-registerable-options.interface';
|
|
2
|
-
import { PoCodeEditorRegisterableSuggestionType } from './po-code-editor-registerable-suggestion.interface';
|
|
3
|
-
/**
|
|
4
|
-
* @usedBy PoCodeEditorRegister
|
|
5
|
-
*
|
|
6
|
-
* @description
|
|
7
|
-
*
|
|
8
|
-
* Interface para configuração de novas sintaxes ao code editor.
|
|
9
|
-
*/
|
|
10
|
-
export interface PoCodeEditorRegisterable {
|
|
11
|
-
/** Nome da sintaxe a ser registrada no code editor. */
|
|
12
|
-
language: string;
|
|
13
|
-
/** Opções de configuração da sintaxe customizada. */
|
|
14
|
-
options: PoCodeEditorRegisterableOptions;
|
|
15
|
-
/** Lista de sugestões para a função de autocomplete. */
|
|
16
|
-
suggestions?: PoCodeEditorRegisterableSuggestionType;
|
|
17
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { ControlValueAccessor } from '@angular/forms';
|
|
2
|
-
import { PoCodeEditorRegisterableSuggestion } from './interfaces/po-code-editor-registerable-suggestion.interface';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* @description
|
|
6
|
-
*
|
|
7
|
-
* O `po-code-editor` é um componente para edição de código fonte baseado no Monaco Editor da Microsoft.
|
|
8
|
-
*
|
|
9
|
-
* Sendo assim, algumas configurações presentes no Monaco podem ser utilizadas aqui, como a escolha da linguagem
|
|
10
|
-
* (utilizando o highlight syntax específico), escolha do tema e opção de diff, além de ser muito similar ao Visual
|
|
11
|
-
* Studio Code, com autocomplete e fechamento automático de brackets.
|
|
12
|
-
*
|
|
13
|
-
* Este componente pode ser usado em qualquer situação que necessite de adição de códigos, como por exemplo, criar
|
|
14
|
-
* receitas utilizando Terraform para gerenciar topologias.
|
|
15
|
-
* É importante ressaltar que este não é um componente para edição de textos comuns.
|
|
16
|
-
*
|
|
17
|
-
* O [(ngModel)] deve ser usado para manipular o conteúdo do po-code-editor, ou seja, tanto para incluir um conteúdo quanto
|
|
18
|
-
* para recuperar o conteúdo do po-code-editor, utiliza-se uma variável passada por [(ngModel)].
|
|
19
|
-
*
|
|
20
|
-
* #### Adicionando o pacote @po-ui/ng-code-editor
|
|
21
|
-
*
|
|
22
|
-
* Para instalar o pacote `po-code-editor` em sua aplicação execute:
|
|
23
|
-
*
|
|
24
|
-
* ```shell
|
|
25
|
-
* ng add @po-ui/ng-code-editor
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* O comando `ng add` do `Angular CLI`:
|
|
29
|
-
* - inclui o `po-code-editor` no seu projeto;
|
|
30
|
-
* - adiciona o módulo `PoCodeEditorModule`:;
|
|
31
|
-
*
|
|
32
|
-
* ```
|
|
33
|
-
* // app.module.ts
|
|
34
|
-
* ...
|
|
35
|
-
* import { PoModule } from '@po-ui/ng-components';
|
|
36
|
-
* import { PoCodeEditorModule } from '@po-ui/ng-code-editor';
|
|
37
|
-
* ...
|
|
38
|
-
* @NgModule({
|
|
39
|
-
* imports: [
|
|
40
|
-
* ...
|
|
41
|
-
* PoModule,
|
|
42
|
-
* PoCodeEditorModule
|
|
43
|
-
* ],
|
|
44
|
-
* ...
|
|
45
|
-
* })
|
|
46
|
-
* export class AppModule { }
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* - adiciona o tema PO UI e também o *asset* do Monaco no arquivo `angular.json`, conforme abaixo:
|
|
50
|
-
*
|
|
51
|
-
* <pre ngNonBindable>
|
|
52
|
-
* ...
|
|
53
|
-
* "assets": [
|
|
54
|
-
* { "glob": "**/*", "input": "node_modules/monaco-editor/min", "output": "/assets/monaco/" }
|
|
55
|
-
* ],
|
|
56
|
-
* "styles": [
|
|
57
|
-
* "./node_modules/@po-ui/style/css/po-theme-default.min.css"
|
|
58
|
-
* ]
|
|
59
|
-
* ...
|
|
60
|
-
* </pre>
|
|
61
|
-
*/
|
|
62
|
-
export declare abstract class PoCodeEditorBaseComponent implements ControlValueAccessor {
|
|
63
|
-
editor: any;
|
|
64
|
-
modifiedValue: string;
|
|
65
|
-
value: any;
|
|
66
|
-
private _height;
|
|
67
|
-
private _language;
|
|
68
|
-
private _readonly;
|
|
69
|
-
private _showDiff;
|
|
70
|
-
private _suggestions;
|
|
71
|
-
private _theme;
|
|
72
|
-
/**
|
|
73
|
-
* @optional
|
|
74
|
-
*
|
|
75
|
-
* @description
|
|
76
|
-
*
|
|
77
|
-
* Linguagem na qual será apresentado o código fonte.
|
|
78
|
-
* Para saber quais são as linguagens compatíveis, consulte a documentação oficial do
|
|
79
|
-
* [**Monaco Editor**](https://microsoft.github.io/monaco-editor/).
|
|
80
|
-
*
|
|
81
|
-
* Também é possível adicionar uma nova linguagem personalizada utilizando o serviço:
|
|
82
|
-
* [**po-code-editor-register**](https://po-ui.io/documentation/po-code-editor-register?view=doc).
|
|
83
|
-
*
|
|
84
|
-
* @default `plainText`
|
|
85
|
-
*/
|
|
86
|
-
set language(language: string);
|
|
87
|
-
get language(): string;
|
|
88
|
-
/**
|
|
89
|
-
* @optional
|
|
90
|
-
*
|
|
91
|
-
* @description
|
|
92
|
-
*
|
|
93
|
-
* Indica se o editor será aberto em modo de leitura.
|
|
94
|
-
*
|
|
95
|
-
* Neste caso, não é possível editar o código inserido.
|
|
96
|
-
*
|
|
97
|
-
* Obs: Esta propriedade não refletirá efeito se alterada após o carregamento do componente.
|
|
98
|
-
*
|
|
99
|
-
* @default `false`
|
|
100
|
-
*/
|
|
101
|
-
set readonly(readonly: boolean);
|
|
102
|
-
get readonly(): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* @optional
|
|
105
|
-
*
|
|
106
|
-
* @description
|
|
107
|
-
*
|
|
108
|
-
* Indica se o editor será aberto em modo de comparação.
|
|
109
|
-
*
|
|
110
|
-
* Caso esteja habilitada esta opção, então o [(ngModel)] deverá ser passado como um array, cuja primeira opção deve
|
|
111
|
-
* conter uma string com o código original e na segunda posição uma string código modificado para efeito de
|
|
112
|
-
* comparação. Neste caso, o usuário conseguirá editar apenas o código modificado e isso refletirá na segunda posição
|
|
113
|
-
* do array consequentemente.
|
|
114
|
-
*
|
|
115
|
-
* Obs: Esta propriedade não refletirá efeito se alterada após o carregamento do componente.
|
|
116
|
-
*
|
|
117
|
-
* @default `false`
|
|
118
|
-
*/
|
|
119
|
-
set showDiff(showDiff: boolean);
|
|
120
|
-
get showDiff(): boolean;
|
|
121
|
-
/**
|
|
122
|
-
* @optional
|
|
123
|
-
*
|
|
124
|
-
* @description
|
|
125
|
-
*
|
|
126
|
-
* Lista de sugestões usadas pelo autocomplete dentro do editor.
|
|
127
|
-
*
|
|
128
|
-
* Para visualizar a lista de sugestões use o comando `CTRL + SPACE`.
|
|
129
|
-
*
|
|
130
|
-
* Caso o editor esteja usando uma linguagem que já tenha uma lista de sugestões predefinida, o valor passado será adicionado
|
|
131
|
-
* a lista preexistente, aumentando as opções para o usuário.
|
|
132
|
-
*
|
|
133
|
-
* Caso tenha mais de um editor da mesma linguagem na aplicação, as sugestões serão adicionadas para que todos os editores da mesma linguagem
|
|
134
|
-
* tenham as mesmas sugestões.
|
|
135
|
-
*
|
|
136
|
-
* ```
|
|
137
|
-
* <po-code-editor
|
|
138
|
-
* [p-suggestions]="[{ label: 'po', insertText: 'Portinari UI' }, { label: 'ng', insertText: 'Angular' }]">
|
|
139
|
-
* </po-code-editor>
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* Ao fornecer uma lista de sugestões é possível acelerar a escrita de scripts pelos usuários.
|
|
143
|
-
*/
|
|
144
|
-
set suggestions(values: Array<PoCodeEditorRegisterableSuggestion>);
|
|
145
|
-
get suggestions(): Array<PoCodeEditorRegisterableSuggestion>;
|
|
146
|
-
/**
|
|
147
|
-
* @optional
|
|
148
|
-
*
|
|
149
|
-
* @description
|
|
150
|
-
*
|
|
151
|
-
* Define um tema para o editor.
|
|
152
|
-
*
|
|
153
|
-
* Temas válidos:
|
|
154
|
-
* - `vs-dark`
|
|
155
|
-
* - `vs`
|
|
156
|
-
* - `hc-black`
|
|
157
|
-
*
|
|
158
|
-
* É importante salientar que o tema será aplicados a todos os componentes po-code-editor existentes na tela,
|
|
159
|
-
* ou seja, todas as instâncias do componente receberão o último tema atribuído ou o tema da última instância
|
|
160
|
-
* criada.
|
|
161
|
-
*
|
|
162
|
-
* @default `vs`
|
|
163
|
-
*/
|
|
164
|
-
set theme(theme: string);
|
|
165
|
-
get theme(): string;
|
|
166
|
-
/**
|
|
167
|
-
* @optional
|
|
168
|
-
*
|
|
169
|
-
* @description
|
|
170
|
-
*
|
|
171
|
-
* Define a altura do componente em pixels do po-code-editor.
|
|
172
|
-
* Esta propriedade não poderá ser alterada após o componente ter sido iniciado.
|
|
173
|
-
* A altura mínima é 150 pixels.
|
|
174
|
-
*/
|
|
175
|
-
set height(height: string);
|
|
176
|
-
get height(): string;
|
|
177
|
-
onTouched: (value: any) => void;
|
|
178
|
-
onChangePropagate: (value: any) => void;
|
|
179
|
-
getOptions(): {
|
|
180
|
-
language: string;
|
|
181
|
-
theme: string;
|
|
182
|
-
readOnly: boolean;
|
|
183
|
-
};
|
|
184
|
-
registerOnChange(fn: any): void;
|
|
185
|
-
registerOnTouched(fn: any): void;
|
|
186
|
-
protected convertToBoolean(val: any): boolean;
|
|
187
|
-
abstract writeValue(value: any): any;
|
|
188
|
-
abstract setLanguage(value: any): any;
|
|
189
|
-
abstract setTheme(value: any): any;
|
|
190
|
-
abstract setReadOnly(value: any): any;
|
|
191
|
-
abstract setSuggestions(value: any): any;
|
|
192
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorBaseComponent, never>;
|
|
193
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<PoCodeEditorBaseComponent, never, never, { "language": { "alias": "p-language"; "required": false; }; "readonly": { "alias": "p-readonly"; "required": false; }; "showDiff": { "alias": "p-show-diff"; "required": false; }; "suggestions": { "alias": "p-suggestions"; "required": false; }; "theme": { "alias": "p-theme"; "required": false; }; "height": { "alias": "p-height"; "required": false; }; }, {}, never, never, true, never>;
|
|
194
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { PoCodeEditorRegisterable } from './interfaces/po-code-editor-registerable.interface';
|
|
2
|
-
import { PoCodeEditorRegisterableOptions } from './interfaces/po-code-editor-registerable-options.interface';
|
|
3
|
-
import { PoCodeEditorRegisterableSuggestionType } from './interfaces/po-code-editor-registerable-suggestion.interface';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
/**
|
|
6
|
-
* @description
|
|
7
|
-
*
|
|
8
|
-
* Wrapper para registro de sintaxes customizadas para o po-code-editor.
|
|
9
|
-
*
|
|
10
|
-
* Para utilização do serviço de idiomas **PoCodeEditorRegister**,
|
|
11
|
-
* deve-se importar o módulo PoCodeEditorModule mesmo já tendo importado
|
|
12
|
-
* o módulo PoModule.
|
|
13
|
-
* Na importação opcionalmente pode ser invocado o método **forRegister** informando um objeto para configuração.
|
|
14
|
-
*
|
|
15
|
-
* Exemplo de configuração:
|
|
16
|
-
* ```
|
|
17
|
-
* import { PoCodeEditorModule, PoCodeEditorRegisterable } from '@po-ui/ng-code-editor';
|
|
18
|
-
*
|
|
19
|
-
* declare const monaco: any; // Importante para usar configurações com tipos definidos pelo Monaco
|
|
20
|
-
*
|
|
21
|
-
* // A função `provideCompletionItems` precisa ser exportada para ser compatível com AOT.
|
|
22
|
-
* export function provideCompletionItems() {
|
|
23
|
-
* const suggestions = [{
|
|
24
|
-
* label: 'terraform',
|
|
25
|
-
* insertText: '#terraform language'
|
|
26
|
-
* }, {
|
|
27
|
-
* label: 'server',
|
|
28
|
-
* insertText: 'server ${1:ip}'
|
|
29
|
-
* }];
|
|
30
|
-
*
|
|
31
|
-
* return { suggestions: suggestions };
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* const customEditor: PoCodeEditorRegisterable = {
|
|
35
|
-
* language: 'terraform',
|
|
36
|
-
* options: {
|
|
37
|
-
* keywords: ['resource', 'provider', 'variable', 'output', 'module', 'true', 'false'],
|
|
38
|
-
* operators: ['{', '}', '(', ')', '[', ']', '?', ':'],
|
|
39
|
-
* symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
|
40
|
-
* escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
41
|
-
* tokenizer: {
|
|
42
|
-
* ...
|
|
43
|
-
* }
|
|
44
|
-
* },
|
|
45
|
-
* suggestions: { provideCompletionItems: provideCompletionItems }
|
|
46
|
-
* };
|
|
47
|
-
*
|
|
48
|
-
* @NgModule({
|
|
49
|
-
* declarations: [],
|
|
50
|
-
* imports: [
|
|
51
|
-
* PoModule,
|
|
52
|
-
* PoCodeEditorModule.forRegister(customEditor)
|
|
53
|
-
* ],
|
|
54
|
-
* bootstrap: [AppComponent]
|
|
55
|
-
* })
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* > As configurações para o registro de uma nova sintaxe no Monaco code editor podem ser encontradas em
|
|
59
|
-
* > [**Monaco Editor**](https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages).
|
|
60
|
-
*/
|
|
61
|
-
export declare class PoCodeEditorRegister implements PoCodeEditorRegisterable {
|
|
62
|
-
/** Sintaxe a ser registrada. */
|
|
63
|
-
language: string;
|
|
64
|
-
/** Opções da sintaxe para registro no po-code-editor. */
|
|
65
|
-
options: PoCodeEditorRegisterableOptions;
|
|
66
|
-
/** Lista de sugestões para a função de autocomplete (CTRL + SPACE). */
|
|
67
|
-
suggestions?: PoCodeEditorRegisterableSuggestionType;
|
|
68
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorRegister, never>;
|
|
69
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<PoCodeEditorRegister>;
|
|
70
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { PoCodeEditorRegisterableSuggestion } from './interfaces/po-code-editor-registerable-suggestion.interface';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class PoCodeEditorSuggestionService {
|
|
4
|
-
private suggestions;
|
|
5
|
-
constructor();
|
|
6
|
-
getSuggestion(language: string, newSuggestion: Array<PoCodeEditorRegisterableSuggestion>): PoCodeEditorRegisterableSuggestion[];
|
|
7
|
-
private deduplicateSuggestions;
|
|
8
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorSuggestionService, never>;
|
|
9
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<PoCodeEditorSuggestionService>;
|
|
10
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit, DoCheck, ElementRef, NgZone } from '@angular/core';
|
|
2
|
-
import { PoCodeEditorBaseComponent } from './po-code-editor-base.component';
|
|
3
|
-
import { PoCodeEditorRegister } from './po-code-editor-register.service';
|
|
4
|
-
import { PoCodeEditorRegisterableSuggestion } from './interfaces/po-code-editor-registerable-suggestion.interface';
|
|
5
|
-
import { PoCodeEditorSuggestionService } from './po-code-editor-suggestion.service';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
/**
|
|
8
|
-
* @docsExtends PoCodeEditorBaseComponent
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
*
|
|
12
|
-
* <example name="po-code-editor-basic" title="PO Code Editor Basic">
|
|
13
|
-
* <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.html"> </file>
|
|
14
|
-
* <file name="sample-po-code-editor-basic/sample-po-code-editor-basic.component.ts"> </file>
|
|
15
|
-
* </example>
|
|
16
|
-
*
|
|
17
|
-
* <example name="po-code-editor-labs" title="PO Code Editor Labs">
|
|
18
|
-
* <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.html"> </file>
|
|
19
|
-
* <file name="sample-po-code-editor-labs/sample-po-code-editor-labs.component.ts"> </file>
|
|
20
|
-
* </example>
|
|
21
|
-
*
|
|
22
|
-
* <example name="po-code-editor-diff" title="PO Code Editor - Diff">
|
|
23
|
-
* <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.html"> </file>
|
|
24
|
-
* <file name="sample-po-code-editor-diff/sample-po-code-editor-diff.component.ts"> </file>
|
|
25
|
-
* </example>
|
|
26
|
-
*
|
|
27
|
-
* <example name="po-code-editor-terraform" title="PO Code Editor - Terraform">
|
|
28
|
-
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.html"> </file>
|
|
29
|
-
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.component.ts"> </file>
|
|
30
|
-
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.constant.ts"> </file>
|
|
31
|
-
* <file name="sample-po-code-editor-terraform/sample-po-code-editor-terraform.module.ts"> </file>
|
|
32
|
-
* </example>
|
|
33
|
-
*
|
|
34
|
-
* <example name="po-code-editor-suggestion" title="PO Code Editor Suggestion">
|
|
35
|
-
* <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.html"> </file>
|
|
36
|
-
* <file name="sample-po-code-editor-suggestion/sample-po-code-editor-suggestion.component.ts"> </file>
|
|
37
|
-
* </example>
|
|
38
|
-
*/
|
|
39
|
-
export declare class PoCodeEditorComponent extends PoCodeEditorBaseComponent implements AfterViewInit, DoCheck {
|
|
40
|
-
private zone;
|
|
41
|
-
private el;
|
|
42
|
-
private poCodeEditorSuggestionService;
|
|
43
|
-
private codeEditorRegister?;
|
|
44
|
-
editorContainer: ElementRef;
|
|
45
|
-
canLoad: boolean;
|
|
46
|
-
constructor(zone: NgZone, el: ElementRef, poCodeEditorSuggestionService: PoCodeEditorSuggestionService, codeEditorRegister?: PoCodeEditorRegister);
|
|
47
|
-
ngAfterViewInit(): void;
|
|
48
|
-
ngDoCheck(): void;
|
|
49
|
-
monacoCreateModel(value: string): any;
|
|
50
|
-
setValueInEditor(): void;
|
|
51
|
-
setLanguage(language: string): void;
|
|
52
|
-
setTheme(theme: string): void;
|
|
53
|
-
setReadOnly(readOnly: boolean): void;
|
|
54
|
-
setSuggestions(newSuggestions: Array<PoCodeEditorRegisterableSuggestion>, language?: string): void;
|
|
55
|
-
writeValue(value: any): void;
|
|
56
|
-
private initMonaco;
|
|
57
|
-
private setMonacoLanguage;
|
|
58
|
-
private registerCustomLanguage;
|
|
59
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorComponent, never>;
|
|
60
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<PoCodeEditorComponent, "po-code-editor", never, {}, {}, never, never, false, never>;
|
|
61
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { PoCodeEditorRegisterable } from './interfaces/po-code-editor-registerable.interface';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "./po-code-editor.component";
|
|
5
|
-
import * as i2 from "@angular/common";
|
|
6
|
-
/**
|
|
7
|
-
* @description
|
|
8
|
-
*
|
|
9
|
-
* Módulo do componente po-code-editor.
|
|
10
|
-
*/
|
|
11
|
-
export declare class PoCodeEditorModule {
|
|
12
|
-
static forRegister(props: PoCodeEditorRegisterable): ModuleWithProviders<PoCodeEditorModule>;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<PoCodeEditorModule, never>;
|
|
14
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<PoCodeEditorModule, [typeof i1.PoCodeEditorComponent], [typeof i2.CommonModule], [typeof i1.PoCodeEditorComponent]>;
|
|
15
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<PoCodeEditorModule>;
|
|
16
|
-
}
|
package/lib/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { PoCodeEditorComponent } from './components/po-code-editor/po-code-editor.component';
|
|
2
|
-
export { PoCodeEditorRegister } from './components/po-code-editor/po-code-editor-register.service';
|
|
3
|
-
export { PoCodeEditorRegisterable } from './components/po-code-editor/interfaces/po-code-editor-registerable.interface';
|
|
4
|
-
export { PoCodeEditorRegisterableOptions } from './components/po-code-editor/interfaces/po-code-editor-registerable-options.interface';
|
|
5
|
-
export { PoCodeEditorRegisterableTokens } from './components/po-code-editor/interfaces/po-code-editor-registerable-tokens.interface';
|
|
6
|
-
export { PoCodeEditorRegisterableSuggestion } from './components/po-code-editor/interfaces/po-code-editor-registerable-suggestion.interface';
|
|
7
|
-
export { PoCodeEditorModule } from './components/po-code-editor/po-code-editor.module';
|
|
Binary file
|
package/public-api.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib/index';
|