@breadstone/mosaik-elements-foundation 0.0.268 → 0.0.270
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/Controls/Components/Forms/FormFieldElementTemplate.d.ts.map +1 -1
- package/Controls/Components/Forms/FormFieldElementTemplate.js +6 -3
- package/Controls/Components/Forms/FormFieldElementTemplate.js.map +1 -1
- package/Controls/Components/Inputs/Calendar/CalendarElement.d.ts +2 -2
- package/Controls/Components/Inputs/Calendar/CalendarElement.js +2 -2
- package/Controls/Components/Inputs/DateTimeBox/DateTimeBoxElement.d.ts +9 -2
- package/Controls/Components/Inputs/DateTimeBox/DateTimeBoxElement.d.ts.map +1 -1
- package/Controls/Components/Inputs/DateTimeBox/DateTimeBoxElement.js +9 -2
- package/Controls/Components/Inputs/DateTimeBox/DateTimeBoxElement.js.map +1 -1
- package/Controls/Components/Inputs/FileBox/Accessors/FileBoxElementValueAccessor.d.ts +29 -0
- package/Controls/Components/Inputs/FileBox/Accessors/FileBoxElementValueAccessor.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/Accessors/FileBoxElementValueAccessor.js +44 -0
- package/Controls/Components/Inputs/FileBox/Accessors/FileBoxElementValueAccessor.js.map +1 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElement.d.ts +301 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElement.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElement.js +577 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElement.js.map +1 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElementTemplate.d.ts +9 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElementTemplate.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElementTemplate.js +80 -0
- package/Controls/Components/Inputs/FileBox/FileBoxElementTemplate.js.map +1 -0
- package/Controls/Components/Inputs/FileBox/IFileBoxElementProps.d.ts +25 -0
- package/Controls/Components/Inputs/FileBox/IFileBoxElementProps.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/IFileBoxElementProps.js +3 -0
- package/Controls/Components/Inputs/FileBox/IFileBoxElementProps.js.map +1 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Cosmopolitan.d.ts +6 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Cosmopolitan.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Cosmopolitan.js +222 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Cosmopolitan.js.map +1 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Joy.d.ts +6 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Joy.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Joy.js +407 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Joy.js.map +1 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Memphis.d.ts +6 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Memphis.d.ts.map +1 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Memphis.js +231 -0
- package/Controls/Components/Inputs/FileBox/Themes/FileBoxElement.Memphis.js.map +1 -0
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Cosmopolitan.d.ts.map +1 -1
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Cosmopolitan.js +1 -0
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Cosmopolitan.js.map +1 -1
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Joy.d.ts.map +1 -1
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Joy.js +1 -0
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Joy.js.map +1 -1
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Memphis.d.ts.map +1 -1
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Memphis.js +1 -0
- package/Controls/Components/Inputs/FileUpload/Themes/FilePickerElement.Memphis.js.map +1 -1
- package/Controls/Components/Layouts/Page/PageHeaderElement.d.ts +3 -0
- package/Controls/Components/Layouts/Page/PageHeaderElement.d.ts.map +1 -1
- package/Controls/Components/Layouts/Page/PageHeaderElement.js +3 -0
- package/Controls/Components/Layouts/Page/PageHeaderElement.js.map +1 -1
- package/Controls/Components/Layouts/TileManager/TileManagerTileElement.d.ts +3 -3
- package/Controls/Components/Layouts/TileManager/TileManagerTileElement.js +3 -3
- package/Controls/Components/Overlays/MessageBox/MessageBoxElement.d.ts +6 -6
- package/Controls/Components/Overlays/MessageBox/MessageBoxElement.js +6 -6
- package/Controls/events/FileEvents.d.ts +18 -0
- package/Controls/events/FileEvents.d.ts.map +1 -1
- package/Controls/events/index.d.ts +1 -1
- package/Controls/events/index.d.ts.map +1 -1
- package/Index.d.ts +2 -0
- package/Index.d.ts.map +1 -1
- package/Index.js +2 -0
- package/Index.js.map +1 -1
- package/Resources/Icons.js +1 -0
- package/Resources/Icons.js.map +1 -1
- package/custom-elements.json +1329 -52
- package/package.json +3 -3
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
import { HTMLElementEventEmitter } from '@breadstone/mosaik-elements';
|
|
12
|
+
import { DomServiceLocator } from '../../../../Dom/Dom';
|
|
13
|
+
import { Emit } from '../../../../events/Decorators/EmitDecorator';
|
|
14
|
+
import { Appearanceable } from '../../../Behaviors/Appearanceable';
|
|
15
|
+
import { Clearable } from '../../../Behaviors/Clearable';
|
|
16
|
+
import { Disableable } from '../../../Behaviors/Disableable';
|
|
17
|
+
import { Invalidable } from '../../../Behaviors/Invalidable';
|
|
18
|
+
import { Labelable } from '../../../Behaviors/Labelable';
|
|
19
|
+
import { Slottable } from '../../../Behaviors/Slottable';
|
|
20
|
+
import { Themeable } from '../../../Behaviors/Themeable';
|
|
21
|
+
import { Valueable } from '../../../Behaviors/Valueable';
|
|
22
|
+
import { Variantable } from '../../../Behaviors/Variantable';
|
|
23
|
+
import { Attribute } from '../../../Decorators/AttributeDecorator';
|
|
24
|
+
import { Component } from '../../../Decorators/ComponentDecorator';
|
|
25
|
+
import { Property } from '../../../Decorators/PropertyDecorator';
|
|
26
|
+
import { ButtonElement } from '../../Buttons/Button/ButtonElement';
|
|
27
|
+
import { FocusRingElement } from '../../Primitives/FocusRing/FocusRingElement';
|
|
28
|
+
import { InputBaseElement } from '../Abstracts/InputBase';
|
|
29
|
+
import { fileBoxElementTemplate } from './FileBoxElementTemplate';
|
|
30
|
+
import { fileBoxElementCosmopolitanStyle } from './Themes/FileBoxElement.Cosmopolitan';
|
|
31
|
+
import { fileBoxElementJoyStyle } from './Themes/FileBoxElement.Joy';
|
|
32
|
+
import { fileBoxElementMemphisStyle } from './Themes/FileBoxElement.Memphis';
|
|
33
|
+
// #endregion
|
|
34
|
+
/**
|
|
35
|
+
* File Box - A text-box-styled file input control with a trailing browse button.
|
|
36
|
+
*
|
|
37
|
+
* @description
|
|
38
|
+
* The File Box component provides a familiar text-box appearance for file selection.
|
|
39
|
+
* It displays the selected file name(s) in a readonly text input and offers a trailing
|
|
40
|
+
* browse button to open the native file picker dialog. Supports single and multiple file
|
|
41
|
+
* selection, directory selection, file type filtering via accept attribute, clearable state,
|
|
42
|
+
* and form integration through value accessors. Bridges the gap between the primitive
|
|
43
|
+
* FilePicker and the complex FileUpload component.
|
|
44
|
+
*
|
|
45
|
+
* @name File Box
|
|
46
|
+
* @element mosaik-filebox
|
|
47
|
+
* @category Inputs
|
|
48
|
+
*
|
|
49
|
+
* @slot prefix - Content placed before the input field.
|
|
50
|
+
* @slot suffix - Content placed after the input field.
|
|
51
|
+
*
|
|
52
|
+
* @csspart browse - The browse button.
|
|
53
|
+
* @csspart clear - The clear button.
|
|
54
|
+
* @csspart fileInput - The fileInput part.
|
|
55
|
+
* @csspart focusRing - The focus ring indicator.
|
|
56
|
+
* @csspart inner - The inner container wrapper.
|
|
57
|
+
* @csspart input - The readonly text input showing file names.
|
|
58
|
+
* @csspart label - The floating label element.
|
|
59
|
+
* @csspart prefix - The prefix content container.
|
|
60
|
+
* @csspart suffix - The suffix content container.
|
|
61
|
+
*
|
|
62
|
+
* @cssprop {String} --file-box-background-color - The box background color CSS custom property.
|
|
63
|
+
* @cssprop {String} --file-box-border-color - The box border color CSS custom property.
|
|
64
|
+
* @cssprop {String} --file-box-border-radius - The box border radius CSS custom property.
|
|
65
|
+
* @cssprop {String} --file-box-border-style - The box border style CSS custom property.
|
|
66
|
+
* @cssprop {String} --file-box-border-width - The box border width CSS custom property.
|
|
67
|
+
* @cssprop {String} --file-box-focus-ring-width - The box focus ring width CSS custom property.
|
|
68
|
+
* @cssprop {String} --file-box-font-family - The box font family CSS custom property.
|
|
69
|
+
* @cssprop {String} --file-box-font-letter-spacing - The box font letter spacing CSS custom property.
|
|
70
|
+
* @cssprop {String} --file-box-font-line-height - The box font line height CSS custom property.
|
|
71
|
+
* @cssprop {String} --file-box-font-size - The box font size CSS custom property.
|
|
72
|
+
* @cssprop {String} --file-box-font-text-decoration - The box font text decoration CSS custom property.
|
|
73
|
+
* @cssprop {String} --file-box-font-text-transform - The box font text transform CSS custom property.
|
|
74
|
+
* @cssprop {String} --file-box-font-weight - The box font weight CSS custom property.
|
|
75
|
+
* @cssprop {String} --file-box-foreground-color - The box foreground color CSS custom property.
|
|
76
|
+
* @cssprop {String} --file-box-gap - The box gap CSS custom property.
|
|
77
|
+
* @cssprop {String} --file-box-height - The box height CSS custom property.
|
|
78
|
+
* @cssprop {String} --file-box-padding-bottom - The box padding bottom CSS custom property.
|
|
79
|
+
* @cssprop {String} --file-box-padding-left - The box padding left CSS custom property.
|
|
80
|
+
* @cssprop {String} --file-box-padding-right - The box padding right CSS custom property.
|
|
81
|
+
* @cssprop {String} --file-box-padding-top - The box padding top CSS custom property.
|
|
82
|
+
* @cssprop {String} --file-box-shadow - The box shadow CSS custom property.
|
|
83
|
+
* @cssprop {String} --file-box-shadow-blur - The box shadow blur CSS custom property.
|
|
84
|
+
* @cssprop {String} --file-box-shadow-color - The box shadow color CSS custom property.
|
|
85
|
+
* @cssprop {String} --file-box-shadow-offset-x - The box shadow offset x CSS custom property.
|
|
86
|
+
* @cssprop {String} --file-box-shadow-offset-y - The box shadow offset y CSS custom property.
|
|
87
|
+
* @cssprop {String} --file-box-shadow-spread - The box shadow spread CSS custom property.
|
|
88
|
+
* @cssprop {String} --file-box-transition-duration - The box transition duration CSS custom property.
|
|
89
|
+
* @cssprop {String} --file-box-transition-mode - The box transition mode CSS custom property.
|
|
90
|
+
* @cssprop {String} --file-box-transition-property - The box transition property CSS custom property.
|
|
91
|
+
* @cssprop {String} --file-box-translate - The box translate CSS custom property.
|
|
92
|
+
*
|
|
93
|
+
* @fires cleared {ClearedEvent} - Fired when the file selection is cleared.
|
|
94
|
+
* @fires filesSelected {FilesSelectedEvent} - Fired when files are selected.
|
|
95
|
+
*
|
|
96
|
+
* @dependency mosaik-button - Used for the browse button.
|
|
97
|
+
* @dependency mosaik-focus-ring - Used for focus indication.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```html
|
|
101
|
+
* <mosaik-filebox
|
|
102
|
+
* placeholder="Choose a file..."
|
|
103
|
+
* accept=".pdf,.doc,.docx">
|
|
104
|
+
* </mosaik-filebox>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
let FileBoxElement = class FileBoxElement extends Themeable(Slottable(Clearable(Disableable(Invalidable(Valueable(Variantable(Labelable(Appearanceable(InputBaseElement))))))))) {
|
|
110
|
+
// #region Fields
|
|
111
|
+
_filesSelected;
|
|
112
|
+
_fileInputElement;
|
|
113
|
+
_value;
|
|
114
|
+
_readonly;
|
|
115
|
+
_required;
|
|
116
|
+
_autofocus;
|
|
117
|
+
_name;
|
|
118
|
+
_placeholder;
|
|
119
|
+
_multiple;
|
|
120
|
+
_accept;
|
|
121
|
+
_directory;
|
|
122
|
+
_files;
|
|
123
|
+
// #endregion
|
|
124
|
+
// #region Ctor
|
|
125
|
+
/**
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
constructor() {
|
|
129
|
+
super();
|
|
130
|
+
this._value = '';
|
|
131
|
+
this._readonly = false;
|
|
132
|
+
this._required = false;
|
|
133
|
+
this._autofocus = false;
|
|
134
|
+
this._name = '';
|
|
135
|
+
this._placeholder = '';
|
|
136
|
+
this._multiple = false;
|
|
137
|
+
this._accept = [];
|
|
138
|
+
this._directory = false;
|
|
139
|
+
this._files = [];
|
|
140
|
+
this._filesSelected = new HTMLElementEventEmitter(this, 'filesSelected');
|
|
141
|
+
}
|
|
142
|
+
// #endregion
|
|
143
|
+
// #region Properties
|
|
144
|
+
/**
|
|
145
|
+
* Returns the `is` property.
|
|
146
|
+
* The `is` property represents natural name of this element.
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
149
|
+
* @static
|
|
150
|
+
* @readonly
|
|
151
|
+
*/
|
|
152
|
+
static get is() {
|
|
153
|
+
return 'mosaik-filebox';
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets or sets the `value` property.
|
|
157
|
+
* The value represents the display text of the selected file(s).
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
* @override
|
|
161
|
+
*/
|
|
162
|
+
get value() {
|
|
163
|
+
return this._value;
|
|
164
|
+
}
|
|
165
|
+
set value(value) {
|
|
166
|
+
if (this._value !== value) {
|
|
167
|
+
this._value = value;
|
|
168
|
+
this.requestUpdate('value');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Gets or sets the `readonly` property.
|
|
173
|
+
*
|
|
174
|
+
* @public
|
|
175
|
+
* @attr
|
|
176
|
+
*/
|
|
177
|
+
get readonly() {
|
|
178
|
+
return this._readonly;
|
|
179
|
+
}
|
|
180
|
+
set readonly(value) {
|
|
181
|
+
if (this._readonly !== value) {
|
|
182
|
+
this._readonly = value;
|
|
183
|
+
this.requestUpdate('readonly');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Gets or sets the `required` property.
|
|
188
|
+
*
|
|
189
|
+
* @public
|
|
190
|
+
* @attr
|
|
191
|
+
*/
|
|
192
|
+
get required() {
|
|
193
|
+
return this._required;
|
|
194
|
+
}
|
|
195
|
+
set required(value) {
|
|
196
|
+
if (this._required !== value) {
|
|
197
|
+
this._required = value;
|
|
198
|
+
this.requestUpdate('required');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Gets or sets the `autofocus` property.
|
|
203
|
+
*
|
|
204
|
+
* @public
|
|
205
|
+
* @override
|
|
206
|
+
*/
|
|
207
|
+
get autofocus() {
|
|
208
|
+
return this._autofocus;
|
|
209
|
+
}
|
|
210
|
+
set autofocus(value) {
|
|
211
|
+
if (this._autofocus !== value) {
|
|
212
|
+
this._autofocus = value;
|
|
213
|
+
this.requestUpdate('autofocus');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Gets or sets the `name` property.
|
|
218
|
+
*
|
|
219
|
+
* @public
|
|
220
|
+
* @attr
|
|
221
|
+
*/
|
|
222
|
+
get name() {
|
|
223
|
+
return this._name;
|
|
224
|
+
}
|
|
225
|
+
set name(value) {
|
|
226
|
+
if (this._name !== value) {
|
|
227
|
+
this._name = value;
|
|
228
|
+
this.requestUpdate('name');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Gets or sets the `placeholder` property.
|
|
233
|
+
*
|
|
234
|
+
* @public
|
|
235
|
+
* @attr
|
|
236
|
+
*/
|
|
237
|
+
get placeholder() {
|
|
238
|
+
return this._placeholder;
|
|
239
|
+
}
|
|
240
|
+
set placeholder(value) {
|
|
241
|
+
if (this._placeholder !== value) {
|
|
242
|
+
this._placeholder = value;
|
|
243
|
+
this.requestUpdate('placeholder');
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Gets or sets the `multiple` property.
|
|
248
|
+
* When true, allows selecting multiple files.
|
|
249
|
+
*
|
|
250
|
+
* @public
|
|
251
|
+
* @attr
|
|
252
|
+
*/
|
|
253
|
+
get multiple() {
|
|
254
|
+
return this._multiple;
|
|
255
|
+
}
|
|
256
|
+
set multiple(value) {
|
|
257
|
+
if (this._multiple !== value) {
|
|
258
|
+
this._multiple = value;
|
|
259
|
+
this.requestUpdate('multiple');
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Gets or sets the `accept` property.
|
|
264
|
+
* Specifies the file types that the file input should accept.
|
|
265
|
+
*
|
|
266
|
+
* @public
|
|
267
|
+
* @attr
|
|
268
|
+
*/
|
|
269
|
+
get accept() {
|
|
270
|
+
return this._accept;
|
|
271
|
+
}
|
|
272
|
+
set accept(value) {
|
|
273
|
+
if (this._accept !== value) {
|
|
274
|
+
this._accept = value;
|
|
275
|
+
this.requestUpdate('accept');
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Gets or sets the `directory` property.
|
|
280
|
+
* When true, allows selecting directories instead of files.
|
|
281
|
+
*
|
|
282
|
+
* @public
|
|
283
|
+
* @attr
|
|
284
|
+
*/
|
|
285
|
+
get directory() {
|
|
286
|
+
return this._directory;
|
|
287
|
+
}
|
|
288
|
+
set directory(value) {
|
|
289
|
+
if (this._directory !== value) {
|
|
290
|
+
this._directory = value;
|
|
291
|
+
this.requestUpdate('directory');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Gets or sets the selected files.
|
|
296
|
+
*
|
|
297
|
+
* @public
|
|
298
|
+
* @readonly
|
|
299
|
+
*/
|
|
300
|
+
get files() {
|
|
301
|
+
return this._files;
|
|
302
|
+
}
|
|
303
|
+
set files(value) {
|
|
304
|
+
if (this._files !== value) {
|
|
305
|
+
this._files = value;
|
|
306
|
+
this.requestUpdate('files');
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Determines whether the element has a prefix or not.
|
|
311
|
+
*
|
|
312
|
+
* @private
|
|
313
|
+
* @readonly
|
|
314
|
+
* @attr
|
|
315
|
+
*/
|
|
316
|
+
get hasPrefix() {
|
|
317
|
+
return this.hasSlotContent('prefix');
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Determines whether the element has a suffix or not.
|
|
321
|
+
*
|
|
322
|
+
* @private
|
|
323
|
+
* @readonly
|
|
324
|
+
* @attr
|
|
325
|
+
*/
|
|
326
|
+
get hasSuffix() {
|
|
327
|
+
return this.hasSlotContent('suffix');
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Called when files are selected.
|
|
331
|
+
* Provides reference to `IFilesSelectedEventDetail` as event detail.
|
|
332
|
+
*
|
|
333
|
+
* @public
|
|
334
|
+
* @readonly
|
|
335
|
+
* @eventProperty
|
|
336
|
+
*/
|
|
337
|
+
get filesSelected() {
|
|
338
|
+
return this._filesSelected;
|
|
339
|
+
}
|
|
340
|
+
// #endregion
|
|
341
|
+
// #region Methods
|
|
342
|
+
/**
|
|
343
|
+
* @public
|
|
344
|
+
* @override
|
|
345
|
+
*/
|
|
346
|
+
focus() {
|
|
347
|
+
if (this.shadowRoot) {
|
|
348
|
+
DomServiceLocator.current.findDescendant(this.shadowRoot, 'input')?.focus();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @public
|
|
353
|
+
* @override
|
|
354
|
+
*/
|
|
355
|
+
blur() {
|
|
356
|
+
if (this.shadowRoot) {
|
|
357
|
+
DomServiceLocator.current.findDescendant(this.shadowRoot, 'input')?.blur();
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Opens the native file picker dialog.
|
|
362
|
+
*
|
|
363
|
+
* @public
|
|
364
|
+
*/
|
|
365
|
+
browse() {
|
|
366
|
+
if (!this.disabled && !this.readonly) {
|
|
367
|
+
this._fileInputElement.click();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Clears the selected files and value.
|
|
372
|
+
*
|
|
373
|
+
* @public
|
|
374
|
+
* @override
|
|
375
|
+
*/
|
|
376
|
+
clear(force) {
|
|
377
|
+
const isCleared = super.clear(force);
|
|
378
|
+
if (isCleared) {
|
|
379
|
+
this._files = [];
|
|
380
|
+
this._fileInputElement.value = '';
|
|
381
|
+
this.emit('change', {
|
|
382
|
+
bubbles: true,
|
|
383
|
+
composed: true
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
return isCleared;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Resets the value, all kinds of validation and errors.
|
|
390
|
+
*
|
|
391
|
+
* @public
|
|
392
|
+
* @override
|
|
393
|
+
*/
|
|
394
|
+
reset() {
|
|
395
|
+
super.reset();
|
|
396
|
+
this.clear();
|
|
397
|
+
this.invalid = false;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Checks the validity of the element.
|
|
401
|
+
*
|
|
402
|
+
* @public
|
|
403
|
+
* @override
|
|
404
|
+
*/
|
|
405
|
+
checkValidity() {
|
|
406
|
+
if (this.required && this._files.length === 0) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Handles file input change events.
|
|
413
|
+
*
|
|
414
|
+
* @public
|
|
415
|
+
*/
|
|
416
|
+
onFileChange(event) {
|
|
417
|
+
const input = event.target;
|
|
418
|
+
const fileList = input.files;
|
|
419
|
+
if (fileList && fileList.length > 0) {
|
|
420
|
+
const selectedFiles = Array.from(fileList);
|
|
421
|
+
this._files = selectedFiles;
|
|
422
|
+
this.value = selectedFiles.map((file) => file.name).join(', ');
|
|
423
|
+
this.onFilesSelected({ files: selectedFiles });
|
|
424
|
+
this.emit('change', {
|
|
425
|
+
bubbles: true,
|
|
426
|
+
composed: true
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
// Reset file input to allow re-selecting the same file
|
|
430
|
+
input.value = '';
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* @template
|
|
434
|
+
* @protected
|
|
435
|
+
* @override
|
|
436
|
+
*/
|
|
437
|
+
onFocus(event) {
|
|
438
|
+
super.onFocus(event);
|
|
439
|
+
this.emit('focus', { detail: event });
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* @template
|
|
443
|
+
* @protected
|
|
444
|
+
* @override
|
|
445
|
+
*/
|
|
446
|
+
onBlur(event) {
|
|
447
|
+
super.onBlur(event);
|
|
448
|
+
this.emit('blur', { detail: event });
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* @protected
|
|
452
|
+
* @override
|
|
453
|
+
*/
|
|
454
|
+
onApplyTemplate() {
|
|
455
|
+
super.onApplyTemplate();
|
|
456
|
+
this._fileInputElement = this.getTemplatePart('fileInput');
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Emits the `filesSelected` event.
|
|
460
|
+
*
|
|
461
|
+
* @protected
|
|
462
|
+
*/
|
|
463
|
+
onFilesSelected(args) {
|
|
464
|
+
this._filesSelected.emit(args);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
__decorate([
|
|
468
|
+
Attribute({ type: String }),
|
|
469
|
+
__metadata("design:type", String),
|
|
470
|
+
__metadata("design:paramtypes", [String])
|
|
471
|
+
], FileBoxElement.prototype, "value", null);
|
|
472
|
+
__decorate([
|
|
473
|
+
Attribute({
|
|
474
|
+
type: Boolean,
|
|
475
|
+
useDefault: true
|
|
476
|
+
}),
|
|
477
|
+
__metadata("design:type", Boolean),
|
|
478
|
+
__metadata("design:paramtypes", [Boolean])
|
|
479
|
+
], FileBoxElement.prototype, "readonly", null);
|
|
480
|
+
__decorate([
|
|
481
|
+
Attribute({
|
|
482
|
+
type: Boolean,
|
|
483
|
+
useDefault: true
|
|
484
|
+
}),
|
|
485
|
+
__metadata("design:type", Boolean),
|
|
486
|
+
__metadata("design:paramtypes", [Boolean])
|
|
487
|
+
], FileBoxElement.prototype, "required", null);
|
|
488
|
+
__decorate([
|
|
489
|
+
Attribute({
|
|
490
|
+
type: Boolean,
|
|
491
|
+
useDefault: true
|
|
492
|
+
}),
|
|
493
|
+
__metadata("design:type", Boolean),
|
|
494
|
+
__metadata("design:paramtypes", [Boolean])
|
|
495
|
+
], FileBoxElement.prototype, "autofocus", null);
|
|
496
|
+
__decorate([
|
|
497
|
+
Attribute({ type: String }),
|
|
498
|
+
__metadata("design:type", String),
|
|
499
|
+
__metadata("design:paramtypes", [String])
|
|
500
|
+
], FileBoxElement.prototype, "name", null);
|
|
501
|
+
__decorate([
|
|
502
|
+
Attribute({ type: String }),
|
|
503
|
+
__metadata("design:type", String),
|
|
504
|
+
__metadata("design:paramtypes", [String])
|
|
505
|
+
], FileBoxElement.prototype, "placeholder", null);
|
|
506
|
+
__decorate([
|
|
507
|
+
Attribute({
|
|
508
|
+
type: Boolean,
|
|
509
|
+
useDefault: true
|
|
510
|
+
}),
|
|
511
|
+
__metadata("design:type", Boolean),
|
|
512
|
+
__metadata("design:paramtypes", [Boolean])
|
|
513
|
+
], FileBoxElement.prototype, "multiple", null);
|
|
514
|
+
__decorate([
|
|
515
|
+
Property({ type: Array }),
|
|
516
|
+
__metadata("design:type", Array),
|
|
517
|
+
__metadata("design:paramtypes", [Array])
|
|
518
|
+
], FileBoxElement.prototype, "accept", null);
|
|
519
|
+
__decorate([
|
|
520
|
+
Attribute({
|
|
521
|
+
type: Boolean,
|
|
522
|
+
useDefault: true
|
|
523
|
+
}),
|
|
524
|
+
__metadata("design:type", Boolean),
|
|
525
|
+
__metadata("design:paramtypes", [Boolean])
|
|
526
|
+
], FileBoxElement.prototype, "directory", null);
|
|
527
|
+
__decorate([
|
|
528
|
+
Property({ type: Array }),
|
|
529
|
+
__metadata("design:type", Array),
|
|
530
|
+
__metadata("design:paramtypes", [Array])
|
|
531
|
+
], FileBoxElement.prototype, "files", null);
|
|
532
|
+
__decorate([
|
|
533
|
+
Attribute({
|
|
534
|
+
type: Boolean,
|
|
535
|
+
useDefault: true
|
|
536
|
+
}),
|
|
537
|
+
__metadata("design:type", Boolean),
|
|
538
|
+
__metadata("design:paramtypes", [])
|
|
539
|
+
], FileBoxElement.prototype, "hasPrefix", null);
|
|
540
|
+
__decorate([
|
|
541
|
+
Attribute({
|
|
542
|
+
type: Boolean,
|
|
543
|
+
useDefault: true
|
|
544
|
+
}),
|
|
545
|
+
__metadata("design:type", Boolean),
|
|
546
|
+
__metadata("design:paramtypes", [])
|
|
547
|
+
], FileBoxElement.prototype, "hasSuffix", null);
|
|
548
|
+
__decorate([
|
|
549
|
+
Emit({ eventName: 'filesSelected' }),
|
|
550
|
+
__metadata("design:type", Object),
|
|
551
|
+
__metadata("design:paramtypes", [])
|
|
552
|
+
], FileBoxElement.prototype, "filesSelected", null);
|
|
553
|
+
FileBoxElement = __decorate([
|
|
554
|
+
Component({
|
|
555
|
+
selector: 'mosaik-filebox',
|
|
556
|
+
template: fileBoxElementTemplate,
|
|
557
|
+
themes: {
|
|
558
|
+
joy: fileBoxElementJoyStyle,
|
|
559
|
+
memphis: fileBoxElementMemphisStyle,
|
|
560
|
+
cosmopolitan: fileBoxElementCosmopolitanStyle
|
|
561
|
+
},
|
|
562
|
+
host: {
|
|
563
|
+
tabIndex: '0'
|
|
564
|
+
},
|
|
565
|
+
options: {
|
|
566
|
+
mode: 'open',
|
|
567
|
+
delegatesFocus: true
|
|
568
|
+
},
|
|
569
|
+
imports: [
|
|
570
|
+
FocusRingElement,
|
|
571
|
+
ButtonElement
|
|
572
|
+
]
|
|
573
|
+
}),
|
|
574
|
+
__metadata("design:paramtypes", [])
|
|
575
|
+
], FileBoxElement);
|
|
576
|
+
export { FileBoxElement };
|
|
577
|
+
//# sourceMappingURL=FileBoxElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileBoxElement.js","sourceRoot":"","sources":["../../../../../src/Controls/Components/Inputs/FileBox/FileBoxElement.ts"],"names":[],"mappings":"AAAA,kBAAkB;;;;;;;;;;AAElB,OAAO,EAAE,uBAAuB,EAAiB,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAc,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAqB,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAc,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAA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EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;;;mDAGpC;AAhSQ,cAAc;IApB1B,SAAS,CAAC;QACP,QAAQ,EAAE,gBAAgB;QAC1B,QAAQ,EAAE,sBAAsB;QAChC,MAAM,EAAE;YACJ,GAAG,EAAE,sBAAsB;YAC3B,OAAO,EAAE,0BAA0B;YACnC,YAAY,EAAE,+BAA+B;SAChD;QACD,IAAI,EAAE;YACF,QAAQ,EAAE,GAAG;SAChB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,cAAc,EAAE,IAAI;SACvB;QACD,OAAO,EAAE;YACL,gBAAgB;YAChB,aAAa;SAChB;KACJ,CAAC;;GACW,cAAc,CA0b1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type TemplateResult } from '../../../../Dom/Html';
|
|
2
|
+
import type { FileBoxElement } from './FileBoxElement';
|
|
3
|
+
/**
|
|
4
|
+
* The template of the `FileBoxElement`.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare function fileBoxElementTemplate<T extends FileBoxElement>(e: T): TemplateResult;
|
|
9
|
+
//# sourceMappingURL=FileBoxElementTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileBoxElementTemplate.d.ts","sourceRoot":"","sources":["../../../../../src/Controls/Components/Inputs/FileBox/FileBoxElementTemplate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,sBAAsB,CAAC;AAQjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,cAAc,EAAE,CAAC,EAAE,CAAC,GAAG,cAAc,CAgErF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// #region Imports
|
|
2
|
+
import { html } from '../../../../Dom/Html';
|
|
3
|
+
import { Icons } from '../../../../Resources/Icons';
|
|
4
|
+
import { classMap, when } from '../../../Directives/Directives';
|
|
5
|
+
import { ifNonEmpty } from '../../../Directives/IfNonEmpty';
|
|
6
|
+
import { Appearance } from '../../../Types/Appearance';
|
|
7
|
+
import { Size } from '../../../Types/Size';
|
|
8
|
+
import { Variant } from '../../../Types/Variant';
|
|
9
|
+
// #endregion
|
|
10
|
+
/**
|
|
11
|
+
* The template of the `FileBoxElement`.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export function fileBoxElementTemplate(e) {
|
|
16
|
+
return html `
|
|
17
|
+
${when(!e.disabled, () => html `
|
|
18
|
+
<mosaik-focus-ring part="focusRing"
|
|
19
|
+
.variant="${e.invalid ? Variant.Danger : e.variant}"
|
|
20
|
+
.visible="${e.isFocused}"
|
|
21
|
+
.controlled="${'manual'}"
|
|
22
|
+
@connected="${(evt) => evt.target.attach(e)}"></mosaik-focus-ring>
|
|
23
|
+
`)}
|
|
24
|
+
<div part="prefix"
|
|
25
|
+
?hidden="${!e.hasSlotContent('prefix')}">
|
|
26
|
+
<slot name="prefix"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
<div part="inner"
|
|
29
|
+
class="${classMap({ prefix: e.hasPrefix, suffix: e.hasSuffix })}">
|
|
30
|
+
${when(e.label, () => html `
|
|
31
|
+
<label part="label"
|
|
32
|
+
for="input"
|
|
33
|
+
class="${classMap({ floating: e.value || e.isFocused })}">${e.label}</label>
|
|
34
|
+
`)}
|
|
35
|
+
<input part="input"
|
|
36
|
+
.value="${e.value}"
|
|
37
|
+
readonly
|
|
38
|
+
?disabled="${e.disabled}"
|
|
39
|
+
?required="${e.required}"
|
|
40
|
+
id="input"
|
|
41
|
+
name="${ifNonEmpty(e.name)}"
|
|
42
|
+
type="text"
|
|
43
|
+
placeholder="${ifNonEmpty(e.isFocused || !e.label ? e.placeholder : '')}"
|
|
44
|
+
tabindex="${e.tabIndex}"
|
|
45
|
+
aria-invalid="${e.invalid ? 'true' : 'false'}"
|
|
46
|
+
@focus="${(x) => e.onFocus(x)}"
|
|
47
|
+
@blur="${(x) => e.onBlur(x)}"
|
|
48
|
+
@click="${() => e.browse()}"/>
|
|
49
|
+
</div>
|
|
50
|
+
<input part="fileInput"
|
|
51
|
+
type="file"
|
|
52
|
+
?multiple="${e.multiple}"
|
|
53
|
+
accept="${ifNonEmpty(e.accept.join(','))}"
|
|
54
|
+
?webkitdirectory="${e.directory}"
|
|
55
|
+
style="display: none;"
|
|
56
|
+
tabindex="-1"
|
|
57
|
+
@change="${(x) => e.onFileChange(x)}"/>
|
|
58
|
+
${when(!e.disabled && !e.readonly && e.value && e.isClearable, () => html `
|
|
59
|
+
<mosaik-button part="clear"
|
|
60
|
+
.appearance="${Appearance.Plain}"
|
|
61
|
+
.icon="${Icons.clear}"
|
|
62
|
+
.size="${Size.Small}"
|
|
63
|
+
.iconSize="${Size.Medium}"
|
|
64
|
+
@click="${() => e.clear()}"></mosaik-button>
|
|
65
|
+
`)}
|
|
66
|
+
${when(!e.disabled && !e.readonly, () => html `
|
|
67
|
+
<mosaik-button part="browse"
|
|
68
|
+
.appearance="${Appearance.Plain}"
|
|
69
|
+
.icon="${Icons.folderOpen}"
|
|
70
|
+
.size="${Size.Small}"
|
|
71
|
+
.iconSize="${Size.Medium}"
|
|
72
|
+
@click="${() => e.browse()}"></mosaik-button>
|
|
73
|
+
`)}
|
|
74
|
+
<div part="suffix"
|
|
75
|
+
?hidden="${!e.hasSlotContent('suffix')}">
|
|
76
|
+
<slot name="suffix"></slot>
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=FileBoxElementTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileBoxElementTemplate.js","sourceRoot":"","sources":["../../../../../src/Controls/Components/Inputs/FileBox/FileBoxElementTemplate.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAElB,OAAO,EAAuB,IAAI,EAAE,MAA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