wj-elements 0.1.181 → 0.1.183
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/light.css +10 -2
- package/dist/packages/wje-button-group/button-group.element.d.ts +57 -0
- package/dist/packages/wje-input/input.element.d.ts +67 -10
- package/dist/packages/wje-options/options.element.d.ts +2 -2
- package/dist/packages/wje-select/select.element.d.ts +40 -16
- package/dist/packages/wje-textarea/textarea.element.d.ts +20 -0
- package/dist/wje-button-group.js +105 -8
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +2 -2
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-icon-picker.js +1 -2
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-infinite-scroll.js +380 -1
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input.js +111 -43
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-list.js +46 -1
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-master.js +110 -112
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-option.js +1 -0
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +2 -2
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-select.js +131 -38
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-textarea.js +50 -5
- package/dist/wje-textarea.js.map +1 -1
- package/package.json +1 -1
- package/dist/infinite-scroll.element-La0Qx41F.js +0 -384
- package/dist/infinite-scroll.element-La0Qx41F.js.map +0 -1
- package/dist/list.element-D4-wlFN_.js +0 -50
- package/dist/list.element-D4-wlFN_.js.map +0 -1
package/dist/wje-textarea.js
CHANGED
|
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement from "./wje-element.js";
|
|
5
5
|
import { event } from "./event.js";
|
|
6
|
-
const styles = "/*\n[ WJ Textarea ]\n*/\n\n:host {\n width: 100%;\n margin-bottom: var(--wje-textarea-margin-bottom);\n display: block;\n .wrapper {\n display: flex;\n width: 100%;\n border-width: var(--wje-textarea-border-width);\n border-style: var(--wje-textarea-border-style);\n border-color: var(--wje-textarea-border-color);\n border-radius: var(--wje-textarea-border-radius);\n box-sizing: border-box;\n }\n textarea {\n font-family: var(--wje-textarea-font-family);\n color: var(--wje-textarea-color);\n font-size: 14px;\n border: 0 none;\n padding: 0 var(--wje-textarea-padding);\n &:focus {\n outline: none;\n }\n }\n}\n\n:host([invalid]) {\n .error-message {\n display: block;\n }\n .default {\n label {\n opacity: 1 !important;\n color: var(--wje-input-color-invalid) !important;\n animation-name: shake;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n }\n }\n}\n\n:host([required]) .
|
|
6
|
+
const styles = "/*\n[ WJ Textarea ]\n*/\n\n:host {\n width: 100%;\n margin-bottom: var(--wje-textarea-margin-bottom);\n display: block;\n .wrapper {\n display: flex;\n width: 100%;\n border-width: var(--wje-textarea-border-width);\n border-style: var(--wje-textarea-border-style);\n border-color: var(--wje-textarea-border-color);\n border-radius: var(--wje-textarea-border-radius);\n box-sizing: border-box;\n }\n textarea {\n font-family: var(--wje-textarea-font-family);\n color: var(--wje-textarea-color);\n font-size: 14px;\n border: 0 none;\n padding: 0 var(--wje-textarea-padding);\n &:focus {\n outline: none;\n }\n }\n}\n\n:host([invalid]) {\n .error-message {\n display: block;\n }\n .default {\n label {\n opacity: 1 !important;\n color: var(--wje-input-color-invalid) !important;\n animation-name: shake;\n animation-duration: 0.4s;\n animation-iteration-count: 1;\n }\n }\n}\n\n:host([required]) .wrapper::after {\n color: var(--wje-input-color-invalid);\n content: var(--wje-input-required-symbol);\n font-size: 24px;\n position: absolute;\n right: 12px;\n top: 0;\n}\n\n:host([required]) .standard .input-wrapper::after {\n right: 13px;\n top: -20px;\n}\n\n:host([resize='auto']) textarea,\n:host([resize='none']) textarea {\n resize: none;\n}\n\n.native-textarea {\n .input-wrapper {\n width: 100%;\n line-height: normal;\n }\n &.default {\n background-color: var(--wje-textarea-background-color);\n font-family: var(--wje-textarea-font-family);\n position: relative;\n padding-inline: 0;\n padding-top: 0;\n transition: background-color 0.2s ease;\n cursor: text;\n &.focused {\n .wrapper {\n border-color: var(--wje-textarea-border-color-focus) !important;\n }\n label {\n opacity: 0.67;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n textarea {\n border: none;\n padding-top: 0;\n background: none;\n box-shadow: none;\n width: calc(100% - var(--wje-textarea-padding) * 2);\n max-width: calc(100% - var(--wje-textarea-padding) * 2);\n min-width: calc(100% - var(--wje-textarea-padding) * 2);\n }\n label {\n padding: 0 var(--wje-textarea-padding);\n display: block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease;\n line-height: var(--wje-textarea-line-height);\n padding-top: 0.25rem;\n &.fade {\n opacity: 0.5;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n ::slotted([slot='start']) {\n border-left: none;\n border-top: none;\n border-bottom: none;\n }\n\n ::slotted([slot='end']) {\n border-right: none;\n border-top: none;\n border-bottom: none;\n }\n }\n &.standard {\n position: relative;\n border-radius: var(--wje-textarea-border-radius);\n padding: 0;\n transition: background-color 0.2s ease;\n cursor: text;\n &.focused {\n .wrapper {\n border-color: var(--wje-textarea-border-color-focus) !important;\n }\n }\n textarea {\n background-color: var(--wje-textarea-background-color);\n display: block;\n min-height: 32px;\n box-shadow: none;\n width: 100%;\n box-sizing: border-box;\n border-radius: var(--wje-textarea-border-radius);\n }\n label {\n margin: 0;\n display: inline-block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease;\n line-height: var(--wje-textarea-line-height);\n }\n ::slotted([slot='start']) {\n border-right: none;\n border-radius: var(--wje-textarea-border-radius) 0 0 var(--wje-textarea-border-radius);\n }\n\n ::slotted([slot='end']) {\n border-left: none;\n border-radius: 0 var(--wje-textarea-border-radius) var(--wje-textarea-border-radius) 0;\n }\n\n &.has-start textarea {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n &.has-end textarea {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n slot[name='error'] {\n position: static;\n background: transparent;\n padding: 0.25rem 0;\n left: auto;\n transform: none;\n color: var(--wje-textarea-color-invalid);\n font-size: 12px;\n line-height: normal;\n }\n }\n}\n\n.counter {\n float: right;\n}\n\nslot[name='error'] {\n display: none;\n}\n\n:host([invalid]) slot[name='error'] {\n display: block;\n}\n\nslot[name='error'] {\n display: none;\n position: absolute;\n max-width: 100%;\n min-width: auto;\n border-radius: 50px;\n background: black;\n padding: 0.25rem 0.5rem;\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n color: white;\n font-size: var(--wje-font-size-small);\n width: max-content;\n line-height: normal;\n}\n\n@keyframes shake {\n 8%,\n 41% {\n transform: translateX(-4px);\n }\n 25%,\n 58% {\n transform: translateX(4px);\n }\n 75% {\n transform: translateX(-2px);\n }\n 92% {\n transform: translateX(2px);\n }\n 0%,\n 100% {\n transform: translateX(0);\n }\n}\n";
|
|
7
7
|
class Textarea extends WJElement {
|
|
8
8
|
/**
|
|
9
9
|
* Creates an instance of Textarea.
|
|
@@ -20,7 +20,6 @@ class Textarea extends WJElement {
|
|
|
20
20
|
console.log(`Attribute ${attributeName} changed from ${oldValue} to ${newValue}`);
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
this.refresh();
|
|
24
23
|
});
|
|
25
24
|
__publicField(this, "className", "Textarea");
|
|
26
25
|
/**
|
|
@@ -62,6 +61,28 @@ class Textarea extends WJElement {
|
|
|
62
61
|
var _a;
|
|
63
62
|
return ((_a = this.input) == null ? void 0 : _a.value) ?? this._value ?? "";
|
|
64
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Sets the `validateOnChange` property. If set to a truthy value, it adds the
|
|
66
|
+
* `validate-on-change` attribute to the element. If set to a falsy value, it
|
|
67
|
+
* removes the `validate-on-change` attribute from the element.
|
|
68
|
+
* @param {boolean} value Determines whether to add or remove the
|
|
69
|
+
* `validate-on-change` attribute. A truthy value adds the attribute, whereas a
|
|
70
|
+
* falsy value removes it.
|
|
71
|
+
*/
|
|
72
|
+
set validateOnChange(value) {
|
|
73
|
+
if (value) {
|
|
74
|
+
this.setAttribute("validate-on-change", "");
|
|
75
|
+
} else {
|
|
76
|
+
this.removeAttribute("validate-on-change");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Getter for the validateOnChange attribute.
|
|
81
|
+
* @returns {boolean} Whether the attribute is present.
|
|
82
|
+
*/
|
|
83
|
+
get validateOnChange() {
|
|
84
|
+
return this.hasAttribute("validate-on-change");
|
|
85
|
+
}
|
|
65
86
|
/**
|
|
66
87
|
* Getter for the invalid attribute.
|
|
67
88
|
* @returns {boolean} Whether the attribute is present.
|
|
@@ -189,6 +210,10 @@ class Textarea extends WJElement {
|
|
|
189
210
|
input.setAttribute(attr, this[attr] || "");
|
|
190
211
|
}
|
|
191
212
|
});
|
|
213
|
+
let error = document.createElement("div");
|
|
214
|
+
error.setAttribute("slot", "error");
|
|
215
|
+
let errorSlot = document.createElement("slot");
|
|
216
|
+
errorSlot.setAttribute("name", "error");
|
|
192
217
|
if (this.resize === "auto") input.addEventListener("input", this.setTextareaHeight);
|
|
193
218
|
if (this.variant === "standard") {
|
|
194
219
|
if (this.label) native.appendChild(label);
|
|
@@ -198,6 +223,8 @@ class Textarea extends WJElement {
|
|
|
198
223
|
inputWrapper.appendChild(input);
|
|
199
224
|
wrapper.appendChild(inputWrapper);
|
|
200
225
|
native.appendChild(wrapper);
|
|
226
|
+
native.append(errorSlot);
|
|
227
|
+
this.append(error);
|
|
201
228
|
fragment.appendChild(native);
|
|
202
229
|
if (this.hasAttribute("counter")) {
|
|
203
230
|
input.maxLength = this.maxLength || 1e3;
|
|
@@ -230,7 +257,7 @@ class Textarea extends WJElement {
|
|
|
230
257
|
this.native.classList.remove("focused");
|
|
231
258
|
if (!e.target.value) this.labelElement.classList.remove("fade");
|
|
232
259
|
});
|
|
233
|
-
this.addEventListener("invalid", (e) => {
|
|
260
|
+
this.addEventListener("wje-textarea:invalid", (e) => {
|
|
234
261
|
this.invalid = true;
|
|
235
262
|
this.pristine = false;
|
|
236
263
|
this.showInvalidMessage();
|
|
@@ -273,6 +300,24 @@ class Textarea extends WJElement {
|
|
|
273
300
|
var _a;
|
|
274
301
|
(_a = this.resizeObserver) == null ? void 0 : _a.unobserve(this.input);
|
|
275
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* @summary Displays the validation message for the input.
|
|
305
|
+
* 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.
|
|
306
|
+
* If the input does not have an 'error' slot, it sets the text content of the errorMessage property to the validation message.
|
|
307
|
+
*/
|
|
308
|
+
showInvalidMessage() {
|
|
309
|
+
{
|
|
310
|
+
const slot = this.querySelector("[slot='error']");
|
|
311
|
+
let errorMessageEL = slot.querySelector("[error-message]");
|
|
312
|
+
if (!errorMessageEL) {
|
|
313
|
+
const error = document.createElement("div");
|
|
314
|
+
error.setAttribute("error-message", "");
|
|
315
|
+
slot.append(error);
|
|
316
|
+
errorMessageEL = error;
|
|
317
|
+
}
|
|
318
|
+
errorMessageEL.textContent = this.internals.validationMessage;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
276
321
|
/**
|
|
277
322
|
* @summary Validates the input.
|
|
278
323
|
* This method checks the validity state of the input. If the input is not valid, it iterates over the validity state object.
|
|
@@ -306,8 +351,8 @@ class Textarea extends WJElement {
|
|
|
306
351
|
*/
|
|
307
352
|
propagateValidation() {
|
|
308
353
|
this.invalid = !this.pristine && !this.internals.validity.valid;
|
|
309
|
-
if (this.invalid
|
|
310
|
-
this.dispatchEvent(new Event("invalid"));
|
|
354
|
+
if (this.invalid) {
|
|
355
|
+
this.dispatchEvent(new Event("wje-textarea:invalid"));
|
|
311
356
|
}
|
|
312
357
|
}
|
|
313
358
|
/**
|
package/dist/wje-textarea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-textarea.js","sources":["../packages/wje-textarea/textarea.element.js","../packages/wje-textarea/textarea.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Textarea` is a custom web component that represents a textarea input.\n * @summary This element represents a textarea input.\n * @documentation https://elements.webjet.sk/components/textarea\n * @status stable\n * @augments WJElement\n * @csspart native - The native textarea wrapper.\n * @csspart input - The textarea input.\n * @csspart wrapper - The textarea wrapper.\n * @cssproperty [--wje-textarea-font-family=var(--wje-font-family)] - Specifies the font family used for the textarea. Accepts any valid CSS font-family value.\n * @cssproperty [--wje-textarea-background-color=var(--wje-background)] - Sets the background color of the textarea. Accepts any valid CSS color value.\n * @cssproperty [--wje-textarea-color=var(--wje-color)] - Defines the text color within the textarea. Accepts any valid CSS color value.\n * @cssproperty [--wje-textarea-color-invalid=var(--wje-color-danger)] - Changes the text color of the textarea when it is invalid. Useful for highlighting validation errors.\n * @cssproperty [--wje-textarea-border-width=1px] - Specifies the width of the textarea's border. Accepts any valid CSS length unit.\n * @cssproperty [--wje-textarea-border-style=solid] - Sets the style of the textarea's border. Accepts standard CSS border styles such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-textarea-border-color=var(--wje-border-color)] - Defines the border color of the textarea. Accepts any valid CSS color value.\n * @cssproperty [--wje-textarea-border-color-focus=var(--wje-color-primary)] - Specifies the border color of the textarea when it is focused. Enhances the user experience by providing visual feedback.\n * @cssproperty [--wje-textarea-border-radius=4px] - Determines the border radius of the textarea, defining how rounded its corners are. Accepts any valid CSS length unit.\n * @cssproperty [--wje-textarea-margin-bottom=.5rem] - Sets the bottom margin of the textarea. Ensures spacing between the textarea and other elements.\n * @cssproperty [--wje-textarea-line-height=20px] - Specifies the line height of the text within the textarea. Helps control the vertical spacing of the text.\n * @cssproperty [--wje-textarea-padding=0.5rem] - Defines the padding inside the textarea. Controls the spacing between the content and the border.\n * @tag wje-textarea\n */\n\nexport default class Textarea extends WJElement {\n /**\n * Creates an instance of Textarea.\n * @class\n */\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n this.internals = this.attachInternals();\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 this.refresh();\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 * Getter for the value attribute.\n * @returns {string} The value of the attribute.\n */\n get value() {\n return this.input?.value ?? this._value ?? '';\n }\n\n /**\n * Getter for the invalid attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get invalid() {\n return this.hasAttribute('invalid');\n }\n\n /**\n * Setter for the invalid attribute.\n * @param {boolean} isInvalid Whether the input is invalid.\n */\n set invalid(isInvalid) {\n if (isInvalid) this.setAttribute('invalid', '');\n else this.removeAttribute('invalid');\n }\n\n /**\n * Getter for the 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.\n */\n get name() {\n return this.getAttribute('name');\n }\n\n /**\n * Getter for the type attribute.\n * @returns {string} The type of the input.\n */\n get type() {\n return this.localName;\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.\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 className = 'Textarea';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Whether the input is associated with a form.\n * @type {boolean}\n */\n static formAssociated = true;\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n set placeholder(value) {\n this.setAttribute('placeholder', value);\n }\n\n get placeholder() {\n return this.getAttribute('placeholder');\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n\n // if some value was set via value setter then don't use default value\n if (this.pristine) {\n this.value = this.innerHTML;\n this.pristine = false;\n }\n }\n\n beforeDraw() {\n this.observer.disconnect();\n }\n\n /**\n * Draws the component for the textarea.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.classList.add('native-textarea', this.variant || 'default');\n native.setAttribute('part', 'native');\n\n if (this.hasAttribute('invalid')) native.classList.add('has-error');\n\n let wrapper = document.createElement('div');\n wrapper.setAttribute('part', 'wrapper');\n wrapper.classList.add('wrapper');\n\n let inputWrapper = document.createElement('div');\n inputWrapper.classList.add('input-wrapper');\n\n let label = document.createElement('label');\n label.setAttribute('part', 'label');\n label.htmlFor = 'textarea';\n label.innerHTML = this.label || '';\n\n let input = document.createElement('textarea');\n input.id = 'textarea';\n input.name = this.name;\n input.disabled = this.hasAttribute('disabled');\n input.innerText = this.value;\n input.placeholder = this.placeholder || '';\n input.classList.add('form-control');\n input.setAttribute('part', 'input');\n input.setAttribute('rows', this.rows || 3);\n input.setAttribute('spellcheck', false);\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 if (this.resize === 'auto') input.addEventListener('input', this.setTextareaHeight);\n\n if (this.variant === 'standard') {\n if (this.label) native.appendChild(label);\n } else {\n inputWrapper.appendChild(label);\n }\n\n inputWrapper.appendChild(input);\n\n wrapper.appendChild(inputWrapper);\n\n native.appendChild(wrapper);\n\n fragment.appendChild(native);\n\n if (this.hasAttribute('counter')) {\n input.maxLength = this.maxLength || 1000;\n input.addEventListener('input', this.counterFn);\n\n let counter = document.createElement('div');\n counter.classList.add('counter');\n counter.innerText = `${input.value.length}/${input.maxLength}`;\n\n this.counterElement = counter;\n fragment.appendChild(counter);\n }\n\n this.native = native;\n this.labelElement = label;\n this.input = input;\n\n return fragment;\n }\n\n /**\n * Sets up the event listeners after the component is drawn.\n */\n afterDraw() {\n this.resizeObserver = new ResizeObserver(() => this.setTextareaHeight);\n\n if (!this.hasAttribute('disabled')) {\n event.addListener(this, 'click', 'wje-textarea:change');\n event.addListener(this, 'click', 'wje-textarea:input');\n }\n\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.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.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-textarea:input', {\n value: this.input.value,\n });\n\n this.value = this.input.value;\n });\n\n this.validateInput();\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 this.resizeObserver?.unobserve(this.input);\n }\n\n /**\n * Disconnects the component.\n */\n beforeDisconnect() {\n this.resizeObserver?.unobserve(this.input);\n }\n\n /**\n * Sets the height of the textarea.\n */\n setTextareaHeight = () => {\n if (this.getAttribute('resize') === 'auto') {\n this.input.style.height = 'auto';\n this.input.style.height = this.input.scrollHeight + 'px';\n }\n };\n\n /**\n * Updates the counter for the textarea.\n * @param {Event} e The event object.\n */\n counterFn = (e) => {\n this.counterElement.innerText = e.target.value.length + '/' + this.input.maxLength;\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 * @summary Propagates the validation state of the input.\n * This method sets the 'invalid' property of the input based on its 'pristine' state and its internal validity state.\n * If the input is invalid and the 'customErrorDisplay' property is true, it dispatches an 'invalid' event.\n */\n propagateValidation() {\n this.invalid = !this.pristine && !this.internals.validity.valid;\n\n if (this.invalid && this.customErrorDisplay) {\n this.dispatchEvent(new Event('invalid'));\n }\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 this.internals.setFormValue(this.value);\n form?.addEventListener('submit', () => {\n this.validateInput();\n this.propagateValidation();\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","import Textarea from './textarea.element.js';\n\nexport default Textarea;\n\nTextarea.define('wje-textarea', Textarea);\n"],"names":[],"mappings":";;;;;;AA2Be,MAAM,iBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,cAAc;AACV,UAAO;AAQX,2CAAkB,CAAC,cAAc;AAC7B,gBAAU,QAAQ,CAAC,aAAa;AAC5B,YAAI,SAAS,SAAS,cAAc;AAChC,gBAAM,gBAAgB,SAAS;AAC/B,gBAAM,WAAW,SAAS;AAC1B,gBAAM,W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AM;AACzB,SAAK,UAAU,aAAa,KAAK,KAAK;AACtC,iCAAM,iBAAiB,UAAU,MAAM;AACnC,WAAK,cAAe;AACpB,WAAK,oBAAqB;AAAA,IACtC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQI,oBAAoB;AAEhB,SAAK,QAAQ,KAAK;AAElB,SAAK,UAAU,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;AACA;AAAA;AAAA;AAAA;AAAA;AA5TI,cAjIiB,UAiIV,kBAAiB;ACxJ5B,SAAS,OAAO,gBAAgB,QAAQ;"}
|
|
1
|
+
{"version":3,"file":"wje-textarea.js","sources":["../packages/wje-textarea/textarea.element.js","../packages/wje-textarea/textarea.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Textarea` is a custom web component that represents a textarea input.\n * @summary This element represents a textarea input.\n * @documentation https://elements.webjet.sk/components/textarea\n * @status stable\n * @augments WJElement\n * @csspart native - The native textarea wrapper.\n * @csspart input - The textarea input.\n * @csspart wrapper - The textarea wrapper.\n * @cssproperty [--wje-textarea-font-family=var(--wje-font-family)] - Specifies the font family used for the textarea. Accepts any valid CSS font-family value.\n * @cssproperty [--wje-textarea-background-color=var(--wje-background)] - Sets the background color of the textarea. Accepts any valid CSS color value.\n * @cssproperty [--wje-textarea-color=var(--wje-color)] - Defines the text color within the textarea. Accepts any valid CSS color value.\n * @cssproperty [--wje-textarea-color-invalid=var(--wje-color-danger)] - Changes the text color of the textarea when it is invalid. Useful for highlighting validation errors.\n * @cssproperty [--wje-textarea-border-width=1px] - Specifies the width of the textarea's border. Accepts any valid CSS length unit.\n * @cssproperty [--wje-textarea-border-style=solid] - Sets the style of the textarea's border. Accepts standard CSS border styles such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-textarea-border-color=var(--wje-border-color)] - Defines the border color of the textarea. Accepts any valid CSS color value.\n * @cssproperty [--wje-textarea-border-color-focus=var(--wje-color-primary)] - Specifies the border color of the textarea when it is focused. Enhances the user experience by providing visual feedback.\n * @cssproperty [--wje-textarea-border-radius=4px] - Determines the border radius of the textarea, defining how rounded its corners are. Accepts any valid CSS length unit.\n * @cssproperty [--wje-textarea-margin-bottom=.5rem] - Sets the bottom margin of the textarea. Ensures spacing between the textarea and other elements.\n * @cssproperty [--wje-textarea-line-height=20px] - Specifies the line height of the text within the textarea. Helps control the vertical spacing of the text.\n * @cssproperty [--wje-textarea-padding=0.5rem] - Defines the padding inside the textarea. Controls the spacing between the content and the border.\n * @tag wje-textarea\n */\n\nexport default class Textarea extends WJElement {\n /**\n * Creates an instance of Textarea.\n * @class\n */\n constructor() {\n super();\n\n this.invalid = false;\n this.pristine = true;\n this.internals = this.attachInternals();\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 // this.refresh();\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 * Getter for the value attribute.\n * @returns {string} The value of the attribute.\n */\n get value() {\n return this.input?.value ?? this._value ?? '';\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 * Getter for the invalid attribute.\n * @returns {boolean} Whether the attribute is present.\n */\n get invalid() {\n return this.hasAttribute('invalid');\n }\n\n /**\n * Setter for the invalid attribute.\n * @param {boolean} isInvalid Whether the input is invalid.\n */\n set invalid(isInvalid) {\n if (isInvalid) this.setAttribute('invalid', '');\n else this.removeAttribute('invalid');\n }\n\n /**\n * Getter for the 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.\n */\n get name() {\n return this.getAttribute('name');\n }\n\n /**\n * Getter for the type attribute.\n * @returns {string} The type of the input.\n */\n get type() {\n return this.localName;\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.\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 className = 'Textarea';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Whether the input is associated with a form.\n * @type {boolean}\n */\n static formAssociated = true;\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n set placeholder(value) {\n this.setAttribute('placeholder', value);\n }\n\n get placeholder() {\n return this.getAttribute('placeholder');\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n\n // if some value was set via value setter then don't use default value\n if (this.pristine) {\n this.value = this.innerHTML;\n this.pristine = false;\n }\n }\n\n beforeDraw() {\n this.observer.disconnect();\n }\n\n /**\n * Draws the component for the textarea.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.classList.add('native-textarea', this.variant || 'default');\n native.setAttribute('part', 'native');\n\n if (this.hasAttribute('invalid')) native.classList.add('has-error');\n\n let wrapper = document.createElement('div');\n wrapper.setAttribute('part', 'wrapper');\n wrapper.classList.add('wrapper');\n\n let inputWrapper = document.createElement('div');\n inputWrapper.classList.add('input-wrapper');\n\n let label = document.createElement('label');\n label.setAttribute('part', 'label');\n label.htmlFor = 'textarea';\n label.innerHTML = this.label || '';\n\n let input = document.createElement('textarea');\n input.id = 'textarea';\n input.name = this.name;\n input.disabled = this.hasAttribute('disabled');\n input.innerText = this.value;\n input.placeholder = this.placeholder || '';\n input.classList.add('form-control');\n input.setAttribute('part', 'input');\n input.setAttribute('rows', this.rows || 3);\n input.setAttribute('spellcheck', false);\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 let error = document.createElement('div');\n error.setAttribute('slot', 'error');\n\n let errorSlot = document.createElement('slot');\n errorSlot.setAttribute('name', 'error');\n\n if (this.resize === 'auto') input.addEventListener('input', this.setTextareaHeight);\n\n if (this.variant === 'standard') {\n if (this.label) native.appendChild(label);\n } else {\n inputWrapper.appendChild(label);\n }\n\n inputWrapper.appendChild(input);\n\n wrapper.appendChild(inputWrapper);\n\n native.appendChild(wrapper);\n native.append(errorSlot);\n\n this.append(error);\n\n fragment.appendChild(native);\n\n if (this.hasAttribute('counter')) {\n input.maxLength = this.maxLength || 1000;\n input.addEventListener('input', this.counterFn);\n\n let counter = document.createElement('div');\n counter.classList.add('counter');\n counter.innerText = `${input.value.length}/${input.maxLength}`;\n\n this.counterElement = counter;\n fragment.appendChild(counter);\n }\n\n this.native = native;\n this.labelElement = label;\n this.input = input;\n\n return fragment;\n }\n\n /**\n * Sets up the event listeners after the component is drawn.\n */\n afterDraw() {\n this.resizeObserver = new ResizeObserver(() => this.setTextareaHeight);\n\n if (!this.hasAttribute('disabled')) {\n event.addListener(this, 'click', 'wje-textarea:change');\n event.addListener(this, 'click', 'wje-textarea:input');\n }\n\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.addEventListener('wje-textarea: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.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-textarea:input', {\n value: this.input.value,\n });\n\n this.value = this.input.value;\n });\n\n this.validateInput();\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 this.resizeObserver?.unobserve(this.input);\n }\n\n /**\n * Disconnects the component.\n */\n beforeDisconnect() {\n this.resizeObserver?.unobserve(this.input);\n }\n\n /**\n * Sets the height of the textarea.\n */\n setTextareaHeight = () => {\n if (this.getAttribute('resize') === 'auto') {\n this.input.style.height = 'auto';\n this.input.style.height = this.input.scrollHeight + 'px';\n }\n };\n\n /**\n * Updates the counter for the textarea.\n * @param {Event} e The event object.\n */\n counterFn = (e) => {\n this.counterElement.innerText = e.target.value.length + '/' + this.input.maxLength;\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 = true; //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 * @summary Propagates the validation state of the input.\n * This method sets the 'invalid' property of the input based on its 'pristine' state and its internal validity state.\n * If the input is invalid and the 'customErrorDisplay' property is true, it dispatches an 'invalid' event.\n */\n propagateValidation() {\n this.invalid = !this.pristine && !this.internals.validity.valid;\n\n if (this.invalid) {\n this.dispatchEvent(new Event('wje-textarea:invalid'));\n }\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 this.internals.setFormValue(this.value);\n form?.addEventListener('submit', () => {\n this.validateInput();\n this.propagateValidation();\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","import Textarea from './textarea.element.js';\n\nexport default Textarea;\n\nTextarea.define('wje-textarea', Textarea);\n"],"names":[],"mappings":";;;;;;AA2Be,MAAM,iBAAiB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5C,cAAc;AACV,UAAO;AAQX,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,IAGJ;AAgHD,qCAAY;AAuNZ;AAAA;AAAA;AAAA,6CAAoB,MAAM;AACtB,UAAI,KAAK,aAAa,QAAQ,MAAM,QAAQ;AACxC,aAAK,MAAM,MAAM,SAAS;AAC1B,aAAK,MAAM,MAAM,SAAS,KAAK,MAAM,eAAe;AAAA,MAChE;AAAA,IACK;AAMD;AAAA;AAAA;AAAA;AAAA,qCAAY,CAAC,MAAM;AACf,WAAK,eAAe,YAAY,EAAE,OAAO,MAAM,SAAS,MAAM,KAAK,MAAM;AAAA,IAC5E;AAtWG,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,YAAY,KAAK,gBAAiB;AACvC,SAAK,WAAW,IAAI,iBAAiB,KAAK,eAAe;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBI,IAAI,MAAM,OAAO;AACb,SAAK,UAAU,aAAa,KAAK;AAEjC,QAAI,KAAK,MAAO,MAAK,MAAM,QAAQ;AAEnC,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,IAAI,QAA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UAAU,aAAa,KAAK,KAAK;AACtC,iCAAM,iBAAiB,UAAU,MAAM;AACnC,WAAK,cAAe;AACpB,WAAK,oBAAqB;AAAA,IACtC;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQI,oBAAoB;AAEhB,SAAK,QAAQ,KAAK;AAElB,SAAK,UAAU,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;AACA;AAAA;AAAA;AAAA;AAAA;AA9VI,cAzJiB,UAyJV,kBAAiB;AChL5B,SAAS,OAAO,gBAAgB,QAAQ;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wj-elements",
|
|
3
3
|
"description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.183",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __typeError = (msg) => {
|
|
3
|
-
throw TypeError(msg);
|
|
4
|
-
};
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
|
-
var _drawnItems, _loadedItems, _response, _infiniteScrollTemplate, _abortController, _signal, _loading;
|
|
12
|
-
import WJElement from "./wje-element.js";
|
|
13
|
-
import { WjElementUtils } from "./element-utils.js";
|
|
14
|
-
import { event } from "./event.js";
|
|
15
|
-
const styles = "/*\n[ Wj infinite Scroll ]\n*/\n\n:host {\n overflow-x: auto;\n width: var(--wje-infinite-scroll-width);\n height: var(--wje-infinite-scroll-height);\n display: block;\n}\n\n.native {\n /*position: relative;*/\n}\n\n.loading {\n position: sticky;\n display: none;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 9999;\n background-color: var(--wje-infinite-scroll-loading-bg);\n &.show {\n display: flex;\n }\n}\n\n[name='ending'] {\n display: none;\n margin-top: 1rem;\n text-align: center;\n}\n\n[name='ending'].show {\n display: block;\n}\n";
|
|
16
|
-
class InfiniteScroll extends WJElement {
|
|
17
|
-
/**
|
|
18
|
-
* Creates an instance of InfiniteScroll.
|
|
19
|
-
*/
|
|
20
|
-
constructor() {
|
|
21
|
-
super();
|
|
22
|
-
__privateAdd(this, _drawnItems);
|
|
23
|
-
__privateAdd(this, _loadedItems);
|
|
24
|
-
__privateAdd(this, _response);
|
|
25
|
-
__privateAdd(this, _infiniteScrollTemplate);
|
|
26
|
-
__privateAdd(this, _abortController);
|
|
27
|
-
__privateAdd(this, _signal);
|
|
28
|
-
__privateAdd(this, _loading);
|
|
29
|
-
__publicField(this, "className", "InfiniteScroll");
|
|
30
|
-
/**
|
|
31
|
-
* Attaches a scroll event listener to the current object.
|
|
32
|
-
* The `scrollEvent` function binds the `onScroll` method to the 'scroll' event
|
|
33
|
-
* of the current object. This enables handling of scroll events for
|
|
34
|
-
* specific functionality such as updating UI elements, loading content dynamically,
|
|
35
|
-
* or tracking user interaction with scrollable content.
|
|
36
|
-
*/
|
|
37
|
-
__publicField(this, "scrollEvent", () => {
|
|
38
|
-
this.addEventListener("scroll", this.onScroll);
|
|
39
|
-
});
|
|
40
|
-
/**
|
|
41
|
-
* A function that removes the scroll event listener from the current context.
|
|
42
|
-
* This function is used to unbind the `onScroll` event listener
|
|
43
|
-
* from the `scroll` event of the current object. It ensures that
|
|
44
|
-
* the scroll event no longer triggers the `onScroll` handler.
|
|
45
|
-
* @function
|
|
46
|
-
*/
|
|
47
|
-
__publicField(this, "unScrollEvent", () => {
|
|
48
|
-
this.removeEventListener("scroll", this.onScroll);
|
|
49
|
-
});
|
|
50
|
-
/**
|
|
51
|
-
* A scroll event handler function that checks the scroll position and triggers loading additional content
|
|
52
|
-
* when the user scrolls near the bottom of the page.
|
|
53
|
-
* Properties accessed:
|
|
54
|
-
* - `scrollTop`: The number of pixels that the content of an element is scrolled vertically.
|
|
55
|
-
* - `scrollHeight`: The total height of the element's content.
|
|
56
|
-
* - `clientHeight`: The inner height of the element in pixels, including padding but excluding borders and scrollbars.
|
|
57
|
-
* Conditions:
|
|
58
|
-
* - Determines if the scroll position is within 300 pixels of the bottom of the element.
|
|
59
|
-
* - Verifies that the current page number is less than or equal to the total number of pages.
|
|
60
|
-
* - Checks if the current page is already in the loading state.
|
|
61
|
-
* Actions:
|
|
62
|
-
* - Increments the current page number when the conditions are met.
|
|
63
|
-
* - Initiates loading for the next page by calling the `loadPages` function.
|
|
64
|
-
* @param {Event} e The scroll event object.
|
|
65
|
-
*/
|
|
66
|
-
__publicField(this, "onScroll", (e) => {
|
|
67
|
-
const { scrollTop, scrollHeight, clientHeight } = e.target;
|
|
68
|
-
if (scrollTop + clientHeight >= scrollHeight - 300 && this.currentPage <= this.totalPages && this.isLoading.includes(this.currentPage)) {
|
|
69
|
-
this.currentPage++;
|
|
70
|
-
__privateSet(this, _loading, this.loadPages(this.currentPage));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
__publicField(this, "compareFunction", (i, item) => i.id === item.id);
|
|
74
|
-
/**
|
|
75
|
-
* Converts a data item into an HTML element based on a template.
|
|
76
|
-
* This function takes a data item, interpolates it into a predefined template,
|
|
77
|
-
* parses the resulting HTML string, and returns the first child element of the parsed HTML content.
|
|
78
|
-
* @param {object} item The data object to interpolate into the HTML template.
|
|
79
|
-
* @returns {Element} The first child element generated from the interpolated HTML string.
|
|
80
|
-
*/
|
|
81
|
-
__publicField(this, "dataToHtml", (item) => {
|
|
82
|
-
let interpolateItem = this.interpolate(this.infiniteScrollTemplate, item);
|
|
83
|
-
let doc = this.parser.parseFromString(interpolateItem, "text/html");
|
|
84
|
-
let element = doc.activeElement.firstElementChild;
|
|
85
|
-
return element;
|
|
86
|
-
});
|
|
87
|
-
/**
|
|
88
|
-
* A custom implementation of the forEach method designed to iterate over an array of data,
|
|
89
|
-
* transform each item into an HTML element, and append the element to a specified placement object.
|
|
90
|
-
* Additionally, it adds an event listener to each generated element for handling click events.
|
|
91
|
-
* @param {Array} data An array of items to process. Each item is transformed into an HTML element
|
|
92
|
-
* and appended to the placement object specified in the context of `this`.
|
|
93
|
-
*/
|
|
94
|
-
__publicField(this, "customForeach", (data) => {
|
|
95
|
-
data.forEach((item) => {
|
|
96
|
-
let element = this.dataToHtml(item);
|
|
97
|
-
let symbol = Symbol("infinite-scroll-item");
|
|
98
|
-
element[symbol] = item;
|
|
99
|
-
item[symbol] = element;
|
|
100
|
-
event.addListener(element, "click", "wje-infinite-scroll:click-item", null);
|
|
101
|
-
this.placementObj.insertAdjacentElement("beforeend", element);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
/**
|
|
105
|
-
* Interpolates a string template with values from the provided parameters object.
|
|
106
|
-
* The template contains placeholders in the format `{{key}}` or `{{key.subkey}}`,
|
|
107
|
-
* which are replaced with the corresponding values from the `params` object.
|
|
108
|
-
* Placeholders support dot notation for accessing nested properties within the `params` object.
|
|
109
|
-
* @param {string} template The string template containing placeholders to be replaced.
|
|
110
|
-
* @param {object} params The object containing key-value pairs used for substitution in the template.
|
|
111
|
-
* @returns {string} A string with all placeholders replaced by their respective values from the `params` object.
|
|
112
|
-
*/
|
|
113
|
-
__publicField(this, "interpolate", (template, params) => {
|
|
114
|
-
let keys = template.match(/\{{.*?\}}/g);
|
|
115
|
-
if (keys) {
|
|
116
|
-
for (let key of keys) {
|
|
117
|
-
let cleanKey = key.replace("{{", "").replace("}}", "");
|
|
118
|
-
let val = "";
|
|
119
|
-
cleanKey.split(".").forEach((k) => {
|
|
120
|
-
val = val === "" ? params[k] : val[k];
|
|
121
|
-
});
|
|
122
|
-
template = template.replace(key, val);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return template;
|
|
126
|
-
});
|
|
127
|
-
this.totalPages = 0;
|
|
128
|
-
this.isLoading = [];
|
|
129
|
-
__privateSet(this, _response, {});
|
|
130
|
-
this.iterate = null;
|
|
131
|
-
__privateSet(this, _infiniteScrollTemplate, null);
|
|
132
|
-
__privateSet(this, _abortController, new AbortController());
|
|
133
|
-
__privateSet(this, _signal, __privateGet(this, _abortController).signal);
|
|
134
|
-
__privateSet(this, _drawnItems, []);
|
|
135
|
-
__privateSet(this, _loadedItems, []);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Dependencies of the InfiniteScroll component.
|
|
139
|
-
* @param value
|
|
140
|
-
*/
|
|
141
|
-
set infiniteScrollTemplate(value) {
|
|
142
|
-
__privateSet(this, _infiniteScrollTemplate, value);
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Getter for the infiniteScrollTemplate property.
|
|
146
|
-
* @returns {null}
|
|
147
|
-
*/
|
|
148
|
-
get infiniteScrollTemplate() {
|
|
149
|
-
return __privateGet(this, _infiniteScrollTemplate);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Dependencies of the InfiniteScroll component.
|
|
153
|
-
* @param value
|
|
154
|
-
*/
|
|
155
|
-
set response(value) {
|
|
156
|
-
__privateSet(this, _response, value);
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Getter for the response property.
|
|
160
|
-
* @returns {*|{}}
|
|
161
|
-
*/
|
|
162
|
-
get response() {
|
|
163
|
-
return __privateGet(this, _response);
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Dependencies of the InfiniteScroll component.
|
|
167
|
-
* @param value
|
|
168
|
-
*/
|
|
169
|
-
set objectName(value) {
|
|
170
|
-
this.setAttribute("object-name", value);
|
|
171
|
-
}
|
|
172
|
-
get objectName() {
|
|
173
|
-
return this.getAttribute("object-name") ?? "data";
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Returns the CSS styles for the component.
|
|
177
|
-
* @static
|
|
178
|
-
* @returns {CSSStyleSheet}
|
|
179
|
-
*/
|
|
180
|
-
static get cssStyleSheet() {
|
|
181
|
-
return styles;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Returns the list of attributes to observe for changes.
|
|
185
|
-
* @static
|
|
186
|
-
* @returns {Array<string>}
|
|
187
|
-
*/
|
|
188
|
-
static get observedAttributes() {
|
|
189
|
-
return [];
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Sets up the attributes for the component.
|
|
193
|
-
*/
|
|
194
|
-
setupAttributes() {
|
|
195
|
-
this.isShadowRoot = "open";
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Prepares the component for updates before it is drawn.
|
|
199
|
-
* This method handles the removal of templates for iteration, adjusts the height styling of the component,
|
|
200
|
-
* and manages abort signals for loading operations.
|
|
201
|
-
* @returns {void} No return value.
|
|
202
|
-
*/
|
|
203
|
-
beforeDraw() {
|
|
204
|
-
var _a, _b, _c;
|
|
205
|
-
__privateSet(this, _loadedItems, []);
|
|
206
|
-
__privateSet(this, _drawnItems, []);
|
|
207
|
-
this.iterate = this.querySelector("[iterate]");
|
|
208
|
-
if (this.iterate) {
|
|
209
|
-
if (this.iterate.nodeName !== "TEMPLATE") {
|
|
210
|
-
console.error("The iterate attribute must be a template element");
|
|
211
|
-
this.infiniteScrollTemplate = (_a = this.iterate) == null ? void 0 : _a.outerHTML;
|
|
212
|
-
} else {
|
|
213
|
-
this.infiniteScrollTemplate = (_b = this.iterate) == null ? void 0 : _b.innerHTML;
|
|
214
|
-
}
|
|
215
|
-
(_c = this.iterate) == null ? void 0 : _c.remove();
|
|
216
|
-
}
|
|
217
|
-
this.setAttribute("style", "height: " + this.height);
|
|
218
|
-
if (__privateGet(this, _signal)) {
|
|
219
|
-
__privateGet(this, _abortController).abort();
|
|
220
|
-
__privateSet(this, _abortController, new AbortController());
|
|
221
|
-
__privateSet(this, _signal, __privateGet(this, _abortController).signal);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Creates and returns a document fragment containing the structure for an infinite scroll component.
|
|
226
|
-
* The structure includes native elements, slots for customization, and optional loading content.
|
|
227
|
-
* @returns {DocumentFragment} The document fragment containing the component's DOM structure.
|
|
228
|
-
*/
|
|
229
|
-
draw() {
|
|
230
|
-
let fragment = document.createDocumentFragment();
|
|
231
|
-
let native = document.createElement("div");
|
|
232
|
-
native.classList.add("native");
|
|
233
|
-
native.setAttribute("part", "native-infinite-scroll");
|
|
234
|
-
let slot = document.createElement("slot");
|
|
235
|
-
let ending = document.createElement("slot");
|
|
236
|
-
ending.setAttribute("name", "ending");
|
|
237
|
-
if (WjElementUtils.hasSlot(this, "loader")) {
|
|
238
|
-
let loading = document.createElement("div");
|
|
239
|
-
loading.classList.add("loading");
|
|
240
|
-
let loader = document.createElement("slot");
|
|
241
|
-
loader.setAttribute("name", "loader");
|
|
242
|
-
loading.appendChild(loader);
|
|
243
|
-
this.loadingEl = loading;
|
|
244
|
-
fragment.appendChild(loading);
|
|
245
|
-
}
|
|
246
|
-
native.appendChild(slot);
|
|
247
|
-
native.appendChild(ending);
|
|
248
|
-
fragment.appendChild(native);
|
|
249
|
-
this.endingEl = ending;
|
|
250
|
-
return fragment;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Called after the component has been drawn.
|
|
254
|
-
*/
|
|
255
|
-
async afterDraw() {
|
|
256
|
-
this.queryParams = this.queryParams || "";
|
|
257
|
-
this.size = +this.size || 10;
|
|
258
|
-
this.currentPage = 0;
|
|
259
|
-
this.scrollEvent();
|
|
260
|
-
__privateSet(this, _loading, this.loadPages(this.currentPage));
|
|
261
|
-
await __privateGet(this, _loading);
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Fetches the pages from the server.
|
|
265
|
-
* @param {number} page The page number.
|
|
266
|
-
* @returns {Promise<object>} The response from the server.
|
|
267
|
-
*/
|
|
268
|
-
async getPages(page) {
|
|
269
|
-
let hasParams = this.url.includes("?");
|
|
270
|
-
const response = await fetch(
|
|
271
|
-
`${this.url}${hasParams ? "&" : "?"}page=${page}&size=${this.size}${this == null ? void 0 : this.queryParams}`,
|
|
272
|
-
{
|
|
273
|
-
signal: __privateGet(this, _signal)
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
if (!response.ok) {
|
|
277
|
-
throw new Error(`An error occurred: ${response.status}`);
|
|
278
|
-
}
|
|
279
|
-
return await response.json();
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Hides the loader.
|
|
283
|
-
*/
|
|
284
|
-
hideLoader() {
|
|
285
|
-
var _a;
|
|
286
|
-
(_a = this == null ? void 0 : this.loadingEl) == null ? void 0 : _a.classList.remove("show");
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Displays the loader element by adding the 'show' class to its class list.
|
|
290
|
-
* This method is useful for indicating a loading or processing state in the UI.
|
|
291
|
-
* @returns {void} No return value.
|
|
292
|
-
*/
|
|
293
|
-
showLoader() {
|
|
294
|
-
var _a;
|
|
295
|
-
(_a = this == null ? void 0 : this.loadingEl) == null ? void 0 : _a.classList.add("show");
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Checks if there are more pages to load.
|
|
299
|
-
* @param {number} page The page number.
|
|
300
|
-
* @returns {boolean} Whether there are more pages to load.
|
|
301
|
-
*/
|
|
302
|
-
hasMorePages(page) {
|
|
303
|
-
return this.totalPages === 0 || page < this.totalPages;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Loads the pages.
|
|
307
|
-
* @param {number} page The page number.
|
|
308
|
-
*/
|
|
309
|
-
async loadPages(page) {
|
|
310
|
-
this.showLoader();
|
|
311
|
-
try {
|
|
312
|
-
if (this.hasMorePages(page)) {
|
|
313
|
-
let response;
|
|
314
|
-
this.parser = new DOMParser();
|
|
315
|
-
if (typeof this.setCustomData === "function") {
|
|
316
|
-
response = await this.setCustomData(page, __privateGet(this, _signal));
|
|
317
|
-
} else {
|
|
318
|
-
response = await this.getPages(page);
|
|
319
|
-
}
|
|
320
|
-
this.totalPages = response == null ? void 0 : response.totalPages;
|
|
321
|
-
this.currentPage = page;
|
|
322
|
-
this.placementObj = this;
|
|
323
|
-
if (this.hasAttribute("placement")) this.placementObj = this.querySelector(this.placement);
|
|
324
|
-
event.dispatchCustomEvent(this, "wje-infinite-scroll:load", response);
|
|
325
|
-
this.response = response;
|
|
326
|
-
__privateSet(this, _loadedItems, this.objectName ? response[this.objectName] : response);
|
|
327
|
-
const notDrawnItems = __privateGet(this, _loadedItems).filter(
|
|
328
|
-
(item) => !__privateGet(this, _drawnItems).some(this.compareFunction.bind(this, item))
|
|
329
|
-
);
|
|
330
|
-
this.customForeach(notDrawnItems);
|
|
331
|
-
__privateGet(this, _drawnItems).push(...notDrawnItems);
|
|
332
|
-
this.isLoading.push(page);
|
|
333
|
-
} else {
|
|
334
|
-
event.dispatchCustomEvent(this, "wje-infinite-scroll:complete");
|
|
335
|
-
this.endingEl.classList.add("show");
|
|
336
|
-
}
|
|
337
|
-
} catch (error) {
|
|
338
|
-
console.log(error);
|
|
339
|
-
} finally {
|
|
340
|
-
this.hideLoader();
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
addItem(item, place = "beforeend") {
|
|
344
|
-
let element = this.dataToHtml(item);
|
|
345
|
-
let symbol = Symbol("infinite-scroll-item");
|
|
346
|
-
element[symbol] = item;
|
|
347
|
-
item[symbol] = element;
|
|
348
|
-
this.placementObj.insertAdjacentElement(place, element);
|
|
349
|
-
__privateGet(this, _drawnItems).push(item);
|
|
350
|
-
if (__privateGet(this, _drawnItems).length > this.size * this.currentPage) {
|
|
351
|
-
this.totalPages += 1;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
removeItem(item) {
|
|
355
|
-
let drawnItem = __privateGet(this, _drawnItems).find(this.compareFunction.bind(this, item));
|
|
356
|
-
if (!drawnItem) {
|
|
357
|
-
console.error("Item not found");
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
let symbol = Object.getOwnPropertySymbols(drawnItem).at(0);
|
|
361
|
-
let element = drawnItem[symbol];
|
|
362
|
-
if (!element) {
|
|
363
|
-
console.error("Element not found");
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
element == null ? void 0 : element.remove();
|
|
367
|
-
__privateSet(this, _drawnItems, __privateGet(this, _drawnItems).filter((i) => i !== item));
|
|
368
|
-
if (__privateGet(this, _drawnItems).length < this.size * this.currentPage) {
|
|
369
|
-
this.isLoading = this.isLoading.filter((i) => i !== this.currentPage);
|
|
370
|
-
this.currentPage--;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
_drawnItems = new WeakMap();
|
|
375
|
-
_loadedItems = new WeakMap();
|
|
376
|
-
_response = new WeakMap();
|
|
377
|
-
_infiniteScrollTemplate = new WeakMap();
|
|
378
|
-
_abortController = new WeakMap();
|
|
379
|
-
_signal = new WeakMap();
|
|
380
|
-
_loading = new WeakMap();
|
|
381
|
-
export {
|
|
382
|
-
InfiniteScroll as I
|
|
383
|
-
};
|
|
384
|
-
//# sourceMappingURL=infinite-scroll.element-La0Qx41F.js.map
|