wj-elements 0.1.32 → 0.1.34
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/localize.js +13 -11
- package/dist/{popup.element-DE8fye8C.js → popup.element-CWsSOxs2.js} +99 -95
- package/dist/wje-button.js +56 -29
- package/dist/wje-chip.js +1 -1
- package/dist/wje-dropdown.js +73 -27
- package/dist/wje-element.js +50 -50
- package/dist/wje-icon-picker.js +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-input.js +152 -58
- package/dist/wje-master.js +1 -1
- package/dist/wje-menu-item.js +18 -17
- package/dist/wje-popup.js +1 -1
- package/dist/wje-reorder-handle.js +43 -37
- package/dist/wje-select.js +1 -1
- package/dist/wje-tooltip.js +24 -23
- package/package.json +1 -1
package/dist/wje-tooltip.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var w = Object.defineProperty;
|
|
2
|
-
var v = (
|
|
3
|
-
var
|
|
4
|
-
import f, { event as
|
|
2
|
+
var v = (s, o, t) => o in s ? w(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
|
|
3
|
+
var a = (s, o, t) => (v(s, typeof o != "symbol" ? o + "" : o, t), t);
|
|
4
|
+
import f, { event as n } from "./wje-element.js";
|
|
5
5
|
const b = '.native-tooltip{display:flex;align-items:center;padding:var(--wje-tooltip-spacing);color:var(--wje-tooltip-color);background-color:var(--wje-tooltip-background);font-weight:var(--wje-tooltip-font-weight);font-size:var(--wje-tooltip-font-size);border-radius:var(--wje-tooltip-border-radius);line-height:var(--wje-tooltip-line-height);box-sizing:border-box;box-shadow:var(--wje-tooltip-shadow)}::slotted([slot="start"]){margin:0 .3rem 0 0}::slotted([slot="end"]){margin:0 0 0 .3rem}.arrow{position:absolute;width:10px;height:10px;background:var(--wje-tooltip-arrow-color);transform:rotate(45deg)}';
|
|
6
6
|
class m extends f {
|
|
7
7
|
/**
|
|
@@ -14,23 +14,24 @@ class m extends f {
|
|
|
14
14
|
* @summary Class name
|
|
15
15
|
* @type {string}
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
a(this, "className", "Tooltip");
|
|
18
18
|
/**
|
|
19
19
|
* @summary Show tooltip
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
a(this, "onShow", () => {
|
|
22
|
+
var t;
|
|
23
|
+
this.classList.add("active"), !((t = this.querySelector("wje-dropdown")) != null && t.classList.contains("active")) && Promise.resolve(this.beforeShow(this)).then((e) => {
|
|
24
|
+
if (!this.classList.contains("active") || !e || typeof e != "string")
|
|
24
25
|
throw new Error("beforeShow method returned false or not string");
|
|
25
|
-
this.native.innerHTML =
|
|
26
|
-
}).catch((
|
|
26
|
+
this.native.innerHTML = e, this.popup.show(), Promise.resolve(this.afterShow(this));
|
|
27
|
+
}).catch((e) => {
|
|
27
28
|
this.classList.remove("active"), this.popup.hide();
|
|
28
29
|
});
|
|
29
30
|
});
|
|
30
31
|
/**
|
|
31
32
|
* @summary Hide tooltip
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
a(this, "onHide", () => {
|
|
34
35
|
this.classList.remove("active"), this.popup.hide();
|
|
35
36
|
});
|
|
36
37
|
}
|
|
@@ -69,33 +70,33 @@ class m extends f {
|
|
|
69
70
|
* @param {Object} params - The parameters
|
|
70
71
|
* @returns {Object} Document fragment
|
|
71
72
|
*/
|
|
72
|
-
draw(t,
|
|
73
|
-
let
|
|
74
|
-
|
|
73
|
+
draw(t, e, g) {
|
|
74
|
+
let c = document.createDocumentFragment(), r = document.createElement("wje-popup");
|
|
75
|
+
r.setAttribute("placement", this.placement || "top"), r.setAttribute("offset", this.offset || "0");
|
|
75
76
|
let l = document.createElement("slot");
|
|
76
77
|
l.setAttribute("slot", "anchor");
|
|
77
|
-
let
|
|
78
|
-
|
|
78
|
+
let d = document.createElement("div");
|
|
79
|
+
d.classList.add("arrow"), d.setAttribute("slot", "arrow");
|
|
79
80
|
let h = document.createElement("slot");
|
|
80
81
|
h.setAttribute("name", "start");
|
|
81
82
|
let p = document.createElement("slot");
|
|
82
83
|
p.setAttribute("name", "end");
|
|
83
84
|
let u = document.createElement("div");
|
|
84
85
|
u.innerHTML = this.content;
|
|
85
|
-
let
|
|
86
|
-
return
|
|
86
|
+
let i = document.createElement("div");
|
|
87
|
+
return i.setAttribute("part", "native"), i.classList.add("native-tooltip"), i.appendChild(h), i.appendChild(u), i.appendChild(p), r.appendChild(l), r.appendChild(d), r.appendChild(i), this.mySlot = l, this.popup = r, this.native = i, c.appendChild(r), c;
|
|
87
88
|
}
|
|
88
89
|
/**
|
|
89
90
|
* @summary After draw method
|
|
90
91
|
*/
|
|
91
92
|
afterDraw() {
|
|
92
93
|
let t = this.mySlot.assignedElements()[0];
|
|
93
|
-
this.selector && (t = this.checkSelector(t)), t && (
|
|
94
|
+
this.selector && (t = this.checkSelector(t)), t && (n.addListener(t, "mouseenter", null, this.onShow), n.addListener(t, "mouseleave", null, this.onHide), n.addListener(this, "wje-dropdown:open", null, this.onHide), n.addListener(this, "wje-dropdown:close", null, this.onShow));
|
|
94
95
|
}
|
|
95
96
|
dispatch(t) {
|
|
96
|
-
return new Promise((
|
|
97
|
-
|
|
98
|
-
resolve:
|
|
97
|
+
return new Promise((e) => {
|
|
98
|
+
n.dispatchCustomEvent(this, t, {
|
|
99
|
+
resolve: e
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
102
|
}
|
|
@@ -105,8 +106,8 @@ class m extends f {
|
|
|
105
106
|
afterShow() {
|
|
106
107
|
}
|
|
107
108
|
checkSelector(t) {
|
|
108
|
-
const
|
|
109
|
-
return
|
|
109
|
+
const e = t.querySelector(this.selector);
|
|
110
|
+
return e === null && console.error("Selector not found:", this.selector), e;
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
m.define("wje-tooltip", m);
|
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.34",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|