wj-elements 0.1.42 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dark.css +1 -1
- package/dist/light.css +1 -1
- package/dist/wje-avatar.js +1 -1
- package/dist/wje-badge.js +8 -8
- package/dist/wje-button.js +9 -9
- package/dist/wje-chip.js +15 -15
- package/dist/wje-dialog.js +20 -20
- package/dist/wje-infinite-scroll.js +63 -55
- package/dist/wje-inline-edit.js +57 -32
- package/dist/wje-input.js +5 -5
- package/dist/wje-item.js +1 -1
- package/dist/wje-master.js +300 -253
- package/dist/wje-menu-item.js +52 -36
- package/package.json +1 -1
package/dist/wje-inline-edit.js
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var p = (s, n, t) => n in s ? u(s, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[n] = t;
|
|
3
|
+
var r = (s, n, t) => (p(s, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
import c from "./wje-element.js";
|
|
5
|
+
import m from "./wje-format-digital.js";
|
|
6
|
+
import b from "./wje-button.js";
|
|
7
|
+
import v from "./wje-input.js";
|
|
8
|
+
import f from "./wje-icon.js";
|
|
9
|
+
const g = ":host{cursor:pointer;overflow:hidden;@keyframes wjFade{0%{display:flex}to{display:none}}}:host .heading{z-index:1;display:flex;align-items:center;position:relative;min-height:34px}:host .heading .edit{margin-left:.5rem;opacity:0}:host .heading:hover .edit{opacity:1}:host .heading h5{margin:0;width:calc(100% - 50px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host .native-inline-edit{align-items:center;border-radius:3px!important;margin:0 1rem 0 0;display:flex}:host .native-inline-edit.open{z-index:9}:host .native-inline-edit .buttons{display:flex;margin:0 0 0 .5rem}:host .fade-out{display:none}:host .fade-in{display:flex}";
|
|
10
|
+
class l extends c {
|
|
7
11
|
constructor() {
|
|
8
12
|
super();
|
|
9
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Dependencies
|
|
15
|
+
* @type {Object}
|
|
16
|
+
*/
|
|
17
|
+
r(this, "depandencies", {
|
|
18
|
+
"wje-format-digital": m,
|
|
19
|
+
"wje-button": b,
|
|
20
|
+
"wje-input": v,
|
|
21
|
+
"wje-icon": f
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* The class name.
|
|
25
|
+
*/
|
|
26
|
+
r(this, "className", "InlineEdit");
|
|
10
27
|
}
|
|
11
28
|
get title() {
|
|
12
29
|
return this.getAttribute("title");
|
|
@@ -27,45 +44,53 @@ class o extends l {
|
|
|
27
44
|
return this.setAttribute("endpoint", t);
|
|
28
45
|
}
|
|
29
46
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @static
|
|
33
|
-
* @returns {CSSStyleSheet}
|
|
47
|
+
* Getter for the CSS stylesheet.
|
|
48
|
+
* @returns {string} The CSS stylesheet.
|
|
34
49
|
*/
|
|
35
50
|
static get cssStyleSheet() {
|
|
36
|
-
return
|
|
51
|
+
return g;
|
|
37
52
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Returns the list of attributes to observe for changes.
|
|
40
|
-
*
|
|
41
|
-
* @static
|
|
42
|
-
* @returns {Array<string>}
|
|
43
|
-
*/
|
|
44
53
|
static get observedAttributes() {
|
|
45
|
-
return [];
|
|
54
|
+
return ["checked", "disabled"];
|
|
46
55
|
}
|
|
47
56
|
/**
|
|
48
|
-
* Sets up the attributes for the
|
|
57
|
+
* Sets up the attributes for the checkbox.
|
|
49
58
|
*/
|
|
50
59
|
setupAttributes() {
|
|
51
60
|
this.isShadowRoot = "open";
|
|
52
61
|
}
|
|
53
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Draws the checkbox.
|
|
64
|
+
* @param {object} context - The context.
|
|
65
|
+
* @param {object} store - The store.
|
|
66
|
+
* @param {object} params - The parameters.
|
|
67
|
+
* @returns {DocumentFragment} The created fragment.
|
|
68
|
+
*/
|
|
69
|
+
draw(t, e, h) {
|
|
54
70
|
let i = document.createDocumentFragment();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
if (this.heading = document.createElement("div"), this.heading.classList.add("heading"), this.h5 = document.createElement("h5"), this.h5.innerHTML = this.textContent || this.title || "Názov", this.heading.appendChild(this.h5), i.appendChild(this.heading), !this.notEditable) {
|
|
72
|
+
this.span = document.createElement("span"), this.span.innerHTML = '<wje-icon name="pencil"></wje-icon>';
|
|
73
|
+
let a = document.createElement("div");
|
|
74
|
+
a.setAttribute("part", "native"), a.classList.add("native-inline-edit"), this.input = this.inputElement(), this.buttons = document.createElement("div"), this.buttons.classList.add("buttons", "btn-group");
|
|
75
|
+
let d = document.createElement("wje-button");
|
|
76
|
+
d.setAttribute("fill", "outline"), d.setAttribute("color", "success"), d.innerHTML = '<wje-icon name="check"></wje-icon>';
|
|
77
|
+
let o = document.createElement("wje-button");
|
|
78
|
+
o.setAttribute("fill", "outline"), o.setAttribute("color", "danger"), o.innerHTML = '<wje-icon name="x"></wje-icon>', this.heading.appendChild(this.span), this.buttons.appendChild(d), this.buttons.appendChild(o), a.appendChild(this.input), a.appendChild(this.buttons), this.save = d, this.close = o, i.appendChild(a);
|
|
79
|
+
}
|
|
80
|
+
return i;
|
|
81
|
+
}
|
|
82
|
+
afterDraw(t, e, h) {
|
|
58
83
|
this.notEditable || (this.heading.addEventListener("click", (i) => {
|
|
59
|
-
this.
|
|
60
|
-
}), this.
|
|
61
|
-
i.preventDefault(), i.stopImmediatePropagation(), i.stopPropagation(),
|
|
62
|
-
}), this.
|
|
84
|
+
this.heading.classList.remove("fade-in"), this.heading.classList.add("fade-out");
|
|
85
|
+
}), this.close.addEventListener("click", (i) => {
|
|
86
|
+
i.preventDefault(), i.stopImmediatePropagation(), i.stopPropagation(), native.classList.remove("open", "fade-in"), this.heading.classList.remove("fade-out"), this.heading.classList.add("fade-in");
|
|
87
|
+
}), this.save.addEventListener("click", (i) => {
|
|
63
88
|
this.endpoint === null ? this.dispatchEdit(this.input.value) : this.save(this.input.value);
|
|
64
89
|
}));
|
|
65
90
|
}
|
|
66
91
|
inputElement() {
|
|
67
|
-
let t = document.createElement("input");
|
|
68
|
-
return t.
|
|
92
|
+
let t = document.createElement("wje-input");
|
|
93
|
+
return t.setAttribute("variant", "standard"), t.setAttribute("type", "text"), t.setAttribute("placeholder", this.placelhoder), t.setAttribute("value", this.textContent), t;
|
|
69
94
|
}
|
|
70
95
|
save(t) {
|
|
71
96
|
return fetch(this.endpoint, {
|
|
@@ -114,7 +139,7 @@ class o extends l {
|
|
|
114
139
|
);
|
|
115
140
|
}
|
|
116
141
|
}
|
|
117
|
-
|
|
142
|
+
l.define("wje-inline-edit", l);
|
|
118
143
|
export {
|
|
119
|
-
|
|
144
|
+
l as default
|
|
120
145
|
};
|
package/dist/wje-input.js
CHANGED
|
@@ -152,7 +152,7 @@ class f extends A {
|
|
|
152
152
|
let a = this.hasSlot(this, "start"), g = this.hasSlot(this, "end"), y = this.hasSlot(this, "error"), w = document.createDocumentFragment(), i = document.createElement("div");
|
|
153
153
|
i.setAttribute("part", "native"), i.classList.add("native-input", this.variant || "default"), this.hasAttribute("invalid") && i.classList.add("has-error");
|
|
154
154
|
let s = document.createElement("div");
|
|
155
|
-
s.classList.add("wrapper")
|
|
155
|
+
s.classList.add("wrapper");
|
|
156
156
|
let p = document.createElement("div");
|
|
157
157
|
p.classList.add("input-wrapper");
|
|
158
158
|
let h = document.createElement("label");
|
|
@@ -165,15 +165,15 @@ class f extends A {
|
|
|
165
165
|
d.classList.add("error-message"), d.setAttribute("part", "error");
|
|
166
166
|
let c = null;
|
|
167
167
|
y ? (c = document.createElement("slot"), c.setAttribute("name", "error"), this.hasAttribute("error-inline") ? i.appendChild(c) : (d.appendChild(c), s.appendChild(d))) : s.appendChild(d);
|
|
168
|
-
let v = null;
|
|
169
|
-
a && (v = document.createElement("slot"), v.setAttribute("name", "start"));
|
|
170
168
|
let b = null;
|
|
171
|
-
|
|
169
|
+
a && (b = document.createElement("slot"), b.setAttribute("name", "start"), b.setAttribute("part", "start"));
|
|
170
|
+
let v = null;
|
|
171
|
+
if (g && (v = document.createElement("slot"), v.setAttribute("name", "end"), v.setAttribute("part", "end")), a && (s.appendChild(b), i.classList.add("has-start")), this.variant === "standard" ? this.label && i.appendChild(h) : p.appendChild(h), p.appendChild(o), s.appendChild(p), i.appendChild(s), this.hasAttribute("clearable")) {
|
|
172
172
|
this.clear = document.createElement("wje-button"), this.clear.classList.add("clear"), this.clear.setAttribute("fill", "link"), this.clear.setAttribute("part", "clear");
|
|
173
173
|
let u = document.createElement("wje-icon");
|
|
174
174
|
u.setAttribute("name", "x"), this.clear.appendChild(u), p.appendChild(this.clear);
|
|
175
175
|
}
|
|
176
|
-
return g && (s.appendChild(
|
|
176
|
+
return g && (s.appendChild(v), i.classList.add("has-end")), w.appendChild(i), this.native = i, this.labelElement = h, this.input = o, this.errorMessage = d, w;
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Runs after the input is drawn.
|
package/dist/wje-item.js
CHANGED
|
@@ -26,7 +26,7 @@ class a extends m {
|
|
|
26
26
|
return this.hostContext("wje-list", this) && this.classList.add("wje-item-list"), `<${o} class="item-native" part="native">
|
|
27
27
|
<slot name="start"></slot>
|
|
28
28
|
<div class="item-inner">
|
|
29
|
-
<div class="input-wrapper">
|
|
29
|
+
<div class="input-wrapper" part="inner">
|
|
30
30
|
<slot></slot>
|
|
31
31
|
</div>
|
|
32
32
|
<slot name="end"></slot>
|