wj-elements 0.1.183 → 0.1.185
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/form-associated-element-CaIxmEod.js +242 -0
- package/dist/form-associated-element-CaIxmEod.js.map +1 -0
- package/dist/light.css +11 -3
- package/dist/packages/internals/form-associated-element.d.ts +138 -0
- package/dist/packages/wje-checkbox/checkbox.element.d.ts +17 -90
- package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +1 -1
- package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +1 -1
- package/dist/packages/wje-input/input.element.d.ts +3 -106
- package/dist/packages/wje-options/options.element.d.ts +23 -19
- package/dist/packages/wje-popup/popup.element.d.ts +10 -0
- package/dist/packages/wje-radio/radio.element.d.ts +12 -1
- package/dist/packages/wje-radio-group/radio-group.element.d.ts +8 -90
- package/dist/packages/wje-select/select.d.ts +1 -1
- package/dist/packages/wje-select/select.element.d.ts +56 -194
- package/dist/packages/wje-textarea/textarea.element.d.ts +3 -110
- package/dist/packages/wje-tree/tree.element.d.ts +1 -0
- package/dist/{popup.element-Di4nHYij.js → popup.element-CVbbnTWI.js} +53 -24
- package/dist/{popup.element-Di4nHYij.js.map → popup.element-CVbbnTWI.js.map} +1 -1
- package/dist/wje-checkbox.js +59 -403
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-dropdown.js +1 -1
- package/dist/wje-icon-picker.js +2 -2
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-infinite-scroll.js +7 -2
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input.js +10 -213
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-master.js +1 -1
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +56 -45
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-popup.js +1 -1
- package/dist/wje-radio-group.js +82 -148
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +36 -8
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-select.js +186 -303
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-textarea.js +16 -210
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-tooltip.js +1 -1
- package/dist/wje-tree-item.js +11 -97
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +13 -1
- package/dist/wje-tree.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormAssociatedElement } from '../internals/form-associated-element.js';
|
|
2
2
|
import { default as Button } from '../wje-button/button.js';
|
|
3
3
|
import { default as Popup } from '../wje-popup/popup.js';
|
|
4
4
|
import { default as Icon } from '../wje-icon/icon.js';
|
|
@@ -8,36 +8,7 @@ import { default as Input } from '../wje-input/input.js';
|
|
|
8
8
|
import { default as Option } from '../wje-option/option.js';
|
|
9
9
|
import { default as Options } from '../wje-options/options.js';
|
|
10
10
|
import { default as Checkbox } from '../wje-checkbox/checkbox.js';
|
|
11
|
-
|
|
12
|
-
* `Select` is a custom web component that represents a select input.
|
|
13
|
-
* @summary This element represents a select input.
|
|
14
|
-
* @documentation https://elements.webjet.sk/components/select
|
|
15
|
-
* @status stable
|
|
16
|
-
* @augments {WJElement}
|
|
17
|
-
* @slot - The default slot for the select.
|
|
18
|
-
* @slot anchor - The slot for the anchor.
|
|
19
|
-
* @slot arrow - The slot for the arrow.
|
|
20
|
-
* @csspart native - The native select wrapper.
|
|
21
|
-
* @csspart input - The input field.
|
|
22
|
-
* @csspart clear - The clear button.
|
|
23
|
-
* @property {Array} _selected - An array to store selected items.
|
|
24
|
-
* @property {HTMLElement|null} counterEl - A reference to the counter element, initially null.
|
|
25
|
-
* @property {ElementInternals} internals - The internal element API for managing state and attributes.
|
|
26
|
-
* @property {number} maxOptions - The maximum number of options allowed.
|
|
27
|
-
* @property {boolean} _wasOppened - Tracks whether the select element was previously opened, initially false.
|
|
28
|
-
* @cssproperty [--wje-select-border-width=1px] - Specifies the width of the border around the select component. Accepts any valid CSS length unit (e.g., `px`, `rem`, `em`).
|
|
29
|
-
* @cssproperty [--wje-select-border-style=solid] - Defines the style of the border for the select component. Accepts standard CSS border styles, such as `solid`, `dashed`, or `dotted`.
|
|
30
|
-
* @cssproperty [--wje-select-border-color=var(--wje-border-color)] - Sets the color of the border for the select component. Accepts any valid CSS color value, including color variables, named colors, and hex values.
|
|
31
|
-
* @cssproperty [--wje-select-options-border-width=1px] - Specifies the width of the border for the select options dropdown. Accepts any valid CSS length unit.
|
|
32
|
-
* @cssproperty [--wje-select-options-border-style=var(--wje-border-style)] - Defines the border style for the select options dropdown. Inherits from a defined CSS variable for consistency.
|
|
33
|
-
* @cssproperty [--wje-select-options-border-color=var(--wje-border-color)] - Sets the border color for the select options dropdown. Accepts any valid CSS color value.
|
|
34
|
-
* @cssproperty [--wje-select-background=var(--wje-background)] - Specifies the background color of the select component. Accepts any valid CSS color value.
|
|
35
|
-
* @cssproperty [--wje-select-line-height=20px] - Defines the line height for the text within the select component. Accepts any valid CSS length value, ensuring consistent vertical alignment.
|
|
36
|
-
* @cssproperty [--wje-select-color=var(--wje-color)] - Sets the text color for the select component. Accepts any valid CSS color value.
|
|
37
|
-
* @cssproperty [--wje-select-border-radius=var(--wje-border-radius-medium)] - Specifies the border radius for the select component.Determines the roundness of the corners and accepts any valid CSS length unit or variable.
|
|
38
|
-
* @tag wje-select
|
|
39
|
-
*/
|
|
40
|
-
export default class Select extends WJElement {
|
|
11
|
+
export class Select extends FormAssociatedElement {
|
|
41
12
|
/**
|
|
42
13
|
* Returns the CSS styles for the component.
|
|
43
14
|
* @static
|
|
@@ -50,32 +21,12 @@ export default class Select extends WJElement {
|
|
|
50
21
|
* @returns {Array<string>}
|
|
51
22
|
*/
|
|
52
23
|
static get observedAttributes(): Array<string>;
|
|
53
|
-
/**
|
|
54
|
-
* Whether the input is associated with a form.
|
|
55
|
-
* @type {boolean}
|
|
56
|
-
*/
|
|
57
|
-
static formAssociated: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* @type {Array}
|
|
60
|
-
* @description An array to store selected items.
|
|
61
|
-
*/
|
|
62
|
-
_selected: any[];
|
|
63
24
|
/**
|
|
64
25
|
* @type {HTMLElement|null}
|
|
65
26
|
* @description A reference to the counter element, initially null.
|
|
66
27
|
* @private
|
|
67
28
|
*/
|
|
68
29
|
private counterEl;
|
|
69
|
-
/**
|
|
70
|
-
* @type {ElementInternals}
|
|
71
|
-
* @description The internal element API for managing state and attributes.
|
|
72
|
-
* @private
|
|
73
|
-
* @readonly
|
|
74
|
-
* @constant
|
|
75
|
-
* @default {ElementInternals} this.attachInternals()
|
|
76
|
-
* @description Attaches the internals to the element.
|
|
77
|
-
*/
|
|
78
|
-
private readonly internals;
|
|
79
30
|
/**
|
|
80
31
|
* @type {boolean}
|
|
81
32
|
* @description Tracks whether the select element was previously opened, initially false.
|
|
@@ -133,7 +84,9 @@ export default class Select extends WJElement {
|
|
|
133
84
|
* @description A reference to the list element, initially null.
|
|
134
85
|
*/
|
|
135
86
|
list: HTMLElement | null;
|
|
136
|
-
|
|
87
|
+
_value: any[];
|
|
88
|
+
_selected: any[];
|
|
89
|
+
_selectedOptions: any[];
|
|
137
90
|
/**
|
|
138
91
|
* An object representing component dependencies with their respective classes.
|
|
139
92
|
* Each property in the object maps a custom component name (as a string key)
|
|
@@ -146,7 +99,6 @@ export default class Select extends WJElement {
|
|
|
146
99
|
* @property {Function} 'wje-chip' Represents the Chip component class.
|
|
147
100
|
* @property {Function} 'wje-input' Represents the Input component class.
|
|
148
101
|
* @property {Function} 'wje-option' Represents the Option component class.
|
|
149
|
-
* @property {Function} 'wje-options' Represents the Options component class.
|
|
150
102
|
* @property {Function} 'wje-checkbox' Represents the Checkbox component class.
|
|
151
103
|
*/
|
|
152
104
|
dependencies: {
|
|
@@ -161,46 +113,31 @@ export default class Select extends WJElement {
|
|
|
161
113
|
'wje-checkbox': typeof Checkbox;
|
|
162
114
|
};
|
|
163
115
|
/**
|
|
164
|
-
*
|
|
165
|
-
* @param {
|
|
116
|
+
* Sets the label value.
|
|
117
|
+
* @param {Array} value The selected value to set.
|
|
166
118
|
*/
|
|
167
|
-
set
|
|
119
|
+
set selected(value: any[]);
|
|
168
120
|
/**
|
|
169
|
-
*
|
|
170
|
-
* @returns {
|
|
121
|
+
* Returns the selected value.
|
|
122
|
+
* @returns {Array} The selected value.
|
|
171
123
|
*/
|
|
172
|
-
get
|
|
173
|
-
set required(value: boolean);
|
|
174
|
-
get required(): boolean;
|
|
124
|
+
get selected(): any[];
|
|
175
125
|
/**
|
|
176
|
-
*
|
|
177
|
-
* @
|
|
126
|
+
* Sets the `validate-on-change` attribute on the element. When the attribute is present, it typically indicates that validation should occur when the value of the input changes.
|
|
127
|
+
* @param {boolean} value A boolean indicating whether to enable or disable the `validate-on-change` attribute.
|
|
178
128
|
*/
|
|
179
|
-
|
|
129
|
+
set validateOnChange(value: boolean);
|
|
180
130
|
/**
|
|
181
131
|
* Getter for the validateOnChange attribute.
|
|
182
132
|
* @returns {boolean} Whether the attribute is present.
|
|
183
133
|
*/
|
|
184
134
|
get validateOnChange(): boolean;
|
|
185
|
-
/**
|
|
186
|
-
* Sets the 'invalid' property of the element.
|
|
187
|
-
* When set to a truthy value, the 'invalid' attribute is added to the element.
|
|
188
|
-
* When set to a falsy value, the 'invalid' attribute is removed from the element.
|
|
189
|
-
* @param {boolean} value A boolean indicating whether the element is invalid.
|
|
190
|
-
*/
|
|
191
|
-
set invalid(value: boolean);
|
|
192
|
-
/**
|
|
193
|
-
* Retrieves the value of the 'invalid' attribute.
|
|
194
|
-
* This method checks if the 'invalid' attribute is present on the element.
|
|
195
|
-
* @returns {boolean} Returns true if the 'invalid' attribute is present, otherwise false.
|
|
196
|
-
*/
|
|
197
|
-
get invalid(): boolean;
|
|
198
135
|
/**
|
|
199
136
|
* Sets the maximum number of options allowed.
|
|
200
|
-
* @param {
|
|
137
|
+
* @param { number | object} value The value to set as the maximum number of options.
|
|
201
138
|
* If null, the 'max-options' attribute will be removed.
|
|
202
139
|
*/
|
|
203
|
-
set maxOptions(value:
|
|
140
|
+
set maxOptions(value: number | object);
|
|
204
141
|
/**
|
|
205
142
|
* Retrieves the maximum number of options allowed.
|
|
206
143
|
* Parses the value of the 'max-options' attribute from the element and converts it to a number.
|
|
@@ -208,36 +145,6 @@ export default class Select extends WJElement {
|
|
|
208
145
|
* @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.
|
|
209
146
|
*/
|
|
210
147
|
get maxOptions(): number;
|
|
211
|
-
/**
|
|
212
|
-
* Getter for the form attribute.
|
|
213
|
-
* @returns {HTMLFormElement} The form the input is associated with.
|
|
214
|
-
*/
|
|
215
|
-
get form(): HTMLFormElement;
|
|
216
|
-
/**
|
|
217
|
-
* Getter for the name attribute.
|
|
218
|
-
* @returns {string} The name of the input.
|
|
219
|
-
*/
|
|
220
|
-
get name(): string;
|
|
221
|
-
/**
|
|
222
|
-
* Getter for the type attribute.
|
|
223
|
-
* @returns {string} The type of the input.
|
|
224
|
-
*/
|
|
225
|
-
get type(): string;
|
|
226
|
-
/**
|
|
227
|
-
* Getter for the validity attribute.
|
|
228
|
-
* @returns {ValidityState} The validity state of the input.
|
|
229
|
-
*/
|
|
230
|
-
get validity(): ValidityState;
|
|
231
|
-
/**
|
|
232
|
-
* Getter for the validationMessage attribute.
|
|
233
|
-
* @returns {string} The validation message of the input.
|
|
234
|
-
*/
|
|
235
|
-
get validationMessage(): string;
|
|
236
|
-
/**
|
|
237
|
-
* Getter for the willValidate attribute.
|
|
238
|
-
* @returns {boolean} Whether the input will be validated.
|
|
239
|
-
*/
|
|
240
|
-
get willValidate(): boolean;
|
|
241
148
|
/**
|
|
242
149
|
* @summary Setter for the defaultValue attribute.
|
|
243
150
|
* This method sets the 'value' attribute of the custom input element to the provided value.
|
|
@@ -253,24 +160,6 @@ export default class Select extends WJElement {
|
|
|
253
160
|
* @returns {string} The default value of the input element.
|
|
254
161
|
*/
|
|
255
162
|
get defaultValue(): string;
|
|
256
|
-
/**
|
|
257
|
-
* Sets the label value.
|
|
258
|
-
* @param {Array} value The selected value to set.
|
|
259
|
-
*/
|
|
260
|
-
set selected(value: any[]);
|
|
261
|
-
/**
|
|
262
|
-
* Returns the selected value.
|
|
263
|
-
* @returns {Array} The selected value.
|
|
264
|
-
*/
|
|
265
|
-
get selected(): any[];
|
|
266
|
-
/**
|
|
267
|
-
* Retrieves the complete list of options available for the component.
|
|
268
|
-
* The options are determined by combining elements from various sources, including loaded options, added options, and HTML-sourced options.
|
|
269
|
-
* If a `wje-options` element is present within the component, its loaded options are included in the merged list.
|
|
270
|
-
* In the absence of a `wje-options` element, duplicates among the added and HTML options are removed, retaining their order.
|
|
271
|
-
* @returns {Array<object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.
|
|
272
|
-
*/
|
|
273
|
-
get options(): Array<object>;
|
|
274
163
|
/**
|
|
275
164
|
* Sets the trigger value.
|
|
276
165
|
* @param {string} value The trigger value to set.
|
|
@@ -281,8 +170,42 @@ export default class Select extends WJElement {
|
|
|
281
170
|
* @returns {string} The trigger value.
|
|
282
171
|
*/
|
|
283
172
|
get trigger(): string;
|
|
173
|
+
/**
|
|
174
|
+
* Sets the offset attribute for the element.
|
|
175
|
+
* @param {string} value The value to assign to the offset attribute.
|
|
176
|
+
*/
|
|
284
177
|
set offset(value: string);
|
|
178
|
+
/**
|
|
179
|
+
* Gets the value of the offset attribute of the current element.
|
|
180
|
+
* If the offset attribute is not present, returns a default value of '0'.
|
|
181
|
+
* @returns {string} The value of the offset attribute or the default value '0'.
|
|
182
|
+
*/
|
|
285
183
|
get offset(): string;
|
|
184
|
+
/**
|
|
185
|
+
* Sets the selected options for the object.
|
|
186
|
+
* @param {Array|object} value The new value for the selected options. It can be an array or object containing the selected options.
|
|
187
|
+
*/
|
|
188
|
+
set selectedOptions(value: any[] | object);
|
|
189
|
+
/**
|
|
190
|
+
* Retrieves the selected options.
|
|
191
|
+
* @returns {Array} An array containing the currently selected options. If no options are selected, an empty array is returned.
|
|
192
|
+
*/
|
|
193
|
+
get selectedOptions(): any[];
|
|
194
|
+
set lazy(value: boolean);
|
|
195
|
+
get lazy(): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Getter for the customErrorDisplay attribute.
|
|
198
|
+
* @returns {boolean} Whether the attribute is present.
|
|
199
|
+
*/
|
|
200
|
+
get customErrorDisplay(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves the complete list of options available for the component.
|
|
203
|
+
* The options are determined by combining elements from various sources, including loaded options, added options, and HTML-sourced options.
|
|
204
|
+
* If a `wje-options` element is present within the component, its loaded options are included in the merged list.
|
|
205
|
+
* In the absence of a `wje-options` element, duplicates among the added and HTML options are removed, retaining their order.
|
|
206
|
+
* @returns {Array<object>} An array containing all the available options, combining the loaded, added, and HTML-based options, with duplicates removed where applicable.
|
|
207
|
+
*/
|
|
208
|
+
get options(): Array<object>;
|
|
286
209
|
/**
|
|
287
210
|
* Draws the component for the select.
|
|
288
211
|
* @returns {DocumentFragment}
|
|
@@ -323,16 +246,6 @@ export default class Select extends WJElement {
|
|
|
323
246
|
* @returns {NodeList} The options as HTML.
|
|
324
247
|
*/
|
|
325
248
|
getAllOptions(): NodeList;
|
|
326
|
-
/**
|
|
327
|
-
* Returns the selected options as HTML.
|
|
328
|
-
* @returns {NodeList} The selected options as HTML.
|
|
329
|
-
*/
|
|
330
|
-
getSelectedOptions(): NodeList;
|
|
331
|
-
/**
|
|
332
|
-
* Returns the selected options.
|
|
333
|
-
* @returns {Array} The selected options.
|
|
334
|
-
*/
|
|
335
|
-
getSelected(): any[];
|
|
336
249
|
/**
|
|
337
250
|
* Handles the selection change.
|
|
338
251
|
* @param {Element[]} options The option that changed.
|
|
@@ -386,6 +299,12 @@ export default class Select extends WJElement {
|
|
|
386
299
|
value?: string;
|
|
387
300
|
text?: string;
|
|
388
301
|
}): HTMLElement;
|
|
302
|
+
/**
|
|
303
|
+
* Returns the provided item.
|
|
304
|
+
* @param {any} item The item to be returned.
|
|
305
|
+
* @returns {any} The same item that was passed as input.
|
|
306
|
+
*/
|
|
307
|
+
htmlSelectedItem(item: any): any;
|
|
389
308
|
/**
|
|
390
309
|
* Adds an option to the select element.
|
|
391
310
|
* @param {any} optionData The data for the option to be added.
|
|
@@ -412,69 +331,12 @@ export default class Select extends WJElement {
|
|
|
412
331
|
* @param {boolean} [silent] Whether to trigger the change event or not.
|
|
413
332
|
*/
|
|
414
333
|
selectOptions(values: any[] | any, silent?: boolean): void;
|
|
415
|
-
/**
|
|
416
|
-
* Returns the provided item.
|
|
417
|
-
* @param {any} item The item to be returned.
|
|
418
|
-
* @returns {any} The same item that was passed as input.
|
|
419
|
-
*/
|
|
420
|
-
htmlSelectedItem(item: any): any;
|
|
421
334
|
/**
|
|
422
335
|
* Clones and appends an icon from a template with slot "check" to the given option element.
|
|
423
336
|
* @param {HTMLElement} option The target option element where the "check" icon will be added.
|
|
424
337
|
* @returns {void}
|
|
425
338
|
*/
|
|
426
339
|
optionCheckSlot(option: HTMLElement): void;
|
|
427
|
-
/**
|
|
428
|
-
* Validates the selection of options in the select element.
|
|
429
|
-
* Checks if the element is required and no option is selected,
|
|
430
|
-
* in which case it sets a validation error with a custom message.
|
|
431
|
-
* If the element passes validation, it clears any existing validation errors.
|
|
432
|
-
*
|
|
433
|
-
* @return {void} Does not return a value.
|
|
434
|
-
*/
|
|
435
|
-
validateSelect(): void;
|
|
436
|
-
/**
|
|
437
|
-
* Checks and updates the validation state of the component based on its current properties.
|
|
438
|
-
* If the component is invalid and a custom error display is enabled, it dispatches an 'invalid' event.
|
|
439
|
-
* @returns {void} This method does not return a value.
|
|
440
|
-
*/
|
|
441
|
-
propagateValidation(): void;
|
|
442
|
-
showInvalidMessage(): void;
|
|
443
|
-
/**
|
|
444
|
-
* Lifecycle callback invoked when the custom element becomes associated with a form element.
|
|
445
|
-
* @param {HTMLFormElement} form The form element the custom element is associated with.
|
|
446
|
-
* @returns {void}
|
|
447
|
-
*/
|
|
448
|
-
formAssociatedCallback(form: HTMLFormElement): void;
|
|
449
|
-
/**
|
|
450
|
-
* The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.
|
|
451
|
-
* This method is responsible for resetting the value of the custom input element to its default value.
|
|
452
|
-
* It also resets the form value and validity state in the form internals.
|
|
453
|
-
* @function
|
|
454
|
-
*/
|
|
455
|
-
formResetCallback(): void;
|
|
456
|
-
/**
|
|
457
|
-
* The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.
|
|
458
|
-
* This method is responsible for restoring the value of the custom input element to its saved state.
|
|
459
|
-
* It also restores the form value and validity state in the form internals to their saved states.
|
|
460
|
-
* @param {object} state The saved state of the custom input element.
|
|
461
|
-
* @function
|
|
462
|
-
*/
|
|
463
|
-
formStateRestoreCallback(state: object): void;
|
|
464
|
-
/**
|
|
465
|
-
* The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.
|
|
466
|
-
* This method is responsible for saving the value of the custom input element.
|
|
467
|
-
* @returns {object} The saved state of the custom input element.
|
|
468
|
-
* @function
|
|
469
|
-
*/
|
|
470
|
-
formStateSaveCallback(): object;
|
|
471
|
-
/**
|
|
472
|
-
* The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.
|
|
473
|
-
* This method is not implemented yet.
|
|
474
|
-
* @param {boolean} disabled The new disabled state of the custom input element.
|
|
475
|
-
* @function
|
|
476
|
-
*/
|
|
477
|
-
formDisabledCallback(disabled: boolean): void;
|
|
478
340
|
/**
|
|
479
341
|
* Checks if all elements in the `elements` array are present in the `options` array based on their `option` property.
|
|
480
342
|
* @param {Array} elements The array of elements to check. Each element should have an `option` property.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormAssociatedElement } from '../internals/form-associated-element.js';
|
|
2
2
|
/**
|
|
3
3
|
* `Textarea` is a custom web component that represents a textarea input.
|
|
4
4
|
* @summary This element represents a textarea input.
|
|
5
5
|
* @documentation https://elements.webjet.sk/components/textarea
|
|
6
6
|
* @status stable
|
|
7
|
-
* @augments
|
|
7
|
+
* @augments {FormAssociatedElement}
|
|
8
8
|
* @csspart native - The native textarea wrapper.
|
|
9
9
|
* @csspart input - The textarea input.
|
|
10
10
|
* @csspart wrapper - The textarea wrapper.
|
|
@@ -22,38 +22,20 @@ import { default as WJElement } from '../wje-element/element.js';
|
|
|
22
22
|
* @cssproperty [--wje-textarea-padding=0.5rem] - Defines the padding inside the textarea. Controls the spacing between the content and the border.
|
|
23
23
|
* @tag wje-textarea
|
|
24
24
|
*/
|
|
25
|
-
export default class Textarea extends
|
|
25
|
+
export default class Textarea extends FormAssociatedElement {
|
|
26
26
|
/**
|
|
27
27
|
* Returns the CSS styles for the component.
|
|
28
28
|
* @static
|
|
29
29
|
* @returns {CSSStyleSheet} The CSS stylesheet
|
|
30
30
|
*/
|
|
31
31
|
static get cssStyleSheet(): CSSStyleSheet;
|
|
32
|
-
/**
|
|
33
|
-
* Whether the input is associated with a form.
|
|
34
|
-
* @type {boolean}
|
|
35
|
-
*/
|
|
36
|
-
static formAssociated: boolean;
|
|
37
32
|
/**
|
|
38
33
|
* Returns the list of attributes to observe for changes.
|
|
39
34
|
* @static
|
|
40
35
|
* @returns {Array<string>}
|
|
41
36
|
*/
|
|
42
37
|
static get observedAttributes(): Array<string>;
|
|
43
|
-
/**
|
|
44
|
-
* Setter for the invalid attribute.
|
|
45
|
-
* @param {boolean} isInvalid Whether the input is invalid.
|
|
46
|
-
*/
|
|
47
|
-
set invalid(isInvalid: boolean);
|
|
48
|
-
/**
|
|
49
|
-
* Getter for the invalid attribute.
|
|
50
|
-
* @returns {boolean} Whether the attribute is present.
|
|
51
|
-
*/
|
|
52
|
-
get invalid(): boolean;
|
|
53
38
|
pristine: boolean;
|
|
54
|
-
internals: ElementInternals;
|
|
55
|
-
observer: MutationObserver;
|
|
56
|
-
observeFunction: (mutations: any) => void;
|
|
57
39
|
/**
|
|
58
40
|
* Setter for the value attribute.
|
|
59
41
|
* @param {string} value The value to set.
|
|
@@ -79,39 +61,8 @@ export default class Textarea extends WJElement {
|
|
|
79
61
|
* @returns {boolean} Whether the attribute is present.
|
|
80
62
|
*/
|
|
81
63
|
get validateOnChange(): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Getter for the form attribute.
|
|
84
|
-
* @returns {HTMLFormElement} The form the input is associated with.
|
|
85
|
-
*/
|
|
86
|
-
get form(): HTMLFormElement;
|
|
87
|
-
/**
|
|
88
|
-
* Getter for the name attribute.
|
|
89
|
-
* @returns {string} The name of the input.
|
|
90
|
-
*/
|
|
91
|
-
get name(): string;
|
|
92
|
-
/**
|
|
93
|
-
* Getter for the type attribute.
|
|
94
|
-
* @returns {string} The type of the input.
|
|
95
|
-
*/
|
|
96
|
-
get type(): string;
|
|
97
|
-
/**
|
|
98
|
-
* Getter for the validity attribute.
|
|
99
|
-
* @returns {ValidityState} The validity state of the input.
|
|
100
|
-
*/
|
|
101
|
-
get validity(): ValidityState;
|
|
102
|
-
/**
|
|
103
|
-
* Getter for the validationMessage attribute.
|
|
104
|
-
* @returns {string} The validation message of the input.
|
|
105
|
-
*/
|
|
106
|
-
get validationMessage(): string;
|
|
107
|
-
/**
|
|
108
|
-
* Getter for the willValidate attribute.
|
|
109
|
-
* @returns {boolean} Whether the input will be validated.
|
|
110
|
-
*/
|
|
111
|
-
get willValidate(): boolean;
|
|
112
64
|
set placeholder(value: string);
|
|
113
65
|
get placeholder(): string;
|
|
114
|
-
beforeDraw(): void;
|
|
115
66
|
/**
|
|
116
67
|
* Draws the component for the textarea.
|
|
117
68
|
* @returns {DocumentFragment}
|
|
@@ -135,62 +86,4 @@ export default class Textarea extends WJElement {
|
|
|
135
86
|
* @param {Event} e The event object.
|
|
136
87
|
*/
|
|
137
88
|
counterFn: (e: Event) => void;
|
|
138
|
-
/**
|
|
139
|
-
* @summary Displays the validation message for the input.
|
|
140
|
-
* If the input has a slot named 'error', it sets the text content of the element with attribute 'error-message' inside the slot to the validation message.
|
|
141
|
-
* If the input does not have an 'error' slot, it sets the text content of the errorMessage property to the validation message.
|
|
142
|
-
*/
|
|
143
|
-
showInvalidMessage(): void;
|
|
144
|
-
/**
|
|
145
|
-
* @summary Validates the input.
|
|
146
|
-
* This method checks the validity state of the input. If the input is not valid, it iterates over the validity state object.
|
|
147
|
-
* For each invalid state, it constructs an attribute name and checks if the input has this attribute.
|
|
148
|
-
* If the input has the attribute, it sets the validation error to the state and the error message to the attribute value.
|
|
149
|
-
* If the input does not have the attribute, it sets the error message to the default validation message of the input.
|
|
150
|
-
* It then sets the validity in the form internals to an object with the validation error as key and true as value, and the error message.
|
|
151
|
-
* If the input is valid, it sets the validity in the form internals to an empty object.
|
|
152
|
-
*/
|
|
153
|
-
validateInput(): void;
|
|
154
|
-
validationError: string;
|
|
155
|
-
/**
|
|
156
|
-
* @summary Propagates the validation state of the input.
|
|
157
|
-
* This method sets the 'invalid' property of the input based on its 'pristine' state and its internal validity state.
|
|
158
|
-
* If the input is invalid and the 'customErrorDisplay' property is true, it dispatches an 'invalid' event.
|
|
159
|
-
*/
|
|
160
|
-
propagateValidation(): void;
|
|
161
|
-
/**
|
|
162
|
-
* @summary Callback function that is called when the custom element is associated with a form.
|
|
163
|
-
* This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
|
|
164
|
-
* @param {HTMLFormElement} form The form the custom element is associated with.
|
|
165
|
-
*/
|
|
166
|
-
formAssociatedCallback(form: HTMLFormElement): void;
|
|
167
|
-
/**
|
|
168
|
-
* The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.
|
|
169
|
-
* This method is responsible for resetting the value of the custom input element to its default value.
|
|
170
|
-
* It also resets the form value and validity state in the form internals.
|
|
171
|
-
* @function
|
|
172
|
-
*/
|
|
173
|
-
formResetCallback(): void;
|
|
174
|
-
/**
|
|
175
|
-
* The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.
|
|
176
|
-
* This method is responsible for restoring the value of the custom input element to its saved state.
|
|
177
|
-
* It also restores the form value and validity state in the form internals to their saved states.
|
|
178
|
-
* @param {object} state The saved state of the custom input element.
|
|
179
|
-
* @function
|
|
180
|
-
*/
|
|
181
|
-
formStateRestoreCallback(state: object): void;
|
|
182
|
-
/**
|
|
183
|
-
* The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.
|
|
184
|
-
* This method is responsible for saving the value of the custom input element.
|
|
185
|
-
* @returns {object} The saved state of the custom input element.
|
|
186
|
-
* @function
|
|
187
|
-
*/
|
|
188
|
-
formStateSaveCallback(): object;
|
|
189
|
-
/**
|
|
190
|
-
* The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.
|
|
191
|
-
* This method is not implemented yet.
|
|
192
|
-
* @param {boolean} disabled The new disabled state of the custom input element.
|
|
193
|
-
* @function
|
|
194
|
-
*/
|
|
195
|
-
formDisabledCallback(disabled: boolean): void;
|
|
196
89
|
}
|
|
@@ -67,6 +67,7 @@ export default class Tree extends WJElement {
|
|
|
67
67
|
* @returns {void} This method does not return a value. If the icon matching the given status is not found, a warning is logged.
|
|
68
68
|
*/
|
|
69
69
|
getExpandCollapseIcon(item: HTMLElement, status: string): void;
|
|
70
|
+
getSlots(item: any, slotName: any): void;
|
|
70
71
|
/**
|
|
71
72
|
* Updates the state of a checkbox, syncing the state both upwards to parent elements
|
|
72
73
|
* and downwards to child elements as necessary.
|
|
@@ -1371,7 +1371,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
1371
1371
|
platform: platformWithCache
|
|
1372
1372
|
});
|
|
1373
1373
|
};
|
|
1374
|
-
const styles = "/*\n[ WJ Popup ]\n*/\n\n:host {\n --wje-popup-top: auto;\n --wje-popup-left: auto;\n display: flex; /* zmenene z contents na flex kvoli breadcrumbs v a jeho trom bodkam */\n}\n\n.native-popup {\n position: absolute;\n isolation: isolate;\n z-index: 999;\n left: var(--wje-popup-left);\n top: var(--wje-popup-top);\n}\n.native-popup:not(.popup-active) {\n display: none;\n}\n";
|
|
1374
|
+
const styles = "/*\n[ WJ Popup ]\n*/\n\n:host {\n --wje-popup-top: auto;\n --wje-popup-left: auto;\n display: flex; /* zmenene z contents na flex kvoli breadcrumbs v a jeho trom bodkam */\n}\n\n.native-popup {\n position: absolute;\n isolation: isolate;\n z-index: 999;\n left: var(--wje-popup-left);\n top: var(--wje-popup-top);\n}\n.native-popup:not(.popup-active) {\n display: none;\n}\n\n.popup-loader.overlay {\n position: absolute;\n inset: 1px;\n background: white;\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1;\n}\n.popup-loader.fade-out {\n opacity: 0;\n transition: opacity 0.3s ease;\n pointer-events: none;\n}";
|
|
1375
1375
|
class Popup extends WJElement {
|
|
1376
1376
|
/**
|
|
1377
1377
|
* Creates an instance of Popup.
|
|
@@ -1398,20 +1398,33 @@ class Popup extends WJElement {
|
|
|
1398
1398
|
});
|
|
1399
1399
|
this._manual = false;
|
|
1400
1400
|
}
|
|
1401
|
+
set loader(value) {
|
|
1402
|
+
if (value) {
|
|
1403
|
+
this.setAttribute("loader", "");
|
|
1404
|
+
} else {
|
|
1405
|
+
this.removeAttribute("loader");
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
get loader() {
|
|
1409
|
+
return this.hasAttribute("loader");
|
|
1410
|
+
}
|
|
1401
1411
|
/**
|
|
1402
1412
|
* Sets the manual property of the popup.
|
|
1403
1413
|
* @param {boolean} value The value to set.
|
|
1404
1414
|
*/
|
|
1405
1415
|
set manual(value) {
|
|
1406
|
-
|
|
1416
|
+
if (value) {
|
|
1417
|
+
this.setAttribute("manual", "");
|
|
1418
|
+
} else {
|
|
1419
|
+
this.removeAttribute("manual");
|
|
1420
|
+
}
|
|
1407
1421
|
}
|
|
1408
1422
|
/**
|
|
1409
1423
|
* Gets the manual property of the popup.
|
|
1410
1424
|
* @returns {boolean} The value of the manual property.
|
|
1411
1425
|
*/
|
|
1412
1426
|
get manual() {
|
|
1413
|
-
|
|
1414
|
-
return this._manual;
|
|
1427
|
+
return this.hasAttribute("manual");
|
|
1415
1428
|
}
|
|
1416
1429
|
/**
|
|
1417
1430
|
* Returns the CSS styles for the component.
|
|
@@ -1426,27 +1439,15 @@ class Popup extends WJElement {
|
|
|
1426
1439
|
* @static
|
|
1427
1440
|
* @returns {Array<string>}
|
|
1428
1441
|
*/
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1442
|
+
static get observedAttributes() {
|
|
1443
|
+
return [];
|
|
1444
|
+
}
|
|
1432
1445
|
/**
|
|
1433
1446
|
* Sets up the attributes for the component.
|
|
1434
1447
|
*/
|
|
1435
1448
|
setupAttributes() {
|
|
1436
1449
|
this.isShadowRoot = "open";
|
|
1437
1450
|
}
|
|
1438
|
-
// /**
|
|
1439
|
-
// * Called when an attribute changes.
|
|
1440
|
-
// */
|
|
1441
|
-
// attributeChangedCallback(name, old, newName) {
|
|
1442
|
-
// // if (name === 'active') {
|
|
1443
|
-
// // if (this.hasAttribute(name)) {
|
|
1444
|
-
// // this.show();
|
|
1445
|
-
// // } else {
|
|
1446
|
-
// // this.hide();
|
|
1447
|
-
// // }
|
|
1448
|
-
// // }
|
|
1449
|
-
// }
|
|
1450
1451
|
afterDisconnect() {
|
|
1451
1452
|
var _a;
|
|
1452
1453
|
event.removeListener(this.anchorEl, "click", this.manualCallback);
|
|
@@ -1471,13 +1472,20 @@ class Popup extends WJElement {
|
|
|
1471
1472
|
native.setAttribute("part", "native");
|
|
1472
1473
|
native.classList.add("native-popup");
|
|
1473
1474
|
let slot = document.createElement("slot");
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1475
|
+
let loader = document.createElement("div");
|
|
1476
|
+
loader.classList.add("popup-loader", "overlay");
|
|
1477
|
+
loader.setAttribute("part", "loader");
|
|
1478
|
+
loader.textContent = "Loading...";
|
|
1479
|
+
console.log("LOADER", this.loader);
|
|
1480
|
+
if (this.loader) native.append(loader);
|
|
1481
|
+
native.append(slot);
|
|
1482
|
+
native.append(slotArrow);
|
|
1483
|
+
fragment.append(slotAnchor);
|
|
1484
|
+
fragment.append(native);
|
|
1478
1485
|
this.slotAnchor = slotAnchor;
|
|
1479
1486
|
this.slotArrow = slotArrow;
|
|
1480
1487
|
this.native = native;
|
|
1488
|
+
this.loaderEl = loader;
|
|
1481
1489
|
return fragment;
|
|
1482
1490
|
}
|
|
1483
1491
|
/**
|
|
@@ -1485,6 +1493,10 @@ class Popup extends WJElement {
|
|
|
1485
1493
|
*/
|
|
1486
1494
|
afterDraw() {
|
|
1487
1495
|
this.setAnchor();
|
|
1496
|
+
this.addEventListener("wje-popup:content-ready", () => {
|
|
1497
|
+
console.log("READY 1", this.loader);
|
|
1498
|
+
this.markContentReady();
|
|
1499
|
+
}, { once: true });
|
|
1488
1500
|
if (this.hasAttribute("active")) this.show(false);
|
|
1489
1501
|
if (!this.hasAttribute("active")) this.hide(false);
|
|
1490
1502
|
}
|
|
@@ -1510,6 +1522,7 @@ class Popup extends WJElement {
|
|
|
1510
1522
|
if (this.hasAttribute("active")) {
|
|
1511
1523
|
this.hide();
|
|
1512
1524
|
} else {
|
|
1525
|
+
event.dispatchCustomEvent(this, "wje-popup:aftershow");
|
|
1513
1526
|
this.show();
|
|
1514
1527
|
}
|
|
1515
1528
|
}
|
|
@@ -1584,6 +1597,11 @@ class Popup extends WJElement {
|
|
|
1584
1597
|
*/
|
|
1585
1598
|
show(dispatchEvent = true) {
|
|
1586
1599
|
var _a, _b, _c;
|
|
1600
|
+
if (this.loader) {
|
|
1601
|
+
this.native.classList.add("loading");
|
|
1602
|
+
this.loaderEl.classList.remove("fade-out");
|
|
1603
|
+
this.native.prepend(this.loaderEl);
|
|
1604
|
+
}
|
|
1587
1605
|
if (dispatchEvent) {
|
|
1588
1606
|
event.dispatchCustomEvent(this, "wje-popup:show");
|
|
1589
1607
|
}
|
|
@@ -1617,8 +1635,19 @@ class Popup extends WJElement {
|
|
|
1617
1635
|
this.removeAttribute("active");
|
|
1618
1636
|
}
|
|
1619
1637
|
}
|
|
1638
|
+
markContentReady() {
|
|
1639
|
+
this.native.classList.remove("loading");
|
|
1640
|
+
if (this.loader) {
|
|
1641
|
+
this.loaderEl.classList.add("fade-out");
|
|
1642
|
+
setTimeout(() => {
|
|
1643
|
+
var _a;
|
|
1644
|
+
(_a = this.loaderEl) == null ? void 0 : _a.remove();
|
|
1645
|
+
this.loader = false;
|
|
1646
|
+
}, 300);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1620
1649
|
}
|
|
1621
1650
|
export {
|
|
1622
1651
|
Popup as P
|
|
1623
1652
|
};
|
|
1624
|
-
//# sourceMappingURL=popup.element-
|
|
1653
|
+
//# sourceMappingURL=popup.element-CVbbnTWI.js.map
|