@aquera/nile-elements 0.1.63-beta-1.2 → 0.1.64-beta-1.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/demo/index.html +8 -8
- package/dist/index.js +84 -84
- package/dist/nile-file-preview/nile-file-preview.cjs.js +1 -1
- package/dist/nile-file-preview/nile-file-preview.cjs.js.map +1 -1
- package/dist/nile-file-preview/nile-file-preview.css.cjs.js +1 -1
- package/dist/nile-file-preview/nile-file-preview.css.cjs.js.map +1 -1
- package/dist/nile-file-preview/nile-file-preview.css.esm.js +19 -2
- package/dist/nile-file-preview/nile-file-preview.esm.js +3 -3
- package/dist/nile-file-preview/nile-file-preview.template.cjs.js +1 -1
- package/dist/nile-file-preview/nile-file-preview.template.cjs.js.map +1 -1
- package/dist/nile-file-preview/nile-file-preview.template.esm.js +22 -22
- package/dist/nile-file-preview/utils/index.cjs.js +1 -1
- package/dist/nile-file-preview/utils/index.esm.js +1 -1
- package/dist/nile-file-preview/utils/nile-file-preview.util.cjs.js +1 -1
- package/dist/nile-file-preview/utils/nile-file-preview.util.cjs.js.map +1 -1
- package/dist/nile-file-preview/utils/nile-file-preview.util.esm.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.cjs.js.map +1 -1
- package/dist/nile-file-upload/nile-file-upload.css.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.css.cjs.js.map +1 -1
- package/dist/nile-file-upload/nile-file-upload.css.esm.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.esm.js +2 -2
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js +3 -3
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js.map +1 -1
- package/dist/nile-file-upload/nile-file-upload.template.esm.js +22 -22
- package/dist/nile-file-upload/utils/file-validation.util.cjs.js +2 -2
- package/dist/nile-file-upload/utils/file-validation.util.cjs.js.map +1 -1
- package/dist/nile-file-upload/utils/file-validation.util.esm.js +1 -1
- package/dist/src/nile-file-preview/nile-file-preview.css.js +19 -2
- package/dist/src/nile-file-preview/nile-file-preview.css.js.map +1 -1
- package/dist/src/nile-file-preview/nile-file-preview.d.ts +1 -0
- package/dist/src/nile-file-preview/nile-file-preview.js +7 -6
- package/dist/src/nile-file-preview/nile-file-preview.js.map +1 -1
- package/dist/src/nile-file-preview/nile-file-preview.template.d.ts +3 -2
- package/dist/src/nile-file-preview/nile-file-preview.template.js +16 -10
- package/dist/src/nile-file-preview/nile-file-preview.template.js.map +1 -1
- package/dist/src/nile-file-preview/utils/nile-file-preview.util.d.ts +1 -2
- package/dist/src/nile-file-preview/utils/nile-file-preview.util.js +8 -8
- package/dist/src/nile-file-preview/utils/nile-file-preview.util.js.map +1 -1
- package/dist/src/nile-file-upload/nile-file-upload.css.js +1 -1
- package/dist/src/nile-file-upload/nile-file-upload.css.js.map +1 -1
- package/dist/src/nile-file-upload/nile-file-upload.d.ts +1 -0
- package/dist/src/nile-file-upload/nile-file-upload.js +7 -6
- package/dist/src/nile-file-upload/nile-file-upload.js.map +1 -1
- package/dist/src/nile-file-upload/nile-file-upload.template.d.ts +5 -4
- package/dist/src/nile-file-upload/nile-file-upload.template.js +24 -15
- package/dist/src/nile-file-upload/nile-file-upload.template.js.map +1 -1
- package/dist/src/nile-file-upload/utils/file-validation.util.d.ts +1 -0
- package/dist/src/nile-file-upload/utils/file-validation.util.js +11 -0
- package/dist/src/nile-file-upload/utils/file-validation.util.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-file-preview/nile-file-preview.css.ts +19 -2
- package/src/nile-file-preview/nile-file-preview.template.ts +23 -10
- package/src/nile-file-preview/nile-file-preview.ts +7 -6
- package/src/nile-file-preview/utils/nile-file-preview.util.ts +7 -10
- package/src/nile-file-upload/nile-file-upload.css.ts +1 -1
- package/src/nile-file-upload/nile-file-upload.template.ts +35 -17
- package/src/nile-file-upload/nile-file-upload.ts +7 -6
- package/src/nile-file-upload/utils/file-validation.util.ts +12 -0
- package/vscode-html-custom-data.json +2 -2
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent nile-elements following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "nile-elements",
|
6
|
-
"version": "0.1.
|
6
|
+
"version": "0.1.64-beta-1.0",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
@@ -108,6 +108,10 @@ export const styles = css`
|
|
108
108
|
}
|
109
109
|
|
110
110
|
/* Uploading State */
|
111
|
+
nile-loader {
|
112
|
+
line-height: 0;
|
113
|
+
}
|
114
|
+
|
111
115
|
.uploading {
|
112
116
|
height: 62px;
|
113
117
|
width: 648px;
|
@@ -189,6 +193,7 @@ export const styles = css`
|
|
189
193
|
|
190
194
|
.preview-inner {
|
191
195
|
display: flex;
|
196
|
+
align-items: center;
|
192
197
|
gap: 18px;
|
193
198
|
}
|
194
199
|
|
@@ -255,6 +260,7 @@ export const styles = css`
|
|
255
260
|
|
256
261
|
.no-preview-container {
|
257
262
|
display: flex;
|
263
|
+
align-items: center;
|
258
264
|
gap: 18px;
|
259
265
|
}
|
260
266
|
|
@@ -288,12 +294,22 @@ export const styles = css`
|
|
288
294
|
margin: 0px;
|
289
295
|
font-size: var(--nile-type-scale-3);
|
290
296
|
font-weight: var(--nile-font-weight-regular);
|
297
|
+
text-align: left;
|
298
|
+
white-space: nowrap;
|
299
|
+
text-overflow: ellipsis;
|
300
|
+
overflow: hidden;
|
301
|
+
width: 500px;
|
291
302
|
}
|
292
303
|
|
293
304
|
.preview-file-info p:last-of-type{
|
294
305
|
color: var(--nile-colors-neutral-700);
|
295
306
|
font-size: var(--nile-type-scale-2);
|
296
307
|
font-weight: var(--nile-font-weight-regular);
|
308
|
+
text-align: left;
|
309
|
+
white-space: nowrap;
|
310
|
+
text-overflow: ellipsis;
|
311
|
+
overflow: hidden;
|
312
|
+
width: 500px;
|
297
313
|
}
|
298
314
|
|
299
315
|
.no-preview > nile-icon:hover {
|
@@ -312,6 +328,7 @@ export const styles = css`
|
|
312
328
|
.error-container {
|
313
329
|
width: 95%;
|
314
330
|
display: flex;
|
331
|
+
align-items: center;
|
315
332
|
gap: 18px;
|
316
333
|
}
|
317
334
|
|
@@ -352,7 +369,7 @@ export const styles = css`
|
|
352
369
|
width: 538px;
|
353
370
|
}
|
354
371
|
|
355
|
-
.file-info
|
372
|
+
.file-info nile-tooltip span, .file-info span {
|
356
373
|
color: var(--nile-colors-red-700);
|
357
374
|
font-size: var(--nile-type-scale-2);
|
358
375
|
font-weight: var(--nile-font-weight-regular);
|
@@ -541,7 +558,7 @@ export const styles = css`
|
|
541
558
|
max-width: 222px;
|
542
559
|
}
|
543
560
|
|
544
|
-
.file-info-vertical-state
|
561
|
+
.file-info-vertical-state nile-tooltip span, .file-info-vertical-state span {
|
545
562
|
color: var(--nile-colors-red-700);
|
546
563
|
font-size: var(--nile-type-scale-2);
|
547
564
|
font-weight: var(--nile-font-weight-regular);
|
@@ -7,6 +7,7 @@ import { html, TemplateResult } from 'lit';
|
|
7
7
|
import { FilePreviewErrorMessages, RemoveFileDetail } from './types';
|
8
8
|
import { removeFile, cancelFileUpload } from './utils';
|
9
9
|
import { formatFileSize, truncateString, getFileType } from './utils/nile-file-preview.util';
|
10
|
+
import { NileFilePreview } from './nile-file-preview';
|
10
11
|
|
11
12
|
export function getHorizontalUploadingState(
|
12
13
|
file: File,
|
@@ -81,7 +82,7 @@ export function getHorizontalNoPreviewState(
|
|
81
82
|
<nile-icon name="general" size="20" color="var(--nile-colors-blue-500)"></nile-icon>
|
82
83
|
</div>
|
83
84
|
<div class="preview-file-info">
|
84
|
-
<p>${
|
85
|
+
<p>${file.name}</p>
|
85
86
|
<p>${getFileType(file.type)} • ${formatFileSize(Number(file.size))}</p>
|
86
87
|
</div>
|
87
88
|
</div>
|
@@ -101,8 +102,10 @@ export function getHorizontalNoPreviewState(
|
|
101
102
|
export function getHorizontalErrorState(
|
102
103
|
file: File,
|
103
104
|
errorMessage: string,
|
104
|
-
originalUrl: string
|
105
|
+
originalUrl: string,
|
106
|
+
nileFilePreview: NileFilePreview
|
105
107
|
): TemplateResult {
|
108
|
+
truncateString(nileFilePreview);
|
106
109
|
return html`
|
107
110
|
<div class="error horizontal-div" part="horizontal-error-state">
|
108
111
|
<div class="error-container">
|
@@ -111,9 +114,13 @@ export function getHorizontalErrorState(
|
|
111
114
|
</div>
|
112
115
|
<div class="file-info">
|
113
116
|
<p class="horizontal-file-name">${file.name}</p>
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
${
|
118
|
+
nileFilePreview.isStringTruncated
|
119
|
+
? html`<nile-tooltip content=${errorMessage}>
|
120
|
+
<span>${errorMessage}</span>
|
121
|
+
</nile-tooltip>`
|
122
|
+
: html`<span>${errorMessage}</span>`
|
123
|
+
}
|
117
124
|
</div>
|
118
125
|
</div>
|
119
126
|
<slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name="cancelIcon">
|
@@ -201,7 +208,7 @@ export function getVerticalNoPreviewState(
|
|
201
208
|
</div>
|
202
209
|
|
203
210
|
<div class="content-container">
|
204
|
-
<p>${
|
211
|
+
<p>${file.name}</p>
|
205
212
|
<p>${getFileType(file.type)} • ${formatFileSize(Number(file.size))}</p>
|
206
213
|
</div>
|
207
214
|
|
@@ -219,8 +226,10 @@ export function getVerticalNoPreviewState(
|
|
219
226
|
export function getVerticalErrorState(
|
220
227
|
file: File,
|
221
228
|
errorMessage: string,
|
222
|
-
originalUrl: string
|
229
|
+
originalUrl: string,
|
230
|
+
nileFilePreview: NileFilePreview
|
223
231
|
): TemplateResult {
|
232
|
+
truncateString(nileFilePreview);
|
224
233
|
return html`
|
225
234
|
<div class="vertical-div vertical-error" part="vertical-error-state">
|
226
235
|
<div class="vertical-document-icon error-bg">
|
@@ -229,9 +238,13 @@ export function getVerticalErrorState(
|
|
229
238
|
|
230
239
|
<div class="file-info-vertical-state">
|
231
240
|
<p class="vertical-file-name">${file.name}</p>
|
232
|
-
|
233
|
-
|
234
|
-
|
241
|
+
${
|
242
|
+
nileFilePreview.isStringTruncated
|
243
|
+
? html`<nile-tooltip content=${errorMessage}>
|
244
|
+
<span>${errorMessage}</span>
|
245
|
+
</nile-tooltip>`
|
246
|
+
: html`<span>${errorMessage}</span>`
|
247
|
+
}
|
235
248
|
</div>
|
236
249
|
|
237
250
|
<slot @click=${(e: CustomEvent<RemoveFileDetail>) => removeFile(file, e, originalUrl)} name="cancelIcon">
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import {styles} from './nile-file-preview.css';
|
9
9
|
import NileElement from '../internal/nile-element';
|
10
10
|
import { customElement, property } from 'lit/decorators.js';
|
11
|
-
import {
|
11
|
+
import { generatePreviewUrl, truncateString } from './utils';
|
12
12
|
import { FilePreviewState, FilePreviewVariant, FilePreviewErrorMessages, FilePreviewEvent } from './types';
|
13
13
|
import { LitElement, html, CSSResultArray, TemplateResult, PropertyValues } from 'lit';
|
14
14
|
import {
|
@@ -48,6 +48,7 @@ export class NileFilePreview extends NileElement {
|
|
48
48
|
@property({ type: String }) inputFileName: string = "";
|
49
49
|
private inputFileHtml: TemplateResult | null = null;
|
50
50
|
private originalUrl: string = "";
|
51
|
+
public isStringTruncated: boolean = false;
|
51
52
|
|
52
53
|
/**
|
53
54
|
* Render method
|
@@ -61,7 +62,7 @@ export class NileFilePreview extends NileElement {
|
|
61
62
|
|
62
63
|
protected firstUpdated(_changedProperties: PropertyValues): void {
|
63
64
|
super.firstUpdated(_changedProperties);
|
64
|
-
fileUploadServerError(this);
|
65
|
+
// fileUploadServerError(this);
|
65
66
|
}
|
66
67
|
|
67
68
|
protected updated(changedProperties: PropertyValues): void {
|
@@ -109,8 +110,8 @@ export class NileFilePreview extends NileElement {
|
|
109
110
|
console.error(this.errorMessage);
|
110
111
|
|
111
112
|
this.inputFileHtml = this.variant === FilePreviewVariant.HORIZONTAL
|
112
|
-
? getHorizontalErrorState(dummyFile, this.errorMessage, this.originalUrl)
|
113
|
-
: getVerticalErrorState(dummyFile, this.errorMessage, this.originalUrl);
|
113
|
+
? getHorizontalErrorState(dummyFile, this.errorMessage, this.originalUrl, this)
|
114
|
+
: getVerticalErrorState(dummyFile, this.errorMessage, this.originalUrl, this);
|
114
115
|
this.requestUpdate();
|
115
116
|
}
|
116
117
|
}
|
@@ -141,8 +142,8 @@ export class NileFilePreview extends NileElement {
|
|
141
142
|
// : FilePreviewErrorMessages.UPLOAD_CANCEL;
|
142
143
|
|
143
144
|
this.inputFileHtml = isHorizontal
|
144
|
-
? getHorizontalErrorState(file, this.errorMessage, this.originalUrl)
|
145
|
-
: getVerticalErrorState(file, this.errorMessage, this.originalUrl);
|
145
|
+
? getHorizontalErrorState(file, this.errorMessage, this.originalUrl, this)
|
146
|
+
: getVerticalErrorState(file, this.errorMessage, this.originalUrl, this);
|
146
147
|
}
|
147
148
|
this.requestUpdate();
|
148
149
|
}
|
@@ -61,15 +61,12 @@ export const getFileType = (type: string): string => {
|
|
61
61
|
return type.split('/')[1].toUpperCase();
|
62
62
|
}
|
63
63
|
|
64
|
-
export const truncateString = (
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
export const fileUploadServerError = (nileFilePreview: NileFilePreview) => {
|
69
|
-
document.addEventListener('nile-network-error', (e: any) => {
|
70
|
-
console.log('working file preview');
|
71
|
-
|
72
|
-
nileFilePreview.errorMessage = FilePreviewErrorMessages.NETWORK_ERROR;
|
64
|
+
export const truncateString = (nileFilePreview: NileFilePreview): void => {
|
65
|
+
if(nileFilePreview.variant === 'vertical' && nileFilePreview.errorMessage.length > 34) {
|
66
|
+
nileFilePreview.isStringTruncated = true;
|
73
67
|
nileFilePreview.requestUpdate();
|
74
|
-
})
|
68
|
+
} else if(nileFilePreview.variant === 'horizontal' && nileFilePreview.errorMessage.length > 96) {
|
69
|
+
nileFilePreview.isStringTruncated = true;
|
70
|
+
nileFilePreview.requestUpdate();
|
71
|
+
}
|
75
72
|
}
|
@@ -3,6 +3,8 @@ import './nile-file-upload.css';
|
|
3
3
|
import { DragHandler } from './utils/drag-drop.util';
|
4
4
|
import { classMap } from 'lit-html/directives/class-map.js';
|
5
5
|
import { FileUploadDefaults, FileUploadState } from './types/file-upload.enums';
|
6
|
+
import { truncateString } from './utils/file-validation.util';
|
7
|
+
import { NileFileUpload } from './nile-file-upload';
|
6
8
|
|
7
9
|
const baseHorizontalState = (
|
8
10
|
browseFiles: Function,
|
@@ -12,8 +14,11 @@ const baseHorizontalState = (
|
|
12
14
|
dragHandler: DragHandler,
|
13
15
|
state: FileUploadState,
|
14
16
|
errorMessage: string,
|
15
|
-
allowedTypes: string[]
|
16
|
-
|
17
|
+
allowedTypes: string[],
|
18
|
+
nileFileUpload: NileFileUpload
|
19
|
+
): TemplateResult => {
|
20
|
+
truncateString(nileFileUpload);
|
21
|
+
return html`
|
17
22
|
<div class="wrapper" part="horizontal-wrapper">
|
18
23
|
<div part="horizontal-div" class=${classMap({ 'hover-border': state === "hover", 'horizontal-div': true, 'disable': disabled })}>
|
19
24
|
<div part="inner-div" class="inner-div">
|
@@ -41,14 +46,19 @@ const baseHorizontalState = (
|
|
41
46
|
${errorMessage ?
|
42
47
|
html`<div class="upload-error">
|
43
48
|
<nile-icon name="warning" size="12" color="var(--nile-colors-red-700)"></nile-icon>
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
${
|
50
|
+
nileFileUpload.isStringTruncated
|
51
|
+
? html`<nile-tooltip content=${errorMessage}>
|
52
|
+
<span>${errorMessage}</span>
|
53
|
+
</nile-tooltip>`
|
54
|
+
: html`<span>${errorMessage}</span>`
|
55
|
+
}
|
47
56
|
</div>` :
|
48
57
|
html``
|
49
58
|
}
|
50
59
|
</div>
|
51
|
-
`;
|
60
|
+
`;
|
61
|
+
}
|
52
62
|
|
53
63
|
export const getHorizontalDefaultState = (
|
54
64
|
browseFiles: Function,
|
@@ -57,8 +67,9 @@ export const getHorizontalDefaultState = (
|
|
57
67
|
dragHandler: DragHandler,
|
58
68
|
state: FileUploadState,
|
59
69
|
errorMessage: string,
|
60
|
-
allowedTypes: string[]
|
61
|
-
|
70
|
+
allowedTypes: string[],
|
71
|
+
nileFileUpload: NileFileUpload
|
72
|
+
): TemplateResult => baseHorizontalState(browseFiles, title, subtitle, false, dragHandler, state, errorMessage, allowedTypes, nileFileUpload);
|
62
73
|
|
63
74
|
export const getHorizontalDisabledState = (
|
64
75
|
browseFiles: Function,
|
@@ -67,8 +78,9 @@ export const getHorizontalDisabledState = (
|
|
67
78
|
dragHandler: DragHandler,
|
68
79
|
state: FileUploadState,
|
69
80
|
errorMessage: string,
|
70
|
-
allowedTypes: string[]
|
71
|
-
|
81
|
+
allowedTypes: string[],
|
82
|
+
nileFileUpload: NileFileUpload
|
83
|
+
): TemplateResult => baseHorizontalState(browseFiles, title, subtitle, true, dragHandler, state, errorMessage, allowedTypes, nileFileUpload);
|
72
84
|
|
73
85
|
export const getHorizontalDragState = (): TemplateResult => html`
|
74
86
|
<div part="horizontal-drag-state" class="horizontal-div dragging">
|
@@ -98,8 +110,11 @@ const baseVerticalState = (
|
|
98
110
|
disabled: boolean,
|
99
111
|
dragHandler: DragHandler,
|
100
112
|
errorMessage: string,
|
101
|
-
allowedTypes: string[]
|
102
|
-
|
113
|
+
allowedTypes: string[],
|
114
|
+
nileFileUpload: NileFileUpload
|
115
|
+
): TemplateResult => {
|
116
|
+
truncateString(nileFileUpload);
|
117
|
+
return html`
|
103
118
|
<div part="vertical-wrapper" class="wrapper">
|
104
119
|
<div part="vertical-default" class="vertical-default vertical-div ${disabled ? 'disable' : ''}">
|
105
120
|
<slot name="upload-icon">
|
@@ -132,7 +147,8 @@ const baseVerticalState = (
|
|
132
147
|
html``
|
133
148
|
}
|
134
149
|
</div>
|
135
|
-
`;
|
150
|
+
`;
|
151
|
+
}
|
136
152
|
|
137
153
|
export const getVerticalDefaultState = (
|
138
154
|
browseFiles: Function,
|
@@ -140,8 +156,9 @@ export const getVerticalDefaultState = (
|
|
140
156
|
subtitle: string,
|
141
157
|
dragHandler: DragHandler,
|
142
158
|
errorMessage: string,
|
143
|
-
allowedTypes: string[]
|
144
|
-
|
159
|
+
allowedTypes: string[],
|
160
|
+
nileFileUpload: NileFileUpload
|
161
|
+
): TemplateResult => baseVerticalState(browseFiles, title, subtitle, false, dragHandler, errorMessage, allowedTypes, nileFileUpload);
|
145
162
|
|
146
163
|
export const getVerticalDisabledState = (
|
147
164
|
browseFiles: Function,
|
@@ -149,8 +166,9 @@ export const getVerticalDisabledState = (
|
|
149
166
|
subtitle: string,
|
150
167
|
dragHandler: DragHandler,
|
151
168
|
errorMessage: string,
|
152
|
-
allowedTypes: string[]
|
153
|
-
|
169
|
+
allowedTypes: string[],
|
170
|
+
nileFileUpload: NileFileUpload
|
171
|
+
): TemplateResult => baseVerticalState(browseFiles, title, subtitle, true, dragHandler, errorMessage, allowedTypes, nileFileUpload);
|
154
172
|
|
155
173
|
|
156
174
|
export const getVerticalDragState = (): TemplateResult => html`
|
@@ -55,6 +55,7 @@ export class NileFileUpload extends NileElement {
|
|
55
55
|
@query('input') input!: HTMLInputElement;
|
56
56
|
public uploadRequests = new Map<File, XMLHttpRequest>();
|
57
57
|
public fileSizeExceededFilesNumber: number = 0;
|
58
|
+
public isStringTruncated: boolean = false;
|
58
59
|
|
59
60
|
private dragHandler!: DragHandler;
|
60
61
|
|
@@ -121,32 +122,32 @@ export class NileFileUpload extends NileElement {
|
|
121
122
|
private getHorizontalState(): TemplateResult {
|
122
123
|
switch(this.state) {
|
123
124
|
case FileUploadState.DEFAULT:
|
124
|
-
return getHorizontalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.state, this.errorMessage, this.allowedTypes);
|
125
|
+
return getHorizontalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.state, this.errorMessage, this.allowedTypes, this);
|
125
126
|
|
126
127
|
case FileUploadState.DISABLED:
|
127
|
-
return getHorizontalDisabledState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.state, this.errorMessage, this.allowedTypes);
|
128
|
+
return getHorizontalDisabledState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.state, this.errorMessage, this.allowedTypes, this);
|
128
129
|
|
129
130
|
case FileUploadState.DRAG:
|
130
131
|
return getHorizontalDragState();
|
131
132
|
|
132
133
|
default:
|
133
|
-
return getHorizontalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.state, this.errorMessage, this.allowedTypes);
|
134
|
+
return getHorizontalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.state, this.errorMessage, this.allowedTypes, this);
|
134
135
|
}
|
135
136
|
}
|
136
137
|
|
137
138
|
private getVerticalState(): TemplateResult {
|
138
139
|
switch(this.state) {
|
139
140
|
case FileUploadState.DEFAULT:
|
140
|
-
return getVerticalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.errorMessage, this.allowedTypes);
|
141
|
+
return getVerticalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.errorMessage, this.allowedTypes, this);
|
141
142
|
|
142
143
|
case FileUploadState.DISABLED:
|
143
|
-
return getVerticalDisabledState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.errorMessage, this.allowedTypes);
|
144
|
+
return getVerticalDisabledState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.errorMessage, this.allowedTypes, this);
|
144
145
|
|
145
146
|
case FileUploadState.DRAG:
|
146
147
|
return getVerticalDragState();
|
147
148
|
|
148
149
|
default:
|
149
|
-
return getVerticalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.errorMessage, this.allowedTypes);
|
150
|
+
return getVerticalDefaultState(this.browseFiles, this.title, this.subtitle, this.dragHandler, this.errorMessage, this.allowedTypes, this);
|
150
151
|
}
|
151
152
|
}
|
152
153
|
|
@@ -203,4 +203,16 @@ export const removeFile = (uploadedFiles: File[], nileFileUpload: NileFileUpload
|
|
203
203
|
nileFileUpload.uploadedFiles = uploadedFiles;
|
204
204
|
nileFileUpload.requestUpdate();
|
205
205
|
});
|
206
|
+
}
|
207
|
+
|
208
|
+
export const truncateString = (nileFileUpload: NileFileUpload): void => {
|
209
|
+
if(nileFileUpload.variant === 'vertical' && nileFileUpload.errorMessage.length > 34) {
|
210
|
+
nileFileUpload.isStringTruncated = true;
|
211
|
+
nileFileUpload.requestUpdate();
|
212
|
+
} else if(nileFileUpload.variant === 'horizontal' && nileFileUpload.errorMessage.length > 96) {
|
213
|
+
console.log('working');
|
214
|
+
|
215
|
+
nileFileUpload.isStringTruncated = true;
|
216
|
+
nileFileUpload.requestUpdate();
|
217
|
+
}
|
206
218
|
}
|
@@ -1395,7 +1395,7 @@
|
|
1395
1395
|
},
|
1396
1396
|
{
|
1397
1397
|
"name": "nile-file-preview",
|
1398
|
-
"description": "Nile preview component.\n\nAttributes:\n\n * `errorMessage` {`string`} - \n\n * `inputFile` {`File`} - \n\n * `fileUrl` {`string`} - \n\n * `uploadStatus` {`number`} - \n\n * `state` {`FilePreviewState`} - \n\n * `variant` {`FilePreviewVariant`} - \n\n * `inputFileName` {`string`} - \n\nProperties:\n\n * `errorMessage` {`string`} - \n\n * `inputFile` {`File`} - \n\n * `fileUrl` {`string`} - \n\n * `uploadStatus` {`number`} - \n\n * `state` {`FilePreviewState`} - \n\n * `variant` {`FilePreviewVariant`} - \n\n * `inputFileName` {`string`} - \n\n * `inputFileHtml` {`UncompiledTemplateResult<ResultType> | null`} - \n\n * `originalUrl` {`string`} - \n\n * `dummyFile` {`File`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
1398
|
+
"description": "Nile preview component.\n\nAttributes:\n\n * `errorMessage` {`string`} - \n\n * `inputFile` {`File`} - \n\n * `fileUrl` {`string`} - \n\n * `uploadStatus` {`number`} - \n\n * `state` {`FilePreviewState`} - \n\n * `variant` {`FilePreviewVariant`} - \n\n * `inputFileName` {`string`} - \n\nProperties:\n\n * `errorMessage` {`string`} - \n\n * `inputFile` {`File`} - \n\n * `fileUrl` {`string`} - \n\n * `uploadStatus` {`number`} - \n\n * `state` {`FilePreviewState`} - \n\n * `variant` {`FilePreviewVariant`} - \n\n * `inputFileName` {`string`} - \n\n * `inputFileHtml` {`UncompiledTemplateResult<ResultType> | null`} - \n\n * `originalUrl` {`string`} - \n\n * `isStringTruncated` {`boolean`} - \n\n * `dummyFile` {`File`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
1399
1399
|
"attributes": [
|
1400
1400
|
{
|
1401
1401
|
"name": "errorMessage",
|
@@ -1454,7 +1454,7 @@
|
|
1454
1454
|
},
|
1455
1455
|
{
|
1456
1456
|
"name": "nile-file-upload",
|
1457
|
-
"description": "Nile file-upload component.\n\nAttributes:\n\n * `size` {`string`} - \n\n * `error` {`boolean`} - \n\n * `errorMessage` {`string`} - \n\n * `allowMultiple` {`boolean`} - \n\n * `allowDuplicates` {`boolean`} - \n\n * `allowedTypes` {`string[]`} - \n\n * `uploadedFiles` {`File[]`} - \n\n * `title` {`string`} - \n\n * `subtitle` {`string`} - \n\n * `state` {`FileUploadState`} - \n\n * `variant` {`FileUploadVariant`} - \n\n * `fileUploadUrl` {`string`} - \n\n * `autoUpload` {`boolean`} - \n\nProperties:\n\n * `size` {`string`} - \n\n * `error` {`boolean`} - \n\n * `errorMessage` {`string`} - \n\n * `allowMultiple` {`boolean`} - \n\n * `allowDuplicates` {`boolean`} - \n\n * `allowedTypes` {`string[]`} - \n\n * `uploadedFiles` {`File[]`} - \n\n * `title` {`string`} - \n\n * `subtitle` {`string`} - \n\n * `state` {`FileUploadState`} - \n\n * `variant` {`FileUploadVariant`} - \n\n * `fileUploadUrl` {`string`} - \n\n * `autoUpload` {`boolean`} - \n\n * `input` {`HTMLInputElement`} - \n\n * `uploadRequests` {`Map<File, XMLHttpRequest>`} - \n\n * `fileSizeExceededFilesNumber` {`number`} - \n\n * `dragHandler` - \n\n * `setState` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
1457
|
+
"description": "Nile file-upload component.\n\nAttributes:\n\n * `size` {`string`} - \n\n * `error` {`boolean`} - \n\n * `errorMessage` {`string`} - \n\n * `allowMultiple` {`boolean`} - \n\n * `allowDuplicates` {`boolean`} - \n\n * `allowedTypes` {`string[]`} - \n\n * `uploadedFiles` {`File[]`} - \n\n * `title` {`string`} - \n\n * `subtitle` {`string`} - \n\n * `state` {`FileUploadState`} - \n\n * `variant` {`FileUploadVariant`} - \n\n * `fileUploadUrl` {`string`} - \n\n * `autoUpload` {`boolean`} - \n\nProperties:\n\n * `size` {`string`} - \n\n * `error` {`boolean`} - \n\n * `errorMessage` {`string`} - \n\n * `allowMultiple` {`boolean`} - \n\n * `allowDuplicates` {`boolean`} - \n\n * `allowedTypes` {`string[]`} - \n\n * `uploadedFiles` {`File[]`} - \n\n * `title` {`string`} - \n\n * `subtitle` {`string`} - \n\n * `state` {`FileUploadState`} - \n\n * `variant` {`FileUploadVariant`} - \n\n * `fileUploadUrl` {`string`} - \n\n * `autoUpload` {`boolean`} - \n\n * `input` {`HTMLInputElement`} - \n\n * `uploadRequests` {`Map<File, XMLHttpRequest>`} - \n\n * `fileSizeExceededFilesNumber` {`number`} - \n\n * `isStringTruncated` {`boolean`} - \n\n * `dragHandler` - \n\n * `setState` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
1458
1458
|
"attributes": [
|
1459
1459
|
{
|
1460
1460
|
"name": "size",
|