wini-web-components 2.3.8 → 2.3.9
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/component/ck-editor/ckeditor.d.ts +37 -0
- package/dist/component/ck-editor/ckeditor.js +404 -0
- package/dist/component/import-file/import-file.d.ts +3 -0
- package/dist/component/import-file/import-file.js +13 -12
- package/dist/component/text-field/text-field.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +8 -6
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { ClassicEditor, EventInfo } from 'ckeditor5';
|
|
3
|
+
import 'ckeditor5/ckeditor5.css';
|
|
4
|
+
import './ck-editor.css';
|
|
5
|
+
/**
|
|
6
|
+
* Please update the following values with your tokens.
|
|
7
|
+
* Instructions on how to obtain them: https://ckeditor.com/docs/trial/latest/guides/real-time/quick-start.html
|
|
8
|
+
*/
|
|
9
|
+
interface Props {
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
className?: string;
|
|
12
|
+
value?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
menuBar?: boolean;
|
|
16
|
+
onChange?: (event: EventInfo, editor: ClassicEditor) => void;
|
|
17
|
+
onFocus?: (event: EventInfo, editor: ClassicEditor) => void;
|
|
18
|
+
onBlur?: (event: EventInfo, editor: ClassicEditor) => void;
|
|
19
|
+
onError?: (error: Error, details: any) => void;
|
|
20
|
+
onReady?: (editor: ClassicEditor) => void;
|
|
21
|
+
onAfterDestroy?: (editor: ClassicEditor) => void;
|
|
22
|
+
extraPlugins?: Array<any>;
|
|
23
|
+
fontFamily?: Array<string>;
|
|
24
|
+
fontSize?: Array<number | "default">;
|
|
25
|
+
fontColors?: Array<{
|
|
26
|
+
color: string;
|
|
27
|
+
label: string;
|
|
28
|
+
}>;
|
|
29
|
+
fontBgColors?: Array<{
|
|
30
|
+
color: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}>;
|
|
33
|
+
helperText?: string;
|
|
34
|
+
helperTextColor?: string;
|
|
35
|
+
}
|
|
36
|
+
export default function CustomCkEditor5(props: Props): React.JSX.Element;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.default = CustomCkEditor5;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var react_2 = require("react");
|
|
20
|
+
var ckeditor5_react_1 = require("@ckeditor/ckeditor5-react");
|
|
21
|
+
var ckeditor5_1 = require("ckeditor5");
|
|
22
|
+
require("ckeditor5/ckeditor5.css");
|
|
23
|
+
require("./ck-editor.css");
|
|
24
|
+
var react_i18next_1 = require("react-i18next");
|
|
25
|
+
/**
|
|
26
|
+
* Create a free account with a trial: https://portal.ckeditor.com/checkout?plan=free
|
|
27
|
+
*/
|
|
28
|
+
var LICENSE_KEY = 'GPL'; // or <YOUR_LICENSE_KEY>.
|
|
29
|
+
function CustomCkEditor5(props) {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
31
|
+
var editorContainerRef = (0, react_2.useRef)(null);
|
|
32
|
+
var editorRef = (0, react_2.useRef)(null);
|
|
33
|
+
// const editorWordCountRef = useRef(null);
|
|
34
|
+
var _e = (0, react_2.useState)(false), isLayoutReady = _e[0], setIsLayoutReady = _e[1];
|
|
35
|
+
var i18n = (0, react_i18next_1.useTranslation)().i18n;
|
|
36
|
+
(0, react_2.useEffect)(function () {
|
|
37
|
+
setIsLayoutReady(true);
|
|
38
|
+
return function () { return setIsLayoutReady(false); };
|
|
39
|
+
}, []);
|
|
40
|
+
var editorConfig = (0, react_2.useMemo)(function () {
|
|
41
|
+
if (!isLayoutReady) {
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
editorConfig: {
|
|
46
|
+
toolbar: {
|
|
47
|
+
items: [
|
|
48
|
+
'heading',
|
|
49
|
+
'|',
|
|
50
|
+
// 'sourceEditing',
|
|
51
|
+
// 'showBlocks',
|
|
52
|
+
// 'findAndReplace',
|
|
53
|
+
// 'textPartLanguage',
|
|
54
|
+
'fontSize',
|
|
55
|
+
'fontFamily',
|
|
56
|
+
'fontColor',
|
|
57
|
+
'fontBackgroundColor',
|
|
58
|
+
'|',
|
|
59
|
+
'bold',
|
|
60
|
+
'italic',
|
|
61
|
+
'underline',
|
|
62
|
+
'strikethrough',
|
|
63
|
+
// 'subscript',
|
|
64
|
+
// 'superscript',
|
|
65
|
+
// 'code',
|
|
66
|
+
// 'removeFormat',
|
|
67
|
+
'|',
|
|
68
|
+
'specialCharacters',
|
|
69
|
+
'insertImage',
|
|
70
|
+
'horizontalLine',
|
|
71
|
+
'pageBreak',
|
|
72
|
+
'link',
|
|
73
|
+
// 'bookmark',
|
|
74
|
+
// 'insertImageViaUrl',
|
|
75
|
+
// 'ckbox',
|
|
76
|
+
'mediaEmbed',
|
|
77
|
+
'insertTable',
|
|
78
|
+
'highlight',
|
|
79
|
+
// 'blockQuote',
|
|
80
|
+
// 'codeBlock',
|
|
81
|
+
'htmlEmbed',
|
|
82
|
+
'|',
|
|
83
|
+
'alignment',
|
|
84
|
+
'|',
|
|
85
|
+
'bulletedList',
|
|
86
|
+
'numberedList',
|
|
87
|
+
'todoList',
|
|
88
|
+
'outdent',
|
|
89
|
+
'indent'
|
|
90
|
+
],
|
|
91
|
+
shouldNotGroupWhenFull: false,
|
|
92
|
+
},
|
|
93
|
+
plugins: [
|
|
94
|
+
ckeditor5_1.Alignment,
|
|
95
|
+
ckeditor5_1.Autoformat,
|
|
96
|
+
ckeditor5_1.AutoImage,
|
|
97
|
+
ckeditor5_1.AutoLink,
|
|
98
|
+
ckeditor5_1.Autosave,
|
|
99
|
+
ckeditor5_1.BalloonToolbar,
|
|
100
|
+
ckeditor5_1.BlockQuote,
|
|
101
|
+
ckeditor5_1.Bold,
|
|
102
|
+
ckeditor5_1.Bookmark,
|
|
103
|
+
ckeditor5_1.Code,
|
|
104
|
+
ckeditor5_1.CodeBlock,
|
|
105
|
+
ckeditor5_1.Essentials,
|
|
106
|
+
ckeditor5_1.FindAndReplace,
|
|
107
|
+
ckeditor5_1.FontBackgroundColor,
|
|
108
|
+
ckeditor5_1.FontColor,
|
|
109
|
+
ckeditor5_1.FontFamily,
|
|
110
|
+
ckeditor5_1.FontSize,
|
|
111
|
+
ckeditor5_1.FullPage,
|
|
112
|
+
ckeditor5_1.GeneralHtmlSupport,
|
|
113
|
+
ckeditor5_1.Heading,
|
|
114
|
+
ckeditor5_1.Highlight,
|
|
115
|
+
ckeditor5_1.HorizontalLine,
|
|
116
|
+
ckeditor5_1.HtmlComment,
|
|
117
|
+
ckeditor5_1.HtmlEmbed,
|
|
118
|
+
ckeditor5_1.ImageBlock,
|
|
119
|
+
ckeditor5_1.ImageCaption,
|
|
120
|
+
ckeditor5_1.ImageInline,
|
|
121
|
+
ckeditor5_1.ImageInsert,
|
|
122
|
+
ckeditor5_1.ImageInsertViaUrl,
|
|
123
|
+
ckeditor5_1.ImageResize,
|
|
124
|
+
ckeditor5_1.ImageStyle,
|
|
125
|
+
ckeditor5_1.ImageTextAlternative,
|
|
126
|
+
ckeditor5_1.ImageToolbar,
|
|
127
|
+
ckeditor5_1.ImageUpload,
|
|
128
|
+
ckeditor5_1.Indent,
|
|
129
|
+
ckeditor5_1.IndentBlock,
|
|
130
|
+
ckeditor5_1.Italic,
|
|
131
|
+
ckeditor5_1.Link,
|
|
132
|
+
ckeditor5_1.LinkImage,
|
|
133
|
+
ckeditor5_1.List,
|
|
134
|
+
ckeditor5_1.ListProperties,
|
|
135
|
+
ckeditor5_1.Markdown,
|
|
136
|
+
ckeditor5_1.MediaEmbed,
|
|
137
|
+
ckeditor5_1.Mention,
|
|
138
|
+
ckeditor5_1.PageBreak,
|
|
139
|
+
ckeditor5_1.Paragraph,
|
|
140
|
+
ckeditor5_1.PasteFromMarkdownExperimental,
|
|
141
|
+
ckeditor5_1.PasteFromOffice,
|
|
142
|
+
ckeditor5_1.PictureEditing,
|
|
143
|
+
ckeditor5_1.RemoveFormat,
|
|
144
|
+
ckeditor5_1.ShowBlocks,
|
|
145
|
+
ckeditor5_1.SourceEditing,
|
|
146
|
+
ckeditor5_1.SpecialCharacters,
|
|
147
|
+
ckeditor5_1.SpecialCharactersArrows,
|
|
148
|
+
ckeditor5_1.SpecialCharactersCurrency,
|
|
149
|
+
ckeditor5_1.SpecialCharactersEssentials,
|
|
150
|
+
ckeditor5_1.SpecialCharactersLatin,
|
|
151
|
+
ckeditor5_1.SpecialCharactersMathematical,
|
|
152
|
+
ckeditor5_1.SpecialCharactersText,
|
|
153
|
+
ckeditor5_1.Strikethrough,
|
|
154
|
+
ckeditor5_1.Style,
|
|
155
|
+
ckeditor5_1.Subscript,
|
|
156
|
+
ckeditor5_1.Superscript,
|
|
157
|
+
ckeditor5_1.Table,
|
|
158
|
+
ckeditor5_1.TableCaption,
|
|
159
|
+
ckeditor5_1.TableCellProperties,
|
|
160
|
+
ckeditor5_1.TableColumnResize,
|
|
161
|
+
ckeditor5_1.TableProperties,
|
|
162
|
+
ckeditor5_1.TableToolbar,
|
|
163
|
+
ckeditor5_1.TextPartLanguage,
|
|
164
|
+
ckeditor5_1.TextTransformation,
|
|
165
|
+
// Title,
|
|
166
|
+
ckeditor5_1.TodoList,
|
|
167
|
+
ckeditor5_1.Underline,
|
|
168
|
+
ckeditor5_1.WordCount
|
|
169
|
+
],
|
|
170
|
+
balloonToolbar: ['bold', 'italic', '|', 'link', 'insertImage', '|', 'bulletedList', 'numberedList'],
|
|
171
|
+
extraPlugins: props.extraPlugins,
|
|
172
|
+
mediaEmbed: {
|
|
173
|
+
previewsInData: true,
|
|
174
|
+
providers: [
|
|
175
|
+
{
|
|
176
|
+
name: "youtube",
|
|
177
|
+
url: /^https:\/\/www\.youtube\.com\/watch\?v=([\w-]+)/,
|
|
178
|
+
html: function (match) {
|
|
179
|
+
var id = match[1];
|
|
180
|
+
return ('<div style="position: relative; padding-bottom: 56.25%; height: 0;">' +
|
|
181
|
+
"<iframe src=\"https://www.youtube.com/embed/".concat(id, "\" ") +
|
|
182
|
+
'style="position: absolute; width: 100%; height: 100%; left: 0;" ' +
|
|
183
|
+
'frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>' +
|
|
184
|
+
"</div>");
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
fontFamily: {
|
|
190
|
+
options: props.fontFamily || ["Default", "Arial", "Courier New", "Inter", "Roboto", "Times New Roman", "Source Serif 4"],
|
|
191
|
+
supportAllValues: true
|
|
192
|
+
},
|
|
193
|
+
fontSize: {
|
|
194
|
+
options: props.fontSize || [10, 12, 14, 'default', 18, 20, 22, 24],
|
|
195
|
+
supportAllValues: true,
|
|
196
|
+
},
|
|
197
|
+
fontColor: {
|
|
198
|
+
columns: 6,
|
|
199
|
+
colors: props.fontColors || [
|
|
200
|
+
{
|
|
201
|
+
color: 'var(--neutral-text-title-color)',
|
|
202
|
+
label: 'title'
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
color: 'var(--neutral-text-subtitle-color)',
|
|
206
|
+
label: 'subtitle'
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
color: 'var(--neutral-text-body-color)',
|
|
210
|
+
label: 'body'
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
color: 'var(--neutral-text-placeholder-color)',
|
|
214
|
+
label: 'placeholder'
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
color: 'var(--neutral-text-disabled-color)',
|
|
218
|
+
label: 'disabled'
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
color: 'var(--neutral-text-stable-color)',
|
|
222
|
+
label: 'stable'
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
color: 'var(--primary-main-color)',
|
|
226
|
+
label: 'primay'
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
color: 'var(--warning-main-color)',
|
|
230
|
+
label: 'warning'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
color: 'var(--success-main-color)',
|
|
234
|
+
label: 'success'
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
color: 'var(--secondary3-main-color)',
|
|
238
|
+
label: 'secondary3'
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
color: 'var(--secondary4-main-color)',
|
|
242
|
+
label: 'secondary4'
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
color: 'var(--secondary5-main-color)',
|
|
246
|
+
label: 'secondary5'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
color: 'var(--infor-main-color)',
|
|
250
|
+
label: 'infor'
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
color: 'var(--error-main-color)',
|
|
254
|
+
label: 'error'
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
fontBackgroundColor: {
|
|
259
|
+
columns: 6,
|
|
260
|
+
colors: props.fontBgColors || [
|
|
261
|
+
{
|
|
262
|
+
color: 'var(--neutral-main-background-color)',
|
|
263
|
+
label: 'main'
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
color: 'var(--neutral-main-reverse-background-color)',
|
|
267
|
+
label: 'main-reverse'
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
color: 'var(--neutral-absolute-background-color)',
|
|
271
|
+
label: 'absolute'
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
color: 'var(--neutral-absolute-reverse-background-color)',
|
|
275
|
+
label: 'absolute-reverse'
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
color: 'var(--primary-background)',
|
|
279
|
+
label: 'primay-bg'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
color: 'var(--warning-background)',
|
|
283
|
+
label: 'warning-bg'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
color: 'var(--success-background)',
|
|
287
|
+
label: 'success-bg'
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
color: 'var(--secondary3-background)',
|
|
291
|
+
label: 'secondary3-bg'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
color: 'var(--secondary4-background)',
|
|
295
|
+
label: 'secondary4-bg'
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
color: 'var(--secondary5-background)',
|
|
299
|
+
label: 'secondary5-bg'
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
color: 'var(--infor-background)',
|
|
303
|
+
label: 'infor-bg'
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
color: 'var(--error-background)',
|
|
307
|
+
label: 'error-bg'
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
},
|
|
311
|
+
heading: {
|
|
312
|
+
options: [
|
|
313
|
+
{
|
|
314
|
+
model: 'paragraph',
|
|
315
|
+
title: 'Paragraph',
|
|
316
|
+
class: 'ck-heading_paragraph'
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
model: 'heading1',
|
|
320
|
+
view: 'h1',
|
|
321
|
+
title: 'Heading 1',
|
|
322
|
+
class: 'ck-heading_heading1'
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
model: 'heading2',
|
|
326
|
+
view: 'h2',
|
|
327
|
+
title: 'Heading 2',
|
|
328
|
+
class: 'ck-heading_heading2'
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
model: 'heading3',
|
|
332
|
+
view: 'h3',
|
|
333
|
+
title: 'Heading 3',
|
|
334
|
+
class: 'ck-heading_heading3'
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
model: 'heading4',
|
|
338
|
+
view: 'h4',
|
|
339
|
+
title: 'Heading 4',
|
|
340
|
+
class: 'ck-heading_heading4'
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
model: 'heading5',
|
|
344
|
+
view: 'h5',
|
|
345
|
+
title: 'Heading 5',
|
|
346
|
+
class: 'ck-heading_heading5'
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
model: 'heading6',
|
|
350
|
+
view: 'h6',
|
|
351
|
+
title: 'Heading 6',
|
|
352
|
+
class: 'ck-heading_heading6'
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
htmlSupport: {
|
|
357
|
+
allow: [
|
|
358
|
+
{
|
|
359
|
+
name: /^.*$/,
|
|
360
|
+
styles: true,
|
|
361
|
+
attributes: true,
|
|
362
|
+
classes: true
|
|
363
|
+
}
|
|
364
|
+
]
|
|
365
|
+
},
|
|
366
|
+
image: {
|
|
367
|
+
toolbar: [
|
|
368
|
+
'toggleImageCaption',
|
|
369
|
+
'imageTextAlternative',
|
|
370
|
+
'|',
|
|
371
|
+
'imageStyle:inline',
|
|
372
|
+
'imageStyle:wrapText',
|
|
373
|
+
'imageStyle:breakText',
|
|
374
|
+
'|',
|
|
375
|
+
'resizeImage'
|
|
376
|
+
]
|
|
377
|
+
},
|
|
378
|
+
language: "vi",
|
|
379
|
+
licenseKey: LICENSE_KEY,
|
|
380
|
+
link: {
|
|
381
|
+
addTargetToExternalLinks: true,
|
|
382
|
+
defaultProtocol: 'https://',
|
|
383
|
+
decorators: {
|
|
384
|
+
toggleDownloadable: {
|
|
385
|
+
mode: 'manual',
|
|
386
|
+
label: 'Downloadable',
|
|
387
|
+
attributes: {
|
|
388
|
+
download: 'file'
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
menuBar: { isVisible: props.menuBar },
|
|
394
|
+
placeholder: props.placeholder,
|
|
395
|
+
table: {
|
|
396
|
+
contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties']
|
|
397
|
+
},
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}, [isLayoutReady, i18n.language]).editorConfig;
|
|
401
|
+
return react_1.default.createElement("div", { ref: editorContainerRef, className: "col editor-container editor-container_classic-editor editor-container_include-style ".concat((_a = props.className) !== null && _a !== void 0 ? _a : "", " ").concat(((_b = props.helperText) === null || _b === void 0 ? void 0 : _b.length) ? 'helper-text' : ""), "helper-text": props.helperText, style: props.style ? __assign(__assign({}, { '--helper-text-color': (_c = props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), props.style) : { '--helper-text-color': (_d = props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' } },
|
|
402
|
+
react_1.default.createElement("div", { className: "editor-container__editor" },
|
|
403
|
+
react_1.default.createElement("div", { ref: editorRef }, editorConfig && (react_1.default.createElement(ckeditor5_react_1.CKEditor, { onReady: props.onReady, onAfterDestroy: props.onAfterDestroy, onFocus: props.onFocus, onChange: props.onChange, onBlur: props.onBlur, editor: ckeditor5_1.ClassicEditor, onError: props.onError, config: editorConfig, data: props.value, disabled: props.disabled })))));
|
|
404
|
+
}
|
|
@@ -105,17 +105,18 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
105
105
|
};
|
|
106
106
|
TImportFile.prototype.render = function () {
|
|
107
107
|
var _this = this;
|
|
108
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
109
109
|
var t = this.props.t;
|
|
110
110
|
var sizeTitle;
|
|
111
111
|
if (this.props.maxSize) {
|
|
112
112
|
sizeTitle = this.props.maxSize > Math.pow(1024, 3) ? "".concat(Math.round(this.props.maxSize / Math.pow(1024, 3)), "TB") : this.props.maxSize > Math.pow(1024, 2) ? "".concat(Math.round(this.props.maxSize / Math.pow(1024, 2)), "GB") : this.props.maxSize > 1024 ? "".concat(Math.round(this.props.maxSize / 1024), "MB") : "".concat(this.props.maxSize, "KB");
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
var _style = this.state.preview ? ((_a = this.props.style) !== null && _a !== void 0 ? _a : {}) : __assign({ cursor: 'pointer' }, ((_b = this.props.style) !== null && _b !== void 0 ? _b : {}));
|
|
115
|
+
return react_1.default.createElement("div", { id: this.props.id, className: "".concat(import_file_module_css_1.default['import-file-container'], " ").concat((_c = this.props.className) !== null && _c !== void 0 ? _c : 'row', " ").concat(this.props.buttonOnly ? import_file_module_css_1.default['button-only'] : '', " ").concat(((_d = this.props.helperText) === null || _d === void 0 ? void 0 : _d.length) ? import_file_module_css_1.default['helper-text'] : ""), style: __assign({ '--helper-text-color': (_e = this.props.helperTextColor) !== null && _e !== void 0 ? _e : '#e14337' }, _style), "helper-text": this.props.helperText, onClick: function () {
|
|
115
116
|
if (!_this.state.preview && !_this.props.buttonOnly)
|
|
116
117
|
_this.showFilePicker();
|
|
117
118
|
} },
|
|
118
|
-
react_1.default.createElement("input", { type: 'file', multiple: this.props.multiple, accept: ((
|
|
119
|
+
react_1.default.createElement("input", { disabled: this.props.disabled, type: 'file', multiple: this.props.multiple, accept: ((_f = this.props.allowType) !== null && _f !== void 0 ? _f : []).join(','), ref: this.fileRef, onChange: function (ev) {
|
|
119
120
|
var _a, _b, _c, _d;
|
|
120
121
|
var files;
|
|
121
122
|
if ((_a = ev.target.files) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -143,7 +144,7 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
143
144
|
} }),
|
|
144
145
|
this.props.buttonOnly
|
|
145
146
|
? null
|
|
146
|
-
: this.props.multiple && ((
|
|
147
|
+
: this.props.multiple && ((_g = this.state.preview) === null || _g === void 0 ? void 0 : _g.length) ? react_1.default.createElement("div", { className: 'row', style: { flex: 1, flexWrap: "wrap", gap: "0.8rem" } }, this.state.preview.map(function (f) {
|
|
147
148
|
var _a;
|
|
148
149
|
return react_1.default.createElement("div", { key: "".concat(f.name, "-").concat(f.size, "-").concat(f.lastModified), className: 'row col6', style: { "--gutter": "0.8rem", gap: "0.8rem", padding: "0.6rem 0.8rem", borderRadius: "0.4rem", border: "var(--neutral-main-border)" } },
|
|
149
150
|
react_1.default.createElement(index_1.Winicon, { src: "outline/".concat(((_a = f.type) === null || _a === void 0 ? void 0 : _a.includes('image')) ? "multimedia/image" : "files/file-export"), size: "1.4rem" }),
|
|
@@ -156,20 +157,20 @@ var TImportFile = /** @class */ (function (_super) {
|
|
|
156
157
|
_this.props.onChange(newValue);
|
|
157
158
|
}, color: '#E14337' }));
|
|
158
159
|
})) : react_1.default.createElement(react_1.default.Fragment, null,
|
|
159
|
-
react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['import-file-prefix'], " row") }, ((
|
|
160
|
+
react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['import-file-prefix'], " row") }, ((_h = this.state.preview) === null || _h === void 0 ? void 0 : _h.length) ? ((_j = this.state.preview[0].type) === null || _j === void 0 ? void 0 : _j.includes('image')) ? react_1.default.createElement("img", { src: this.state.preview[0] instanceof File ? URL.createObjectURL(this.state.preview[0]) : (_l = (_k = this.state.preview) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.url }) : fileSvg : cloudSvg),
|
|
160
161
|
react_1.default.createElement("div", { className: "".concat(import_file_module_css_1.default['file-preview-content'], " col") },
|
|
161
|
-
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['title-file'], " heading-8"), style: { maxWidth: '100%' } }, (
|
|
162
|
-
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['subtitle-file'], " subtitle-3"), style: { maxWidth: '100%' } }, ((
|
|
163
|
-
? "".concat((
|
|
164
|
-
: ((
|
|
165
|
-
((
|
|
166
|
-
react_1.default.createElement(index_1.Text, { className: 'button-text-6' }, (
|
|
162
|
+
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['title-file'], " heading-8"), style: { maxWidth: '100%' } }, (_p = (_o = (_m = this.state.preview) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.name) !== null && _p !== void 0 ? _p : ((_q = this.props.label) !== null && _q !== void 0 ? _q : t("uploadFileAction"))),
|
|
163
|
+
react_1.default.createElement(index_1.Text, { className: "".concat(import_file_module_css_1.default['subtitle-file'], " subtitle-3"), style: { maxWidth: '100%' } }, ((_s = (_r = this.state.preview) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.size)
|
|
164
|
+
? "".concat((_t = this.state.preview) === null || _t === void 0 ? void 0 : _t[0].size, "KB")
|
|
165
|
+
: ((_u = this.props.subTitle) !== null && _u !== void 0 ? _u : (sizeTitle ? t("limitFileWarning", { sizeTitle: sizeTitle }) : ''))))),
|
|
166
|
+
((_v = this.state.preview) === null || _v === void 0 ? void 0 : _v.length) && this.props.buttonOnly && !this.props.multiple ? react_1.default.createElement("div", { className: 'row', style: { gap: "0.4rem" } },
|
|
167
|
+
react_1.default.createElement(index_1.Text, { className: 'button-text-6' }, (_x = (_w = this.state.preview) === null || _w === void 0 ? void 0 : _w[0].name) !== null && _x !== void 0 ? _x : ''),
|
|
167
168
|
react_1.default.createElement("button", { type: 'button', className: "".concat(import_file_module_css_1.default['remove-preview-file']), onClick: function () {
|
|
168
169
|
_this.setState(__assign(__assign({}, _this.state), { preview: undefined }));
|
|
169
170
|
if (_this.props.onChange)
|
|
170
171
|
_this.props.onChange(undefined);
|
|
171
172
|
} }, closeSvg))
|
|
172
|
-
: react_1.default.createElement(index_1.Button, { label: ((
|
|
173
|
+
: react_1.default.createElement(index_1.Button, { label: ((_y = this.state.preview) === null || _y === void 0 ? void 0 : _y.length) ? this.props.multiple ? "".concat(t("add"), " ").concat(t("file").toLowerCase()) : "".concat(t("remove"), " ").concat(t("file").toLowerCase()) : "".concat(t("choose"), " ").concat(t("file").toLowerCase()), style: { padding: "1.2rem", backgroundColor: "var(--neutral-main-background-color)" }, className: 'button-text-4', onClick: function () {
|
|
173
174
|
if (_this.state.preview && !_this.props.multiple) {
|
|
174
175
|
_this.setState(__assign(__assign({}, _this.state), { preview: undefined }));
|
|
175
176
|
if (_this.props.onChange)
|
|
@@ -76,10 +76,10 @@ var TextField = /** @class */ (function (_super) {
|
|
|
76
76
|
TextField.prototype.render = function () {
|
|
77
77
|
var _this = this;
|
|
78
78
|
var _a, _b, _c, _d, _e, _f;
|
|
79
|
-
return react_1.default.createElement("div", { ref: this.containerRef, id: this.props.id, className: "text-field-container row ".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : 'body-3', " ").concat(((_b = this.props.helperText) === null || _b === void 0 ? void 0 : _b.length)
|
|
79
|
+
return react_1.default.createElement("div", { ref: this.containerRef, id: this.props.id, className: "text-field-container row ".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : 'body-3', " ").concat(((_b = this.props.helperText) === null || _b === void 0 ? void 0 : _b.length) ? 'helper-text' : ""), "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' } },
|
|
80
80
|
this.props.prefix,
|
|
81
81
|
this.props.register ?
|
|
82
|
-
react_1.default.createElement("input", __assign({}, this.props.register, { autoComplete: this.props.autoComplete, autoFocus: this.props.autoFocus, maxLength: this.props.maxLength,
|
|
82
|
+
react_1.default.createElement("input", __assign({ name: this.props.name }, this.props.register, { autoComplete: this.props.autoComplete, autoFocus: this.props.autoFocus, maxLength: this.props.maxLength, type: (_e = this.props.type) !== null && _e !== void 0 ? _e : 'text', placeholder: this.props.placeholder, readOnly: this.props.readOnly, disabled: this.props.disabled, onFocus: this.props.onFocus, onKeyDown: this.props.onComplete ? function (ev) {
|
|
83
83
|
if (_this.props.onComplete) {
|
|
84
84
|
switch (ev.key.toLowerCase()) {
|
|
85
85
|
case "enter":
|