@sankhyalabs/ezui 6.1.0-dev.4 → 6.1.0-dev.5
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/cjs/RichToolbarHelper-438916fa.js +46 -0
- package/dist/cjs/{ez-combo-box-list_3.cjs.entry.js → ez-combo-box-list_4.cjs.entry.js} +269 -0
- package/dist/cjs/ez-filter-input.cjs.entry.js +129 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +6 -0
- package/dist/cjs/ez-grid.cjs.entry.js +3 -1348
- package/dist/cjs/ez-icon.cjs.entry.js +1 -1
- package/dist/cjs/ez-link-builder_6.cjs.entry.js +295 -0
- package/dist/cjs/ez-modal-container.cjs.entry.js +1 -1
- package/dist/cjs/ez-rich-toolbar-item.cjs.entry.js +27 -0
- package/dist/cjs/{ez-filter-input_2.cjs.entry.js → ez-tooltip.cjs.entry.js} +1 -123
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +20 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/purify-6de957d4.js +1351 -0
- package/dist/collection/collection-manifest.json +8 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/FieldBuilder.js +2 -0
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/RichText.tpl.js +4 -0
- package/dist/collection/components/ez-icon/ez-icon.css +147 -140
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +2 -0
- package/dist/collection/components/ez-rich-text/ez-link-builder/ez-link-builder.css +22 -0
- package/dist/collection/components/ez-rich-text/ez-link-builder/ez-link-builder.js +131 -0
- package/dist/collection/components/ez-rich-text/ez-rich-text.css +35 -0
- package/dist/collection/components/ez-rich-text/ez-rich-text.js +544 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/RichToolbarHelper.js +39 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-arrows/ez-rich-toolbar-arrows.css +4 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-arrows/ez-rich-toolbar-arrows.js +19 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-configs/ez-rich-toolbar-configs.css +4 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-configs/ez-rich-toolbar-configs.js +19 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-item/ez-rich-toolbar-item.css +20 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-item/ez-rich-toolbar-item.js +122 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-letters/ez-rich-toolbar-letters.css +4 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-letters/ez-rich-toolbar-letters.js +19 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar.css +42 -0
- package/dist/collection/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar.js +183 -0
- package/dist/collection/components/ez-rich-text/ez-simple-image-uploader/ez-simple-image-uploader.css +70 -0
- package/dist/collection/components/ez-rich-text/ez-simple-image-uploader/ez-simple-image-uploader.js +216 -0
- package/dist/collection/components/ez-rich-text/ez-simple-image-uploader/test/resource/imageBase64.js +1 -0
- package/dist/collection/components/ez-rich-text/ez-simple-image-uploader/utils/fileToBase64.js +14 -0
- package/dist/collection/components/ez-rich-text/ez-simple-image-uploader/utils/formatBytes.js +10 -0
- package/dist/collection/components/ez-tooltip/ez-tooltip.js +1 -1
- package/dist/custom-elements/index.d.ts +48 -0
- package/dist/custom-elements/index.js +641 -4
- package/dist/esm/RichToolbarHelper-fd6427df.js +41 -0
- package/dist/esm/{ez-combo-box-list_3.entry.js → ez-combo-box-list_4.entry.js} +270 -2
- package/dist/esm/ez-filter-input.entry.js +125 -0
- package/dist/esm/ez-form-view.entry.js +6 -0
- package/dist/esm/ez-grid.entry.js +2 -1347
- package/dist/esm/ez-icon.entry.js +1 -1
- package/dist/esm/ez-link-builder_6.entry.js +286 -0
- package/dist/esm/ez-modal-container.entry.js +1 -1
- package/dist/esm/ez-rich-toolbar-item.entry.js +23 -0
- package/dist/esm/{ez-filter-input_2.entry.js → ez-tooltip.entry.js} +3 -124
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +20 -8
- package/dist/esm/loader.js +1 -1
- package/dist/esm/purify-aa3062c4.js +1349 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-098594de.entry.js +1 -0
- package/dist/ezui/p-1cebdc92.js +1 -0
- package/dist/ezui/p-20c024f7.entry.js +1 -0
- package/dist/ezui/{p-26685c50.entry.js → p-454bba13.entry.js} +1 -1
- package/dist/ezui/p-566c809b.entry.js +1 -0
- package/dist/ezui/{p-38581954.entry.js → p-5f1e98da.entry.js} +45 -47
- package/dist/ezui/p-79044c3e.entry.js +1 -0
- package/dist/ezui/p-80461324.entry.js +1 -0
- package/dist/ezui/p-91c9d50e.entry.js +1 -0
- package/dist/ezui/p-bcae530a.js +3 -0
- package/dist/ezui/p-ec0d8122.entry.js +1 -0
- package/dist/types/components/ez-form-view/fieldbuilder/templates/RichText.tpl.d.ts +2 -0
- package/dist/types/components/ez-rich-text/ez-link-builder/ez-link-builder.d.ts +17 -0
- package/dist/types/components/ez-rich-text/ez-rich-text.d.ts +98 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/RichToolbarHelper.d.ts +43 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-arrows/ez-rich-toolbar-arrows.d.ts +3 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-configs/ez-rich-toolbar-configs.d.ts +3 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-item/ez-rich-toolbar-item.d.ts +11 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar-letters/ez-rich-toolbar-letters.d.ts +3 -0
- package/dist/types/components/ez-rich-text/ez-rich-toolbar/ez-rich-toolbar.d.ts +33 -0
- package/dist/types/components/ez-rich-text/ez-simple-image-uploader/ez-simple-image-uploader.d.ts +37 -0
- package/dist/types/components/ez-rich-text/ez-simple-image-uploader/test/resource/imageBase64.d.ts +1 -0
- package/dist/types/components/ez-rich-text/ez-simple-image-uploader/utils/fileToBase64.d.ts +1 -0
- package/dist/types/components/ez-rich-text/ez-simple-image-uploader/utils/formatBytes.d.ts +1 -0
- package/dist/types/components.d.ts +291 -0
- package/package.json +1 -1
- package/react/components.d.ts +8 -0
- package/react/components.js +8 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-2b42abbb.entry.js +0 -1
- package/dist/ezui/p-63cb493e.entry.js +0 -1
- package/dist/ezui/p-7ab19270.entry.js +0 -1
- package/dist/ezui/p-9567b31a.entry.js +0 -1
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { KeyboardManager, ObjectUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { RICH_TOOLBAR_COMMANDS, RICH_TOOLBAR_FORMAT_TAGS, } from './ez-rich-toolbar/RichToolbarHelper';
|
|
4
|
+
import DOMPurify from 'dompurify';
|
|
5
|
+
export class EzRichText {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.historyStack = [];
|
|
8
|
+
this.historyIndex = -1;
|
|
9
|
+
this.previewMode = false;
|
|
10
|
+
this.showPreview = true;
|
|
11
|
+
this.showBorder = false;
|
|
12
|
+
this.value = '';
|
|
13
|
+
this.label = undefined;
|
|
14
|
+
this.enabled = true;
|
|
15
|
+
this.rows = 6;
|
|
16
|
+
this.errorMessage = undefined;
|
|
17
|
+
this.showConfigs = true;
|
|
18
|
+
this.showTextFormat = true;
|
|
19
|
+
this.showUndoRedo = true;
|
|
20
|
+
}
|
|
21
|
+
observeValue(newValue, oldValue) {
|
|
22
|
+
if (ObjectUtils.equals(newValue, oldValue))
|
|
23
|
+
return;
|
|
24
|
+
this.ezChange.emit(newValue);
|
|
25
|
+
}
|
|
26
|
+
async handleExecuteToolbarCommand(event) {
|
|
27
|
+
const { command, value } = event.detail;
|
|
28
|
+
await this.executeCommand(command, value);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Aplica o foco no campo.
|
|
32
|
+
*/
|
|
33
|
+
async setFocus() {
|
|
34
|
+
this.handleFocus();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Remove o foco do campo.
|
|
38
|
+
*/
|
|
39
|
+
async setBlur() {
|
|
40
|
+
var _a;
|
|
41
|
+
await ((_a = this.textAreaRef) === null || _a === void 0 ? void 0 : _a.setBlur());
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Retorna se o conteúdo é inválido.
|
|
45
|
+
*/
|
|
46
|
+
async isInvalid() {
|
|
47
|
+
return typeof this.errorMessage === 'string' && this.errorMessage.trim() !== '';
|
|
48
|
+
}
|
|
49
|
+
bindPreview() {
|
|
50
|
+
if (!this._keyboardManager || !this.showPreview)
|
|
51
|
+
return;
|
|
52
|
+
this._keyboardManager
|
|
53
|
+
.bind('ctrl + p', async () => {
|
|
54
|
+
await this.togglePreview();
|
|
55
|
+
}, { description: 'Entra em modo de pré visualização.', element: this.element });
|
|
56
|
+
}
|
|
57
|
+
bindConfigs() {
|
|
58
|
+
if (!this._keyboardManager || !this.showConfigs)
|
|
59
|
+
return;
|
|
60
|
+
this._keyboardManager
|
|
61
|
+
.bind('ctrl + l', async () => {
|
|
62
|
+
await this.handleFormatSelection(RICH_TOOLBAR_FORMAT_TAGS.LIST);
|
|
63
|
+
}, { description: 'Aplica estilo de lista ao texto selecionado.', element: this.element })
|
|
64
|
+
.bind('ctrl + k', async () => {
|
|
65
|
+
await this.handleLink();
|
|
66
|
+
}, { description: 'Abre popup de link.', element: this.element })
|
|
67
|
+
.bind('ctrl + o', async () => {
|
|
68
|
+
await this.handleImage();
|
|
69
|
+
}, { description: 'Abre popup de imagem.', element: this.element });
|
|
70
|
+
}
|
|
71
|
+
bindTextFormat() {
|
|
72
|
+
if (!this._keyboardManager || !this.showTextFormat)
|
|
73
|
+
return;
|
|
74
|
+
this._keyboardManager
|
|
75
|
+
.bind('ctrl + b', async () => {
|
|
76
|
+
await this.handleFormatSelection(RICH_TOOLBAR_FORMAT_TAGS.BOLD);
|
|
77
|
+
}, { description: 'Aplica estilo negrito ao texto selecionado.', element: this.element })
|
|
78
|
+
.bind('ctrl + i', async () => {
|
|
79
|
+
await this.handleFormatSelection(RICH_TOOLBAR_FORMAT_TAGS.ITALIC);
|
|
80
|
+
}, { description: 'Aplica estilo itálico ao texto selecionado.', element: this.element })
|
|
81
|
+
.bind('ctrl + u', async () => {
|
|
82
|
+
await this.handleFormatSelection(RICH_TOOLBAR_FORMAT_TAGS.UNDERLINE);
|
|
83
|
+
}, { description: 'Aplica estilo underline ao texto selecionado.', element: this.element });
|
|
84
|
+
}
|
|
85
|
+
initKeyboardManager() {
|
|
86
|
+
this._keyboardManager = new KeyboardManager({ propagate: false, element: this.element });
|
|
87
|
+
this._keyboardManager
|
|
88
|
+
.bind('ctrl + Enter', async () => {
|
|
89
|
+
await this.handleFormatSelection(RICH_TOOLBAR_FORMAT_TAGS.BREAK_LINE);
|
|
90
|
+
}, { description: 'Aplica quebra de linha.', element: this.element })
|
|
91
|
+
.bind('ctrl + z', async () => {
|
|
92
|
+
await this.handleUndo();
|
|
93
|
+
}, { description: 'Desfaz a ultima alteração de texto.', element: this.element })
|
|
94
|
+
.bind('ctrl + x', async () => {
|
|
95
|
+
await this.handleRedo();
|
|
96
|
+
}, { description: 'Refaz a ultima alteração de texto.', element: this.element });
|
|
97
|
+
this.bindPreview();
|
|
98
|
+
this.bindConfigs();
|
|
99
|
+
this.bindTextFormat();
|
|
100
|
+
}
|
|
101
|
+
async executeCommand(command, value) {
|
|
102
|
+
switch (command) {
|
|
103
|
+
case RICH_TOOLBAR_COMMANDS.FOCUS:
|
|
104
|
+
this.handleFocus();
|
|
105
|
+
break;
|
|
106
|
+
case RICH_TOOLBAR_COMMANDS.PREVIEW:
|
|
107
|
+
await this.togglePreview();
|
|
108
|
+
break;
|
|
109
|
+
case RICH_TOOLBAR_COMMANDS.FORMAT:
|
|
110
|
+
await this.handleFormatSelection(value);
|
|
111
|
+
break;
|
|
112
|
+
case RICH_TOOLBAR_COMMANDS.UNDO:
|
|
113
|
+
await this.handleUndo();
|
|
114
|
+
break;
|
|
115
|
+
case RICH_TOOLBAR_COMMANDS.REDO:
|
|
116
|
+
await this.handleRedo();
|
|
117
|
+
break;
|
|
118
|
+
case RICH_TOOLBAR_COMMANDS.LINK:
|
|
119
|
+
await this.handleLink();
|
|
120
|
+
break;
|
|
121
|
+
case RICH_TOOLBAR_COMMANDS.IMAGE:
|
|
122
|
+
await this.handleImage();
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
handleFocus() {
|
|
127
|
+
this.previewMode = false;
|
|
128
|
+
requestAnimationFrame(async () => {
|
|
129
|
+
await this.textAreaRef.setFocus();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async handleLink() {
|
|
133
|
+
this.previewMode = false;
|
|
134
|
+
requestAnimationFrame(async () => {
|
|
135
|
+
await this.linkBuilderRef.show(this.getSelectedText());
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async handleImage() {
|
|
139
|
+
this.previewMode = false;
|
|
140
|
+
await this.imageUploaderRef.show();
|
|
141
|
+
}
|
|
142
|
+
async handleRedo() {
|
|
143
|
+
this.previewMode = false;
|
|
144
|
+
requestAnimationFrame(async () => {
|
|
145
|
+
this.redo();
|
|
146
|
+
await this.textAreaRef.setFocus();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
async handleUndo() {
|
|
150
|
+
this.previewMode = false;
|
|
151
|
+
requestAnimationFrame(async () => {
|
|
152
|
+
this.undo();
|
|
153
|
+
await this.textAreaRef.setFocus();
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async handleFormatSelection(value) {
|
|
157
|
+
if (!value)
|
|
158
|
+
return;
|
|
159
|
+
this.previewMode = false;
|
|
160
|
+
requestAnimationFrame(async () => {
|
|
161
|
+
await this.formatSelection(value);
|
|
162
|
+
await this.textAreaRef.setFocus();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async togglePreview() {
|
|
166
|
+
this.previewMode = !this.previewMode;
|
|
167
|
+
if (this.previewMode) {
|
|
168
|
+
await this.textAreaRef.setFocus();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
getSelectedText() {
|
|
172
|
+
const textarea = this.getTextAreaElement();
|
|
173
|
+
if (!textarea)
|
|
174
|
+
return undefined;
|
|
175
|
+
const selectionStart = textarea.selectionStart;
|
|
176
|
+
const selectionEnd = textarea.selectionEnd;
|
|
177
|
+
const currentValue = this.textAreaRef.value || '';
|
|
178
|
+
return currentValue.substring(selectionStart, selectionEnd);
|
|
179
|
+
}
|
|
180
|
+
getTextAreaElement() {
|
|
181
|
+
const textAreaElement = this.element.querySelector('ez-text-area');
|
|
182
|
+
return textAreaElement.shadowRoot.querySelector('textarea');
|
|
183
|
+
}
|
|
184
|
+
async formatSelection(htmlTag) {
|
|
185
|
+
if (!this.textAreaRef)
|
|
186
|
+
return;
|
|
187
|
+
const formattedHtml = htmlTag.replace('$selection', this.getSelectedText() || '');
|
|
188
|
+
await this.textAreaRef.appendTextToSelection(formattedHtml);
|
|
189
|
+
this.value = this.textAreaRef.value;
|
|
190
|
+
this.addToHistory(this.value);
|
|
191
|
+
}
|
|
192
|
+
addToHistory(content) {
|
|
193
|
+
// Só adiciona ao histórico se for diferente do estado atual
|
|
194
|
+
if (this.historyIndex >= 0 && content === this.historyStack[this.historyIndex]) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
//se o tamanho do histórico chegou ao máximo, faz um splice mantendo os últimos 49 elementos
|
|
198
|
+
if (this.historyStack.length >= 50) {
|
|
199
|
+
this.historyStack.splice(0, this.historyStack.length - 49);
|
|
200
|
+
}
|
|
201
|
+
//Adiciona novo estado ao histórico
|
|
202
|
+
this.historyStack.push(content);
|
|
203
|
+
this.historyIndex = this.historyStack.length - 1;
|
|
204
|
+
}
|
|
205
|
+
undo() {
|
|
206
|
+
if (!this.canExecuteUndo())
|
|
207
|
+
return;
|
|
208
|
+
this.historyIndex--;
|
|
209
|
+
const content = this.historyStack[this.historyIndex];
|
|
210
|
+
this.value = content;
|
|
211
|
+
this.textAreaRef.value = content;
|
|
212
|
+
}
|
|
213
|
+
canExecuteUndo() {
|
|
214
|
+
return this.historyIndex > 0;
|
|
215
|
+
}
|
|
216
|
+
redo() {
|
|
217
|
+
if (!this.canExecuteRedo())
|
|
218
|
+
return;
|
|
219
|
+
this.historyIndex++;
|
|
220
|
+
this.getValueFromHistory();
|
|
221
|
+
}
|
|
222
|
+
canExecuteRedo() {
|
|
223
|
+
return this.historyIndex < this.historyStack.length - 1;
|
|
224
|
+
}
|
|
225
|
+
getValueFromHistory() {
|
|
226
|
+
const content = this.historyStack[this.historyIndex];
|
|
227
|
+
this.value = content;
|
|
228
|
+
this.textAreaRef.value = content;
|
|
229
|
+
}
|
|
230
|
+
handleTextAreaChanged(event) {
|
|
231
|
+
this.value = event.detail;
|
|
232
|
+
this.addToHistory(this.value);
|
|
233
|
+
}
|
|
234
|
+
async removeShortcuts() {
|
|
235
|
+
var _a;
|
|
236
|
+
(_a = this._keyboardManager) === null || _a === void 0 ? void 0 : _a.unbindAllShortcutKeys();
|
|
237
|
+
}
|
|
238
|
+
componentDidLoad() {
|
|
239
|
+
this.initKeyboardManager();
|
|
240
|
+
this.addToHistory(this.value);
|
|
241
|
+
}
|
|
242
|
+
async disconnectedCallback() {
|
|
243
|
+
await this.removeShortcuts();
|
|
244
|
+
}
|
|
245
|
+
getSanitizedValue() {
|
|
246
|
+
return DOMPurify.sanitize(this.value, {
|
|
247
|
+
ADD_ATTR: ['target', 'rel']
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
renderContent() {
|
|
251
|
+
if (this.previewMode) {
|
|
252
|
+
return (h("div", { id: 'rich-text-preview-container', class: "preview", innerHTML: this.getSanitizedValue() }));
|
|
253
|
+
}
|
|
254
|
+
return h("ez-text-area", { ref: (el) => this.textAreaRef = el, label: this.label, value: this.value, enabled: this.enabled, rows: this.rows, mode: 'slim', errorMessage: this.errorMessage, onEzChange: this.handleTextAreaChanged.bind(this) });
|
|
255
|
+
}
|
|
256
|
+
render() {
|
|
257
|
+
return (h(Host, null, h("div", { class: `editor-container ${this.showBorder ? 'bordered' : ''}` }, h("ez-rich-toolbar", { isPreviewMode: this.previewMode, showPreview: this.showPreview, showConfigs: this.showConfigs && this.enabled, showTextFormat: this.showTextFormat && this.enabled, showUndoRedo: this.showUndoRedo && this.enabled }), this.renderContent()), h("ez-link-builder", { ref: (el) => this.linkBuilderRef = el }), h("ez-simple-image-uploader", { ref: (el) => this.imageUploaderRef = el })));
|
|
258
|
+
}
|
|
259
|
+
static get is() { return "ez-rich-text"; }
|
|
260
|
+
static get encapsulation() { return "scoped"; }
|
|
261
|
+
static get originalStyleUrls() {
|
|
262
|
+
return {
|
|
263
|
+
"$": ["ez-rich-text.css"]
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
static get styleUrls() {
|
|
267
|
+
return {
|
|
268
|
+
"$": ["ez-rich-text.css"]
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
static get properties() {
|
|
272
|
+
return {
|
|
273
|
+
"showPreview": {
|
|
274
|
+
"type": "boolean",
|
|
275
|
+
"mutable": false,
|
|
276
|
+
"complexType": {
|
|
277
|
+
"original": "boolean",
|
|
278
|
+
"resolved": "boolean",
|
|
279
|
+
"references": {}
|
|
280
|
+
},
|
|
281
|
+
"required": false,
|
|
282
|
+
"optional": false,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": "Informa se as op\u00E7\u00F5es a op\u00E7\u00E3o de pr\u00E9-visualiza\u00E7\u00E3o deve ser apresentada."
|
|
286
|
+
},
|
|
287
|
+
"attribute": "show-preview",
|
|
288
|
+
"reflect": false,
|
|
289
|
+
"defaultValue": "true"
|
|
290
|
+
},
|
|
291
|
+
"showBorder": {
|
|
292
|
+
"type": "boolean",
|
|
293
|
+
"mutable": true,
|
|
294
|
+
"complexType": {
|
|
295
|
+
"original": "boolean",
|
|
296
|
+
"resolved": "boolean",
|
|
297
|
+
"references": {}
|
|
298
|
+
},
|
|
299
|
+
"required": false,
|
|
300
|
+
"optional": false,
|
|
301
|
+
"docs": {
|
|
302
|
+
"tags": [],
|
|
303
|
+
"text": "Define se deve exibir a borda externa do componente"
|
|
304
|
+
},
|
|
305
|
+
"attribute": "show-border",
|
|
306
|
+
"reflect": true,
|
|
307
|
+
"defaultValue": "false"
|
|
308
|
+
},
|
|
309
|
+
"value": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"mutable": true,
|
|
312
|
+
"complexType": {
|
|
313
|
+
"original": "string",
|
|
314
|
+
"resolved": "string",
|
|
315
|
+
"references": {}
|
|
316
|
+
},
|
|
317
|
+
"required": false,
|
|
318
|
+
"optional": false,
|
|
319
|
+
"docs": {
|
|
320
|
+
"tags": [],
|
|
321
|
+
"text": "Define o valor HTML do campo."
|
|
322
|
+
},
|
|
323
|
+
"attribute": "value",
|
|
324
|
+
"reflect": true,
|
|
325
|
+
"defaultValue": "''"
|
|
326
|
+
},
|
|
327
|
+
"label": {
|
|
328
|
+
"type": "string",
|
|
329
|
+
"mutable": false,
|
|
330
|
+
"complexType": {
|
|
331
|
+
"original": "string",
|
|
332
|
+
"resolved": "string",
|
|
333
|
+
"references": {}
|
|
334
|
+
},
|
|
335
|
+
"required": false,
|
|
336
|
+
"optional": false,
|
|
337
|
+
"docs": {
|
|
338
|
+
"tags": [],
|
|
339
|
+
"text": "Texto a ser apresentado como t\u00EDtulo do campo."
|
|
340
|
+
},
|
|
341
|
+
"attribute": "label",
|
|
342
|
+
"reflect": true
|
|
343
|
+
},
|
|
344
|
+
"enabled": {
|
|
345
|
+
"type": "boolean",
|
|
346
|
+
"mutable": false,
|
|
347
|
+
"complexType": {
|
|
348
|
+
"original": "boolean",
|
|
349
|
+
"resolved": "boolean",
|
|
350
|
+
"references": {}
|
|
351
|
+
},
|
|
352
|
+
"required": false,
|
|
353
|
+
"optional": false,
|
|
354
|
+
"docs": {
|
|
355
|
+
"tags": [],
|
|
356
|
+
"text": "Se false o usu\u00E1rio n\u00E3o pode interagir com o campo."
|
|
357
|
+
},
|
|
358
|
+
"attribute": "enabled",
|
|
359
|
+
"reflect": true,
|
|
360
|
+
"defaultValue": "true"
|
|
361
|
+
},
|
|
362
|
+
"rows": {
|
|
363
|
+
"type": "number",
|
|
364
|
+
"mutable": false,
|
|
365
|
+
"complexType": {
|
|
366
|
+
"original": "number",
|
|
367
|
+
"resolved": "number",
|
|
368
|
+
"references": {}
|
|
369
|
+
},
|
|
370
|
+
"required": false,
|
|
371
|
+
"optional": false,
|
|
372
|
+
"docs": {
|
|
373
|
+
"tags": [],
|
|
374
|
+
"text": "Define o n\u00FAmero de linhas."
|
|
375
|
+
},
|
|
376
|
+
"attribute": "rows",
|
|
377
|
+
"reflect": true,
|
|
378
|
+
"defaultValue": "6"
|
|
379
|
+
},
|
|
380
|
+
"errorMessage": {
|
|
381
|
+
"type": "string",
|
|
382
|
+
"mutable": true,
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "string",
|
|
385
|
+
"resolved": "string",
|
|
386
|
+
"references": {}
|
|
387
|
+
},
|
|
388
|
+
"required": false,
|
|
389
|
+
"optional": false,
|
|
390
|
+
"docs": {
|
|
391
|
+
"tags": [],
|
|
392
|
+
"text": "Define uma mensagem de orienta\u00E7\u00E3o ao usu\u00E1rio, colocando o campo em modo inv\u00E1lido."
|
|
393
|
+
},
|
|
394
|
+
"attribute": "error-message",
|
|
395
|
+
"reflect": true
|
|
396
|
+
},
|
|
397
|
+
"showConfigs": {
|
|
398
|
+
"type": "boolean",
|
|
399
|
+
"mutable": false,
|
|
400
|
+
"complexType": {
|
|
401
|
+
"original": "boolean",
|
|
402
|
+
"resolved": "boolean",
|
|
403
|
+
"references": {}
|
|
404
|
+
},
|
|
405
|
+
"required": false,
|
|
406
|
+
"optional": false,
|
|
407
|
+
"docs": {
|
|
408
|
+
"tags": [],
|
|
409
|
+
"text": "Informa se as op\u00E7\u00F5es de configura\u00E7\u00F5es (lista, imagem e link) devem ser apresentadas"
|
|
410
|
+
},
|
|
411
|
+
"attribute": "show-configs",
|
|
412
|
+
"reflect": false,
|
|
413
|
+
"defaultValue": "true"
|
|
414
|
+
},
|
|
415
|
+
"showTextFormat": {
|
|
416
|
+
"type": "boolean",
|
|
417
|
+
"mutable": false,
|
|
418
|
+
"complexType": {
|
|
419
|
+
"original": "boolean",
|
|
420
|
+
"resolved": "boolean",
|
|
421
|
+
"references": {}
|
|
422
|
+
},
|
|
423
|
+
"required": false,
|
|
424
|
+
"optional": false,
|
|
425
|
+
"docs": {
|
|
426
|
+
"tags": [],
|
|
427
|
+
"text": "Informa se as op\u00E7\u00F5es de formata\u00E7\u00E3o de texto (it\u00E1lico, sublinhado e negrito) devem ser apresentadas"
|
|
428
|
+
},
|
|
429
|
+
"attribute": "show-text-format",
|
|
430
|
+
"reflect": false,
|
|
431
|
+
"defaultValue": "true"
|
|
432
|
+
},
|
|
433
|
+
"showUndoRedo": {
|
|
434
|
+
"type": "boolean",
|
|
435
|
+
"mutable": false,
|
|
436
|
+
"complexType": {
|
|
437
|
+
"original": "boolean",
|
|
438
|
+
"resolved": "boolean",
|
|
439
|
+
"references": {}
|
|
440
|
+
},
|
|
441
|
+
"required": false,
|
|
442
|
+
"optional": false,
|
|
443
|
+
"docs": {
|
|
444
|
+
"tags": [],
|
|
445
|
+
"text": "Informa se as op\u00E7\u00F5es de desfazer e refazer devem ser habilitadas."
|
|
446
|
+
},
|
|
447
|
+
"attribute": "show-undo-redo",
|
|
448
|
+
"reflect": false,
|
|
449
|
+
"defaultValue": "true"
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
static get states() {
|
|
454
|
+
return {
|
|
455
|
+
"previewMode": {}
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
static get events() {
|
|
459
|
+
return [{
|
|
460
|
+
"method": "ezChange",
|
|
461
|
+
"name": "ezChange",
|
|
462
|
+
"bubbles": true,
|
|
463
|
+
"cancelable": true,
|
|
464
|
+
"composed": true,
|
|
465
|
+
"docs": {
|
|
466
|
+
"tags": [],
|
|
467
|
+
"text": "Emitido quando acontece a altera\u00E7\u00E3o de valor do campo."
|
|
468
|
+
},
|
|
469
|
+
"complexType": {
|
|
470
|
+
"original": "string",
|
|
471
|
+
"resolved": "string",
|
|
472
|
+
"references": {}
|
|
473
|
+
}
|
|
474
|
+
}];
|
|
475
|
+
}
|
|
476
|
+
static get methods() {
|
|
477
|
+
return {
|
|
478
|
+
"setFocus": {
|
|
479
|
+
"complexType": {
|
|
480
|
+
"signature": "() => Promise<void>",
|
|
481
|
+
"parameters": [],
|
|
482
|
+
"references": {
|
|
483
|
+
"Promise": {
|
|
484
|
+
"location": "global"
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
"return": "Promise<void>"
|
|
488
|
+
},
|
|
489
|
+
"docs": {
|
|
490
|
+
"text": "Aplica o foco no campo.",
|
|
491
|
+
"tags": []
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
"setBlur": {
|
|
495
|
+
"complexType": {
|
|
496
|
+
"signature": "() => Promise<void>",
|
|
497
|
+
"parameters": [],
|
|
498
|
+
"references": {
|
|
499
|
+
"Promise": {
|
|
500
|
+
"location": "global"
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
"return": "Promise<void>"
|
|
504
|
+
},
|
|
505
|
+
"docs": {
|
|
506
|
+
"text": "Remove o foco do campo.",
|
|
507
|
+
"tags": []
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
"isInvalid": {
|
|
511
|
+
"complexType": {
|
|
512
|
+
"signature": "() => Promise<boolean>",
|
|
513
|
+
"parameters": [],
|
|
514
|
+
"references": {
|
|
515
|
+
"Promise": {
|
|
516
|
+
"location": "global"
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
"return": "Promise<boolean>"
|
|
520
|
+
},
|
|
521
|
+
"docs": {
|
|
522
|
+
"text": "Retorna se o conte\u00FAdo \u00E9 inv\u00E1lido.",
|
|
523
|
+
"tags": []
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
static get elementRef() { return "element"; }
|
|
529
|
+
static get watchers() {
|
|
530
|
+
return [{
|
|
531
|
+
"propName": "value",
|
|
532
|
+
"methodName": "observeValue"
|
|
533
|
+
}];
|
|
534
|
+
}
|
|
535
|
+
static get listeners() {
|
|
536
|
+
return [{
|
|
537
|
+
"name": "executeToolbarCommand",
|
|
538
|
+
"method": "handleExecuteToolbarCommand",
|
|
539
|
+
"target": undefined,
|
|
540
|
+
"capture": false,
|
|
541
|
+
"passive": false
|
|
542
|
+
}];
|
|
543
|
+
}
|
|
544
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const RICH_TOOLBAR_COMMANDS = {
|
|
2
|
+
PREVIEW: 'preview',
|
|
3
|
+
UNDO: 'undo',
|
|
4
|
+
REDO: 'redo',
|
|
5
|
+
FORMAT: 'format',
|
|
6
|
+
LINK: 'link',
|
|
7
|
+
IMAGE: 'image',
|
|
8
|
+
FOCUS: 'focus',
|
|
9
|
+
};
|
|
10
|
+
export const RICH_TOOLBAR_FORMAT_TAGS = {
|
|
11
|
+
BOLD: '<strong>$selection</strong>',
|
|
12
|
+
ITALIC: '<em>$selection</em>',
|
|
13
|
+
UNDERLINE: '<u>$selection</u>',
|
|
14
|
+
LIST: '<ul><li>$selection</li></ul>',
|
|
15
|
+
BREAK_LINE: '\n<br/>\n',
|
|
16
|
+
};
|
|
17
|
+
export const RICH_TOOLBAR_COMMAND_TITLE = {
|
|
18
|
+
PREVIEW: 'Ctrl + P',
|
|
19
|
+
EDIT: 'Ir para modo edição',
|
|
20
|
+
UNDO: 'Desfazer (Ctrl + Z)',
|
|
21
|
+
REDO: 'Refazer (Ctrl + X)',
|
|
22
|
+
LINK: 'Inserir link (Ctrl + K)',
|
|
23
|
+
IMAGE: 'Inserir imagem (Ctrl + O)',
|
|
24
|
+
LIST: 'Lista (Ctrl + L)',
|
|
25
|
+
UNDERLINE: 'Sublinhado (Ctrl + U)',
|
|
26
|
+
ITALIC: 'Itálico (Ctrl + I)',
|
|
27
|
+
BOLD: 'Negrito (Ctrl + B)',
|
|
28
|
+
};
|
|
29
|
+
export const RICH_TOOLBAR_COMMAND_ICON = {
|
|
30
|
+
PREVIEW: 'Ctrl + P',
|
|
31
|
+
UNDO: 'undo',
|
|
32
|
+
REDO: 'redo',
|
|
33
|
+
LINK: 'link',
|
|
34
|
+
IMAGE: 'image-plus',
|
|
35
|
+
LIST: 'list',
|
|
36
|
+
UNDERLINE: 'underline',
|
|
37
|
+
ITALIC: 'italic',
|
|
38
|
+
BOLD: 'bold',
|
|
39
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { RICH_TOOLBAR_COMMAND_ICON, RICH_TOOLBAR_COMMAND_TITLE, RICH_TOOLBAR_COMMANDS } from '../RichToolbarHelper';
|
|
3
|
+
export class EzRichToolbarArrows {
|
|
4
|
+
render() {
|
|
5
|
+
return (h(Host, null, h("ez-rich-toolbar-item", { icon: RICH_TOOLBAR_COMMAND_ICON.UNDO, command: RICH_TOOLBAR_COMMANDS.UNDO, title: RICH_TOOLBAR_COMMAND_TITLE.UNDO }), h("ez-rich-toolbar-item", { icon: RICH_TOOLBAR_COMMAND_ICON.REDO, command: RICH_TOOLBAR_COMMANDS.REDO, title: RICH_TOOLBAR_COMMAND_TITLE.REDO })));
|
|
6
|
+
}
|
|
7
|
+
static get is() { return "ez-rich-toolbar-arrows"; }
|
|
8
|
+
static get encapsulation() { return "scoped"; }
|
|
9
|
+
static get originalStyleUrls() {
|
|
10
|
+
return {
|
|
11
|
+
"$": ["ez-rich-toolbar-arrows.css"]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static get styleUrls() {
|
|
15
|
+
return {
|
|
16
|
+
"$": ["ez-rich-toolbar-arrows.css"]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { RICH_TOOLBAR_COMMAND_ICON, RICH_TOOLBAR_COMMAND_TITLE, RICH_TOOLBAR_COMMANDS, RICH_TOOLBAR_FORMAT_TAGS, } from '../RichToolbarHelper';
|
|
3
|
+
export class EzRichToolbarConfigs {
|
|
4
|
+
render() {
|
|
5
|
+
return (h(Host, null, h("ez-rich-toolbar-item", { icon: RICH_TOOLBAR_COMMAND_ICON.LIST, command: RICH_TOOLBAR_COMMANDS.FORMAT, value: RICH_TOOLBAR_FORMAT_TAGS.LIST, title: RICH_TOOLBAR_COMMAND_TITLE.LIST }), h("ez-rich-toolbar-item", { icon: RICH_TOOLBAR_COMMAND_ICON.IMAGE, command: RICH_TOOLBAR_COMMANDS.IMAGE, title: RICH_TOOLBAR_COMMAND_TITLE.IMAGE }), h("ez-rich-toolbar-item", { icon: RICH_TOOLBAR_COMMAND_ICON.LINK, command: RICH_TOOLBAR_COMMANDS.LINK, title: RICH_TOOLBAR_COMMAND_TITLE.LINK })));
|
|
6
|
+
}
|
|
7
|
+
static get is() { return "ez-rich-toolbar-configs"; }
|
|
8
|
+
static get encapsulation() { return "scoped"; }
|
|
9
|
+
static get originalStyleUrls() {
|
|
10
|
+
return {
|
|
11
|
+
"$": ["ez-rich-toolbar-configs.css"]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static get styleUrls() {
|
|
15
|
+
return {
|
|
16
|
+
"$": ["ez-rich-toolbar-configs.css"]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
ez-icon {
|
|
2
|
+
--ez-icon--color: var(--color--secondary, #383c45);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.rich-toolbar-item {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
width: 32px;
|
|
10
|
+
height: 32px;
|
|
11
|
+
background: none;
|
|
12
|
+
border: none;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
transition: 0.3s all ease-in-out;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.rich-toolbar-item:hover {
|
|
19
|
+
background-color: #f5f5f5;
|
|
20
|
+
}
|