litos-ui 0.8.0 → 0.9.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/base.js +26 -30
- package/lib/button/index.js +55 -59
- package/lib/color_picker/index.js +17 -21
- package/lib/form/form_events.js +15 -17
- package/lib/form/form_inner.js +43 -47
- package/lib/form/form_item.js +49 -54
- package/lib/form/index.js +62 -66
- package/lib/icon/arrow_down.js +4 -7
- package/lib/icon/arrow_left.js +4 -7
- package/lib/icon/arrow_right.js +4 -7
- package/lib/icon/arrow_up.js +4 -7
- package/lib/icon/base.js +21 -25
- package/lib/icon/caret_bottom.js +4 -7
- package/lib/icon/caret_top.js +4 -7
- package/lib/icon/font_icon.js +13 -17
- package/lib/icon/info.js +4 -7
- package/lib/icon/loading.js +4 -7
- package/lib/icon/mask_close.js +4 -7
- package/lib/icon/moon.js +4 -7
- package/lib/icon/reduction.js +4 -7
- package/lib/icon/refresh_left.js +4 -7
- package/lib/icon/refresh_right.js +4 -7
- package/lib/icon/search.js +4 -7
- package/lib/icon/sort.js +4 -7
- package/lib/icon/success.js +4 -7
- package/lib/icon/sun.js +4 -7
- package/lib/icon/theme_default.js +4 -7
- package/lib/icon/warn.js +4 -7
- package/lib/input/index.js +66 -71
- package/lib/list/index.js +23 -27
- package/lib/polygon/index.js +14 -18
- package/lib/popconfirm/index.js +11 -14
- package/lib/popover/index.js +107 -113
- package/lib/radio/index.js +53 -57
- package/lib/select_ori/index.js +23 -27
- package/lib/switch/index.js +34 -44
- package/lib/tabbar/index.js +117 -126
- package/lib/theme/index.js +71 -74
- package/lib/theme/theme_color.js +17 -27
- package/lib/utils/event.js +16 -18
- package/lib/utils/transition.js +23 -27
- package/package.json +1 -1
package/lib/form/form_item.js
CHANGED
|
@@ -1,38 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { formatClass as a, $one as i, addClass as n, removeClass as m } from "ph-utils/dom";
|
|
2
|
+
import { initAttr as d, parseAttrValue as f } from "../utils/index.js";
|
|
3
|
+
import h from "../base.js";
|
|
4
|
+
import { emit as o, add as c, clear as p, remove as b } from "./form_events.js";
|
|
5
|
+
import { random as s } from "ph-utils";
|
|
6
|
+
const u = ':host{display:contents}.l-form-item{display:var(--l-form-item-display, contents);font-size:14px;grid-template-columns:1fr}.l-form-item__label{text-align:var(--l-form-label-align, right);display:inline-block;width:var(--l-form-label-width, auto);height:var(--l-form-edit-height, 32px);line-height:var(--l-form-edit-height, 32px);color:#606266;padding:0 10px 0 0}.l-form-item__label:empty{display:var(--l-form-label-empty-display, inline-block)}.l-form-item.is-required .l-form-item__label:before{content:"*";margin-right:4px;color:var(--l-warn-color, #f56c6c);vertical-align:middle}.l-form-item__content{flex:1;position:relative;display:flex;align-items:center}.l-form-item__error{font-size:12px;line-height:1;position:absolute;top:100%;left:0;color:var(--nt-error-color, #ed3f13);padding-top:3px}.l-form-item.l-form-item--left{--l-form-label-align: left}.l-form-item.l-form-item--top{--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}';
|
|
7
|
+
class $ extends h {
|
|
8
|
+
static baseName = "form-item";
|
|
9
|
+
disabled = !1;
|
|
10
|
+
sharedAttrs = ["disabled", "id", "name", "innerBlock"];
|
|
11
|
+
/** 是否必须 */
|
|
12
|
+
required = !1;
|
|
13
|
+
error;
|
|
14
|
+
/** 标签文本 */
|
|
15
|
+
label;
|
|
16
|
+
id;
|
|
17
|
+
/** 内置验证规则: required - 必填, same:password - 一般用于验证确认密码和密码, phone - 验证电话号码 */
|
|
18
|
+
verify;
|
|
19
|
+
/** 验证失败错误信息 */
|
|
20
|
+
validity;
|
|
21
|
+
/** 自定义验证的正则 */
|
|
22
|
+
pattern;
|
|
23
|
+
name;
|
|
24
|
+
innerBlock = !1;
|
|
25
|
+
labelPosition = "right";
|
|
26
|
+
formId;
|
|
11
27
|
constructor() {
|
|
12
|
-
super();
|
|
13
|
-
i(this, "disabled", !1);
|
|
14
|
-
i(this, "sharedAttrs", ["disabled", "id", "name", "innerBlock"]);
|
|
15
|
-
/** 是否必须 */
|
|
16
|
-
i(this, "required", !1);
|
|
17
|
-
i(this, "error");
|
|
18
|
-
/** 标签文本 */
|
|
19
|
-
i(this, "label");
|
|
20
|
-
i(this, "id");
|
|
21
|
-
/** 内置验证规则: required - 必填, same:password - 一般用于验证确认密码和密码, phone - 验证电话号码 */
|
|
22
|
-
i(this, "verify");
|
|
23
|
-
/** 验证失败错误信息 */
|
|
24
|
-
i(this, "validity");
|
|
25
|
-
/** 自定义验证的正则 */
|
|
26
|
-
i(this, "pattern");
|
|
27
|
-
i(this, "name");
|
|
28
|
-
i(this, "innerBlock", !1);
|
|
29
|
-
i(this, "labelPosition", "right");
|
|
30
|
-
i(this, "formId");
|
|
31
|
-
i(this, "_validateChange", (e, t) => {
|
|
32
|
-
const r = e === !0 ? void 0 : e[this.name];
|
|
33
|
-
(t == null || t === this.name && this.error != r) && (this.error = r, this._updateError());
|
|
34
|
-
});
|
|
35
|
-
b(this), this.id == null && (this.id = `l-fi${m(3)}-${m(6)}`);
|
|
28
|
+
super(), d(this), this.id == null && (this.id = `l-fi${s(3)}-${s(6)}`);
|
|
36
29
|
}
|
|
37
30
|
static get observedAttributes() {
|
|
38
31
|
return ["error", "label", "disabled"];
|
|
@@ -43,30 +36,29 @@ class x extends v {
|
|
|
43
36
|
else if (e === "label")
|
|
44
37
|
this.label = r, this._updateLabel();
|
|
45
38
|
else if (e === "disabled") {
|
|
46
|
-
const
|
|
47
|
-
|
|
39
|
+
const l = f(r, !1, e);
|
|
40
|
+
l !== this.disabled && (o(this.id, "attributeChanged", e, l, this.id), this.disabled = l);
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
43
|
connectedCallback() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const r = {
|
|
44
|
+
if (super.connectedCallback(), this.loadStyleText([u]), this.formId = this._getFormId(), this.name && this.formId) {
|
|
45
|
+
let e = this.verify?.split("|") || [];
|
|
46
|
+
this.pattern && e.push(new RegExp(this.pattern));
|
|
47
|
+
const t = {
|
|
56
48
|
key: this.name,
|
|
57
49
|
required: this.required,
|
|
58
50
|
message: this.validity,
|
|
59
|
-
rules:
|
|
51
|
+
rules: e
|
|
60
52
|
};
|
|
61
|
-
|
|
53
|
+
o(this.formId, "ruleChange", t), c(this.formId, "validateChange", this._validateChange);
|
|
62
54
|
}
|
|
63
55
|
}
|
|
64
56
|
disconnectedCallback() {
|
|
65
|
-
|
|
57
|
+
p(this.id), this.formId && b(this.formId, "validateChange", this._validateChange);
|
|
66
58
|
}
|
|
67
59
|
setRules(e) {
|
|
68
60
|
const t = { ...e, key: this.name };
|
|
69
|
-
t.required != null && this.required && (t.required = !0), this.formId &&
|
|
61
|
+
t.required != null && this.required && (t.required = !0), this.formId && o(this.formId, "ruleChange", t);
|
|
70
62
|
}
|
|
71
63
|
setError(e) {
|
|
72
64
|
this.error = e;
|
|
@@ -79,31 +71,35 @@ class x extends v {
|
|
|
79
71
|
`l-form-item--${this.labelPosition}`
|
|
80
72
|
], t = this.label != null ? `<label class="l-form-item__label">${this.label}</label>` : "", r = this.error ? `<div class="l-form-item__error">${this.error}</div>` : "";
|
|
81
73
|
return [
|
|
82
|
-
`<div class="${
|
|
74
|
+
`<div class="${a(e)}">${t}`,
|
|
83
75
|
'<div class="l-form-item__content">',
|
|
84
76
|
`<slot></slot>${r}</div></div>`
|
|
85
77
|
].join("");
|
|
86
78
|
}
|
|
79
|
+
_validateChange = (e, t) => {
|
|
80
|
+
const r = e === !0 ? void 0 : e[this.name];
|
|
81
|
+
(t == null || t === this.name && this.error != r) && (this.error = r, this._updateError());
|
|
82
|
+
};
|
|
87
83
|
_updateError() {
|
|
88
84
|
if (!this.rendered) return;
|
|
89
|
-
let e =
|
|
85
|
+
let e = i(".l-form-item__error", this.root);
|
|
90
86
|
if (e)
|
|
91
87
|
this.error ? e.textContent = this.error : e.remove();
|
|
92
88
|
else if (this.error) {
|
|
93
89
|
e = document.createElement("div"), e.className = "l-form-item__error", e.textContent = this.error;
|
|
94
|
-
const r =
|
|
90
|
+
const r = i(".l-form-item__content", this.root);
|
|
95
91
|
r && r.appendChild(e);
|
|
96
92
|
}
|
|
97
|
-
const t =
|
|
98
|
-
t && (this.error ?
|
|
93
|
+
const t = i(".l-form-item", this.root);
|
|
94
|
+
t && (this.error ? n(t, "is-error") : m(t, "is-error"));
|
|
99
95
|
}
|
|
100
96
|
_updateLabel() {
|
|
101
97
|
if (!this.rendered) return;
|
|
102
|
-
let e =
|
|
98
|
+
let e = i(".l-form-item__label", this.root);
|
|
103
99
|
if (e == null) {
|
|
104
100
|
if (this.label != null) {
|
|
105
101
|
e = document.createElement("div"), e.className = "l-form-item__label", e.textContent = this.label;
|
|
106
|
-
const t =
|
|
102
|
+
const t = i(".l-form-item", this.root);
|
|
107
103
|
t && t.appendChild(e);
|
|
108
104
|
}
|
|
109
105
|
} else
|
|
@@ -123,7 +119,6 @@ class x extends v {
|
|
|
123
119
|
return e = null, t;
|
|
124
120
|
}
|
|
125
121
|
}
|
|
126
|
-
i(x, "baseName", "form-item");
|
|
127
122
|
export {
|
|
128
|
-
|
|
123
|
+
$ as default
|
|
129
124
|
};
|
package/lib/form/index.js
CHANGED
|
@@ -1,104 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { $one as n, formatClass as o, formatStyle as f } from "ph-utils/dom";
|
|
2
|
+
import m from "../base.js";
|
|
3
|
+
import { initAttr as c, parseAttrValue as u } from "../utils/index.js";
|
|
4
|
+
import { random as d } from "ph-utils";
|
|
5
|
+
import { emit as l, add as h, clear as v } from "./form_events.js";
|
|
6
|
+
import p from "ph-utils/validator";
|
|
7
|
+
const b = ":host{display:block}.l-form{display:grid;grid-template-columns:var(--l-form-label-width, auto) 1fr;row-gap:20px}.l-form-inline{display:flex;gap:20px;flex-flow:row wrap}.l-form.l-form-inline{--l-form-item-display: flex}.l-form.l-form--left{--l-form-label-align: left}.l-form.l-form--top{--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}";
|
|
8
|
+
class $ extends m {
|
|
9
|
+
static baseName = "form";
|
|
10
|
+
/** 是否行内表单 */
|
|
11
|
+
inline = !1;
|
|
12
|
+
labelPosition = "right";
|
|
13
|
+
labelWidth;
|
|
14
|
+
id;
|
|
15
|
+
disabled = !1;
|
|
16
|
+
sharedAttrs = ["disabled", "id", "innerBlock"];
|
|
17
|
+
validator;
|
|
18
|
+
innerBlock = !1;
|
|
19
|
+
novalidate = !1;
|
|
20
|
+
_data;
|
|
21
|
+
emit;
|
|
12
22
|
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
/** 是否行内表单 */
|
|
15
|
-
i(this, "inline", !1);
|
|
16
|
-
i(this, "labelPosition", "right");
|
|
17
|
-
i(this, "labelWidth");
|
|
18
|
-
i(this, "id");
|
|
19
|
-
i(this, "disabled", !1);
|
|
20
|
-
i(this, "sharedAttrs", ["disabled", "id", "innerBlock"]);
|
|
21
|
-
i(this, "validator");
|
|
22
|
-
i(this, "innerBlock", !1);
|
|
23
|
-
i(this, "novalidate", !1);
|
|
24
|
-
i(this, "_data");
|
|
25
|
-
i(this, "emit");
|
|
26
|
-
i(this, "ruleChange", (t) => {
|
|
27
|
-
this.validator.addSchema(t);
|
|
28
|
-
});
|
|
29
|
-
i(this, "_valueChange", (t, l, e = !0) => {
|
|
30
|
-
this._data == null && (this._data = {});
|
|
31
|
-
const a = Object.hasOwn(this._data, t);
|
|
32
|
-
this._data[t] = l, !this.novalidate && a && e && this.validator.validateKey(t, l, this._data).then(() => {
|
|
33
|
-
s(this.id, "validateChange", !0, t);
|
|
34
|
-
}).catch((o) => {
|
|
35
|
-
s(this.id, "validateChange", o.detail, t);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
g(this), this.id == null && (this.id = `l-f${f(3)}-${f(6)}`), this.validator = new _([]), this.emit = new CustomEvent("submit");
|
|
23
|
+
super(), c(this), this.id == null && (this.id = `l-f${d(3)}-${d(6)}`), this.validator = new p([]), this.emit = new CustomEvent("submit");
|
|
39
24
|
}
|
|
40
25
|
static get observedAttributes() {
|
|
41
26
|
return ["disabled", "label-position"];
|
|
42
27
|
}
|
|
43
|
-
attributeChangedCallback(t,
|
|
28
|
+
attributeChangedCallback(t, e, a) {
|
|
44
29
|
if (t === "disabled") {
|
|
45
|
-
const
|
|
46
|
-
|
|
30
|
+
const i = u(a, !1, t);
|
|
31
|
+
i !== this.disabled && (l(this.id, "attributeChanged", t, i, this.id), this.disabled = i);
|
|
47
32
|
} else if (t === "label-position") {
|
|
48
|
-
const
|
|
49
|
-
|
|
33
|
+
const i = n("form", this.root);
|
|
34
|
+
i && (i.className = o([
|
|
50
35
|
"l-form",
|
|
51
36
|
this.inline ? "l-form-inline" : void 0,
|
|
52
|
-
`l-form--${
|
|
37
|
+
`l-form--${a}`
|
|
53
38
|
]));
|
|
54
39
|
}
|
|
55
40
|
}
|
|
56
41
|
connectedCallback() {
|
|
57
|
-
this.loadStyleText([
|
|
42
|
+
this.loadStyleText([b]), super.connectedCallback(), h(this.id, "ruleChange", this.ruleChange), h(this.id, "valueChange", this._valueChange);
|
|
58
43
|
}
|
|
59
44
|
disconnectedCallback() {
|
|
60
|
-
|
|
45
|
+
v(this.id), this.validator = void 0;
|
|
61
46
|
}
|
|
62
47
|
render() {
|
|
63
|
-
const t =
|
|
48
|
+
const t = o([
|
|
64
49
|
"l-form",
|
|
65
50
|
this.inline ? "l-form-inline" : void 0,
|
|
66
51
|
`l-form--${this.labelPosition}`
|
|
67
|
-
]),
|
|
52
|
+
]), e = f({
|
|
68
53
|
"--l-form-label-width": this.labelWidth ? this.labelWidth : ""
|
|
69
54
|
});
|
|
70
|
-
return `<form class="${t}" style="${
|
|
55
|
+
return `<form class="${t}" style="${e}"><slot></slot></form>`;
|
|
71
56
|
}
|
|
57
|
+
ruleChange = (t) => {
|
|
58
|
+
this.validator.addSchema(t);
|
|
59
|
+
};
|
|
60
|
+
_valueChange = (t, e, a = !0) => {
|
|
61
|
+
this._data == null && (this._data = {});
|
|
62
|
+
const i = Object.hasOwn(this._data, t);
|
|
63
|
+
this._data[t] = e, !this.novalidate && i && a && this.validator.validateKey(t, e, this._data).then(() => {
|
|
64
|
+
l(this.id, "validateChange", !0, t);
|
|
65
|
+
}).catch((s) => {
|
|
66
|
+
l(this.id, "validateChange", s.detail, t);
|
|
67
|
+
});
|
|
68
|
+
};
|
|
72
69
|
validateField(t) {
|
|
73
|
-
const
|
|
70
|
+
const e = [];
|
|
74
71
|
if (this._data != null) {
|
|
75
72
|
if (Array.isArray(t))
|
|
76
|
-
for (let
|
|
77
|
-
const
|
|
78
|
-
|
|
73
|
+
for (let a = 0, i = t.length; a < i; a++) {
|
|
74
|
+
const s = t[a];
|
|
75
|
+
e.push(this.validator.validateKey(s, this._data[s], this._data));
|
|
79
76
|
}
|
|
80
77
|
else
|
|
81
|
-
|
|
78
|
+
e.push(
|
|
82
79
|
this.validator.validateKey(t, this._data[t], this._data)
|
|
83
80
|
);
|
|
84
|
-
Promise.allSettled(
|
|
85
|
-
for (let
|
|
86
|
-
const
|
|
87
|
-
|
|
81
|
+
Promise.allSettled(e).then((a) => {
|
|
82
|
+
for (let i = 0, s = a.length; i < s; i++) {
|
|
83
|
+
const r = a[i];
|
|
84
|
+
r.status === "rejected" ? l(
|
|
88
85
|
this.id,
|
|
89
86
|
"validateChange",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
) :
|
|
87
|
+
r.reason.detail,
|
|
88
|
+
r.reason.key
|
|
89
|
+
) : l(this.id, "validateChange", !0, r.value.key);
|
|
93
90
|
}
|
|
94
91
|
});
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
clearValidate() {
|
|
98
|
-
|
|
95
|
+
l(this.id, "validateChange", !0);
|
|
99
96
|
}
|
|
100
97
|
reset() {
|
|
101
|
-
this.clearValidate(),
|
|
98
|
+
this.clearValidate(), l(this.id, "reset");
|
|
102
99
|
}
|
|
103
100
|
submit() {
|
|
104
101
|
this.novalidate ? this.dispatchEvent(this.emit) : this.validate().then((t) => {
|
|
@@ -111,9 +108,9 @@ class w extends b {
|
|
|
111
108
|
async validate() {
|
|
112
109
|
if (this._data != null)
|
|
113
110
|
try {
|
|
114
|
-
return await this.validator.validate(this._data),
|
|
111
|
+
return await this.validator.validate(this._data), l(this.id, "validateChange", !0), Promise.resolve(!0);
|
|
115
112
|
} catch (t) {
|
|
116
|
-
return
|
|
113
|
+
return l(this.id, "validateChange", t.detail), Promise.resolve(!1);
|
|
117
114
|
}
|
|
118
115
|
return Promise.resolve(!0);
|
|
119
116
|
}
|
|
@@ -121,7 +118,6 @@ class w extends b {
|
|
|
121
118
|
return { ...this._data };
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
|
-
i(w, "baseName", "form");
|
|
125
121
|
export {
|
|
126
|
-
|
|
122
|
+
$ as default
|
|
127
123
|
};
|
package/lib/icon/arrow_down.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import l from "./base.js";
|
|
5
|
-
class o extends l {
|
|
1
|
+
import a from "./base.js";
|
|
2
|
+
class n extends a {
|
|
3
|
+
static baseName = "arrow-down-icon";
|
|
6
4
|
connectedCallback() {
|
|
7
5
|
super.connectedCallback();
|
|
8
6
|
}
|
|
@@ -10,7 +8,6 @@ class o extends l {
|
|
|
10
8
|
return '<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>';
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
|
-
n(o, "baseName", "arrow-down-icon");
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
n as default
|
|
16
13
|
};
|
package/lib/icon/arrow_left.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import n from "./base.js";
|
|
5
|
-
class s extends n {
|
|
1
|
+
import r from "./base.js";
|
|
2
|
+
class t extends r {
|
|
3
|
+
static baseName = "arrow-left-icon";
|
|
6
4
|
renderChildren() {
|
|
7
5
|
return '<path fill="currentColor" d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>';
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
t(s, "baseName", "arrow-left-icon");
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
t as default
|
|
13
10
|
};
|
package/lib/icon/arrow_right.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import s from "./base.js";
|
|
5
|
-
class i extends s {
|
|
1
|
+
import r from "./base.js";
|
|
2
|
+
class t extends r {
|
|
3
|
+
static baseName = "arrow-right-icon";
|
|
6
4
|
renderChildren() {
|
|
7
5
|
return '<path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>';
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
t(i, "baseName", "arrow-right-icon");
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
t as default
|
|
13
10
|
};
|
package/lib/icon/arrow_up.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import n from "./base.js";
|
|
5
|
-
class o extends n {
|
|
1
|
+
import a from "./base.js";
|
|
2
|
+
class l extends a {
|
|
3
|
+
static baseName = "arrow-up-icon";
|
|
6
4
|
connectedCallback() {
|
|
7
5
|
super.connectedCallback();
|
|
8
6
|
}
|
|
@@ -10,7 +8,6 @@ class o extends n {
|
|
|
10
8
|
return '<path fill="currentColor" d="m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"></path>';
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
|
-
l(o, "baseName", "arrow-up-icon");
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
l as default
|
|
16
13
|
};
|
package/lib/icon/base.js
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import d from "../base.js";
|
|
2
|
+
const h = ":host{display:inline-flex}.l-icon{width:1em;height:1em;fill:currentColor;vertical-align:middle;display:inline-block}";
|
|
3
|
+
class p extends d {
|
|
4
|
+
static baseName = "base-icon";
|
|
5
|
+
useLink;
|
|
6
|
+
viewBox;
|
|
7
7
|
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
n(this, "useLink");
|
|
10
|
-
n(this, "viewBox");
|
|
11
|
-
this.useLink = !1, this.viewBox = "0 0 1024 1024";
|
|
8
|
+
super(), this.useLink = !1, this.viewBox = "0 0 1024 1024";
|
|
12
9
|
}
|
|
13
10
|
connectedCallback() {
|
|
14
|
-
this.loadStyleText([
|
|
11
|
+
this.loadStyleText([h]), this.render(), this.rendered = !0;
|
|
15
12
|
}
|
|
16
13
|
render() {
|
|
17
|
-
const e = this.createEl("svg"),
|
|
18
|
-
e.classList.add("l-icon"),
|
|
19
|
-
const
|
|
20
|
-
if (typeof
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
for (let
|
|
24
|
-
const
|
|
25
|
-
|
|
14
|
+
const e = this.createEl("svg"), r = this.getAttr("useLink", this.useLink), l = this.getAttr("viewBox", this.viewBox);
|
|
15
|
+
e.classList.add("l-icon"), r || e.setAttribute("viewBox", l);
|
|
16
|
+
const t = this.renderChildren();
|
|
17
|
+
if (typeof t == "string")
|
|
18
|
+
if (t === "") {
|
|
19
|
+
const s = this.children, n = [];
|
|
20
|
+
for (let i = 0, o = s.length; i < o; i++) {
|
|
21
|
+
const c = s[i];
|
|
22
|
+
n.push(c.outerHTML);
|
|
26
23
|
}
|
|
27
|
-
e.innerHTML =
|
|
24
|
+
e.innerHTML = n.join("");
|
|
28
25
|
} else
|
|
29
|
-
e.innerHTML =
|
|
26
|
+
e.innerHTML = t;
|
|
30
27
|
else
|
|
31
|
-
e.append(
|
|
28
|
+
e.append(t);
|
|
32
29
|
this.shadow.appendChild(e);
|
|
33
30
|
}
|
|
34
31
|
renderChildren() {
|
|
@@ -38,7 +35,6 @@ class g extends w {
|
|
|
38
35
|
return document.createElementNS("http://www.w3.org/2000/svg", e);
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
n(g, "baseName", "base-icon");
|
|
42
38
|
export {
|
|
43
|
-
|
|
39
|
+
p as default
|
|
44
40
|
};
|
package/lib/icon/caret_bottom.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import s from "./base.js";
|
|
5
|
-
class c extends s {
|
|
1
|
+
import t from "./base.js";
|
|
2
|
+
class a extends t {
|
|
3
|
+
static baseName = "caret-bottom-icon";
|
|
6
4
|
renderChildren() {
|
|
7
5
|
return '<path fill="currentColor" d="m192 384 320 384 320-384z"></path>';
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
a(c, "baseName", "caret-bottom-icon");
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
a as default
|
|
13
10
|
};
|
package/lib/icon/caret_top.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import s from "./base.js";
|
|
5
|
-
class c extends s {
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
class a extends e {
|
|
3
|
+
static baseName = "caret-top-icon";
|
|
6
4
|
renderChildren() {
|
|
7
5
|
return '<path fill="currentColor" d="M512 320 192 704h639.936z"></path>';
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
a(c, "baseName", "caret-top-icon");
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
a as default
|
|
13
10
|
};
|
package/lib/icon/font_icon.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import i from "./base.js";
|
|
2
|
+
class a extends i {
|
|
3
|
+
static baseName = "font-icon";
|
|
4
|
+
_t;
|
|
5
|
+
_start;
|
|
6
6
|
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
r(this, "_t");
|
|
9
|
-
r(this, "_start");
|
|
10
|
-
this.useLink = !0, this._t = void 0, this._start = 0;
|
|
7
|
+
super(), this.useLink = !0, this._t = void 0, this._start = 0;
|
|
11
8
|
}
|
|
12
9
|
renderChildren() {
|
|
13
10
|
return "";
|
|
@@ -25,20 +22,19 @@ class u extends l {
|
|
|
25
22
|
}
|
|
26
23
|
_loadIcon(t) {
|
|
27
24
|
Date.now() - this._start >= 1e4 || (this._t = requestAnimationFrame(() => {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
25
|
+
const e = document.querySelector(`#${t}`);
|
|
26
|
+
if (e == null) {
|
|
30
27
|
this._loadIcon(t);
|
|
31
28
|
return;
|
|
32
29
|
}
|
|
33
30
|
this._t = void 0;
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
31
|
+
let n = e.getAttribute("viewBox");
|
|
32
|
+
n || (n = "0 0 1024 1024");
|
|
33
|
+
const r = this.shadow.querySelector("svg");
|
|
34
|
+
r != null && (r.setAttribute("viewBox", n), r.innerHTML = e.innerHTML);
|
|
38
35
|
}));
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
r(u, "baseName", "font-icon");
|
|
42
38
|
export {
|
|
43
|
-
|
|
39
|
+
a as default
|
|
44
40
|
};
|
package/lib/icon/info.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import t from "./base.js";
|
|
5
|
-
class o extends t {
|
|
1
|
+
import c from "./base.js";
|
|
2
|
+
class l extends c {
|
|
3
|
+
static baseName = "info-icon";
|
|
6
4
|
connectedCallback() {
|
|
7
5
|
super.connectedCallback();
|
|
8
6
|
}
|
|
@@ -10,7 +8,6 @@ class o extends t {
|
|
|
10
8
|
return '<path fill="currentColor" d="M512 64a448 448 0 110 896.064A448 448 0 01512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 01-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 017.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"></path>';
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
|
-
l(o, "baseName", "info-icon");
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
l as default
|
|
16
13
|
};
|
package/lib/icon/loading.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import n from "./base.js";
|
|
5
|
-
class o extends n {
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
class s extends e {
|
|
3
|
+
static baseName = "loading-icon";
|
|
6
4
|
renderChildren() {
|
|
7
5
|
return '<path d="M520.665 64.564a29.244 29.244 0 0 0-7.071-.894c-16.211 0-29.35 13.14-29.35 29.35 0 15.83 12.538 28.696 28.223 29.293v.073c.375 0 .751-.014 1.127-.014 216.493 0 389.629 173.942 389.629 390.433 0 216.496-173.136 388.827-389.63 388.827s-389.63-172.333-389.63-388.829c0-.27.01-.536.01-.804h-.01c0-16.209-13.141-29.35-29.35-29.35s-29.35 13.139-29.35 29.35c0 .055.007.11.007.164-.001.214-.007.425-.007.64 0 247.609 200.722 448.331 448.33 448.331 247.607 0 448.33-200.722 448.33-448.33-.002-245.242-196.917-444.456-441.258-448.24z" fill="currentColor"></path>';
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
|
-
c(o, "baseName", "loading-icon");
|
|
11
8
|
export {
|
|
12
|
-
|
|
9
|
+
s as default
|
|
13
10
|
};
|
package/lib/icon/mask_close.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import l from "./base.js";
|
|
5
|
-
class c extends l {
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
class t extends e {
|
|
3
|
+
static baseName = "mask-close-icon";
|
|
6
4
|
constructor() {
|
|
7
5
|
super(), this.viewBox = "0 0 24 24";
|
|
8
6
|
}
|
|
@@ -10,7 +8,6 @@ class c extends l {
|
|
|
10
8
|
return '<path fill="currentColor" d="M12 23a11 11 0 100-22 11 11 0 000 22zM8.82 7.4L12 10.6l3.18-3.19 1.42 1.42L13.4 12l3.19 3.18-1.42 1.42L12 13.4 8.82 16.6 7.4 15.18 10.6 12 7.4 8.82 8.82 7.4z"></path>';
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
|
-
s(c, "baseName", "mask-close-icon");
|
|
14
11
|
export {
|
|
15
|
-
|
|
12
|
+
t as default
|
|
16
13
|
};
|