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
package/dist/wje-input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-input.js","sources":["../packages/wje-input/input.element.js","../packages/wje-input/input.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a custom input element. It extends the WJElement class and provides additional functionality for handling input.\n * @documentation https://elements.webjet.sk/components/input\n * @status stable\n * @augments WJElement\n * @csspart native - The native part.\n * @csspart wrapper - The wrapper part.\n * @csspart input - The input part.\n * @csspart clear - The clear part.\n * @slot start - Slot for content at the start of the input.\n * @slot end - Slot for content at the end of the input.\n * @cssproperty [--wje-input-font-family=var(--wje-font-family)] - Defines the font family for the input text.\n * @cssproperty [--wje-input-background-color=var(--wje-background)] - Specifies the background color of the input field.\n * @cssproperty [--wje-input-color=var(--wje-color)] - Sets the text color within the input field.\n * @cssproperty [--wje-input-color-invalid=var(--wje-color-danger)] - Changes the text color when the input value is invalid.\n * @cssproperty [--wje-input-border-color=var(--wje-border-color)] - Defines the border color of the input field.\n * @cssproperty [--wje-input-border-color-focus=var(--wje-color-primary)] - Specifies the border color when the input is focused.\n * @cssproperty [--wje-input-border-width=1px] - Sets the width of the input border.\n * @cssproperty [--wje-input-border-style=solid] - Defines the border style of the input (e.g., solid, dashed).\n * @cssproperty [--wje-input-border-radius=4px] - Specifies the border radius, creating rounded corners.\n * @cssproperty [--wje-input-margin-bottom=.5rem] - Adds spacing below the input field.\n * @cssproperty [--wje-input-line-height=20px] - Sets the line height of the text within the input field.\n * @cssproperty [--wje-input-slot-padding-inline=.5rem] - Controls the padding on the left and right of the input slot content.\n * // @fires wje-input:input - Dispatched when the input value changes.\n * // @fires wje-input:clear - Dispatched when the input is cleared.\n */\nexport default class Input extends WJElement {\n /**\n * Creates an instance of Input.\n */\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n this.internals = this.attachInternals();\n\n // Create a mutation observer instance to watch for changes in attributes\n this.observer = new MutationObserver(this.observeFunction);\n }\n\n observeFunction = (mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'attributes') {\n const attributeName = mutation.attributeName;\n const oldValue = mutation.oldValue;\n const newValue = this.getAttribute(attributeName);\n\n console.log(`Attribute ${attributeName} changed from ${oldValue} to ${newValue}`);\n }\n });\n }\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n this.internals.setFormValue(value);\n\n if (this.input) this.input.value = value;\n\n this.pristine = false;\n this._value = value;\n }\n\n /**\n * Retrieves the value from the input element if available; otherwise,\n * returns the internal _value property or an empty string as the default.\n * @returns {string} The current value from the input element, the internal _value, or an empty string.\n */\n get value() {\n return this.input?.value ?? this._value ?? '';\n }\n\n /**\n * Sets the label attribute of the element.\n * @param {string} value The value to set as the label attribute.\n */\n set label(value) {\n this.setAttribute('label', value);\n }\n\n /**\n * Retrieves the value of the 'label' attribute if it exists.\n * If the 'label' attribute is not set, it returns false.\n * @returns {string|boolean} The value of the 'label' attribute as a string, or false if the attribute is not set.\n */\n get label() {\n return this.getAttribute('label') || false;\n }\n\n /**\n * Sets the custom error display attribute for an element.\n * @param {boolean} value If true, adds the 'custom-error-display' attribute to the element. If false, removes the attribute from the element.\n */\n set customErrorDisplay(value) {\n if (value) {\n this.setAttribute('custom-error-display', '');\n } else {\n this.removeAttribute('custom-error-display');\n }\n }\n\n /**\n * Getter for the customErrorDisplay attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get customErrorDisplay() {\n return this.hasAttribute('custom-error-display');\n }\n\n /**\n * Sets the `validateOnChange` property. If set to a truthy value, it adds the\n * `validate-on-change` attribute to the element. If set to a falsy value, it\n * removes the `validate-on-change` attribute from the element.\n * @param {boolean} value Determines whether to add or remove the\n * `validate-on-change` attribute. A truthy value adds the attribute, whereas a\n * falsy value removes it.\n */\n set validateOnChange(value) {\n if (value) {\n this.setAttribute('validate-on-change', '');\n } else {\n this.removeAttribute('validate-on-change');\n }\n }\n\n /**\n * Getter for the validateOnChange attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get validateOnChange() {\n return this.hasAttribute('validate-on-change');\n }\n\n /**\n * Sets or removes the 'invalid' attribute on an element based on the provided value.\n * @param {boolean} value If true, the 'invalid' attribute is set. If false, the 'invalid' attribute is removed.\n */\n set invalid(value) {\n if (value) {\n this.setAttribute('invalid', '');\n } else {\n this.removeAttribute('invalid');\n }\n }\n\n /**\n * Gets the value of the 'invalid' attribute.\n * Determines whether the 'invalid' attribute is present on the element.\n * @returns {boolean} True if the 'invalid' attribute is present, otherwise false.\n */\n get invalid() {\n return this.hasAttribute('invalid');\n }\n\n /**\n * Getter for the form attribute.\n * @returns {HTMLFormElement} The form the input is associated with.\n */\n get form() {\n return this.internals.form;\n }\n\n /**\n * Getter for the name attribute.\n * @returns {string} The name of the input element.\n */\n get name() {\n return this.getAttribute('name');\n }\n\n /**\n * Getter for the validity attribute.\n * @returns {ValidityState} The validity state of the input.\n */\n get validity() {\n return this.internals.validity;\n }\n\n /**\n * Getter for the validationMessage attribute.\n * @returns {string} The validation message of the input element.\n */\n get validationMessage() {\n return this.internals.validationMessage;\n }\n\n /**\n * Getter for the willValidate attribute.\n * @returns {boolean} Whether the input will be validated.\n */\n get willValidate() {\n return this.internals.willValidate;\n }\n\n /**\n * @summary Getter for the defaultValue attribute.\n * This method retrieves the 'value' attribute of the custom input element.\n * The 'value' attribute represents the default value of the input element.\n * If the 'value' attribute is not set, it returns an empty string.\n * @returns {string} The default value of the input element.\n */\n get defaultValue() {\n return this.getAttribute('value') ?? '';\n }\n\n /**\n * @summary Setter for the defaultValue attribute.\n * This method sets the 'value' attribute of the custom input element to the provided value.\n * The 'value' attribute represents the default value of the input element.\n * @param {string} value The value to set as the default value.\n */\n set defaultValue(value) {\n this.setAttribute('value', value);\n }\n\n /**\n * Sets or removes the 'clearable' attribute on the element.\n * When set to a truthy value, the 'clearable' attribute is added; when falsy, the attribute is removed.\n * @param {boolean} value Determines whether to set or remove the 'clearable' attribute. If true, the 'clearable' attribute is added. If false, it is removed.\n */\n set clearable(value) {\n if (value) {\n this.setAttribute('clearable', '');\n } else {\n this.removeAttribute('clearable');\n }\n }\n\n /**\n * Checks if the 'clearable' attribute is present on the element.\n * @returns {boolean} True if the 'clearable' attribute is set, otherwise false.\n */\n get clearable() {\n return this.hasAttribute('clearable');\n }\n\n /**\n * Sets the placeholder value for an element. If the provided value is non-empty,\n * it assigns the value to the \"placeholder\" attribute. Otherwise, it removes\n * the \"placeholder\" attribute from the element.\n * @param {string} value The placeholder text to set or null/undefined to remove the attribute.\n */\n set placeholder(value) {\n if (value) {\n this.setAttribute('placeholder', value);\n } else {\n this.removeAttribute('placeholder');\n }\n }\n\n /**\n * Retrieves the value of the 'placeholder' attribute from the element.\n * If the attribute is not set, it returns an empty string.\n * @returns {string} The value of the 'placeholder' attribute or an empty string if not set.\n */\n get placeholder() {\n return this.getAttribute('placeholder') || '';\n }\n\n /**\n * Sets the `variant` attribute on the element. If a value is provided, it will set the attribute to the given value.\n * If no value is provided, it removes the `variant` attribute from the element.\n * @param {string} value The value to set for the `variant` attribute. If falsy, the attribute is removed.\n */\n set variant(value) {\n if (value) {\n this.setAttribute('variant', value);\n } else {\n this.removeAttribute('variant');\n }\n }\n\n /**\n * Retrieves the value of the 'variant' attribute from the element.\n * If the attribute is not set, it defaults to 'default'.\n * @returns {string} The value of the 'variant' attribute or 'default' if not set.\n */\n get variant() {\n return this.getAttribute('variant') || 'default';\n }\n\n /**\n * The class name of the input element.\n * @type {string}\n */\n className = 'Input';\n\n /**\n * Getter for the cssStyleSheet attribute.\n * @returns {CSSStyleSheet} The CSS style sheet of the input element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return ['value', 'name', 'disabled', 'placeholder', 'label', 'message', 'error-inline'];\n }\n\n /**\n * Whether the input is associated with a form.\n * @type {boolean}\n */\n static formAssociated = true;\n\n /**\n * Sets up the attributes for the input.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n // if some value was set via value setter then dont use default value\n if (this.pristine) {\n this.value = this.defaultValue;\n this.pristine = false;\n }\n }\n\n beforeDraw() {\n this.observer.disconnect();\n }\n\n /**\n * Draws the input element.\n * @returns {DocumentFragment} The drawn input.\n */\n draw() {\n let hasSlotStart = this.hasSlot(this, 'start');\n let hasSlotEnd = this.hasSlot(this, 'end');\n let hasSlotError = this.hasSlot(this, 'error');\n let fragment = document.createDocumentFragment();\n\n // Wrapper\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-input', this.variant);\n\n if (this.hasAttribute('invalid')) native.classList.add('has-error');\n\n let wrapper = document.createElement('div');\n wrapper.classList.add('wrapper');\n\n let inputWrapper = document.createElement('div');\n inputWrapper.setAttribute('part', 'wrapper');\n inputWrapper.classList.add('input-wrapper');\n\n // Label\n let label = document.createElement('label');\n label.setAttribute('part', 'label');\n label.innerText = this.label;\n if (this.value && !this.hasAttribute('error')) label.classList.add('fade');\n\n // Input\n let input = document.createElement('input');\n input.setAttribute('type', 'text');\n input.setAttribute('part', 'input');\n input.setAttribute('value', this.value || '');\n input.classList.add('form-control');\n\n const attributes = Array.from(this.attributes).map((attr) => attr.name);\n\n attributes.forEach((attr) => {\n if (this.hasAttribute(attr)) {\n input.setAttribute(attr, this[attr] || '');\n }\n });\n\n // Error\n let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n let start = null;\n if (hasSlotStart) {\n start = document.createElement('slot');\n start.setAttribute('name', 'start');\n start.setAttribute('part', 'start');\n }\n\n let end = null;\n if (hasSlotEnd) {\n end = document.createElement('slot');\n end.setAttribute('name', 'end');\n end.setAttribute('part', 'end');\n }\n\n if (hasSlotStart) {\n wrapper.appendChild(start); // zmenene\n native.classList.add('has-start');\n }\n\n if (this.label) {\n if (this.variant === 'standard') {\n native.append(label);\n } else {\n inputWrapper.appendChild(label);\n }\n }\n\n inputWrapper.appendChild(input);\n wrapper.appendChild(inputWrapper);\n\n native.appendChild(wrapper);\n\n // if (hasSlotError) {\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n\n // if (this.hasAttribute('error-inline')) {\n // inline version of error message\n native.append(errorSlot);\n // } else {\n // tooltip version of error message\n // error.appendChild(errorSlot);\n // wrapper.appendChild(error);\n // }\n\n // if (!hasSlotError) {\n this.append(error);\n // }\n\n if (this.clearable) {\n this.clear = document.createElement('wje-button');\n this.clear.classList.add('clear');\n this.clear.setAttribute('fill', 'link');\n this.clear.setAttribute('part', 'clear');\n\n let clearIcon = document.createElement('wje-icon');\n clearIcon.setAttribute('name', 'x');\n this.clear.appendChild(clearIcon);\n inputWrapper.appendChild(this.clear);\n }\n\n if (hasSlotEnd) {\n wrapper.appendChild(end);// zmenene\n native.classList.add('has-end');\n }\n\n fragment.appendChild(native);\n\n this.native = native;\n this.labelElement = label;\n this.input = input;\n this.errorMessage = error;\n\n return fragment;\n }\n\n /**\n * Runs after the input is drawn to the DOM.\n */\n afterDraw() {\n this.input.addEventListener('focus', (e) => {\n this.labelElement.classList.add('fade');\n this.native.classList.add('focused');\n });\n\n this.input.addEventListener('blur', (e) => {\n this.native.classList.remove('focused');\n if (!e.target.value) this.labelElement.classList.remove('fade');\n });\n\n this.input.addEventListener('input', (e) => {\n this.validateInput();\n\n if (this.validateOnChange) {\n this.pristine = false;\n this.propagateValidation();\n }\n\n this.input.classList.remove('pristine');\n this.labelElement.classList.add('fade');\n\n const clone = new e.constructor(e.type, e);\n this.dispatchEvent(clone);\n\n event.dispatchCustomEvent(this, 'wje-input:input', {\n value: this.input.value,\n });\n\n this.value = this.input.value;\n });\n\n this.addEventListener('invalid', (e) => {\n this.invalid = true;\n this.pristine = false;\n\n this.showInvalidMessage();\n\n if (this.customErrorDisplay) {\n e.preventDefault();\n }\n });\n\n this.addEventListener('focus', () => this.input.focus());\n\n if (this.clear) {\n this.clear.addEventListener('wje-button:click', (e) => {\n this.input.value = '';\n event.dispatchCustomEvent(this.clear, 'wje-input:clear');\n });\n }\n\n this.validateInput();\n\n if (this.hasAttribute('invalid')) {\n this.showInvalidMessage();\n }\n\n this.observer.observe(this, {\n attributes: true, // Watch for attribute changes\n attributeOldValue: true, // Keep track of the old value of attributes\n });\n }\n\n componentCleanup() {\n this.observer.disconnect();\n }\n\n /**\n * @summary Displays the validation message for the input.\n * 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.\n * If the input does not have an 'error' slot, it sets the text content of the errorMessage property to the validation message.\n */\n showInvalidMessage() {\n let hasSlotError = this.hasSlot(this, 'error');\n\n if (hasSlotError) {\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 = this.internals.validationMessage;\n } else {\n this.errorMessage.textContent = this.internals.validationMessage;\n }\n }\n\n /**\n * @summary Validates the input.\n * This method checks the validity state of the input. If the input is not valid, it iterates over the validity state object.\n * For each invalid state, it constructs an attribute name and checks if the input has this attribute.\n * If the input has the attribute, it sets the validation error to the state and the error message to the attribute value.\n * If the input does not have the attribute, it sets the error message to the default validation message of the input.\n * 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.\n * If the input is valid, it sets the validity in the form internals to an empty object.\n */\n validateInput() {\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);\n }\n }\n } else {\n this.internals.setValidity({});\n }\n }\n\n /**\n * Checks and updates the validation state of the component based on its current properties.\n * If the component is invalid and a custom error display is enabled, it dispatches an 'invalid' event.\n * @returns {void} This method does not return a value.\n */\n propagateValidation() {\n this.invalid = !this.pristine && !this.validity.valid;\n\n // if (this.invalid && this.customErrorDisplay) {\n if (this.invalid) {\n event.dispatchCustomEvent(this, 'invalid');\n }\n }\n\n /**\n * Checks whether the input has a slot.\n * @param {HTMLElement} el The element to check.\n * @param {string} slotName The name of the slot to check for.\n * @returns {boolean} Whether the input has the slot.\n */\n hasSlot(el, slotName = null) {\n let selector = slotName ? `[slot=\"${slotName}\"]` : '[slot]';\n\n return el.querySelectorAll(selector).length > 0 ? true : false;\n }\n\n /**\n * @summary Callback function that is called when the custom element is associated with a form.\n * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.\n * @param {HTMLFormElement} form The form the custom element is associated with.\n */\n formAssociatedCallback(form) {\n if (form) {\n this.internals.setFormValue(this.value);\n form?.addEventListener('submit', () => {\n this.validateInput();\n this.propagateValidation();\n });\n }\n }\n\n /**\n * The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.\n * This method is responsible for resetting the value of the custom input element to its default value.\n * It also resets the form value and validity state in the form internals.\n * @function\n */\n formResetCallback() {\n // Set the value of the custom input element to its default value\n this.value = this.defaultValue;\n // Reset the form value in the form internals to the default value\n this.internals.setFormValue(this.defaultValue);\n // Reset the validity state in the form internals\n this.internals.setValidity({});\n }\n\n /**\n * The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.\n * This method is responsible for restoring the value of the custom input element to its saved state.\n * It also restores the form value and validity state in the form internals to their saved states.\n * @param {object} state The saved state of the custom input element.\n * @function\n */\n formStateRestoreCallback(state) {\n // Set the value of the custom input element to its saved value\n this.value = state.value;\n // Restore the form value in the form internals to the saved value\n this.internals.setFormValue(state.value);\n // Restore the validity state in the form internals to the saved state\n this.internals.setValidity({});\n }\n\n /**\n * The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.\n * This method is responsible for saving the value of the custom input element.\n * @returns {object} The saved state of the custom input element.\n * @function\n */\n formStateSaveCallback() {\n return {\n value: this.value,\n };\n }\n\n /**\n * The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.\n * This method is not implemented yet.\n * @param {boolean} disabled The new disabled state of the custom input element.\n * @function\n */\n formDisabledCallback(disabled) {\n console.warn('formDisabledCallback not implemented yet');\n }\n\n // dispatchEvent(e) {\n // return false;\n // }\n}\n","import Input from './input.element.js';\n\nexport default Input;\n\nInput.define('wje-input', Input);\n"],"names":[],"mappings":";;;;;;AA6Be,MAAM,cAAc,UAAU;AAAA;AAAA;AAAA;AAAA,EAIzC,cAAc;AACV,UAAO;AAUX,2CAAkB,CAAC,cAAc;AAC7B,gBAAU,QAAQ,CAAC,aAAa;AAC5B,YAAI,SAAS,SAAS,cAAc;AAChC,gBAAM,gBAAgB,SAAS;AAC/B,gBAAM,WAAW,SAAS;AAC1B,gBAAM,WAAW,KAAK,aAAa,aAAa;AAEhD,kBAAQ,IAAI,aAAa,aAAa,iBAAiB,QAAQ,OAAO,QAAQ,EAAE;AAAA,QAChG;AAAA,MACA,CAAS;AAAA,IACT;AA6OI;AAAA;AAAA;AAAA;AAAA,qCAAY;AA/PR,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,YAAY,KAAK,gBAAiB;AAGvC,SAAK,WAAW,IAAI,iBAAiB,KAAK,eAAe;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBI,IAAI,MAAM,OAAO;AACb,SAAK,UAAU,aAAa,KAAK;AAEjC,QAAI,KAAK,MAAO,MAAK,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U,aAAa,KAAK,YAAY;AAE7C,SAAK,UAAU,YAAY,EAAE;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,yBAAyB,OAAO;AAE5B,SAAK,QAAQ,MAAM;AAEnB,SAAK,UAAU,aAAa,MAAM,KAAK;AAEvC,SAAK,UAAU,YAAY,EAAE;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQI,wBAAwB;AACpB,WAAO;AAAA,MACH,OAAO,KAAK;AAAA,IACf;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQI,qBAAqB,UAAU;AAC3B,YAAQ,KAAK,0CAA0C;AAAA,EAC/D;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAAA;AAhXI,cA5RiB,OA4RV,kBAAiB;ACrT5B,MAAM,OAAO,aAAa,KAAK;"}
|
|
1
|
+
{"version":3,"file":"wje-input.js","sources":["../packages/wje-input/input.element.js","../packages/wje-input/input.js"],"sourcesContent":["import { FormAssociatedElement } from '../internals/form-associated-element.js';\nimport { event } from '../utils/event.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * @summary This class represents a custom input element. It extends the WJElement class and provides additional functionality for handling input.\n * @documentation https://elements.webjet.sk/components/input\n * @status stable\n * @augments {FormAssociatedElement}\n * @csspart native - The native part.\n * @csspart wrapper - The wrapper part.\n * @csspart input - The input part.\n * @csspart clear - The clear part.\n * @slot start - Slot for content at the start of the input.\n * @slot end - Slot for content at the end of the input.\n * @cssproperty [--wje-input-font-family=var(--wje-font-family)] - Defines the font family for the input text.\n * @cssproperty [--wje-input-background-color=var(--wje-background)] - Specifies the background color of the input field.\n * @cssproperty [--wje-input-color=var(--wje-color)] - Sets the text color within the input field.\n * @cssproperty [--wje-input-color-invalid=var(--wje-color-danger)] - Changes the text color when the input value is invalid.\n * @cssproperty [--wje-input-border-color=var(--wje-border-color)] - Defines the border color of the input field.\n * @cssproperty [--wje-input-border-color-focus=var(--wje-color-primary)] - Specifies the border color when the input is focused.\n * @cssproperty [--wje-input-border-width=1px] - Sets the width of the input border.\n * @cssproperty [--wje-input-border-style=solid] - Defines the border style of the input (e.g., solid, dashed).\n * @cssproperty [--wje-input-border-radius=4px] - Specifies the border radius, creating rounded corners.\n * @cssproperty [--wje-input-margin-bottom=.5rem] - Adds spacing below the input field.\n * @cssproperty [--wje-input-line-height=20px] - Sets the line height of the text within the input field.\n * @cssproperty [--wje-input-slot-padding-inline=.5rem] - Controls the padding on the left and right of the input slot content.\n * // @fires wje-input:input - Dispatched when the input value changes.\n * // @fires wje-input:clear - Dispatched when the input is cleared.\n */\nexport default class Input extends FormAssociatedElement {\n /**\n * Creates an instance of Input.\n */\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n }\n\n /**\n * Setter for the value attribute.\n * @param {string} value The value to set.\n */\n set value(value) {\n this.internals.setFormValue(value);\n\n if (this.input) this.input.value = value;\n\n this.pristine = false;\n this._value = value;\n }\n\n /**\n * Retrieves the value from the input element if available; otherwise,\n * returns the internal _value property or an empty string as the default.\n * @returns {string} The current value from the input element, the internal _value, or an empty string.\n */\n get value() {\n return this.input?.value ?? this._value ?? '';\n }\n\n /**\n * Sets the label attribute of the element.\n * @param {string} value The value to set as the label attribute.\n */\n set label(value) {\n this.setAttribute('label', value);\n }\n\n /**\n * Retrieves the value of the 'label' attribute if it exists.\n * If the 'label' attribute is not set, it returns false.\n * @returns {string|boolean} The value of the 'label' attribute as a string, or false if the attribute is not set.\n */\n get label() {\n return this.getAttribute('label') || false;\n }\n\n /**\n * Sets the custom error display attribute for an element.\n * @param {boolean} value If true, adds the 'custom-error-display' attribute to the element. If false, removes the attribute from the element.\n */\n set customErrorDisplay(value) {\n if (value) {\n this.setAttribute('custom-error-display', '');\n } else {\n this.removeAttribute('custom-error-display');\n }\n }\n\n /**\n * Getter for the customErrorDisplay attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get customErrorDisplay() {\n return this.hasAttribute('custom-error-display');\n }\n\n /**\n * Sets the `validateOnChange` property. If set to a truthy value, it adds the\n * `validate-on-change` attribute to the element. If set to a falsy value, it\n * removes the `validate-on-change` attribute from the element.\n * @param {boolean} value Determines whether to add or remove the\n * `validate-on-change` attribute. A truthy value adds the attribute, whereas a\n * falsy value removes it.\n */\n set validateOnChange(value) {\n if (value) {\n this.setAttribute('validate-on-change', '');\n } else {\n this.removeAttribute('validate-on-change');\n }\n }\n\n /**\n * Getter for the validateOnChange attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get validateOnChange() {\n return this.hasAttribute('validate-on-change');\n }\n\n /**\n * @summary Getter for the defaultValue attribute.\n * This method retrieves the 'value' attribute of the custom input element.\n * The 'value' attribute represents the default value of the input element.\n * If the 'value' attribute is not set, it returns an empty string.\n * @returns {string} The default value of the input element.\n */\n get defaultValue() {\n return this.getAttribute('value') ?? '';\n }\n\n /**\n * @summary Setter for the defaultValue attribute.\n * This method sets the 'value' attribute of the custom input element to the provided value.\n * The 'value' attribute represents the default value of the input element.\n * @param {string} value The value to set as the default value.\n */\n set defaultValue(value) {\n this.setAttribute('value', value);\n }\n\n /**\n * Sets or removes the 'clearable' attribute on the element.\n * When set to a truthy value, the 'clearable' attribute is added; when falsy, the attribute is removed.\n * @param {boolean} value Determines whether to set or remove the 'clearable' attribute. If true, the 'clearable' attribute is added. If false, it is removed.\n */\n set clearable(value) {\n if (value) {\n this.setAttribute('clearable', '');\n } else {\n this.removeAttribute('clearable');\n }\n }\n\n /**\n * Checks if the 'clearable' attribute is present on the element.\n * @returns {boolean} True if the 'clearable' attribute is set, otherwise false.\n */\n get clearable() {\n return this.hasAttribute('clearable');\n }\n\n /**\n * Sets the placeholder value for an element. If the provided value is non-empty,\n * it assigns the value to the \"placeholder\" attribute. Otherwise, it removes\n * the \"placeholder\" attribute from the element.\n * @param {string} value The placeholder text to set or null/undefined to remove the attribute.\n */\n set placeholder(value) {\n if (value) {\n this.setAttribute('placeholder', value);\n } else {\n this.removeAttribute('placeholder');\n }\n }\n\n /**\n * Retrieves the value of the 'placeholder' attribute from the element.\n * If the attribute is not set, it returns an empty string.\n * @returns {string} The value of the 'placeholder' attribute or an empty string if not set.\n */\n get placeholder() {\n return this.getAttribute('placeholder') || '';\n }\n\n /**\n * Sets the `variant` attribute on the element. If a value is provided, it will set the attribute to the given value.\n * If no value is provided, it removes the `variant` attribute from the element.\n * @param {string} value The value to set for the `variant` attribute. If falsy, the attribute is removed.\n */\n set variant(value) {\n if (value) {\n this.setAttribute('variant', value);\n } else {\n this.removeAttribute('variant');\n }\n }\n\n /**\n * Retrieves the value of the 'variant' attribute from the element.\n * If the attribute is not set, it defaults to 'default'.\n * @returns {string} The value of the 'variant' attribute or 'default' if not set.\n */\n get variant() {\n return this.getAttribute('variant') || 'default';\n }\n\n /**\n * The class name of the input element.\n * @type {string}\n */\n className = 'Input';\n\n /**\n * Getter for the cssStyleSheet attribute.\n * @returns {CSSStyleSheet} The CSS style sheet of the input element.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes attribute of the input element.\n * @returns {Array} The attributes to observe for changes.\n */\n static get observedAttributes() {\n return ['value', 'name', 'disabled', 'placeholder', 'label', 'message', 'error-inline'];\n }\n\n /**\n * Sets up the attributes for the input.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n // if some value was set via value setter then dont use default value\n if (this.pristine) {\n this.value = this.defaultValue;\n this.pristine = false;\n }\n }\n\n /**\n * Draws the input element.\n * @returns {DocumentFragment} The drawn input.\n */\n draw() {\n let hasSlotStart = this.hasSlot(this, 'start');\n let hasSlotEnd = this.hasSlot(this, 'end');\n let hasSlotError = this.hasSlot(this, 'error');\n let fragment = document.createDocumentFragment();\n\n // Wrapper\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-input', this.variant);\n\n if (this.invalid) native.classList.add('has-error');\n\n let wrapper = document.createElement('div');\n wrapper.classList.add('wrapper');\n\n let inputWrapper = document.createElement('div');\n inputWrapper.setAttribute('part', 'wrapper');\n inputWrapper.classList.add('input-wrapper');\n\n // Label\n let label = document.createElement('label');\n label.setAttribute('part', 'label');\n label.innerText = this.label;\n if (this.value && !this.hasAttribute('error')) label.classList.add('fade');\n\n // Input\n let input = document.createElement('input');\n input.setAttribute('type', 'tralala');\n input.setAttribute('part', 'input');\n input.setAttribute('value', this.value || '');\n input.classList.add('form-control');\n\n const attributes = Array.from(this.attributes).map((attr) => attr.name);\n\n attributes.forEach((attr) => {\n if (this.hasAttribute(attr)) {\n input.setAttribute(attr, this[attr] || '');\n }\n });\n\n // Error\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n\n let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n let start = null;\n if (hasSlotStart) {\n start = document.createElement('slot');\n start.setAttribute('name', 'start');\n start.setAttribute('part', 'start');\n }\n\n let end = null;\n if (hasSlotEnd) {\n end = document.createElement('slot');\n end.setAttribute('name', 'end');\n end.setAttribute('part', 'end');\n }\n\n if (hasSlotStart) {\n wrapper.appendChild(start); // zmenene\n native.classList.add('has-start');\n }\n\n if (this.label) {\n if (this.variant === 'standard') {\n native.append(label);\n } else {\n inputWrapper.appendChild(label);\n }\n }\n\n inputWrapper.appendChild(input);\n wrapper.appendChild(inputWrapper);\n\n native.appendChild(wrapper);\n native.append(errorSlot);\n\n this.append(error);\n\n if (this.clearable) {\n this.clear = document.createElement('wje-button');\n this.clear.classList.add('clear');\n this.clear.setAttribute('fill', 'link');\n this.clear.setAttribute('part', 'clear');\n\n let clearIcon = document.createElement('wje-icon');\n clearIcon.setAttribute('name', 'x');\n this.clear.appendChild(clearIcon);\n inputWrapper.appendChild(this.clear);\n }\n\n if (hasSlotEnd) {\n wrapper.appendChild(end);// zmenene\n native.classList.add('has-end');\n }\n\n fragment.appendChild(native);\n\n this.native = native;\n this.labelElement = label;\n this.input = input;\n this.errorMessage = error;\n\n return fragment;\n }\n\n /**\n * Runs after the input is drawn to the DOM.\n */\n afterDraw() {\n this.input.addEventListener('focus', (e) => {\n this.labelElement.classList.add('fade');\n this.native.classList.add('focused');\n });\n\n this.input.addEventListener('blur', (e) => {\n this.native.classList.remove('focused');\n if (!e.target.value) this.labelElement.classList.remove('fade');\n });\n\n this.input.addEventListener('input', (e) => {\n this.validate();\n\n if (this.validateOnChange) {\n this.pristine = false;\n this.propagateValidation();\n }\n\n this.input.classList.remove('pristine');\n this.labelElement.classList.add('fade');\n\n // const clone = new e.constructor(e.type, e);\n // this.dispatchEvent(clone);\n\n event.dispatchCustomEvent(this, 'wje-input:input', {\n value: this.input.value,\n });\n\n this.value = this.input.value;\n });\n\n this.addEventListener('wje-input:invalid', (e) => {\n this.invalid = true;\n this.pristine = false;\n\n this.showInvalidMessage();\n\n if (this.customErrorDisplay) {\n e.preventDefault();\n }\n });\n\n this.addEventListener('focus', () => this.input.focus());\n\n if (this.clear) {\n this.clear.addEventListener('wje-button:click', (e) => {\n this.input.value = '';\n event.dispatchCustomEvent(this.clear, 'wje-input:clear');\n });\n }\n\n this.validate();\n\n if (this.invalid) {\n this.showInvalidMessage();\n }\n\n }\n\n /**\n * Checks whether the input has a slot.\n * @param {HTMLElement} el The element to check.\n * @param {string} slotName The name of the slot to check for.\n * @returns {boolean} Whether the input has the slot.\n */\n hasSlot(el, slotName = null) {\n let selector = slotName ? `[slot=\"${slotName}\"]` : '[slot]';\n\n return el.querySelectorAll(selector).length > 0 ? true : false;\n }\n}\n","import Input from './input.element.js';\n\nexport default Input;\n\nInput.define('wje-input', Input);\n"],"names":[],"mappings":";;;;;;AA8Be,MAAM,cAAc,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAIrD,cAAc;AACV,UAAO;AAoLX;AAAA;AAAA;AAAA;AAAA,qCAAY;AAlLR,SAAK,UAAU;AACf,SAAK,WAAW;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,IAAI,MAAM,OAAO;AACb,SAAK,UAAU,aAAa,KAAK;AAEjC,QAAI,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package/dist/wje-master.js
CHANGED
|
@@ -105,7 +105,7 @@ import { default as default89 } from "./wje-tree.js";
|
|
|
105
105
|
import { default as default90 } from "./wje-tree-item.js";
|
|
106
106
|
import { default as default91 } from "./wje-visually-hidden.js";
|
|
107
107
|
import { default as default92 } from "./wje-sliding-container.js";
|
|
108
|
-
import { P } from "./popup.element-
|
|
108
|
+
import { P } from "./popup.element-CVbbnTWI.js";
|
|
109
109
|
const skSk = {
|
|
110
110
|
code: "sk-sk",
|
|
111
111
|
name: "Slovak",
|
package/dist/wje-option.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-option.js","sources":["../packages/wje-option/option.element.js","../packages/wje-option/option.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Icon from '../wje-icon/icon.js';\nimport Checkbox from '../wje-checkbox/checkbox.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Option` is a custom web component that represents an option.\n * @summary This element represents an option.\n * @documentation https://elements.webjet.sk/components/option\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the option.\n * @slot start - The slot for the start of the option.\n * @slot - The default slot for the option.\n * @slot end - The slot for the end of the option.\n * // @fires wje-option:change - Event fired when the option is clicked.\n * @tag wje-option\n */\nexport default class Option extends WJElement {\n\t/**\n\t * Creates an instance of Option.\n\t * @class\n\t */\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Dependencies of the Option component.\n\t */\n\tdependencies = {\n\t\t'wje-icon': Icon,\n\t\t'wje-checkbox': Checkbox,\n\t};\n\n\t/**\n\t * Sets the selected attribute of the option.\n\t * @param {boolean} value The value to set.\n\t */\n\tset selected(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('selected', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('selected');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the 'selected' attribute status of the element.\n\t * @returns {boolean} Returns true if the 'selected' attribute is set on the element; otherwise, false.\n\t */\n\tget selected() {\n\t\treturn this.hasAttribute('selected');\n\t}\n\n\t/**\n\t * Retrieves the value indicating whether the closest 'wje-select' element has a 'checkbox' attribute.\n\t * @returns {boolean} True if the closest 'wje-select' element has a 'checkbox' attribute; otherwise, false.\n\t */\n\tget checkbox() {\n\t\treturn this.closest('wje-select').hasAttribute('checkbox');\n\t}\n\n\t/**\n\t * Determines whether the closest 'wje-select' element has the 'multiple' attribute.\n\t * @returns {boolean} Returns true if the 'wje-select' element has the 'multiple' attribute, otherwise false.\n\t */\n\tget multiple() {\n\t\treturn this.closest('wje-select').hasAttribute('multiple');\n\t}\n\n\t/**\n\t * Sets the value attribute of the option.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\tget value() {\n\t\treturn this.getAttribute('value');\n\t}\n\n\t/**\n\t * Sets the text content of the option.\n\t * @param {string} value The text to set.\n\t */\n\tset text(value) {\n\t\tthis.innerText = value;\n\t}\n\n\tclassName = 'Option';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['selected'];\n\t}\n\n\t/**\n\t * This method is called whenever an observed attribute is added, removed, or changed.\n\t * @param {string} name The name of the attribute that was changed.\n\t * @param {*} old The previous value of the attribute before the change.\n\t * @param {*} newName The new value of the attribute after the change.\n\t * @returns {void} This method does not return a value.\n\t */\n\tattributeChangedCallback(name, old, newName) {\n\t\tif (this.checkbox) {\n\t\t\tif (name === 'selected' && newName !== null) {\n\t\t\t\tthis.#setCheckbox(true);\n\t\t\t} else {\n\t\t\t\tthis.#setCheckbox(false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component for the option.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tlet native = document.createElement('div');\n\t\tnative.classList.add('native-option');\n\t\tnative.setAttribute('part', 'native');\n\n\t\tlet icon = document.createElement('wje-icon');\n\t\ticon.setAttribute('name', 'check');\n\t\ticon.setAttribute('slot', 'check');\n\n\t\tlet checkboxEl = document.createElement('wje-checkbox');\n\t\tcheckboxEl.setAttribute('slot', 'check');\n\n\t\tlet check = document.createElement('slot');\n\t\tcheck.setAttribute('name', 'check');\n\t\tcheck.setAttribute('part', 'check');\n\n\t\tlet start = document.createElement('slot');\n\t\tstart.setAttribute('name', 'start');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet end = document.createElement('slot');\n\t\tend.setAttribute('name', 'end');\n\n\t\tconst hasCheckSlot = this.querySelector('[slot=\"check\"]') !== null;\n\n\t\tif (!hasCheckSlot) {\n\t\t\tif (this.checkbox && this.multiple) {\n\t\t\t\tthis.append(checkboxEl);\n\t\t\t} else {\n\t\t\t\tthis.append(icon);\n\t\t\t}\n\t\t}\n\n\t\tnative.append(check);\n\t\tnative.append(start);\n\t\tnative.append(slot);\n\t\tnative.append(end);\n\n\t\tfragment.append(native);\n\n\t\tthis.check = check;\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Method executed after the drawing process is completed.\n\t * Sets up an event listener for 'click' events, linking them to the specified callback function.\n\t * @returns {void} Does not return a value.\n\t */\n\tafterDraw() {\n\t\tevent.addListener(this, 'click', null, this.optionClickCallback);\n\t}\n\n\t/**\n\t * Handles operations or cleanup tasks that need to occur before disconnecting.\n\t * Removes an event listener associated with the 'click' event and a specified callback function.\n\t * @returns {void} This method does not return a value.\n\t */\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this, 'click', null, this.optionClickCallback);\n\t}\n\n\t/**\n\t * Handles the click event on an option element and dispatches a custom event when triggered.\n\t * @param {Event} e The click event object that triggered the callback.\n\t * @returns {void} No return value.\n\t */\n\toptionClickCallback(e) {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\te.stopImmediatePropagation();\n\n\t\tif (this.hasAttribute('disabled')) return;\n\n\t\tevent.dispatchCustomEvent(this, 'wje-option:change', {\n\t\t\tvalue: this.value,\n\t\t\ttext: this.textContent,\n\t\t\toption: this,\n\t\t});\n\t}\n\n\t/**\n\t * Checks if the given DOM node represents a checkbox element.\n\t * @param {Node} node The DOM node to be checked.\n\t * @returns {boolean} Returns true if the node is an element with a class name of 'Checkbox', otherwise false.\n\t */\n\t#isCheckbox(node) {\n\t\treturn node instanceof Element && node.className === 'Checkbox';\n\t}\n\n\t/**\n\t * Updates the checked status of the first checkbox element found within the assigned elements of the specified container.\n\t * @param {boolean} checked The desired checked state to be applied to the checkbox.\n\t * @returns {void}\n\t */\n\t#setCheckbox(checked) {\n\t\tlet arr = [...this.check?.assignedElements({ flatten: true })]?.filter(item=> this.#isCheckbox(item));\n\t\tif(arr.length > 0)\n\t\t\tarr[0].checked = checked;\n\t}\n}\n","import Option from './option.element.js';\n\nexport default Option;\n\nOption.define('wje-option', Option);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,cAAc;AACb,UAAO;AANM;AAYd;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,YAAY;AAAA,MACZ,gBAAgB;AAAA,IAChB;AA0DD,qCAAY;AAAA,EAlEb;AAAA;AAAA;AAAA;AAAA;AAAA,EAcC,IAAI,SAAS,OAAO;AACnB,QAAI,OAAO;AACV,WAAK,aAAa,YAAY,EAAE;AAAA,IACnC,OAAS;AACN,WAAK,gBAAgB,UAAU;AAAA,IAClC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMC,IAAI,WAAW;AACd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AAAA,EACH;AAqBA;AAjOe;AAAA;AAAA;AAAA;AAAA;AAAA;AAmNd,gBAAW,SAAC,MAAM;AACjB,SAAO,gBAAgB,WAAW,KAAK,cAAc;AACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAOC,iBAAY,SAAC,SAAS;;AACrB,MAAI,OAAM,MAAC,IAAG,UAAK,UAAL,mBAAY,iBAAiB,EAAE,SAAS,KAAI,EAAG,MAAnD,mBAAsD,OAAO,UAAO,sBAAK,kCAAL,WAAiB;AAC/F,MAAG,IAAI,SAAS;AACf,QAAI,CAAC,EAAE,UAAU;AACpB;AC9OA,OAAO,OAAO,cAAc,MAAM;"}
|
|
1
|
+
{"version":3,"file":"wje-option.js","sources":["../packages/wje-option/option.element.js","../packages/wje-option/option.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Icon from '../wje-icon/icon.js';\nimport Checkbox from '../wje-checkbox/checkbox.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Option` is a custom web component that represents an option.\n * @summary This element represents an option.\n * @documentation https://elements.webjet.sk/components/option\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the option.\n * @slot start - The slot for the start of the option.\n * @slot - The default slot for the option.\n * @slot end - The slot for the end of the option.\n * // @fires wje-option:change - Event fired when the option is clicked.\n * @tag wje-option\n */\nexport default class Option extends WJElement {\n\t/**\n\t * Creates an instance of Option.\n\t * @class\n\t */\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t/**\n\t * Dependencies of the Option component.\n\t */\n\tdependencies = {\n\t\t'wje-icon': Icon,\n\t\t'wje-checkbox': Checkbox,\n\t};\n\n\t/**\n\t * Sets the selected attribute of the option.\n\t * @param {boolean} value The value to set.\n\t */\n\tset selected(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('selected', '');\n\t\t} else {\n\t\t\tthis.removeAttribute('selected');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the 'selected' attribute status of the element.\n\t * @returns {boolean} Returns true if the 'selected' attribute is set on the element; otherwise, false.\n\t */\n\tget selected() {\n\t\treturn this.hasAttribute('selected');\n\t}\n\n\t/**\n\t * Retrieves the value indicating whether the closest 'wje-select' element has a 'checkbox' attribute.\n\t * @returns {boolean} True if the closest 'wje-select' element has a 'checkbox' attribute; otherwise, false.\n\t */\n\tget checkbox() {\n\t\treturn this.closest('wje-select').hasAttribute('checkbox');\n\t}\n\n\t/**\n\t * Determines whether the closest 'wje-select' element has the 'multiple' attribute.\n\t * @returns {boolean} Returns true if the 'wje-select' element has the 'multiple' attribute, otherwise false.\n\t */\n\tget multiple() {\n\t\treturn this.closest('wje-select').hasAttribute('multiple');\n\t}\n\n\t/**\n\t * Sets the value attribute of the option.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\tget value() {\n\t\treturn this.getAttribute('value');\n\t}\n\n\t/**\n\t * Sets the text content of the option.\n\t * @param {string} value The text to set.\n\t */\n\tset text(value) {\n\t\tthis.innerText = value;\n\t}\n\n\tclassName = 'Option';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['selected'];\n\t}\n\n\t/**\n\t * This method is called whenever an observed attribute is added, removed, or changed.\n\t * @param {string} name The name of the attribute that was changed.\n\t * @param {*} old The previous value of the attribute before the change.\n\t * @param {*} newName The new value of the attribute after the change.\n\t * @returns {void} This method does not return a value.\n\t */\n\tattributeChangedCallback(name, old, newName) {\n\t\tif (this.checkbox) {\n\t\t\tif (name === 'selected' && newName !== null) {\n\t\t\t\tthis.#setCheckbox(true);\n\t\t\t} else {\n\t\t\t\tthis.#setCheckbox(false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component for the option.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tlet native = document.createElement('div');\n\t\tnative.classList.add('native-option');\n\t\tnative.setAttribute('part', 'native');\n\n\t\tlet icon = document.createElement('wje-icon');\n\t\ticon.setAttribute('name', 'check');\n\t\ticon.setAttribute('slot', 'check');\n\n\t\tlet checkboxEl = document.createElement('wje-checkbox');\n\t\tcheckboxEl.setAttribute('slot', 'check');\n\n\t\tlet check = document.createElement('slot');\n\t\tcheck.setAttribute('name', 'check');\n\t\tcheck.setAttribute('part', 'check');\n\n\t\tlet start = document.createElement('slot');\n\t\tstart.setAttribute('name', 'start');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet end = document.createElement('slot');\n\t\tend.setAttribute('name', 'end');\n\n\t\tconst hasCheckSlot = this.querySelector('[slot=\"check\"]') !== null;\n\n\t\tif (!hasCheckSlot) {\n\t\t\tif (this.checkbox && this.multiple) {\n\t\t\t\tthis.append(checkboxEl);\n\t\t\t} else {\n\t\t\t\tthis.append(icon);\n\t\t\t}\n\t\t}\n\n\t\tnative.append(check);\n\t\tnative.append(start);\n\t\tnative.append(slot);\n\t\tnative.append(end);\n\n\t\tfragment.append(native);\n\n\t\tthis.check = check;\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Method executed after the drawing process is completed.\n\t * Sets up an event listener for 'click' events, linking them to the specified callback function.\n\t * @returns {void} Does not return a value.\n\t */\n\tafterDraw() {\n\t\tevent.addListener(this, 'click', null, this.optionClickCallback);\n\t}\n\n\t/**\n\t * Handles operations or cleanup tasks that need to occur before disconnecting.\n\t * Removes an event listener associated with the 'click' event and a specified callback function.\n\t * @returns {void} This method does not return a value.\n\t */\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this, 'click', null, this.optionClickCallback);\n\t}\n\n\t/**\n\t * Handles the click event on an option element and dispatches a custom event when triggered.\n\t * @param {Event} e The click event object that triggered the callback.\n\t * @returns {void} No return value.\n\t */\n\toptionClickCallback(e) {\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\t\te.stopImmediatePropagation();\n\n\t\tif (this.hasAttribute('disabled')) return;\n\n\t\tevent.dispatchCustomEvent(this, 'wje-option:change', {\n\t\t\tvalue: this.value,\n\t\t\ttext: this.textContent,\n\t\t\toption: this,\n\t\t});\n\t}\n\n\t/**\n\t * Checks if the given DOM node represents a checkbox element.\n\t * @param {Node} node The DOM node to be checked.\n\t * @returns {boolean} Returns true if the node is an element with a class name of 'Checkbox', otherwise false.\n\t */\n\t#isCheckbox(node) {\n\t\treturn node instanceof Element && node.className === 'Checkbox';\n\t}\n\n\t/**\n\t * Updates the checked status of the first checkbox element found within the assigned elements of the specified container.\n\t * @param {boolean} checked The desired checked state to be applied to the checkbox.\n\t * @returns {void}\n\t */\n\t#setCheckbox(checked) {\n\t\tlet arr = [...this.check?.assignedElements({ flatten: true })]?.filter(item=> this.#isCheckbox(item));\n\t\tif(arr.length > 0)\n\t\t\tarr[0].checked = checked;\n\t}\n}","import Option from './option.element.js';\n\nexport default Option;\n\nOption.define('wje-option', Option);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7C,cAAc;AACb,UAAO;AANM;AAYd;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,YAAY;AAAA,MACZ,gBAAgB;AAAA,IAChB;AA0DD,qCAAY;AAAA,EAlEb;AAAA;AAAA;AAAA;AAAA;AAAA,EAcC,IAAI,SAAS,OAAO;AACnB,QAAI,OAAO;AACV,WAAK,aAAa,YAAY,EAAE;AAAA,IACnC,OAAS;AACN,WAAK,gBAAgB,UAAU;AAAA,IAClC;AAAA,EACA;AAAA;AAAA;AAA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;AAAA,MACX,QAAQ;AAAA,IACX,CAAG;AAAA,EACH;AAqBA;AAjOe;AAAA;AAAA;AAAA;AAAA;AAAA;AAmNd,gBAAW,SAAC,MAAM;AACjB,SAAO,gBAAgB,WAAW,KAAK,cAAc;AACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAOC,iBAAY,SAAC,SAAS;;AACrB,MAAI,OAAM,MAAC,IAAG,UAAK,UAAL,mBAAY,iBAAiB,EAAE,SAAS,KAAI,EAAG,MAAnD,mBAAsD,OAAO,UAAO,sBAAK,kCAAL,WAAiB;AAC/F,MAAG,IAAI,SAAS;AACf,QAAI,CAAC,EAAE,UAAU;AACpB;AC9OA,OAAO,OAAO,cAAc,MAAM;"}
|
package/dist/wje-options.js
CHANGED
|
@@ -14,18 +14,10 @@ import InfiniteScroll from "./wje-infinite-scroll.js";
|
|
|
14
14
|
import List from "./wje-list.js";
|
|
15
15
|
import Option from "./wje-option.js";
|
|
16
16
|
import { event } from "./event.js";
|
|
17
|
+
const styles = "/*\n[ WJ OPTIONS ]\n*/\n";
|
|
17
18
|
class Options extends WJElement {
|
|
18
|
-
/**
|
|
19
|
-
* Creates an instance of Options.
|
|
20
|
-
* @class
|
|
21
|
-
*/
|
|
22
19
|
constructor() {
|
|
23
20
|
super();
|
|
24
|
-
/**
|
|
25
|
-
* Stores the loaded options.
|
|
26
|
-
* @type {Array}
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
21
|
__privateAdd(this, _loadedOptions, []);
|
|
30
22
|
__privateAdd(this, _drawPreloadedElements, []);
|
|
31
23
|
__publicField(this, "dependencies", {
|
|
@@ -34,6 +26,13 @@ class Options extends WJElement {
|
|
|
34
26
|
"wje-list": List
|
|
35
27
|
});
|
|
36
28
|
__publicField(this, "className", "Options");
|
|
29
|
+
__publicField(this, "dispatchOptionsLoadEvent", (e) => {
|
|
30
|
+
requestAnimationFrame(() => {
|
|
31
|
+
requestAnimationFrame(() => {
|
|
32
|
+
event.dispatchCustomEvent(this, "wje-options:load", {});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
37
36
|
/**
|
|
38
37
|
* Recursively updates the object based on the provided path to the property.
|
|
39
38
|
* @param {object | Array | null} object
|
|
@@ -84,14 +83,6 @@ class Options extends WJElement {
|
|
|
84
83
|
return option;
|
|
85
84
|
});
|
|
86
85
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Returns the list of attributes to observe for changes.
|
|
89
|
-
* @static
|
|
90
|
-
* @returns {Array<string>}
|
|
91
|
-
*/
|
|
92
|
-
static get observedAttributes() {
|
|
93
|
-
return ["search", "attached"];
|
|
94
|
-
}
|
|
95
86
|
/**
|
|
96
87
|
* Sets the option array path attribute.
|
|
97
88
|
* @param {string} value The value to set for the option array path.
|
|
@@ -241,13 +232,6 @@ class Options extends WJElement {
|
|
|
241
232
|
get queryParams() {
|
|
242
233
|
return this.getAttribute("query-params");
|
|
243
234
|
}
|
|
244
|
-
/**
|
|
245
|
-
* Checks if the lazy attribute is present.
|
|
246
|
-
* @returns {boolean} True if the lazy attribute is present, false otherwise.
|
|
247
|
-
*/
|
|
248
|
-
get lazy() {
|
|
249
|
-
return this.hasAttribute("lazy");
|
|
250
|
-
}
|
|
251
235
|
/**
|
|
252
236
|
* Sets the lazy attribute.
|
|
253
237
|
* @param {boolean} value The value to set for the lazy attribute.
|
|
@@ -255,6 +239,13 @@ class Options extends WJElement {
|
|
|
255
239
|
set lazy(value) {
|
|
256
240
|
this.setAttribute("lazy", value);
|
|
257
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Checks if the lazy attribute is present.
|
|
244
|
+
* @returns {boolean} True if the lazy attribute is present, false otherwise.
|
|
245
|
+
*/
|
|
246
|
+
get lazy() {
|
|
247
|
+
return this.hasAttribute("lazy");
|
|
248
|
+
}
|
|
258
249
|
/**
|
|
259
250
|
* Gets the loaded options.
|
|
260
251
|
* @returns {Array} The loaded options.
|
|
@@ -285,20 +276,34 @@ class Options extends WJElement {
|
|
|
285
276
|
get drawPreloadedElements() {
|
|
286
277
|
return __privateGet(this, _drawPreloadedElements);
|
|
287
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Sets the elements that are preloaded and ready to be drawn.
|
|
281
|
+
* @param {Array|object} elements The elements to be set for preloading. This can be an array or a specific object containing drawable elements.
|
|
282
|
+
*/
|
|
288
283
|
set drawPreloadedElements(elements) {
|
|
289
284
|
__privateSet(this, _drawPreloadedElements, elements);
|
|
290
285
|
}
|
|
291
286
|
/**
|
|
292
|
-
*
|
|
287
|
+
* Returns the CSS styles for the component.
|
|
288
|
+
* @static
|
|
289
|
+
* @returns {CSSStyleSheet} The CSS styles for the component.
|
|
293
290
|
*/
|
|
294
|
-
|
|
295
|
-
|
|
291
|
+
static get cssStyleSheet() {
|
|
292
|
+
return styles;
|
|
296
293
|
}
|
|
297
294
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
295
|
+
* Retrieves an array of attributes that should be observed for changes.
|
|
296
|
+
* The method returns a list of attribute names that the browser will monitor for changes.
|
|
297
|
+
* @returns {Array<string>} An array of attribute names to observe.
|
|
300
298
|
*/
|
|
301
|
-
|
|
299
|
+
static get observedAttributes() {
|
|
300
|
+
return ["search", "attached"];
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Sets up the attributes for the component.
|
|
304
|
+
*/
|
|
305
|
+
setupAttributes() {
|
|
306
|
+
this.isShadowRoot = "open";
|
|
302
307
|
}
|
|
303
308
|
/**
|
|
304
309
|
* Draws the component.
|
|
@@ -308,7 +313,7 @@ class Options extends WJElement {
|
|
|
308
313
|
let fragment = document.createDocumentFragment();
|
|
309
314
|
const slot = document.createElement("slot");
|
|
310
315
|
fragment.appendChild(slot);
|
|
311
|
-
if (this.
|
|
316
|
+
if (this.lazy) {
|
|
312
317
|
if (this.contains(this.infiniteScroll)) {
|
|
313
318
|
this.drawPreloadedElements.forEach((el) => {
|
|
314
319
|
el.remove();
|
|
@@ -317,14 +322,14 @@ class Options extends WJElement {
|
|
|
317
322
|
this.infiniteScroll.placementObj.innerHTML = "";
|
|
318
323
|
this.infiniteScroll.totalPages = 0;
|
|
319
324
|
this.infiniteScroll.refresh();
|
|
320
|
-
return fragment;
|
|
321
325
|
}
|
|
326
|
+
let loader = document.createElement("div");
|
|
327
|
+
loader.setAttribute("slot", "loader");
|
|
328
|
+
loader.append("Loading...");
|
|
322
329
|
const infiniteScroll = document.createElement("wje-infinite-scroll");
|
|
323
330
|
infiniteScroll.setAttribute("placement", "wje-list");
|
|
324
331
|
infiniteScroll.setAttribute("height", this.dropdownHeight);
|
|
325
332
|
infiniteScroll.setAttribute("object-name", this.optionArrayPath);
|
|
326
|
-
const list = document.createElement("wje-list");
|
|
327
|
-
infiniteScroll.append(list);
|
|
328
333
|
infiniteScroll.dataToHtml = this.htmlItem;
|
|
329
334
|
infiniteScroll.setCustomData = async (page, signal) => {
|
|
330
335
|
let processedUrl = `${this.url}${this.search ? `/${this.search}` : ""}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ""}`;
|
|
@@ -336,16 +341,16 @@ class Options extends WJElement {
|
|
|
336
341
|
this.loadedOptions.push(...this.processData(filteredOptions));
|
|
337
342
|
return filteredOptions;
|
|
338
343
|
};
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (this.hasAttribute("attached")) {
|
|
344
|
+
const list = document.createElement("wje-list");
|
|
345
|
+
infiniteScroll.append(list);
|
|
346
|
+
infiniteScroll.append(loader);
|
|
347
|
+
if (this.hasAttribute("attached") && !this.hasSearch) {
|
|
343
348
|
this.appendChild(infiniteScroll);
|
|
344
349
|
this.drawPreloadedElements.forEach((el) => {
|
|
345
350
|
list.appendChild(el);
|
|
346
351
|
});
|
|
352
|
+
this.infiniteScroll = infiniteScroll;
|
|
347
353
|
}
|
|
348
|
-
this.infiniteScroll = infiniteScroll;
|
|
349
354
|
} else {
|
|
350
355
|
this.response = await this.getPages();
|
|
351
356
|
let optionsData = this.filterOutDrawnOptions(this.response);
|
|
@@ -356,10 +361,13 @@ class Options extends WJElement {
|
|
|
356
361
|
}
|
|
357
362
|
return fragment;
|
|
358
363
|
}
|
|
364
|
+
afterDraw() {
|
|
365
|
+
event.addListener(this.infiniteScroll, "wje-infinite-scroll:load", null, this.dispatchOptionsLoadEvent);
|
|
366
|
+
}
|
|
359
367
|
/**
|
|
360
|
-
* Processes the
|
|
361
|
-
* @param {
|
|
362
|
-
* @returns {
|
|
368
|
+
* Processes the provided data based on the optional array path set in the instance.
|
|
369
|
+
* @param {object} data The input data to be processed.
|
|
370
|
+
* @returns {Array} The resolved options array from the data or an empty array if no match is found.
|
|
363
371
|
*/
|
|
364
372
|
processData(data) {
|
|
365
373
|
var _a;
|
|
@@ -371,9 +379,9 @@ class Options extends WJElement {
|
|
|
371
379
|
return options ?? [];
|
|
372
380
|
}
|
|
373
381
|
/**
|
|
374
|
-
* Filters out
|
|
375
|
-
* @param {object
|
|
376
|
-
* @returns {object} The filtered response.
|
|
382
|
+
* Filters out options from the response object that have already been drawn, based on the specified option array path.
|
|
383
|
+
* @param {object} response The response object containing data to process.
|
|
384
|
+
* @returns {object} The filtered response object with drawn options removed.
|
|
377
385
|
*/
|
|
378
386
|
filterOutDrawnOptions(response) {
|
|
379
387
|
var _a;
|
|
@@ -425,6 +433,9 @@ class Options extends WJElement {
|
|
|
425
433
|
if (Array.isArray(optionsData)) optionsData == null ? void 0 : optionsData.forEach((od) => this.addOption(od, silent));
|
|
426
434
|
else this.addOption(optionsData, silent);
|
|
427
435
|
}
|
|
436
|
+
beforeDisconnect() {
|
|
437
|
+
event.removeListener(this.infiniteScroll, "wje-infinite-scroll:load", null, this.dispatchOptionsLoadEvent);
|
|
438
|
+
}
|
|
428
439
|
}
|
|
429
440
|
_loadedOptions = new WeakMap();
|
|
430
441
|
_drawPreloadedElements = new WeakMap();
|
package/dist/wje-options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-options.js","sources":["../packages/wje-options/options.element.js","../packages/wje-options/options.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport InfiniteScroll from '../wje-infinite-scroll/infinite-scroll.js';\nimport List from '../wje-list/list.js';\nimport Option from '../wje-option/option.js';\n\n/**\n * `Options` is a custom web component that represents a set of options.\n * It extends from `WJElement`.\n * @summary This element represents a set of options.\n * @documentation https://elements.webjet.sk/components/options\n * @status stable\n * @augments {WJElement}\n * // @fires wje-options:load - Event fired when the options are loaded.\n * @tag wje-options\n */\nexport default class Options extends WJElement {\n\t/**\n\t * Stores the loaded options.\n\t * @type {Array}\n\t * @private\n\t */\n\t#loadedOptions = [];\n\n\t#drawPreloadedElements = []\n\n\t/**\n\t * Creates an instance of Options.\n\t * @class\n\t */\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tdependencies = {\n\t\t'wje-option': Option,\n\t\t'wje-infinite-scroll': InfiniteScroll,\n\t\t'wje-list': List,\n\t};\n\n\tclassName = 'Options';\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['search', 'attached'];\n\t}\n\n\t/**\n\t * Sets the option array path attribute.\n\t * @param {string} value The value to set for the option array path.\n\t */\n\tset optionArrayPath(value) {\n\t\tthis.setAttribute('option-array-path', value);\n\t}\n\n\t/**\n\t * Gets the option array path attribute.\n\t * @returns {string} The value of the option array path attribute or \"data\" if not set.\n\t */\n\tget optionArrayPath() {\n\t\treturn this.getAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Checks if the option array path attribute is present.\n\t * @returns {boolean} True if the option array path attribute is present, false otherwise.\n\t */\n\tget hasOptionArrayPath() {\n\t\treturn this.hasAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Gets the dropdown height attribute.\n\t * @returns {string} The value of the dropdown height attribute or \"100%\" if not set.\n\t */\n\tget dropdownHeight() {\n\t\treturn this.getAttribute('dropdown-height') || '100%';\n\t}\n\n\t/**\n\t * Sets the dropdown height attribute.\n\t * @param {string} value The value to set for the dropdown height.\n\t */\n\tset dropdownHeight(value) {\n\t\tthis.setAttribute('dropdown-height', value);\n\t}\n\n\t/**\n\t * Sets the item value attribute.\n\t * @param {string} value The value to set for the item value.\n\t */\n\tset itemValue(value) {\n\t\tthis.setAttribute('item-value', value);\n\t}\n\n\t/**\n\t * Gets the item value attribute.\n\t * @returns {string} The value of the item value attribute or \"value\" if not set.\n\t */\n\tget itemValue() {\n\t\treturn this.getAttribute('item-value') || 'value';\n\t}\n\n\t/**\n\t * Sets the item text attribute.\n\t * @param {string} value The value to set for the item text.\n\t */\n\tset itemText(value) {\n\t\tthis.setAttribute('item-text', value);\n\t}\n\n\t/**\n\t * Gets the item text attribute.\n\t * @returns {string} The value of the item text attribute or \"text\" if not set.\n\t */\n\tget itemText() {\n\t\treturn this.getAttribute('item-text') || 'text';\n\t}\n\n\t/**\n\t * Gets the lazy load size attribute.\n\t * @returns {number} The value of the lazy load size attribute or 10 if not set.\n\t */\n\tget lazyLoadSize() {\n\t\treturn this.getAttribute('lazy-load-size') || 10;\n\t}\n\n\t/**\n\t * Sets the lazy load size attribute.\n\t * @param {number} value The value to set for the lazy load size.\n\t */\n\tset lazyLoadSize(value) {\n\t\tthis.setAttribute('lazy-load-size', value);\n\t}\n\n\t/**\n\t * Sets the search attribute.\n\t * @param {string} value The value to set for the search.\n\t */\n\tset search(value) {\n\t\tthis.setAttribute('search', value);\n\t}\n\n\t/**\n\t * Gets the search attribute.\n\t * @returns {string} The value of the search attribute.\n\t */\n\tget search() {\n\t\treturn this.getAttribute('search');\n\t}\n\n\t/**\n\t * Checks if the search attribute is present.\n\t * @returns {boolean} True if the search attribute is present, false otherwise.\n\t */\n\tget hasSearch() {\n\t\treturn this.hasAttribute('search');\n\t}\n\n\t/**\n\t * Retrieves the value of the 'search-to-query-params' attribute from the current instance.\n\t * @returns {string | null} The value of the 'search-to-query-params' attribute, or null if the attribute is not set.\n\t */\n\tget searchToQueryParams() {\n\t\treturn this.getAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value to define search-to-query params behavior.\n\t * @param {string} value The value to be set for the search-to-query-params attribute.\n\t */\n\tset searchToQueryParams(value) {\n\t\tthis.setAttribute('search-to-query-params', value);\n\t}\n\n\t/**\n\t * Determines whether the 'search-to-query-params' attribute is present on the element.\n\t * @returns {boolean} True if the 'search-to-query-params' attribute exists, otherwise false.\n\t */\n\tget hasSearchToQueryParams() {\n\t\treturn this.hasAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value of the search parameter name attribute.\n\t * @param {string} value The string value to set as the search parameter name.\n\t */\n\tset searchParamName(value) {\n\t\tthis.setAttribute('search-param-name', value);\n\t}\n\n\t/**\n\t * Gets the search parameter name used in queries.\n\t * Retrieves the value of the 'search-param-name' attribute.\n\t * If the attribute is not set, it defaults to 'search'.\n\t * @returns {string} The search parameter name used for queries.\n\t */\n\tget searchParamName() {\n\t\treturn this.getAttribute('search-param-name') || 'search';\n\t}\n\n\t/**\n\t * Sets the queryParams attribute on the element.\n\t * @param {string} value The query parameters to set, represented as a string.\n\t */\n\tset queryParams(value) {\n\t\tthis.setAttribute('query-params', value);\n\t}\n\n\t/**\n\t * Retrieves the value of the 'query-params' attribute.\n\t * @returns {string | null} The value of the 'query-params' attribute, or null if the attribute is not set.\n\t */\n\tget queryParams() {\n\t\treturn this.getAttribute('query-params');\n\t}\n\n\t/**\n\t * Checks if the lazy attribute is present.\n\t * @returns {boolean} True if the lazy attribute is present, false otherwise.\n\t */\n\tget lazy() {\n\t\treturn this.hasAttribute('lazy');\n\t}\n\n\t/**\n\t * Sets the lazy attribute.\n\t * @param {boolean} value The value to set for the lazy attribute.\n\t */\n\tset lazy(value) {\n\t\tthis.setAttribute('lazy', value);\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @returns {Array} The loaded options.\n\t */\n\tget options() {\n\t\treturn this.loadedOptions?.flat();\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @type {Array}\n\t */\n\tget loadedOptions() {\n\t\treturn this.#loadedOptions;\n\t}\n\n\t/**\n\t * Sets the loaded options.\n\t * @type {Array}\n\t */\n\tset loadedOptions(loadedOptions) {\n\t\tthis.#loadedOptions = loadedOptions;\n\t}\n\n\t/**\n\t * Array of preloaded elements.\n\t * @type {Array}\n\t * @private\n\t */\n\tget drawPreloadedElements() {\n\t\treturn this.#drawPreloadedElements;\n\t}\n\n\tset drawPreloadedElements(elements) {\n\t\tthis.#drawPreloadedElements = elements;\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Prepares the component before drawing.\n\t * Fetches the pages and creates the options elements.\n\t */\n\tafterDraw() {\n\t\t// event.dispatchCustomEvent(this, 'wje-options:load', {}); // nepomohlo to, v ff stale je scroll hore\n\t}\n\n\t/**\n\t * Draws the component.\n\t * @returns {DocumentFragment}\n\t */\n\tasync draw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tconst slot = document.createElement('slot');\n\t\tfragment.appendChild(slot);\n\n\t\tif (this.hasAttribute('lazy')) {\n\n\t\t\tif (this.contains(this.infiniteScroll)) {\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => { el.remove() });\n\t\t\t\tthis.loadedOptions = [];\n\t\t\t\tthis.infiniteScroll.placementObj.innerHTML = '';\n\t\t\t\tthis.infiniteScroll.totalPages = 0;\n\t\t\t\tthis.infiniteScroll.refresh();\n\n\t\t\t\treturn fragment;\n\t\t\t}\n\n\t\t\tconst infiniteScroll = document.createElement('wje-infinite-scroll');\n\t\t\tinfiniteScroll.setAttribute('placement', 'wje-list');\n\t\t\tinfiniteScroll.setAttribute('height', this.dropdownHeight);\n\t\t\tinfiniteScroll.setAttribute('object-name', this.optionArrayPath);\n\n\t\t\tconst list = document.createElement('wje-list');\n\t\t\tinfiniteScroll.append(list);\n\n\t\t\tinfiniteScroll.dataToHtml = this.htmlItem;\n\n\t\t\tinfiniteScroll.setCustomData = async (page, signal) => {\n\t\t\t\tlet processedUrl = `${this.url}${this.search ? `/${this.search}` : ''}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}`;\n\n\t\t\t\tif (this.hasSearchToQueryParams) {\n\t\t\t\t\tprocessedUrl = `${this.url}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}${this.search ? `&${this.searchParamName}=${this.search}` : ''}`;\n\t\t\t\t}\n\n\t\t\t\tlet res = await this.service.get(processedUrl, null, false, signal);\n\t\t\t\tconst filteredOptions = this.filterOutDrawnOptions(res);\n\t\t\t\tthis.loadedOptions.push(...this.processData(filteredOptions));\n\n\t\t\t\treturn filteredOptions;\n\t\t\t};\n\n\t\t\tevent.addListener(infiniteScroll, 'wje-infinite-scroll:load', null, (e) => {\n\t\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t\t});\n\n\t\t\tif (this.hasAttribute('attached')) {\n\t\t\t\tthis.appendChild(infiniteScroll);\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => {\n\t\t\t\t\tlist.appendChild(el);\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.infiniteScroll = infiniteScroll;\n\n\t\t} else {\n\t\t\tthis.response = await this.getPages();\n\t\t\tlet optionsData = this.filterOutDrawnOptions(this.response);\n\t\t\toptionsData = this.processData(optionsData);\n\n\t\t\tthis.loadedOptions.push(...optionsData);\n\n\t\t\tthis.append(...optionsData.map(this.htmlItem));\n\n\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t}\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Processes the given data and returns the options based on the option array path.\n\t * @param {any} data The data to be processed.\n\t * @returns {any} - The options based on the option array path.\n\t */\n\tprocessData(data) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : null;\n\t\tlet options = data;\n\n\t\tsplittedOptionArrayPath?.forEach((path) => {\n\t\t\toptions = options[path];\n\t\t});\n\n\t\treturn options ?? [];\n\t}\n\n\t/**\n\t * Filters out drawn options from the response.\n\t * @param {object | null} response The response to filter.\n\t * @returns {object} The filtered response.\n\t */\n\tfilterOutDrawnOptions(response) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : [];\n\t\tlet filteredResponse = structuredClone(response);\n\n\t\tfilteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);\n\t\treturn filteredResponse;\n\t}\n\n\t/**\n\t * Recursively updates the object based on the provided path to the property.\n\t * @param {object | Array | null} object\n\t * @param {Array<string> | null} pathToProperty\n\t * @returns {object | Array | null}\n\t */\n\trecursiveUpdate = (object, pathToProperty) => {\n\t\tif (pathToProperty.length === 0) {\n\t\t\tif (Array.isArray(object)) {\n\t\t\t\treturn object.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error('Expected an array but got:', object, pathToProperty);\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\tconst [currentPath, ...remainingPath] = pathToProperty;\n\t\tif (remainingPath.length > 0) {\n\t\t\tobject[currentPath] = this.recursiveUpdate(object[currentPath], remainingPath);\n\t\t} else {\n\t\t\tobject[currentPath] =\n\t\t\t\tobject[currentPath]?.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t) ?? [];\n\t\t}\n\t\treturn object;\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item.\n\t * @param {object} item The item to generate the option element for.\n\t * @returns {HTMLElement} The generated option element.\n\t */\n\thtmlItem = (item) => {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[this.itemValue] === null || item[this.itemValue] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemValue}`);\n\t\t}\n\n\t\tif (item[this.itemText] === null || item[this.itemText] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemText}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[this.itemValue] ?? '');\n\t\toption.innerText = item[this.itemText] ?? '';\n\n\t\treturn option;\n\t};\n\n\t/**\n\t * Fetches the pages from the provided URL.\n\t * @param {number} page The page number to fetch.\n\t * @returns {Promise<object>} The fetched data.\n\t * @throws Will throw an error if the response is not ok.\n\t */\n\tasync getPages(page) {\n\t\tconst response = await fetch(this.url);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`An error occurred: ${response.status}`);\n\t\t}\n\t\treturn await response.json();\n\t}\n\n\t/**\n\t * Finds the selected option data based on the given selected option values.\n\t * @param {Array} selectedOptionValues The array of selected option values.\n\t * @returns {Array} - The array of option data that matches the selected option values.\n\t */\n\tfindSelectedOptionData(selectedOptionValues = []) {\n\t\treturn this.options.filter((option) => selectedOptionValues.includes(option[this.itemValue]));\n\t}\n\n\t/**\n\t * Adds an option to the element.\n\t * @param {object} optionData The data of the option to be added.\n\t */\n\taddOption(optionData) {\n\t\tif (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst item = this.htmlItem(optionData);\n\t\tthis.#drawPreloadedElements.push(item);\n\t\tthis.prepend(item);\n\t\tthis.loadedOptions.push(optionData);\n\t}\n\n\t/**\n\t * Adds options to the element.\n\t * @param {Array} optionsData The array of option data to be added.\n\t * @param {boolean} [silent] Whether to suppress events triggered by adding options.\n\t */\n\taddOptions(optionsData = [], silent = false) {\n\t\tif (Array.isArray(optionsData)) optionsData?.forEach((od) => this.addOption(od, silent));\n\t\telse this.addOption(optionsData, silent);\n\t}\n}\n","import Options from './options.element.js';\n\nexport default Options;\n\nOptions.define('wje-options', Options);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAee,MAAM,gBAAgB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAc9C,cAAc;AACb,UAAO;AATR;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAiB,CAAE;AAEnB,+CAAyB,CAAA;AAUzB,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,uBAAuB;AAAA,MACvB,YAAY;AAAA,IACZ;AAED,qCAAY;AAsWZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAkB,CAAC,QAAQ,mBAAmB;;AAC7C,UAAI,eAAe,WAAW,GAAG;AAChC,YAAI,MAAM,QAAQ,MAAM,GAAG;AAC1B,iBAAO,OAAO;AAAA,YACb,CAAC,WACA,CAAC,KAAK,cAAc;AAAA,cACnB,CAAC,iBAAiB,aAAa,KAAK,SAAS,MAAM,OAAO,KAAK,SAAS;AAAA,YAC/E;AAAA,UACK;AAAA,QACL,OAAU;AACN,kBAAQ,MAAM,8BAA8B,QAAQ,cAAc;AAClE,iBAAO,CAAE;AAAA,QACb;AAAA,MACA;AAEE,YAAM,CAAC,aAAa,GAAG,aAAa,IAAI;AACxC,UAAI,cAAc,SAAS,GAAG;AAC7B,eAAO,WAAW,IAAI,KAAK,gBAAgB,OAAO,WAAW,GAAG,aAAa;AAAA,MAChF,OAAS;AACN,eAAO,WAAW,MACjB,YAAO,WAAW,MAAlB,mBAAqB;AAAA,UACpB,CAAC,WACA,CAAC,KAAK,cAAc;AAAA,YACnB,CAAC,iBAAiB,aAAa,KAAK,SAAS,MAAM,OAAO,KAAK,SAAS;AAAA,UAC/E;AAAA,cACS,CAAE;AAAA,MACX;AACE,aAAO;AAAA,IACP;AAOD;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAW,CAAC,SAAS;AACpB,UAAI,SAAS,SAAS,cAAc,YAAY;AAEhD,UAAI,KAAK,KAAK,SAAS,MAAM,QAAQ,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AAC,WAAW,OAAO,KAAK,SAAS,MAAM,WAAW,KAAK,SAAS,CAAC,GAAG;AAC/F;AAAA,IACH;AAEE,UAAM,OAAO,KAAK,SAAS,UAAU;AACrC,uBAAK,wBAAuB,KAAK,IAAI;AACrC,SAAK,QAAQ,IAAI;AACjB,SAAK,cAAc,KAAK,UAAU;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOC,WAAW,cAAc,IAAI,SAAS,OAAO;AAC5C,QAAI,MAAM,QAAQ,WAAW,EAAG,4CAAa,QAAQ,CAAC,OAAO,KAAK,UAAU,IAAI,MAAM;AAAA,QACjF,MAAK,UAAU,aAAa,MAAM;AAAA,EACzC;AACA;AA3dC;AAEA;ACnBD,QAAQ,OAAO,eAAe,OAAO;"}
|
|
1
|
+
{"version":3,"file":"wje-options.js","sources":["../packages/wje-options/options.element.js","../packages/wje-options/options.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport InfiniteScroll from '../wje-infinite-scroll/infinite-scroll.js';\nimport List from '../wje-list/list.js';\nimport Option from '../wje-option/option.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Options` is a custom web component that represents a set of options. It extends from `WJElement`.\n * @summary This element represents a set of options.\n * @documentation https://elements.webjet.sk/components/options\n * @status stable\n * @tag wje-options\n */\n\nexport default class Options extends WJElement {\n\n\t#loadedOptions = [];\n\n\t#drawPreloadedElements = [];\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tdependencies = {\n\t\t'wje-option': Option,\n\t\t'wje-infinite-scroll': InfiniteScroll,\n\t\t'wje-list': List,\n\t}\n\n\t/**\n\t * Sets the option array path attribute.\n\t * @param {string} value The value to set for the option array path.\n\t */\n\tset optionArrayPath(value) {\n\t\tthis.setAttribute('option-array-path', value);\n\t}\n\n\t/**\n\t * Gets the option array path attribute.\n\t * @returns {string} The value of the option array path attribute or \"data\" if not set.\n\t */\n\tget optionArrayPath() {\n\t\treturn this.getAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Checks if the option array path attribute is present.\n\t * @returns {boolean} True if the option array path attribute is present, false otherwise.\n\t */\n\tget hasOptionArrayPath() {\n\t\treturn this.hasAttribute('option-array-path');\n\t}\n\n\t/**\n\t * Gets the dropdown height attribute.\n\t * @returns {string} The value of the dropdown height attribute or \"100%\" if not set.\n\t */\n\tget dropdownHeight() {\n\t\treturn this.getAttribute('dropdown-height') || '100%';\n\t}\n\n\t/**\n\t * Sets the dropdown height attribute.\n\t * @param {string} value The value to set for the dropdown height.\n\t */\n\tset dropdownHeight(value) {\n\t\tthis.setAttribute('dropdown-height', value);\n\t}\n\n\t/**\n\t * Sets the item value attribute.\n\t * @param {string} value The value to set for the item value.\n\t */\n\tset itemValue(value) {\n\t\tthis.setAttribute('item-value', value);\n\t}\n\n\t/**\n\t * Gets the item value attribute.\n\t * @returns {string} The value of the item value attribute or \"value\" if not set.\n\t */\n\tget itemValue() {\n\t\treturn this.getAttribute('item-value') || 'value';\n\t}\n\n\t/**\n\t * Sets the item text attribute.\n\t * @param {string} value The value to set for the item text.\n\t */\n\tset itemText(value) {\n\t\tthis.setAttribute('item-text', value);\n\t}\n\n\t/**\n\t * Gets the item text attribute.\n\t * @returns {string} The value of the item text attribute or \"text\" if not set.\n\t */\n\tget itemText() {\n\t\treturn this.getAttribute('item-text') || 'text';\n\t}\n\n\t/**\n\t * Gets the lazy load size attribute.\n\t * @returns {number} The value of the lazy load size attribute or 10 if not set.\n\t */\n\tget lazyLoadSize() {\n\t\treturn this.getAttribute('lazy-load-size') || 10;\n\t}\n\n\t/**\n\t * Sets the lazy load size attribute.\n\t * @param {number} value The value to set for the lazy load size.\n\t */\n\tset lazyLoadSize(value) {\n\t\tthis.setAttribute('lazy-load-size', value);\n\t}\n\n\t/**\n\t * Sets the search attribute.\n\t * @param {string} value The value to set for the search.\n\t */\n\tset search(value) {\n\t\tthis.setAttribute('search', value);\n\t}\n\n\t/**\n\t * Gets the search attribute.\n\t * @returns {string} The value of the search attribute.\n\t */\n\tget search() {\n\t\treturn this.getAttribute('search');\n\t}\n\n\t/**\n\t * Checks if the search attribute is present.\n\t * @returns {boolean} True if the search attribute is present, false otherwise.\n\t */\n\tget hasSearch() {\n\t\treturn this.hasAttribute('search');\n\t}\n\n\t/**\n\t * Retrieves the value of the 'search-to-query-params' attribute from the current instance.\n\t * @returns {string | null} The value of the 'search-to-query-params' attribute, or null if the attribute is not set.\n\t */\n\tget searchToQueryParams() {\n\t\treturn this.getAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value to define search-to-query params behavior.\n\t * @param {string} value The value to be set for the search-to-query-params attribute.\n\t */\n\tset searchToQueryParams(value) {\n\t\tthis.setAttribute('search-to-query-params', value);\n\t}\n\n\t/**\n\t * Determines whether the 'search-to-query-params' attribute is present on the element.\n\t * @returns {boolean} True if the 'search-to-query-params' attribute exists, otherwise false.\n\t */\n\tget hasSearchToQueryParams() {\n\t\treturn this.hasAttribute('search-to-query-params');\n\t}\n\n\t/**\n\t * Sets the value of the search parameter name attribute.\n\t * @param {string} value The string value to set as the search parameter name.\n\t */\n\tset searchParamName(value) {\n\t\tthis.setAttribute('search-param-name', value);\n\t}\n\n\t/**\n\t * Gets the search parameter name used in queries.\n\t * Retrieves the value of the 'search-param-name' attribute.\n\t * If the attribute is not set, it defaults to 'search'.\n\t * @returns {string} The search parameter name used for queries.\n\t */\n\tget searchParamName() {\n\t\treturn this.getAttribute('search-param-name') || 'search';\n\t}\n\n\t/**\n\t * Sets the queryParams attribute on the element.\n\t * @param {string} value The query parameters to set, represented as a string.\n\t */\n\tset queryParams(value) {\n\t\tthis.setAttribute('query-params', value);\n\t}\n\n\t/**\n\t * Retrieves the value of the 'query-params' attribute.\n\t * @returns {string | null} The value of the 'query-params' attribute, or null if the attribute is not set.\n\t */\n\tget queryParams() {\n\t\treturn this.getAttribute('query-params');\n\t}\n\n\t/**\n\t * Sets the lazy attribute.\n\t * @param {boolean} value The value to set for the lazy attribute.\n\t */\n\tset lazy(value) {\n\t\tthis.setAttribute('lazy', value);\n\t}\n\n\t/**\n\t * Checks if the lazy attribute is present.\n\t * @returns {boolean} True if the lazy attribute is present, false otherwise.\n\t */\n\tget lazy() {\n\t\treturn this.hasAttribute('lazy');\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @returns {Array} The loaded options.\n\t */\n\tget options() {\n\t\treturn this.loadedOptions?.flat();\n\t}\n\n\t/**\n\t * Gets the loaded options.\n\t * @type {Array}\n\t */\n\tget loadedOptions() {\n\t\treturn this.#loadedOptions;\n\t}\n\n\t/**\n\t * Sets the loaded options.\n\t * @type {Array}\n\t */\n\tset loadedOptions(loadedOptions) {\n\t\tthis.#loadedOptions = loadedOptions;\n\t}\n\n\t/**\n\t * Array of preloaded elements.\n\t * @type {Array}\n\t * @private\n\t */\n\tget drawPreloadedElements() {\n\t\treturn this.#drawPreloadedElements;\n\t}\n\n\t/**\n\t * Sets the elements that are preloaded and ready to be drawn.\n\t * @param {Array|object} elements The elements to be set for preloading. This can be an array or a specific object containing drawable elements.\n\t */\n\tset drawPreloadedElements(elements) {\n\t\tthis.#drawPreloadedElements = elements;\n\t}\n\n\tclassName = 'Options';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet} The CSS styles for the component.\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Retrieves an array of attributes that should be observed for changes.\n\t * The method returns a list of attribute names that the browser will monitor for changes.\n\t * @returns {Array<string>} An array of attribute names to observe.\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['search', 'attached'];\n\t}\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component.\n\t * @returns {DocumentFragment}\n\t */\n\tasync draw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tconst slot = document.createElement('slot');\n\t\tfragment.appendChild(slot);\n\n\t\tif (this.lazy) {\n\t\t\tif (this.contains(this.infiniteScroll)) {\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => { el.remove() });\n\t\t\t\tthis.loadedOptions = [];\n\t\t\t\tthis.infiniteScroll.placementObj.innerHTML = '';\n\t\t\t\tthis.infiniteScroll.totalPages = 0;\n\t\t\t\tthis.infiniteScroll.refresh();\n\t\t\t}\n\n\t\t\tlet loader = document.createElement('div');\n\t\t\tloader.setAttribute('slot', 'loader');\n\t\t\tloader.append('Loading...');\n\n\t\t\tconst infiniteScroll = document.createElement('wje-infinite-scroll');\n\t\t\tinfiniteScroll.setAttribute('placement', 'wje-list');\n\t\t\tinfiniteScroll.setAttribute('height', this.dropdownHeight);\n\t\t\tinfiniteScroll.setAttribute('object-name', this.optionArrayPath);\n\t\t\tinfiniteScroll.dataToHtml = this.htmlItem;\n\t\t\tinfiniteScroll.setCustomData = async (page, signal) => {\n\t\t\t\tlet processedUrl = `${this.url}${this.search ? `/${this.search}` : ''}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}`;\n\n\t\t\t\tif (this.hasSearchToQueryParams) {\n\t\t\t\t\tprocessedUrl = `${this.url}?page=${page}&size=${this.lazyLoadSize}${this.queryParams ? `&${this.queryParams}` : ''}${this.search ? `&${this.searchParamName}=${this.search}` : ''}`;\n\t\t\t\t}\n\n\t\t\t\tlet res = await this.service.get(processedUrl, null, false, signal);\n\t\t\t\tconst filteredOptions = this.filterOutDrawnOptions(res);\n\t\t\t\tthis.loadedOptions.push(...this.processData(filteredOptions));\n\n\t\t\t\treturn filteredOptions;\n\t\t\t};\n\n\t\t\tconst list = document.createElement('wje-list');\n\n\t\t\tinfiniteScroll.append(list);\n\t\t\tinfiniteScroll.append(loader);\n\n\t\t\tif (this.hasAttribute('attached') && !this.hasSearch) {\n\t\t\t\tthis.appendChild(infiniteScroll);\n\t\t\t\tthis.drawPreloadedElements.forEach((el) => {\n\t\t\t\t\tlist.appendChild(el);\n\t\t\t\t});\n\t\t\t\tthis.infiniteScroll = infiniteScroll;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.response = await this.getPages();\n\n\t\t\tlet optionsData = this.filterOutDrawnOptions(this.response);\n\t\t\toptionsData = this.processData(optionsData);\n\n\t\t\tthis.loadedOptions.push(...optionsData);\n\n\t\t\tthis.append(...optionsData.map(this.htmlItem));\n\n\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t}\n\n\t\treturn fragment;\n\t}\n\n\tafterDraw() {\n\t\tevent.addListener(this.infiniteScroll, 'wje-infinite-scroll:load', null, this.dispatchOptionsLoadEvent);\n\t}\n\n\tdispatchOptionsLoadEvent = (e) => {\n\t\t// Wait for next paint cycle to ensure options are in DOM\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tevent.dispatchCustomEvent(this, 'wje-options:load', {});\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Processes the provided data based on the optional array path set in the instance.\n\t * @param {object} data The input data to be processed.\n\t * @returns {Array} The resolved options array from the data or an empty array if no match is found.\n\t */\n\tprocessData(data) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : null;\n\t\tlet options = data;\n\n\t\tsplittedOptionArrayPath?.forEach((path) => {\n\t\t\toptions = options[path];\n\t\t});\n\n\t\treturn options ?? [];\n\t}\n\n\t/**\n\t * Filters out options from the response object that have already been drawn, based on the specified option array path.\n\t * @param {object} response The response object containing data to process.\n\t * @returns {object} The filtered response object with drawn options removed.\n\t */\n\tfilterOutDrawnOptions(response) {\n\t\tconst splittedOptionArrayPath = this.optionArrayPath ? this.optionArrayPath?.split('.') : [];\n\t\tlet filteredResponse = structuredClone(response);\n\n\t\tfilteredResponse = this.recursiveUpdate(filteredResponse, splittedOptionArrayPath);\n\t\treturn filteredResponse;\n\t}\n\n\t/**\n\t * Recursively updates the object based on the provided path to the property.\n\t * @param {object | Array | null} object\n\t * @param {Array<string> | null} pathToProperty\n\t * @returns {object | Array | null}\n\t */\n\trecursiveUpdate = (object, pathToProperty) => {\n\t\tif (pathToProperty.length === 0) {\n\t\t\tif (Array.isArray(object)) {\n\t\t\t\treturn object.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconsole.error('Expected an array but got:', object, pathToProperty);\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}\n\n\t\tconst [currentPath, ...remainingPath] = pathToProperty;\n\t\tif (remainingPath.length > 0) {\n\t\t\tobject[currentPath] = this.recursiveUpdate(object[currentPath], remainingPath);\n\t\t} else {\n\t\t\tobject[currentPath] =\n\t\t\t\tobject[currentPath]?.filter(\n\t\t\t\t\t(option) =>\n\t\t\t\t\t\t!this.loadedOptions.some(\n\t\t\t\t\t\t\t(loadedOption) => loadedOption[this.itemValue] === option[this.itemValue]\n\t\t\t\t\t\t)\n\t\t\t\t) ?? [];\n\t\t}\n\t\treturn object;\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item.\n\t * @param {object} item The item to generate the option element for.\n\t * @returns {HTMLElement} The generated option element.\n\t */\n\thtmlItem = (item) => {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[this.itemValue] === null || item[this.itemValue] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemValue}`);\n\t\t}\n\n\t\tif (item[this.itemText] === null || item[this.itemText] === undefined) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${this.itemText}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[this.itemValue] ?? '');\n\t\toption.innerText = item[this.itemText] ?? '';\n\n\t\treturn option;\n\t};\n\n\t/**\n\t * Fetches the pages from the provided URL.\n\t * @param {number} page The page number to fetch.\n\t * @returns {Promise<object>} The fetched data.\n\t * @throws Will throw an error if the response is not ok.\n\t */\n\tasync getPages(page) {\n\t\tconst response = await fetch(this.url);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`An error occurred: ${response.status}`);\n\t\t}\n\t\treturn await response.json();\n\t}\n\n\t/**\n\t * Finds the selected option data based on the given selected option values.\n\t * @param {Array} selectedOptionValues The array of selected option values.\n\t * @returns {Array} - The array of option data that matches the selected option values.\n\t */\n\tfindSelectedOptionData(selectedOptionValues = []) {\n\t\treturn this.options.filter((option) => selectedOptionValues.includes(option[this.itemValue]));\n\t}\n\n\t/**\n\t * Adds an option to the element.\n\t * @param {object} optionData The data of the option to be added.\n\t */\n\taddOption(optionData) {\n\t\tif (this.loadedOptions.some((option) => option[this.itemValue] === optionData[this.itemValue])) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst item = this.htmlItem(optionData);\n\t\tthis.#drawPreloadedElements.push(item);\n\t\tthis.prepend(item);\n\t\tthis.loadedOptions.push(optionData);\n\t}\n\n\t/**\n\t * Adds options to the element.\n\t * @param {Array} optionsData The array of option data to be added.\n\t * @param {boolean} [silent] Whether to suppress events triggered by adding options.\n\t */\n\taddOptions(optionsData = [], silent = false) {\n\t\tif (Array.isArray(optionsData)) optionsData?.forEach((od) => this.addOption(od, silent));\n\t\telse this.addOption(optionsData, silent);\n\t}\n\n\tbeforeDisconnect() {\n\t\tevent.removeListener(this.infiniteScroll, 'wje-infinite-scroll:load', null, this.dispatchOptionsLoadEvent);\n\t}\n}\n","import Options from './options.element.js';\n\nexport default Options;\n\nOptions.define('wje-options', Options);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAce,MAAM,gBAAgB,UAAU;AAAA,EAM9C,cAAc;AACb,UAAO;AALR,uCAAiB,CAAE;AAEnB,+CAAyB,CAAE;AAM3B,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,uBAAuB;AAAA,MACvB,YAAY;AAAA,IACd;AAqOC,qCAAY;AAqGZ,oDAA2B,CAAC,MAAM;AAEjC,4BAAsB,MA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