wj-elements 0.1.190 → 0.1.192
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/dark.css +4 -0
- package/dist/{form-associated-element-CaIxmEod.js → form-associated-element-o0UjvdUp.js} +6 -2
- package/dist/form-associated-element-o0UjvdUp.js.map +1 -0
- package/dist/light.css +10 -1
- package/dist/packages/index.d.ts +1 -1
- package/dist/packages/internals/form-associated-element.d.ts +5 -0
- package/dist/packages/wje-select/select.element.d.ts +89 -99
- package/dist/packages/wje-sliding-container/sliding-container.d.ts +2 -0
- package/dist/packages/wje-sliding-container/sliding-container.element.d.ts +265 -0
- package/dist/wje-button.js +0 -1
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-checkbox.js +1 -1
- package/dist/wje-chip.js +1 -1
- package/dist/wje-element.js +1 -1
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload.js +1 -5
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input.js +1 -1
- package/dist/wje-kanban.js +1 -1
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-master.js +36 -36
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-radio-group.js +1 -3
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +0 -1
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-select.js +127 -157
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-sliding-container.js +195 -110
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-textarea.js +1 -1
- package/package.json +1 -1
- package/dist/form-associated-element-CaIxmEod.js.map +0 -1
package/dist/dark.css
CHANGED
|
@@ -218,6 +218,10 @@
|
|
|
218
218
|
--wje-select-background: var(--wje-color-contrast-0);
|
|
219
219
|
--wje-select-color: var(--wje-color);
|
|
220
220
|
|
|
221
|
+
/* Sliding - Container */
|
|
222
|
+
--wje-sliding-container-background: transparent;
|
|
223
|
+
--wje-sliding-container-box-shadow: none;
|
|
224
|
+
|
|
221
225
|
/* Tab */
|
|
222
226
|
--wje-tab-color-active: var(--wje-color-primary-11);
|
|
223
227
|
--wje-tab-color-hover: var(--wje-color-primary-1);
|
|
@@ -27,7 +27,6 @@ class FormAssociatedElement extends WJElement {
|
|
|
27
27
|
* @returns {string} The type of the input.
|
|
28
28
|
*/
|
|
29
29
|
get type() {
|
|
30
|
-
console.log("LOCAL NAME", this.localName, this.getAttribute("type"));
|
|
31
30
|
return this.getAttribute("type");
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
@@ -170,6 +169,11 @@ class FormAssociatedElement extends WJElement {
|
|
|
170
169
|
}
|
|
171
170
|
errorMessageEl.textContent = internals.validationMessage;
|
|
172
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Checks the validity of the input by invoking custom validation logic
|
|
174
|
+
* and then verifying against internal validation rules.
|
|
175
|
+
* @returns {boolean} Returns true if the input is valid according to both custom validation and internal validation rules, otherwise false.
|
|
176
|
+
*/
|
|
173
177
|
checkValidity() {
|
|
174
178
|
this.validate();
|
|
175
179
|
return this.internals.checkValidity();
|
|
@@ -239,4 +243,4 @@ __publicField(FormAssociatedElement, "formAssociated", true);
|
|
|
239
243
|
export {
|
|
240
244
|
FormAssociatedElement as F
|
|
241
245
|
};
|
|
242
|
-
//# sourceMappingURL=form-associated-element-
|
|
246
|
+
//# sourceMappingURL=form-associated-element-o0UjvdUp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-associated-element-o0UjvdUp.js","sources":["../packages/internals/form-associated-element.js"],"sourcesContent":["import { default as WJElement, event } from \"../wje-element/element.js\";\n\nexport class FormAssociatedElement extends WJElement {\n static formAssociated = true;\n\n constructor() {\n super();\n this.internals = this.attachInternals();\n }\n\n /**\n * Sets the 'name' attribute to the given value.\n * @param {string} value The new value for the 'name' attribute.\n */\n set name(value) {\n this.setAttribute('name', value);\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string} The name of the input.\n */\n get name() {\n return this.getAttribute('name');\n }\n\n /**\n * Getter for the type attribute.\n * @returns {string} The type of the input.\n */\n get type() {\n return this.getAttribute(\"type\");\n }\n\n /**\n * Sets or removes the 'required' attribute on the element.\n * @param {boolean} value If true, adds the 'required' attribute. If false, removes the 'required' attribute.\n */\n set required(value) {\n if (value) {\n this.setAttribute('required', '');\n } else {\n this.removeAttribute('required');\n }\n }\n\n /**\n * Checks if the 'required' attribute is present on the element.\n * @returns {boolean} `true` if the 'required' attribute is set, otherwise `false`.\n */\n get required() {\n return this.hasAttribute('required');\n }\n\n /**\n * Setter for the invalid attribute.\n * @param {boolean} isInvalid Whether the input is invalid.\n */\n set invalid(isInvalid) {\n if (isInvalid) this.setAttribute('invalid', '');\n else this.removeAttribute('invalid');\n }\n\n /**\n * Getter for the invalid attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get invalid() {\n return this.hasAttribute('invalid');\n }\n\n /**\n * Set checked attribute.\n * @param {boolean} value true if the toggle is checked, false otherwise\n */\n set disabled(value) {\n if (value) {\n this.setAttribute('disabled', '');\n } else {\n this.removeAttribute('disabled');\n }\n }\n\n /**\n * Get disabled attribute value.\n * @returns {boolean} true if the toggle is disabled, false otherwise\n */\n get disabled() {\n return this.hasAttribute('disabled');\n }\n\n /**\n * Retrieves the form element associated with this object.\n * @returns {HTMLFormElement|null} The associated form element, or null if there isn't one.\n */\n get form() {\n return this.internals.form;\n }\n\n /**\n * Retrieves the validity state of the element by returning the validity object from the internal element.\n * The validity object provides information on whether the element satisfies its validation constraints.\n * @returns {ValidityState} The validity state object representing the element's validation constraints.\n */\n get validity() {\n return this.internals.validity;\n }\n\n /**\n * Retrieves the current validation message associated with the element.\n * @returns {string} The validation message that describes why the element's value fails validity checks.\n */\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n /**\n * Indicates whether the element is a candidate for constraint validation.\n * @returns {boolean} Returns true if the element will be validated during constraint validation, false otherwise.\n */\n get willValidate() {\n return this.internals.willValidate;\n }\n\n /**\n * Validates the input element associated with the component and updates its validity state\n * and error messages based on the user's input and the current validation rules.\n * @returns {void} This method does not return a value. It modifies the validity state\n * internally and sets appropriate validation messages.\n */\n validate() {\n const validState = this.input.validity;\n\n if (!validState.valid) {\n for (let state in validState) {\n const attr = `message-${state.toString()}`;\n\n if (validState[state]) {\n this.validationError = state.toString();\n let errorMessage = this.message;\n\n // TODO this take error messages based on lang from operating system of user should we implement custom translations based on app language ?\n if (!this.hasAttribute('message'))\n errorMessage = this.hasAttribute(attr) ? this.getAttribute(attr) : this.input.validationMessage;\n\n this.internals.setValidity({ [this.validationError]: true }, errorMessage, this.input);\n }\n }\n } else {\n this.internals.setValidity({});\n }\n }\n\n /**\n * Propagates a validation event based on the validity state of the component.\n *\n * This method checks the validity status of the component and emits a custom\n * event if the component is invalid. The event's name and additional details\n * can be specified.\n * @param {string} [eventName] The name of the event to dispatch when the component is invalid.\n * @param {object} [detail] Additional detail to include in the dispatched event.\n * @returns {void} This method does not return a value.\n */\n propagateValidation(eventName = 'invalid', detail = {}) {\n const internals = this.internals;\n\n this.invalid = !this.pristine && !internals.validity.valid;\n\n if (this.invalid) {\n event.dispatchCustomEvent(this, this.tagName.toLocaleLowerCase() + ':' + eventName, detail);\n }\n }\n\n /**\n * Displays an invalid message for the current element.\n * If an error message element does not exist within the designated slot,\n * it creates one and appends it to the slot. Updates the text content\n * of the error message element with the validation message from the\n * element's internals.\n * @returns {void} This method does not return any value.\n */\n showInvalidMessage() {\n const internals = this.internals;\n const slot = this.querySelector(\"[slot='error']\");\n let errorMessageEl = slot?.querySelector('[error-message]');\n\n if (!errorMessageEl) {\n const error = document.createElement('div');\n error.setAttribute('error-message', '');\n slot?.append(error);\n errorMessageEl = error;\n }\n\n errorMessageEl.textContent = internals.validationMessage;\n }\n\n /**\n * Checks the validity of the input by invoking custom validation logic\n * and then verifying against internal validation rules.\n * @returns {boolean} Returns true if the input is valid according to both custom validation and internal validation rules, otherwise false.\n */\n checkValidity() {\n // zavolá tvoju vlastnú validáciu pred kontrolou internals\n this.validate();\n return this.internals.checkValidity();\n }\n\n /**\n * Callback to handle the reset action for a form.\n * Resets the value of the form control to its default value, updates the form value, and clears any validity states.\n * @returns {void} Does not return a value.\n */\n formResetCallback() {\n this.value = this.defaultValue;\n this.internals.setFormValue(this.defaultValue);\n this.internals.setValidity({});\n }\n\n /**\n * Restores the form state by assigning the provided state value\n * and updating the internal form value and validity.\n * @param {object} state The state object containing the value to restore the form.\n * @param {*} state.value The value to set for the form element.\n * @returns {void} This method does not return any value.\n */\n formStateRestoreCallback(state) {\n this.value = state.value;\n this.internals.setFormValue(state.value);\n this.internals.setValidity({});\n }\n\n /**\n * Callback method to save the current state of a form.\n * This method captures and returns the form's value property.\n * @returns {object} An object containing the `value` property of the current form state.\n */\n formStateSaveCallback() {\n return {\n value: this.value\n };\n }\n\n /**\n * Toggles the disabled state of the component and updates corresponding attributes.\n * @param {boolean} disabled Indicates whether the form should be marked as disabled.\n * If true, the 'disabled' class is added, and the 'disabled' attribute is set.\n * If false, both the class and attribute are removed.\n * @returns {void}\n */\n formDisabledCallback(disabled) {\n this.native?.classList.toggle('disabled', disabled);\n this.toggleAttribute('disabled', disabled);\n }\n\n /**\n * A lifecycle callback that is executed when the element is associated with a form.\n * It updates the form's value field with the element's value and sets up an event\n * listener to perform validation and propagate it whenever the form is submitted.\n * @returns {void} Does not return any value.\n */\n formAssociatedCallback() {\n if (this.form) {\n this.internals.setFormValue(this.value);\n this.form?.addEventListener('submit', () => {\n this.validate();\n this.propagateValidation();\n });\n }\n }\n}"],"names":[],"mappings":";;;;;AAEO,MAAM,8BAA8B,UAAU;AAAA,EAGnD,cAAc;AACZ,UAAO;AACP,SAAK,YAAY,KAAK,gBAAiB;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA,EAME,IAAI,KAAK,OAAO;AACd,SAAK,aAAa,QAAQ,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;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOE,gBAAgB;AAEd,SAAK,SAAU;AACf,WAAO,KAAK,UAAU,cAAe;AAAA,EACzC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOE,oBAAoB;AAClB,SAAK,QAAQ,KAAK;AAClB,SAAK,UAAU,aAAa,KAAK,YAAY;AAC7C,SAAK,UAAU,YAAY,EAAE;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASE,yBAAyB,OAAO;AAC9B,SAAK,QAAQ,MAAM;AACnB,SAAK,UAAU,aAAa,MAAM,KAAK;AACvC,SAAK,UAAU,YAAY,EAAE;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOE,wBAAwB;AACtB,WAAO;AAAA,MACL,OAAO,KAAK;AAAA,IACb;AAAA,EACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASE,qBAAqB,UAAU;;AAC7B,eAAK,WAAL,mBAAa,UAAU,OAAO,YAAY;AAC1C,SAAK,gBAAgB,YAAY,QAAQ;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQE,yBAAyB;;AACvB,QAAI,KAAK,MAAM;AACb,WAAK,UAAU,aAAa,KAAK,KAAK;AACtC,iBAAK,SAAL,mBAAW,iBAAiB,UAAU,MAAM;AAC1C,aAAK,SAAU;AACf,aAAK,oBAAqB;AAAA,MAClC;AAAA,IACA;AAAA,EACA;AACA;AA1QE,cADW,uBACJ,kBAAiB;"}
|
package/dist/light.css
CHANGED
|
@@ -316,6 +316,10 @@
|
|
|
316
316
|
--wje-checkbox-border-radius: var(--wje-border-radius-medium);
|
|
317
317
|
|
|
318
318
|
/* Chip */
|
|
319
|
+
--wje-chip-background: var(--wje-color-contrast-3);
|
|
320
|
+
--wje-chip-color: var(--wje-color-contrast-11);
|
|
321
|
+
--wje-chip-background-hover: var(--wje-color-contrast-4);
|
|
322
|
+
--wje-chip-color-hover: var(--wje-color-contrast-11);
|
|
319
323
|
--wje-chip-border-radius: 100px;
|
|
320
324
|
--wje-chip-margin: 0;
|
|
321
325
|
|
|
@@ -392,7 +396,7 @@
|
|
|
392
396
|
--wje-input-label-display: block;
|
|
393
397
|
--wje-input-label-margin: 0;
|
|
394
398
|
--wje-input-label-padding: 0;
|
|
395
|
-
--wje-input-label-line-height:
|
|
399
|
+
--wje-input-label-line-height: var(--wje-line-height-normal);
|
|
396
400
|
--wje-input-label-font-size: var(--wje-font-size);
|
|
397
401
|
--wje-input-required-symbol: '*';
|
|
398
402
|
|
|
@@ -525,6 +529,11 @@
|
|
|
525
529
|
--wje-select-find-margin-block: var(--wje-spacing-x-small);
|
|
526
530
|
--wje-select-find-width: calc(100% - var(--wje-select-find-margin-inline) * 2);
|
|
527
531
|
|
|
532
|
+
/* Sliding - Container */
|
|
533
|
+
--wje-sliding-container-background: transparent;
|
|
534
|
+
--wje-sliding-container-box-shadow: none;
|
|
535
|
+
--wje-sliding-container-border-radius: var(--wje-border-radius-large);
|
|
536
|
+
|
|
528
537
|
/* Status */
|
|
529
538
|
--wje-status-size: var(--wje-size-small);
|
|
530
539
|
|
package/dist/packages/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ export { default as RouterOutlet } from './wje-router-outlet/router-outlet.js';
|
|
|
81
81
|
export { default as Row } from './wje-row/row.js';
|
|
82
82
|
export { default as Select } from './wje-select/select.js';
|
|
83
83
|
export { default as Slider } from './wje-slider/slider.js';
|
|
84
|
+
export { default as SlidingContainer } from './wje-sliding-container/sliding-container.js';
|
|
84
85
|
export { default as SplitView } from './wje-split-view/split-view.js';
|
|
85
86
|
export { default as Status } from './wje-status/status.js';
|
|
86
87
|
export { default as Step } from './wje-step/step.js';
|
|
@@ -100,7 +101,6 @@ export { default as Tooltip } from './wje-tooltip/tooltip.js';
|
|
|
100
101
|
export { default as Tree } from './wje-tree/tree.js';
|
|
101
102
|
export { default as TreeItem } from './wje-tree-item/tree-item.js';
|
|
102
103
|
export { default as VisuallyHidden } from './wje-visually-hidden/visually-hidden.js';
|
|
103
|
-
export { default as SlidingContainer } from '../experimental-packages/wje-sliding-container/sliding-container.js';
|
|
104
104
|
export { setBasePath, getBasePath } from './utils/base-path.js';
|
|
105
105
|
export { formatDate, toSafeDate } from './utils/date.js';
|
|
106
106
|
export { registerIconLibrary, unregisterIconLibrary } from './utils/icon-library.js';
|
|
@@ -96,6 +96,11 @@ export class FormAssociatedElement extends WJElement {
|
|
|
96
96
|
* @returns {void} This method does not return any value.
|
|
97
97
|
*/
|
|
98
98
|
showInvalidMessage(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Checks the validity of the input by invoking custom validation logic
|
|
101
|
+
* and then verifying against internal validation rules.
|
|
102
|
+
* @returns {boolean} Returns true if the input is valid according to both custom validation and internal validation rules, otherwise false.
|
|
103
|
+
*/
|
|
99
104
|
checkValidity(): boolean;
|
|
100
105
|
/**
|
|
101
106
|
* Callback to handle the reset action for a form.
|
|
@@ -64,11 +64,6 @@ export class Select extends FormAssociatedElement {
|
|
|
64
64
|
* @description A reference to the input element, initially null.
|
|
65
65
|
*/
|
|
66
66
|
input: HTMLElement | null;
|
|
67
|
-
/**
|
|
68
|
-
* @type {HTMLElement|null}
|
|
69
|
-
* @description A reference to the options wrapper element, initially null.
|
|
70
|
-
*/
|
|
71
|
-
optionsWrapper: HTMLElement | null;
|
|
72
67
|
/**
|
|
73
68
|
* @type {HTMLElement|null}
|
|
74
69
|
* @description A reference to the chips element, initially null.
|
|
@@ -85,7 +80,6 @@ export class Select extends FormAssociatedElement {
|
|
|
85
80
|
*/
|
|
86
81
|
list: HTMLElement | null;
|
|
87
82
|
_value: any[];
|
|
88
|
-
_selected: any[];
|
|
89
83
|
_selectedOptions: any[];
|
|
90
84
|
/**
|
|
91
85
|
* An object representing component dependencies with their respective classes.
|
|
@@ -112,26 +106,6 @@ export class Select extends FormAssociatedElement {
|
|
|
112
106
|
'wje-options': typeof Options;
|
|
113
107
|
'wje-checkbox': typeof Checkbox;
|
|
114
108
|
};
|
|
115
|
-
/**
|
|
116
|
-
* Sets the label value.
|
|
117
|
-
* @param {Array} value The selected value to set.
|
|
118
|
-
*/
|
|
119
|
-
set selected(value: any[]);
|
|
120
|
-
/**
|
|
121
|
-
* Returns the selected value.
|
|
122
|
-
* @returns {Array} The selected value.
|
|
123
|
-
*/
|
|
124
|
-
get selected(): any[];
|
|
125
|
-
/**
|
|
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.
|
|
128
|
-
*/
|
|
129
|
-
set validateOnChange(value: boolean);
|
|
130
|
-
/**
|
|
131
|
-
* Getter for the validateOnChange attribute.
|
|
132
|
-
* @returns {boolean} Whether the attribute is present.
|
|
133
|
-
*/
|
|
134
|
-
get validateOnChange(): boolean;
|
|
135
109
|
/**
|
|
136
110
|
* Sets the maximum number of options allowed.
|
|
137
111
|
* @param { number | object} value The value to set as the maximum number of options.
|
|
@@ -231,79 +205,80 @@ export class Select extends FormAssociatedElement {
|
|
|
231
205
|
*/
|
|
232
206
|
draw(): DocumentFragment;
|
|
233
207
|
findEl: HTMLElement;
|
|
208
|
+
displayInput: HTMLInputElement;
|
|
234
209
|
/**
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* @returns {void}
|
|
210
|
+
* Executes post-render logic for the custom element.
|
|
211
|
+
* This includes validation, event listener registration, managing custom attributes, and
|
|
212
|
+
* handling options initialization for the component.
|
|
213
|
+
* @returns {void} This method does not return any value.
|
|
239
214
|
*/
|
|
240
215
|
afterDraw(): void;
|
|
241
216
|
pristine: boolean;
|
|
242
217
|
/**
|
|
243
|
-
* Handles the option
|
|
244
|
-
*
|
|
218
|
+
* Handles the change event for an option element within a select-like component.
|
|
219
|
+
* This method processes user interactions with options and updates the state of the component,
|
|
220
|
+
* including selection management, validation, and UI updates. Behavior differs based on
|
|
221
|
+
* whether the component supports multiple selections.
|
|
222
|
+
* Key functionality:
|
|
223
|
+
* - Prevents the default behavior, event propagation, and immediate propagation of the event.
|
|
224
|
+
* - Retrieves all options within the component.
|
|
225
|
+
* - If the component doesn't support multiple selection:
|
|
226
|
+
* - Marks only the clicked option as selected and deselects others.
|
|
227
|
+
* - Hides the option popup.
|
|
228
|
+
* - If the component supports multiple selection:
|
|
229
|
+
* - Processes the clicked option without deselecting others.
|
|
230
|
+
* - Updates the selected options and triggers validation.
|
|
231
|
+
* - Marks the form state as non-pristine.
|
|
232
|
+
* - Propagates the validation state to other relevant parts of the component or system.
|
|
233
|
+
* @param {Event} e The event object representing the option change interaction.
|
|
245
234
|
*/
|
|
246
235
|
optionChange: (e: Event) => void;
|
|
247
236
|
/**
|
|
248
|
-
* Handles the selection
|
|
249
|
-
* @
|
|
250
|
-
* @param {
|
|
237
|
+
* Handles the logic for processing the selection state of a clicked option element.
|
|
238
|
+
* @function processClickedOption
|
|
239
|
+
* @param {Element} option The option element that is clicked.
|
|
240
|
+
* @param {boolean} [multiple] A Boolean indicating whether multiple options can be selected. Defaults to false.
|
|
241
|
+
* Changes the selected state of the passed option and updates the selected options list.
|
|
242
|
+
* Checks if the option already has a "selected" attribute, toggles its state,
|
|
243
|
+
* and updates the internal selected options.
|
|
251
244
|
*/
|
|
252
|
-
processClickedOption: (option:
|
|
253
|
-
/**
|
|
254
|
-
* Filters out a specified option from the `selectedOptions` array.
|
|
255
|
-
* This function removes an option from the `selectedOptions` array if its value
|
|
256
|
-
* matches the value of the option provided as an argument. It allows for dynamically
|
|
257
|
-
* updating the selected options by excluding the specified option.
|
|
258
|
-
* @param {object} option The option to be removed from the `selectedOptions` array.
|
|
259
|
-
* Should be an object containing a `value` property that is compared to the
|
|
260
|
-
* `value` property of objects in the `selectedOptions` array.
|
|
261
|
-
*/
|
|
262
|
-
filterOutOption: (option: object) => void;
|
|
245
|
+
processClickedOption: (option: Element, multiple?: boolean) => void;
|
|
263
246
|
/**
|
|
264
247
|
* Returns all the options as HTML.
|
|
265
248
|
* @returns {NodeList} The options as HTML.
|
|
266
249
|
*/
|
|
267
250
|
getAllOptions(): NodeList;
|
|
268
251
|
/**
|
|
269
|
-
* Handles the selection
|
|
270
|
-
*
|
|
271
|
-
* @param {
|
|
252
|
+
* Handles changes in the selection for a component, updating internal values, input fields,
|
|
253
|
+
* and visual presentation (like chips or slots) as per the given selection options.
|
|
254
|
+
* @param {Array|null} options The collection of selected option elements. If null, no options are selected.
|
|
255
|
+
* @param {number} length The total number of selected options.
|
|
256
|
+
* @returns {void}
|
|
272
257
|
*/
|
|
273
|
-
selectionChanged(options?:
|
|
258
|
+
selectionChanged(options?: any[] | null, length?: number): void;
|
|
274
259
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
* @
|
|
278
|
-
* @
|
|
279
|
-
* This method fetches the currently selected options and updates the `selectedOptions` array.
|
|
280
|
-
* It clears and rebuilds the chips representing the selected items in the UI.
|
|
281
|
-
* If the number of selected options reaches the maximum allowed (`maxOptions`), it stops updating the counter.
|
|
282
|
-
* Optionally, it dispatches a custom event when the selection changes unless `silence` is set to `true`.
|
|
283
|
-
* //@fires wje-select:change - Dispatched when the selection changes, unless `silence` is `true`.
|
|
284
|
-
* @example
|
|
285
|
-
* // Call the method and allow event dispatch
|
|
286
|
-
* selections();
|
|
287
|
-
* @example
|
|
288
|
-
* // Call the method without dispatching the event
|
|
289
|
-
* selections(true);
|
|
260
|
+
* Handles the logic for updating selections based on the current selected options,
|
|
261
|
+
* updating chips content, and dispatching change events if necessary.
|
|
262
|
+
* @param {boolean} [silence] If true, suppresses the dispatch of a custom change event.
|
|
263
|
+
* @returns {void} This method does not return a value.
|
|
290
264
|
*/
|
|
291
265
|
selections(silence?: boolean): void;
|
|
292
266
|
/**
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
267
|
+
* Updates the counter element to reflect the current state of selected values relative to the maximum allowed options.
|
|
268
|
+
* If the maximum options are selected, the counter element is removed. If it does not already exist and needs to be displayed, it is created.
|
|
269
|
+
* @returns {void} Does not return a value.
|
|
296
270
|
*/
|
|
297
271
|
counter(): void;
|
|
298
272
|
/**
|
|
299
|
-
*
|
|
300
|
-
* @param {
|
|
301
|
-
* @returns {
|
|
273
|
+
* Creates and returns a chip element with specified properties and a label.
|
|
274
|
+
* @param {object} option The configuration object for the chip. Typically includes properties such as value and textContent to set up the chip's label and data.
|
|
275
|
+
* @returns {HTMLElement} The newly created chip element with a label and default properties.
|
|
302
276
|
*/
|
|
303
|
-
getChip(option:
|
|
277
|
+
getChip(option: object): HTMLElement;
|
|
304
278
|
/**
|
|
305
|
-
* Handles the chip
|
|
306
|
-
* @param {Event} e The event.
|
|
279
|
+
* Handles the removal of a chip element from the DOM and updates the related state.
|
|
280
|
+
* @param {Event} e The event object triggered by the chip removal action.
|
|
281
|
+
* The target of the event is expected to be the chip element itself.
|
|
307
282
|
*/
|
|
308
283
|
removeChip: (e: Event) => void;
|
|
309
284
|
/**
|
|
@@ -325,44 +300,59 @@ export class Select extends FormAssociatedElement {
|
|
|
325
300
|
*/
|
|
326
301
|
htmlSelectedItem(item: any): any;
|
|
327
302
|
/**
|
|
328
|
-
* Adds
|
|
329
|
-
* @param {
|
|
330
|
-
* @param {boolean} [silent] Whether
|
|
331
|
-
* @param {object} [map]
|
|
303
|
+
* Adds a new option to the component.
|
|
304
|
+
* @param {object} optionData The data used to create the new option.
|
|
305
|
+
* @param {boolean} [silent] Whether the addition should trigger events or not.
|
|
306
|
+
* @param {object} [map] Mapping of keys to identify value and text in the optionData.
|
|
307
|
+
* @param {string} [map.value] The key in optionData that represents the value of the option.
|
|
308
|
+
* @param {string} [map.text] The key in optionData that represents the text of the option.
|
|
309
|
+
* @returns {void}
|
|
332
310
|
*/
|
|
333
|
-
addOption(optionData:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
*
|
|
311
|
+
addOption(optionData: object, silent?: boolean, map?: {
|
|
312
|
+
value?: string;
|
|
313
|
+
text?: string;
|
|
314
|
+
}): void;
|
|
315
|
+
/**
|
|
316
|
+
* Adds one or more options to a collection. If the input is an array, it adds each option within the array.
|
|
317
|
+
* Otherwise, it adds a single option.
|
|
318
|
+
* @param {Array | object} optionsData The data representing the options to be added. It can be a single object or an array of objects.
|
|
319
|
+
* @param {boolean} [silent] Optional flag to determine if events or notifications should be suppressed while adding options.
|
|
320
|
+
* @param {object} [map] An optional mapping object specifying how to map data properties to value and text for the options.
|
|
321
|
+
* @param {string} [map.value] The property in the optionsData that represents the value of the option.
|
|
322
|
+
* @param {string} [map.text] The property in the optionsData that represents the text of the option.
|
|
323
|
+
* @returns {void}
|
|
339
324
|
*/
|
|
340
|
-
addOptions(optionsData: any[] | object, silent?: boolean, map?:
|
|
325
|
+
addOptions(optionsData: any[] | object, silent?: boolean, map?: {
|
|
326
|
+
value?: string;
|
|
327
|
+
text?: string;
|
|
328
|
+
}): void;
|
|
341
329
|
/**
|
|
342
|
-
* Selects an option
|
|
330
|
+
* Selects an option from the available options within the component.
|
|
343
331
|
* @param {string} value The value of the option to be selected.
|
|
344
|
-
* @param {boolean} [silent]
|
|
332
|
+
* @param {boolean} [silent] Determines whether the selection should trigger notification or updates. Defaults to false.
|
|
333
|
+
* @returns {void} Does not return a value.
|
|
345
334
|
*/
|
|
346
335
|
selectOption(value: string, silent?: boolean): void;
|
|
347
336
|
/**
|
|
348
|
-
* Selects
|
|
349
|
-
*
|
|
350
|
-
* @param {
|
|
337
|
+
* Selects multiple options based on the provided values. If a single value is provided, it selects that option.
|
|
338
|
+
* If an array of values is provided, it iterates through the array and selects each option.
|
|
339
|
+
* @param {any|any[]} values A single value or an array of values to be selected.
|
|
340
|
+
* @param {boolean} [silent] Determines whether the selection action should occur silently without triggering other side effects or events.
|
|
341
|
+
* @returns {void} This method does not return a value.
|
|
351
342
|
*/
|
|
352
|
-
selectOptions(values: any
|
|
343
|
+
selectOptions(values: any | any[], silent?: boolean): void;
|
|
353
344
|
/**
|
|
354
|
-
* Clones and appends an icon
|
|
355
|
-
* @param {HTMLElement} option The target
|
|
356
|
-
* @returns {void}
|
|
345
|
+
* Clones and appends an icon with the "check" slot to the specified option element.
|
|
346
|
+
* @param {HTMLElement} option The target HTML element to which the cloned "check" icon will be appended.
|
|
347
|
+
* @returns {void} This method does not return a value, but it modifies the DOM by appending a cloned "check" icon to the provided option element.
|
|
357
348
|
*/
|
|
358
349
|
optionCheckSlot(option: HTMLElement): void;
|
|
359
350
|
/**
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* @returns {
|
|
351
|
+
* Clears all selected options and resets selections.
|
|
352
|
+
* The method ensures that all options are deselected, updates the internal state, validates the selections,
|
|
353
|
+
* propagates the validation status, and indicates invalid state if necessary.
|
|
354
|
+
* @returns {void} No value is returned by this method.
|
|
364
355
|
*/
|
|
365
|
-
areAllElementsInOptions(elements: any[], options: any[]): boolean;
|
|
366
356
|
clearSelections(): void;
|
|
367
357
|
#private;
|
|
368
358
|
}
|