litos-ui 0.6.3 → 0.8.0
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/lib/{animation-QfX4RtqD.js → animation-DttknHkX.js} +2 -2
- package/lib/base.d.ts +1 -3
- package/lib/base.js +12 -40
- package/lib/button/index.js +49 -49
- package/lib/color_picker/index.js +6 -4
- package/lib/form/form_item.d.ts +1 -1
- package/lib/form/form_item.js +26 -25
- package/lib/form/index.d.ts +1 -1
- package/lib/form/index.js +42 -41
- package/lib/icon/base.js +19 -18
- package/lib/{index-B_9rPBWp.js → index-391POYEJ.js} +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +64 -62
- package/lib/input/index.d.ts +1 -1
- package/lib/input/index.js +16 -15
- package/lib/list/index.d.ts +1 -1
- package/lib/list/index.js +13 -13
- package/lib/litos-ui.css +1 -1
- package/lib/litos-ui.min.js +1 -1
- package/lib/message/index.js +35 -33
- package/lib/polygon/index.d.ts +1 -1
- package/lib/polygon/index.js +17 -16
- package/lib/popconfirm/index.d.ts +7 -0
- package/lib/popconfirm/index.js +33 -0
- package/lib/popover/index.d.ts +5 -2
- package/lib/popover/index.js +106 -97
- package/lib/radio/index.d.ts +2 -2
- package/lib/radio/index.js +69 -68
- package/lib/select_ori/index.d.ts +1 -1
- package/lib/select_ori/index.js +8 -8
- package/lib/switch/index.js +42 -41
- package/lib/tabbar/index.js +94 -92
- package/lib/theme/index.js +39 -39
- package/lib/utils/index.js +54 -54
- package/lib/utils/transition.js +5 -6
- package/package.json +4 -1
- package/lib/browser.d.ts +0 -16
- package/lib/form/types.js +0 -1
- package/lib/index-116dRdDj.js +0 -4
- package/lib/index-BUyxD_nH.js +0 -4
- package/lib/index-BeOxuMd4.js +0 -4
- package/lib/index-Bl8lRTJd.js +0 -4
- package/lib/index-BxlGVrX3.js +0 -4
- package/lib/index-C98Kx857.js +0 -4
- package/lib/index-CCcVpk6U.js +0 -4
- package/lib/index-CMz7GCCH.js +0 -4
- package/lib/index-D-Ikkdx0.js +0 -4
- package/lib/index-DJ70Xyma.js +0 -4
- package/lib/index-DKvzJmsR.js +0 -4
- package/lib/index-oNjb_IVt.js +0 -4
package/lib/popover/index.js
CHANGED
|
@@ -1,93 +1,99 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var T = (r) => {
|
|
3
|
+
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var N = (
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
5
|
+
var N = (r, e, o) => e in r ? I(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
|
|
6
|
+
var t = (r, e, o) => N(r, typeof e != "symbol" ? e + "" : e, o), A = (r, e, o) => e.has(r) || T("Cannot " + o);
|
|
7
|
+
var p = (r, e, o) => (A(r, e, "read from private field"), o ? o.call(r) : e.get(r)), h = (r, e, o) => e.has(r) ? T("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, o);
|
|
8
|
+
var d = (r, e, o) => (A(r, e, "access private method"), o);
|
|
9
9
|
import j from "../base.js";
|
|
10
|
-
import { initAttr as D, useId as X, getPopoverOffsetY as Y, getPopoverOffsetX as q, impactDetect as
|
|
11
|
-
import { set as
|
|
12
|
-
import { $one as
|
|
13
|
-
var
|
|
14
|
-
|
|
10
|
+
import { initAttr as D, useId as X, getPopoverOffsetY as Y, getPopoverOffsetX as q, impactDetect as F } from "../utils/index.js";
|
|
11
|
+
import { set as G, remove as J } from "../utils/clickoutside.js";
|
|
12
|
+
import { $one as c, $$ as L, on as g, off as b } from "ph-utils/dom";
|
|
13
|
+
const K = ':host{width:max-content;position:relative}.l-popover--content{--l-popover-border-color: #e4e4e4;--l-popover-color: #666666;--l-popover-box-shadow: 0 4px 8px rgba(0, 0, 0, .12);--l-popover-background: #ffffff;--l-popover-arrow-size: 8px;--l-popover-offset: 10px;position:absolute;width:max-content;box-shadow:var(--l-popover-box-shadow);background:var(--l-popover-background);border:1px solid var(--l-popover-border-color);border-radius:4px;padding:10px;z-index:30;color:var(--l-popover-color);box-sizing:border-box}.l-popover-tooltip{--l-popover-color: #fff;--l-popover-box-shadow: 4px 4px 8px rgba(0, 0, 0, .3);--l-popover-background: #383838;--l-popover-arrow-size: 6px;border-radius:5px;padding:8px;font-size:12px;line-height:1}.l-popover--arrow{position:absolute;width:var(--l-popover-arrow-size, 8px);height:var(--l-popover-arrow-size, 8px);z-index:-1}.l-popover--arrow:before{content:"";position:absolute;width:var(--l-popover-arrow-size, 8px);height:var(--l-popover-arrow-size, 8px);transform:rotate3d(0,0,1,45deg);background-color:var(--l-popover-background);border-width:1px;border-style:solid}.l-popover-top,.l-popover-top-start,.l-popover-top-end{bottom:calc(100% + var(--l-popover-offset, 10px))}.l-popover-bottom,.l-popover-bottom-start,.l-popover-bottom-end{top:calc(100% + var(--l-popover-offset, 10px))}.l-popover-top-start,.l-popover-bottom-start{left:0}.l-popover-top-end,.l-popover-bottom-end{right:0}.l-popover-bottom,.l-popover-top{left:50%;transform:translate3d(-50%,0,0)}.l-popover-left-start,.l-popover-left,.l-popover-left-end{right:calc(100% + var(--l-popover-offset, 10px))}.l-popover-left-start,.l-popover-right-start{top:0}.l-popover-left-end,.l-popover-right-end{bottom:0}.l-popover-left,.l-popover-right{top:50%;transform:translate3d(0,-50%,0)}.l-popover-right-start,.l-popover-right,.l-popover-right-end{left:calc(100% + var(--l-popover-offset, 10px))}.l-popover-top .l-popover--arrow,.l-popover-bottom .l-popover--arrow{left:50%;margin-left:-4px}.l-popover-top .l-popover--arrow:before,.l-popover-top-start .l-popover--arrow:before,.l-popover-top-end .l-popover--arrow:before{border-color:transparent var(--l-popover-border-color) var(--l-popover-border-color) transparent}.l-popover-bottom .l-popover--arrow:before,.l-popover-bottom-start .l-popover--arrow:before,.l-popover-bottom-end .l-popover--arrow:before{border-color:var(--l-popover-border-color) transparent transparent var(--l-popover-border-color)}.l-popover-top .l-popover--arrow,.l-popover-top-start .l-popover--arrow,.l-popover-top-end .l-popover--arrow{bottom:calc((var(--l-popover-arrow-size, 8px) / -2) + 1px)}.l-popover-top-start .l-popover--arrow,.l-popover-bottom-start .l-popover--arrow{left:10px}.l-popover-top-end .l-popover--arrow,.l-popover-bottom-end .l-popover--arrow{right:10px}.l-popover-bottom .l-popover--arrow,.l-popover-bottom-start .l-popover--arrow,.l-popover-bottom-end .l-popover--arrow{top:calc((var(--l-popover-arrow-size, 8px) / -2) - 1px)}.l-popover-left .l-popover--arrow,.l-popover-left-start .l-popover--arrow,.l-popover-left-end .l-popover--arrow{margin-top:-4px;right:-4px}.l-popover-left-start .l-popover--arrow:before,.l-popover-left .l-popover--arrow:before,.l-popover-left-end .l-popover--arrow:before{border-color:var(--l-popover-border-color) var(--l-popover-border-color) transparent transparent}.l-popover-right .l-popover--arrow,.l-popover-right-start .l-popover--arrow,.l-popover-right-end .l-popover--arrow{margin-top:-4px;left:-4px}.l-popover-right-start .l-popover--arrow:before,.l-popover-right .l-popover--arrow:before,.l-popover-right-end .l-popover--arrow:before{border-color:transparent transparent var(--l-popover-border-color) var(--l-popover-border-color)}.l-popover-left .l-popover--arrow,.l-popover-right .l-popover--arrow{top:50%}.l-popover-left-start .l-popover--arrow,.l-popover-right-start .l-popover--arrow{top:10px}.l-popover-left-end .l-popover--arrow,.l-popover-right-end .l-popover--arrow{bottom:10px}';
|
|
14
|
+
var l, O, P, S, x, a, n, w, H, E;
|
|
15
|
+
class Q extends j {
|
|
15
16
|
constructor() {
|
|
16
17
|
super();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
s(this, "isShow", !1);
|
|
18
|
+
h(this, l);
|
|
19
|
+
t(this, "placement", "top");
|
|
20
|
+
t(this, "content");
|
|
21
|
+
t(this, "showArrow", !0);
|
|
22
|
+
t(this, "trigger", "hover");
|
|
23
|
+
t(this, "disabled", !1);
|
|
24
|
+
t(this, "isShow", !1);
|
|
25
25
|
/** 宽度, 'trigger' 表示 popover 的宽度会和它的触发元素一致 */
|
|
26
|
-
|
|
26
|
+
t(this, "width");
|
|
27
27
|
/** 隐藏时销毁 DOM 结构 */
|
|
28
|
-
|
|
28
|
+
t(this, "destroyOnHide", !1);
|
|
29
29
|
/** 浮层偏移量 */
|
|
30
|
-
|
|
30
|
+
t(this, "offset");
|
|
31
31
|
/** 浮层定位方式 */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
t(this, "position", "absolute");
|
|
33
|
+
t(this, "theme", "default");
|
|
34
|
+
/**
|
|
35
|
+
* @property inline = false
|
|
36
|
+
*/
|
|
37
|
+
t(this, "_t");
|
|
38
|
+
h(this, x, (o) => {
|
|
39
|
+
o.target.id !== this.id && this.hide();
|
|
37
40
|
});
|
|
38
|
-
|
|
39
|
-
this.show(
|
|
41
|
+
h(this, a, (o) => {
|
|
42
|
+
this.show(o.target);
|
|
40
43
|
});
|
|
41
|
-
|
|
44
|
+
h(this, n, () => {
|
|
42
45
|
this.hide();
|
|
43
46
|
});
|
|
44
|
-
|
|
45
|
-
this.trigger === "click" ? this.toggle(
|
|
47
|
+
h(this, w, (o) => {
|
|
48
|
+
this.trigger === "click" ? this.toggle(o.target) : this.trigger === "focus" && this.show(o.target);
|
|
46
49
|
});
|
|
47
|
-
D(this)
|
|
50
|
+
D(this);
|
|
48
51
|
}
|
|
49
52
|
connectedCallback() {
|
|
50
|
-
this.
|
|
53
|
+
this.loadStyleText(K), d(this, l, O).call(this), super.connectedCallback(), this.renderContent(), d(this, l, P).call(this);
|
|
51
54
|
}
|
|
52
55
|
disconnectedCallback() {
|
|
53
|
-
super.disconnectedCallback(),
|
|
56
|
+
super.disconnectedCallback(), d(this, l, S).call(this);
|
|
54
57
|
}
|
|
55
58
|
render() {
|
|
56
|
-
const
|
|
57
|
-
return
|
|
59
|
+
const o = document.createElement("slot");
|
|
60
|
+
return o.setAttribute("name", "trigger"), o;
|
|
58
61
|
}
|
|
59
62
|
renderContent() {
|
|
60
63
|
if (!this.isShow) return;
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
+
let o = c(".l-popover--content", this.root);
|
|
65
|
+
if (o) {
|
|
66
|
+
o.style.removeProperty("display");
|
|
64
67
|
return;
|
|
65
68
|
}
|
|
66
|
-
if (
|
|
69
|
+
if (o = L("div", {
|
|
67
70
|
class: [
|
|
68
71
|
"l-popover--content",
|
|
69
72
|
`l-popover-${this.placement}`,
|
|
70
|
-
this.theme === "
|
|
73
|
+
this.theme === "default" ? void 0 : `l-popover-${this.theme}`
|
|
71
74
|
]
|
|
72
|
-
}), this.offset && (
|
|
73
|
-
const
|
|
75
|
+
}), this.offset && (o.style.cssText = "--l-popover-offset: ${this.offset}px;"), o.part = "content", o.innerHTML = this.contentHTML(), this.showArrow) {
|
|
76
|
+
const s = L("div", {
|
|
74
77
|
class: "l-popover--arrow"
|
|
75
78
|
});
|
|
76
|
-
|
|
79
|
+
o.appendChild(s);
|
|
77
80
|
}
|
|
78
|
-
this.trigger === "hover" && (
|
|
81
|
+
this.trigger === "hover" && (g(o, "mouseenter", p(this, a)), g(o, "mouseleave", p(this, n))), this.root.appendChild(o);
|
|
82
|
+
}
|
|
83
|
+
contentHTML() {
|
|
84
|
+
return this.content ? `<span>${this.content}</span>` : "<slot></slot>";
|
|
79
85
|
}
|
|
80
86
|
hideContent() {
|
|
81
|
-
const
|
|
82
|
-
|
|
87
|
+
const o = c(".l-popover--content", this.root);
|
|
88
|
+
o && (this.destroyOnHide ? (this.trigger === "hover" && (b(o, "mouseenter", p(this, a)), b(o, "mouseleave", p(this, n))), this.root.removeChild(o)) : o.style.display = "none");
|
|
83
89
|
}
|
|
84
|
-
show(
|
|
90
|
+
show(o) {
|
|
85
91
|
if (!this.disabled) {
|
|
86
92
|
if (this.isShow) {
|
|
87
|
-
|
|
93
|
+
d(this, l, H).call(this);
|
|
88
94
|
return;
|
|
89
95
|
}
|
|
90
|
-
this.isShow = !0, this.renderContent(),
|
|
96
|
+
this.isShow = !0, this.renderContent(), d(this, l, E).call(this, o);
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
hide() {
|
|
@@ -95,59 +101,62 @@ class J extends j {
|
|
|
95
101
|
this.isShow = !1, this.hideContent();
|
|
96
102
|
}, 50);
|
|
97
103
|
}
|
|
98
|
-
toggle(
|
|
99
|
-
this.isShow ? this.hide() : this.show(
|
|
104
|
+
toggle(o) {
|
|
105
|
+
this.isShow ? this.hide() : this.show(o);
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
},
|
|
108
|
+
l = new WeakSet(), O = function() {
|
|
109
|
+
const o = this.getAttr("inline", !1);
|
|
110
|
+
this.style.display = o ? "inline-block" : "block", this.id || (this.id = `${X()}-popover`);
|
|
111
|
+
}, P = function() {
|
|
112
|
+
const o = c('[slot="trigger"]', this);
|
|
113
|
+
o && (this.trigger === "hover" ? (g(o, "mouseenter", p(this, a)), g(o, "mouseleave", p(this, n))) : (this.trigger === "click" || this.trigger === "focus") && (g(o, "click", p(this, w)), G(o, p(this, x))));
|
|
114
|
+
}, S = function() {
|
|
115
|
+
const o = c('[slot="trigger"]', this);
|
|
116
|
+
o && (this.trigger === "hover" ? (b(o, "mouseenter", p(this, a)), b(o, "mouseleave", p(this, n))) : (this.trigger === "click" || this.trigger === "focus") && (b(o, "click", p(this, w)), J(o)));
|
|
117
|
+
}, x = new WeakMap(), a = new WeakMap(), n = new WeakMap(), w = new WeakMap(), H = function() {
|
|
109
118
|
this._t && (clearTimeout(this._t), this._t = void 0);
|
|
110
|
-
},
|
|
111
|
-
let
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
let
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
let
|
|
119
|
-
const
|
|
120
|
-
let
|
|
121
|
-
const
|
|
122
|
-
this.width != null && (this.width === "trigger" ?
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
}, E = function(o) {
|
|
120
|
+
let s = "bottom", i = "";
|
|
121
|
+
const k = this.placement.split("-");
|
|
122
|
+
k != null && (s = k[0], i = k[1] || "");
|
|
123
|
+
let v;
|
|
124
|
+
o == null && (o = c('[slot="trigger"]', this));
|
|
125
|
+
const f = c(".l-popover--content", this.root);
|
|
126
|
+
if (f) {
|
|
127
|
+
let m = f.getBoundingClientRect();
|
|
128
|
+
const u = o.getBoundingClientRect();
|
|
129
|
+
let C = document.documentElement;
|
|
130
|
+
const M = C.scrollLeft, R = C.scrollTop;
|
|
131
|
+
this.width != null && (this.width === "trigger" ? v = u.width : v = this.width), v != null && (m.width = v);
|
|
132
|
+
const _ = Y(
|
|
133
|
+
u,
|
|
134
|
+
m,
|
|
135
|
+
s,
|
|
136
|
+
i,
|
|
128
137
|
this.offset
|
|
129
|
-
),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
138
|
+
), B = q(
|
|
139
|
+
u,
|
|
140
|
+
m,
|
|
141
|
+
s,
|
|
142
|
+
i,
|
|
134
143
|
this.offset
|
|
135
|
-
),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
I,
|
|
144
|
+
), y = F(
|
|
145
|
+
u,
|
|
146
|
+
m,
|
|
147
|
+
s,
|
|
148
|
+
i,
|
|
149
|
+
M,
|
|
150
|
+
R,
|
|
143
151
|
B,
|
|
152
|
+
_,
|
|
144
153
|
this.offset
|
|
145
154
|
);
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
155
|
+
s = y.mainAlign, i = y.crossAlign, v != null && f.style.setProperty("width", `${v}px`);
|
|
156
|
+
const z = `l-popover-${s}${i === "" ? "" : "-" + i}`, $ = f.className.split(" ");
|
|
157
|
+
$[1] !== z && ($[1] = `${z}`, f.className = $.join(" "));
|
|
149
158
|
}
|
|
150
|
-
},
|
|
159
|
+
}, t(Q, "baseName", "popover");
|
|
151
160
|
export {
|
|
152
|
-
|
|
161
|
+
Q as default
|
|
153
162
|
};
|
package/lib/radio/index.d.ts
CHANGED
|
@@ -10,13 +10,13 @@ export default class Radio extends FormInner {
|
|
|
10
10
|
type?: "button";
|
|
11
11
|
label?: string;
|
|
12
12
|
checked: boolean;
|
|
13
|
-
private
|
|
13
|
+
private _ignoreInitAttrs;
|
|
14
14
|
setItems(items: RadioItem[]): void;
|
|
15
15
|
constructor();
|
|
16
16
|
connectedCallback(): void;
|
|
17
17
|
disconnectedCallback(): void;
|
|
18
18
|
protected attributeChange(name: string, oldValue: string, newValue: string): void;
|
|
19
|
-
render():
|
|
19
|
+
render(): string;
|
|
20
20
|
setValue(value: any): void;
|
|
21
21
|
private _renderItems;
|
|
22
22
|
private _renderItem;
|
package/lib/radio/index.js
CHANGED
|
@@ -1,52 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { initAttr as
|
|
5
|
-
import
|
|
6
|
-
import { $one as
|
|
7
|
-
import { random as
|
|
8
|
-
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var A = (n, l, e) => l in n ? C(n, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[l] = e;
|
|
3
|
+
var s = (n, l, e) => A(n, typeof l != "symbol" ? l + "" : l, e);
|
|
4
|
+
import { initAttr as E, tagAttr as c, parseAttrValue as I } from "../utils/index.js";
|
|
5
|
+
import w from "../form/form_inner.js";
|
|
6
|
+
import { $one as d, hasClass as m, addClass as b, $ as u, iterate as p, getAttr as N, removeClass as f, formatClass as V, on as j, off as z } from "ph-utils/dom";
|
|
7
|
+
import { random as _ } from "ph-utils";
|
|
8
|
+
const S = ':host{display:flex;align-items:center}.l-radio{--l-radio-size: 16px;--l-radio-label-color: #333;--l-radio-disabled-color: #e6e6e6;--l-radio-disabled-label-color: var(--l-disabled-color, #c0c4cc);--l-radio-checked-color: var(--l-primary-color, #722ed1);--l-radio-item-margin: 10px;display:inline-flex;align-items:center;position:relative;cursor:pointer}.l-radio__label{transition:color .3s ease-in-out;margin-left:5px}.l-radio__input{position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-radio__inner{display:flex;justify-content:center;align-items:center;width:var(--l-radio-size);height:var(--l-radio-size);border:1px solid #dcddd9;border-radius:50%;box-sizing:border-box;transition:border-color .3s ease-in-out}.l-radio__inner:before{content:"";display:block;width:60%;height:60%;background-color:transparent;border-radius:50%;transition:background-color .3s ease-in-out}.l-radio.is-checked .l-radio__inner{border-color:var(--l-primary-color, #722ed1)}.l-radio.is-checked .l-radio__inner:before{background-color:var(--l-primary-color, #722ed1)}.l-radio.is-checked .l-radio__label{color:var(--l-primary-color, #722ed1)}.l-radio--disabled{cursor:not-allowed}.l-radio--disabledd .l-radio__inner{border-color:var(--l-radio-disabled-color)}.l-radio--disabled .l-radio__label{color:var(--l-radio-disabled-label-color)}.l-radio:not(:first-child){margin-left:var(--l-radio-item-margin)}.l-radio--button .l-radio__label{display:inline-flex;height:var(--l-form-edit-height, 32px);justify-content:center;align-items:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0}.l-radio--button:not(:first-of-type){margin-left:0}.l-radio--button:first-of-type .l-radio__label{border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}.l-radio--button:last-of-type .l-radio__label{border-top-right-radius:3px;border-bottom-right-radius:3px}.is-checked.l-radio--button .l-radio__label{background-color:var(--l-radio-checked-color);color:#fff;border-color:var(--l-radio-checked-color)}';
|
|
9
|
+
class D extends w {
|
|
9
10
|
constructor() {
|
|
10
11
|
super(!1);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
let t =
|
|
18
|
-
for (; t != null && !
|
|
12
|
+
s(this, "type");
|
|
13
|
+
s(this, "label");
|
|
14
|
+
s(this, "checked", !1);
|
|
15
|
+
s(this, "_ignoreInitAttrs", []);
|
|
16
|
+
s(this, "_radioChange", (e) => {
|
|
17
|
+
const o = e.target;
|
|
18
|
+
let t = o.parentElement;
|
|
19
|
+
for (; t != null && !m(t, "l-radio"); )
|
|
19
20
|
t = t.parentElement;
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const i = d(".is-checked", this.root);
|
|
22
|
+
i && f(i, "is-checked"), this.value = o.value, t && b(t, "is-checked"), this.dispatchEvent(new CustomEvent("change"));
|
|
22
23
|
});
|
|
23
|
-
|
|
24
|
+
console.log(), E(this);
|
|
24
25
|
}
|
|
25
26
|
setItems(e) {
|
|
26
27
|
this._removeEvents(), this.root.innerHTML = this._renderItems(e), this._initEvents();
|
|
27
28
|
}
|
|
28
29
|
connectedCallback() {
|
|
29
|
-
super.connectedCallback(), this.
|
|
30
|
+
super.connectedCallback(), this.loadStyleText(S), this._initEvents();
|
|
30
31
|
}
|
|
31
32
|
disconnectedCallback() {
|
|
32
33
|
super.disconnectedCallback(), this._removeEvents();
|
|
33
34
|
}
|
|
34
|
-
attributeChange(e,
|
|
35
|
+
attributeChange(e, o, t) {
|
|
35
36
|
if (e === "checked") {
|
|
36
|
-
const
|
|
37
|
-
this.checked =
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
37
|
+
const i = I(t, !1, e);
|
|
38
|
+
this.checked = i, this.value = i;
|
|
39
|
+
const r = d(".l-radio", this.root);
|
|
40
|
+
if (r && !m(r, "is-checked")) {
|
|
41
|
+
b(r, "is-checked");
|
|
42
|
+
const a = d("input", r);
|
|
43
|
+
a && (a.checked = !0);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
render() {
|
|
47
|
-
this.getName() || (this.name = `la${
|
|
48
|
-
const e = [],
|
|
49
|
-
|
|
48
|
+
this.getName() || (this.name = `la${_(3)}_${_(6)}`);
|
|
49
|
+
const e = [], o = d('[slot="label"]', this), t = u("[radio-value]", this);
|
|
50
|
+
return o != null || this.label ? (this.value = this._isChecked(), o ? e.push(
|
|
50
51
|
this._renderItem("slot", void 0, this._isChecked(), "label")
|
|
51
52
|
) : e.push(
|
|
52
53
|
this._renderItem(
|
|
@@ -55,71 +56,71 @@ class L extends V {
|
|
|
55
56
|
this._isChecked(),
|
|
56
57
|
"label"
|
|
57
58
|
)
|
|
58
|
-
)) : t.length > 0 && (
|
|
59
|
-
const
|
|
59
|
+
)) : t.length > 0 && (p(t, (i) => {
|
|
60
|
+
const r = i.cloneNode(!0), a = N(i, "radio-value");
|
|
60
61
|
e.push(
|
|
61
|
-
this._renderItem(
|
|
62
|
+
this._renderItem(r.outerHTML, a, this.value === a)
|
|
62
63
|
);
|
|
63
|
-
}), this.pushValueChange()),
|
|
64
|
+
}), this.pushValueChange()), e.join("");
|
|
64
65
|
}
|
|
65
66
|
setValue(e) {
|
|
66
67
|
super.setValue(e);
|
|
67
|
-
let
|
|
68
|
-
typeof e != "boolean" && (
|
|
69
|
-
const t =
|
|
70
|
-
t &&
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
typeof e == "boolean" ? (e ?
|
|
68
|
+
let o = "";
|
|
69
|
+
typeof e != "boolean" && (o = `[l-value="${e}"]`);
|
|
70
|
+
const t = d(".is-checked", this.root);
|
|
71
|
+
t && f(t, "is-checked");
|
|
72
|
+
const i = d(`label${o}`, this.root);
|
|
73
|
+
if (i) {
|
|
74
|
+
const r = d("input", i);
|
|
75
|
+
typeof e == "boolean" ? (e ? b(i, "is-checked") : f(i, "is-checked"), r.checked = e) : (b(i, "is-checked"), r.checked = !0);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
_renderItems(e) {
|
|
78
|
-
const
|
|
79
|
-
for (let t = 0,
|
|
80
|
-
const
|
|
81
|
-
|
|
79
|
+
const o = [];
|
|
80
|
+
for (let t = 0, i = e.length; t < i; t++) {
|
|
81
|
+
const r = e[t];
|
|
82
|
+
o.push(
|
|
82
83
|
this._renderItem(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.value ===
|
|
86
|
-
|
|
84
|
+
r.label,
|
|
85
|
+
r.value,
|
|
86
|
+
this.value === r.value,
|
|
87
|
+
r.labelPart
|
|
87
88
|
)
|
|
88
89
|
);
|
|
89
90
|
}
|
|
90
|
-
return
|
|
91
|
+
return o.join("");
|
|
91
92
|
}
|
|
92
|
-
_renderItem(e,
|
|
93
|
-
const
|
|
93
|
+
_renderItem(e, o, t = !1, i = void 0) {
|
|
94
|
+
const r = V({
|
|
94
95
|
"l-radio": !0,
|
|
95
96
|
"l-radio--disabled": this.isDisabled(),
|
|
96
97
|
"l-radio--button": this.type === "button",
|
|
97
98
|
"is-checked": t
|
|
98
|
-
}),
|
|
99
|
-
`<label class="${
|
|
100
|
-
`<input type="radio" class="l-radio__input"${
|
|
99
|
+
}), a = c("disabled", this.isDisabled()), v = c("checked", t), g = c("value", o), k = `${c("name", this.getName())}${g}${a}${v}`, $ = c("part", i), x = c("l-value", o), h = [
|
|
100
|
+
`<label class="${r}"${x}>`,
|
|
101
|
+
`<input type="radio" class="l-radio__input"${k} />`
|
|
101
102
|
];
|
|
102
|
-
this.type !== "button" &&
|
|
103
|
-
let
|
|
104
|
-
return
|
|
105
|
-
`<div class="l-radio__label"${
|
|
106
|
-
),
|
|
103
|
+
this.type !== "button" && h.push('<span class="l-radio__inner"></span>');
|
|
104
|
+
let y = e === "slot" ? '<slot name="label"></slot>' : e;
|
|
105
|
+
return h.push(
|
|
106
|
+
`<div class="l-radio__label"${$}>${y}</div>`
|
|
107
|
+
), h.push("</label>"), h.join("");
|
|
107
108
|
}
|
|
108
109
|
_isChecked() {
|
|
109
110
|
return this.checked;
|
|
110
111
|
}
|
|
111
112
|
_initEvents() {
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
p(u("input", this.root), (e) => {
|
|
114
|
+
j(e, "change", this._radioChange);
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
_removeEvents() {
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
p(u("input", this.root), (e) => {
|
|
119
|
+
z(e, "change", this._radioChange);
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
|
-
|
|
123
|
+
s(D, "baseName", "radio");
|
|
123
124
|
export {
|
|
124
|
-
|
|
125
|
+
D as default
|
|
125
126
|
};
|
|
@@ -10,7 +10,7 @@ export default class SelectOri extends FormInner {
|
|
|
10
10
|
constructor();
|
|
11
11
|
connectedCallback(): void;
|
|
12
12
|
disconnectedCallback(): void;
|
|
13
|
-
render():
|
|
13
|
+
render(): string;
|
|
14
14
|
protected _changeDisabled(): void;
|
|
15
15
|
setOptions(options: Option[]): void;
|
|
16
16
|
appendOptions(options: Option[]): void;
|
package/lib/select_ori/index.js
CHANGED
|
@@ -3,8 +3,9 @@ var o = (i, t, e) => t in i ? r(i, t, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var n = (i, t, e) => o(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import u from "../form/form_inner.js";
|
|
5
5
|
import { initAttr as d, tagAttrs as p } from "../utils/index.js";
|
|
6
|
-
import { $one as
|
|
7
|
-
|
|
6
|
+
import { $one as m, on as $, off as g } from "ph-utils/dom";
|
|
7
|
+
import { i as v } from "../index-391POYEJ.js";
|
|
8
|
+
class f extends u {
|
|
8
9
|
constructor() {
|
|
9
10
|
super();
|
|
10
11
|
n(this, "$select");
|
|
@@ -16,18 +17,17 @@ class v extends u {
|
|
|
16
17
|
d(this), this.changeEmit = new CustomEvent("change");
|
|
17
18
|
}
|
|
18
19
|
connectedCallback() {
|
|
19
|
-
this.
|
|
20
|
+
this.loadStyleText(v), super.connectedCallback(), this.$select = m("select", this.root), this.value && (this.$select.value = this.value), $(this.$select, "change", this._handleChange);
|
|
20
21
|
}
|
|
21
22
|
disconnectedCallback() {
|
|
22
23
|
super.disconnectedCallback(), this.$select && g(this.$select, "change", this._handleChange), this.changeEmit = void 0, this.$select = void 0;
|
|
23
24
|
}
|
|
24
25
|
render() {
|
|
25
26
|
let e = this.innerHTML.trim();
|
|
26
|
-
|
|
27
|
+
return `<select class="l-input"${p([
|
|
27
28
|
["name", this.getName()],
|
|
28
29
|
["disabled", this.isDisabled()]
|
|
29
|
-
])
|
|
30
|
-
this.root.innerHTML = `<select class="l-input"${s}>${e}</select>`;
|
|
30
|
+
])}>${e}</select>`;
|
|
31
31
|
}
|
|
32
32
|
_changeDisabled() {
|
|
33
33
|
this.$select && (this.$select.disabled = this.isDisabled());
|
|
@@ -53,7 +53,7 @@ class v extends u {
|
|
|
53
53
|
super.setValue(e), this.$select && (this.$select.value = this.value);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
n(
|
|
56
|
+
n(f, "baseName", "select-ori");
|
|
57
57
|
export {
|
|
58
|
-
|
|
58
|
+
f as default
|
|
59
59
|
};
|