wj-elements 0.1.116 → 0.1.117
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/wje-checkbox.js +2 -2
- package/dist/wje-element.js +84 -82
- package/dist/wje-input.js +1 -1
- package/dist/wje-options.js +7 -1
- package/dist/wje-select.js +1 -1
- package/package.json +1 -1
package/dist/wje-checkbox.js
CHANGED
|
@@ -222,7 +222,7 @@ class Checkbox extends WJElement {
|
|
|
222
222
|
/**
|
|
223
223
|
* Removes the event listener when the checkbox is disconnected.
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
beforeDisconnect() {
|
|
226
226
|
event.removeElement(this.input);
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
@@ -231,7 +231,7 @@ class Checkbox extends WJElement {
|
|
|
231
231
|
* @param {HTMLFormElement} form - The form the custom element is associated with.
|
|
232
232
|
*/
|
|
233
233
|
formAssociatedCallback(form) {
|
|
234
|
-
form.addEventListener("submit", () => {
|
|
234
|
+
form == null ? void 0 : form.addEventListener("submit", () => {
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
/**
|
package/dist/wje-element.js
CHANGED
|
@@ -393,20 +393,21 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
393
393
|
constructor(componentTemplate) {
|
|
394
394
|
super();
|
|
395
395
|
__publicField(this, "initWjElement", async (force = false) => {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
396
|
+
return new Promise(async (resolve, reject) => {
|
|
397
|
+
var _a;
|
|
398
|
+
this.drawingStatus = this.drawingStatuses.BEGINING;
|
|
399
|
+
(_a = this.setupAttributes) == null ? void 0 : _a.call(this);
|
|
400
|
+
if (this.isShadowRoot) {
|
|
401
|
+
!this.shadowRoot && this.attachShadow({ mode: this.shadowType || "open" });
|
|
402
|
+
}
|
|
403
|
+
this.setUpAccessors();
|
|
404
|
+
this.drawingStatus = this.drawingStatuses.START;
|
|
405
|
+
await this.display(force);
|
|
406
|
+
const sheet = new CSSStyleSheet();
|
|
407
|
+
sheet.replaceSync(this.constructor.cssStyleSheet);
|
|
408
|
+
this.context.adoptedStyleSheets = [sheet];
|
|
409
|
+
resolve();
|
|
410
|
+
});
|
|
410
411
|
});
|
|
411
412
|
this.template = componentTemplate || template;
|
|
412
413
|
this.isAttached = false;
|
|
@@ -415,11 +416,15 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
415
416
|
});
|
|
416
417
|
this.definedependencies();
|
|
417
418
|
this.rendering = false;
|
|
418
|
-
this.runtimeTimeout = null;
|
|
419
|
-
this.count = 0;
|
|
420
|
-
this.functionStack = [];
|
|
421
|
-
this.scheludedRefresh = false;
|
|
422
419
|
this._dependencies = {};
|
|
420
|
+
this.drawingStatuses = {
|
|
421
|
+
ATTACHED: 1,
|
|
422
|
+
BEGINING: 2,
|
|
423
|
+
START: 3,
|
|
424
|
+
DRAWING: 4,
|
|
425
|
+
DONE: 5,
|
|
426
|
+
DISCONNECTED: 6
|
|
427
|
+
};
|
|
423
428
|
}
|
|
424
429
|
get permission() {
|
|
425
430
|
return this.getAttribute("permission-check");
|
|
@@ -508,6 +513,7 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
508
513
|
});
|
|
509
514
|
}
|
|
510
515
|
async connectedCallback() {
|
|
516
|
+
this.drawingStatus = this.drawingStatuses.ATTACHED;
|
|
511
517
|
this.finisPromise = (resolve) => {
|
|
512
518
|
resolve();
|
|
513
519
|
};
|
|
@@ -515,7 +521,7 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
515
521
|
reject();
|
|
516
522
|
};
|
|
517
523
|
this.refreshUpdatePromise();
|
|
518
|
-
|
|
524
|
+
this.renderPromise = this.initWjElement(true);
|
|
519
525
|
}
|
|
520
526
|
setupAttributes() {
|
|
521
527
|
let allEvents = WjElementUtils.getEvents(this);
|
|
@@ -533,32 +539,37 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
533
539
|
(_a = this.beforeDisconnect) == null ? void 0 : _a.call(this);
|
|
534
540
|
if (this.isAttached)
|
|
535
541
|
this.context.innerHTML = "";
|
|
536
|
-
this.drawingStatus = "DISCONNECTED";
|
|
537
542
|
this.isAttached = false;
|
|
538
543
|
(_b = this.afterDisconnect) == null ? void 0 : _b.call(this);
|
|
544
|
+
this.drawingStatus = this.drawingStatuses.DISCONNECTED;
|
|
545
|
+
}
|
|
546
|
+
async enqueueUpdate() {
|
|
547
|
+
try {
|
|
548
|
+
await this.renderPromise;
|
|
549
|
+
} catch (e) {
|
|
550
|
+
Promise.reject(e);
|
|
551
|
+
}
|
|
552
|
+
const result = this.refresh();
|
|
553
|
+
if (result != null) {
|
|
554
|
+
await result;
|
|
555
|
+
}
|
|
556
|
+
this.renderPromise = null;
|
|
539
557
|
}
|
|
540
558
|
/**
|
|
541
559
|
* Lifecycle method, called whenever an observed property changes
|
|
542
560
|
*/
|
|
543
561
|
attributeChangedCallback(name, old, newName) {
|
|
544
|
-
if (!this.isAttached && old !== newName) {
|
|
545
|
-
this.scheludedRefresh = true;
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
562
|
if (old !== newName) {
|
|
549
|
-
this.
|
|
563
|
+
this.renderPromise = this.enqueueUpdate();
|
|
550
564
|
}
|
|
551
565
|
}
|
|
552
566
|
async refresh() {
|
|
553
|
-
var _a, _b
|
|
554
|
-
(
|
|
555
|
-
|
|
556
|
-
|
|
567
|
+
var _a, _b;
|
|
568
|
+
if (this.drawingStatus && this.drawingStatus >= this.drawingStatuses.START) {
|
|
569
|
+
(_a = this.beforeDisconnect) == null ? void 0 : _a.call(this);
|
|
570
|
+
this.refreshUpdatePromise();
|
|
557
571
|
(_b = this.afterDisconnect) == null ? void 0 : _b.call(this);
|
|
558
|
-
|
|
559
|
-
} else {
|
|
560
|
-
(_c = this.unregister) == null ? void 0 : _c.call(this);
|
|
561
|
-
await this.initWjElement(true);
|
|
572
|
+
return this.initWjElement(true);
|
|
562
573
|
}
|
|
563
574
|
}
|
|
564
575
|
/**
|
|
@@ -567,9 +578,7 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
567
578
|
draw(context, store2, params) {
|
|
568
579
|
return null;
|
|
569
580
|
}
|
|
570
|
-
display(force = false,
|
|
571
|
-
if (this.isProcessingFlow(processId))
|
|
572
|
-
return;
|
|
581
|
+
display(force = false, signal) {
|
|
573
582
|
if (force) {
|
|
574
583
|
[...this.context.childNodes].forEach(this.context.removeChild.bind(this.context));
|
|
575
584
|
this.isAttached = false;
|
|
@@ -577,33 +586,32 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
577
586
|
this.context.append(this.template.content.cloneNode(true));
|
|
578
587
|
if (this.isPermissionCheck || this.isShow) {
|
|
579
588
|
if (WjePermissionsApi.isPermissionFulfilled.bind(this)(this.permission)) {
|
|
580
|
-
this.
|
|
589
|
+
this.drawingStatus = this.drawingStatuses.DRAWING;
|
|
590
|
+
return this._resolveRender(signal);
|
|
581
591
|
} else {
|
|
582
592
|
this.remove();
|
|
583
593
|
}
|
|
584
594
|
} else {
|
|
585
|
-
this._resolveRender(
|
|
595
|
+
return this._resolveRender(signal);
|
|
586
596
|
}
|
|
587
597
|
}
|
|
588
|
-
async render(
|
|
598
|
+
async render() {
|
|
589
599
|
this.drawingStatus = "DRAWING";
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
this.context.appendChild(rendered);
|
|
606
|
-
});
|
|
600
|
+
let _draw = this.draw(this.context, this.store, WjElementUtils.getAttributes(this));
|
|
601
|
+
if (_draw instanceof Promise) {
|
|
602
|
+
_draw = await _draw;
|
|
603
|
+
}
|
|
604
|
+
let rend = _draw;
|
|
605
|
+
let element;
|
|
606
|
+
if (rend instanceof HTMLElement || rend instanceof DocumentFragment) {
|
|
607
|
+
element = rend;
|
|
608
|
+
} else {
|
|
609
|
+
let template2 = document.createElement("template");
|
|
610
|
+
template2.innerHTML = rend;
|
|
611
|
+
element = template2.content.cloneNode(true);
|
|
612
|
+
}
|
|
613
|
+
let rendered = element;
|
|
614
|
+
this.context.appendChild(rendered);
|
|
607
615
|
}
|
|
608
616
|
/**
|
|
609
617
|
* Turns a string split with "-" into camel case notation
|
|
@@ -641,33 +649,27 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
641
649
|
});
|
|
642
650
|
});
|
|
643
651
|
}
|
|
644
|
-
|
|
645
|
-
return !this.functionStack.find((d) => d == processId);
|
|
646
|
-
}
|
|
647
|
-
_resolveRender(processId) {
|
|
648
|
-
if (this.isProcessingFlow(processId))
|
|
649
|
-
return;
|
|
652
|
+
async _resolveRender(signal) {
|
|
650
653
|
this.params = WjElementUtils.getAttributes(this);
|
|
651
|
-
Promise
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
});
|
|
654
|
+
return new Promise(async (resolve, reject) => {
|
|
655
|
+
var _a;
|
|
656
|
+
const __beforeDraw = this.beforeDraw(this.context, this.store, WjElementUtils.getAttributes(this));
|
|
657
|
+
if (__beforeDraw instanceof Promise) {
|
|
658
|
+
await __beforeDraw;
|
|
659
|
+
}
|
|
660
|
+
await this.render();
|
|
661
|
+
const __afterDraw = (_a = this.afterDraw) == null ? void 0 : _a.call(this, this.context, this.store, WjElementUtils.getAttributes(this));
|
|
662
|
+
if (__afterDraw instanceof Promise) {
|
|
663
|
+
await __afterDraw;
|
|
664
|
+
}
|
|
665
|
+
this.finisPromise();
|
|
666
|
+
this.rendering = false;
|
|
667
|
+
this.isAttached = true;
|
|
668
|
+
this.removeClassAfterConnect && this.classList.remove(...this.removeClassAfterConnect);
|
|
669
|
+
this.drawingStatus = this.drawingStatuses.DONE;
|
|
670
|
+
resolve();
|
|
671
|
+
}).catch((e) => {
|
|
672
|
+
console.log(e);
|
|
671
673
|
});
|
|
672
674
|
}
|
|
673
675
|
};
|
package/dist/wje-input.js
CHANGED
|
@@ -390,7 +390,7 @@ class Input extends WJElement {
|
|
|
390
390
|
* @param {HTMLFormElement} form - The form the custom element is associated with.
|
|
391
391
|
*/
|
|
392
392
|
formAssociatedCallback(form) {
|
|
393
|
-
form.addEventListener("submit", () => {
|
|
393
|
+
form == null ? void 0 : form.addEventListener("submit", () => {
|
|
394
394
|
this.validateInput();
|
|
395
395
|
this.propagateValidation();
|
|
396
396
|
});
|
package/dist/wje-options.js
CHANGED
|
@@ -60,6 +60,12 @@ class Options extends WJElement {
|
|
|
60
60
|
get hasOptionArrayPath() {
|
|
61
61
|
return this.hasAttribute("option-array-path");
|
|
62
62
|
}
|
|
63
|
+
get dropdownHeight() {
|
|
64
|
+
return this.getAttribute("dropdown-height") || "100%";
|
|
65
|
+
}
|
|
66
|
+
set dropdownHeight(value) {
|
|
67
|
+
this.setAttribute("dropdown-height", value);
|
|
68
|
+
}
|
|
63
69
|
set itemValue(value) {
|
|
64
70
|
this.setAttribute("item-value", value);
|
|
65
71
|
}
|
|
@@ -128,7 +134,7 @@ class Options extends WJElement {
|
|
|
128
134
|
const list = document.createElement("wje-list");
|
|
129
135
|
const infiniteScroll = document.createElement("wje-infinite-scroll");
|
|
130
136
|
infiniteScroll.setAttribute("placement", "wje-list");
|
|
131
|
-
infiniteScroll.setAttribute("height",
|
|
137
|
+
infiniteScroll.setAttribute("height", this.dropdownHeight);
|
|
132
138
|
infiniteScroll.setAttribute("object-name", this.optionArrayPath);
|
|
133
139
|
infiniteScroll.append(list);
|
|
134
140
|
infiniteScroll.dataToHtml = this.htmlItem;
|
package/dist/wje-select.js
CHANGED
|
@@ -597,7 +597,7 @@ class Select extends WJElement {
|
|
|
597
597
|
* @param {HTMLFormElement} form - The form the custom element is associated with.
|
|
598
598
|
*/
|
|
599
599
|
formAssociatedCallback(form) {
|
|
600
|
-
form.addEventListener("submit", () => {
|
|
600
|
+
form == null ? void 0 : form.addEventListener("submit", () => {
|
|
601
601
|
});
|
|
602
602
|
}
|
|
603
603
|
/**
|
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.117",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|