litos-ui 0.13.0 → 0.14.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.d.ts +1 -1
- package/lib/base.js +3 -3
- package/lib/carousel/index.d.ts +20 -0
- package/lib/carousel/index.js +280 -0
- package/lib/carousel/item.d.ts +6 -0
- package/lib/carousel/item.js +15 -0
- package/lib/carousel/timer.d.ts +5 -0
- package/lib/carousel/timer.js +19 -0
- package/lib/check/check.d.ts +22 -0
- package/lib/check/check.js +81 -0
- package/lib/check/checkbox.d.ts +7 -0
- package/lib/check/checkbox.js +25 -0
- package/lib/check/checkbox_group.d.ts +9 -0
- package/lib/check/checkbox_group.js +33 -0
- package/lib/check/index.d.ts +12 -0
- package/lib/check/index.js +35 -0
- package/lib/check/radio.d.ts +6 -0
- package/lib/check/radio.js +19 -0
- package/lib/check/radio_group.d.ts +6 -0
- package/lib/check/radio_group.js +24 -0
- package/lib/check-BlDsQQo0.js +4 -0
- package/lib/color_picker/index.d.ts +1 -1
- package/lib/color_picker/index.js +5 -5
- package/lib/form/form_inner.d.ts +1 -8
- package/lib/form/form_inner.js +31 -39
- package/lib/form/form_item.d.ts +1 -1
- package/lib/form/form_item.js +30 -37
- package/lib/form/index.js +5 -5
- package/lib/icon/close_filled.d.ts +1 -1
- package/lib/index.d.ts +12 -4
- package/lib/index.js +80 -72
- package/lib/input/index.js +10 -10
- package/lib/list/index.d.ts +1 -2
- package/lib/list/index.js +17 -17
- package/lib/md_input/index.js +9 -9
- package/lib/menu/index.d.ts +2 -0
- package/lib/menu/index.js +47 -42
- package/lib/menu/sub_menu.d.ts +4 -2
- package/lib/menu/sub_menu.js +59 -41
- package/lib/select_ori/index.d.ts +1 -1
- package/lib/select_ori/index.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/index.js +49 -49
- package/lib/utils/transition.js +3 -2
- package/package.json +1 -1
- package/lib/checkbox/index.d.ts +0 -17
- package/lib/checkbox/index.js +0 -135
- package/lib/radio/index.d.ts +0 -28
- package/lib/radio/index.js +0 -122
package/lib/input/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $one as h, on as a, formatStyle as
|
|
1
|
+
import { $one as h, on as a, formatStyle as p, addClass as o, off as u, $ as d, $$ as n, removeClass as f } from "ph-utils/dom";
|
|
2
2
|
import { initAttr as c, parseAttrValue as m } from "../utils/index.js";
|
|
3
|
-
import
|
|
4
|
-
import { add as
|
|
3
|
+
import b from "../form/form_inner.js";
|
|
4
|
+
import { add as g, remove as v } from "../utils/event.js";
|
|
5
5
|
import { i as C } from "../index-dwS1N2uN.js";
|
|
6
|
-
class y extends
|
|
6
|
+
class y extends b {
|
|
7
7
|
static baseName = "input";
|
|
8
8
|
/** 原生 input 的 type */
|
|
9
9
|
type = "text";
|
|
@@ -31,10 +31,10 @@ class y extends g {
|
|
|
31
31
|
return ["disabled", "error"];
|
|
32
32
|
}
|
|
33
33
|
connectedCallback() {
|
|
34
|
-
c(this), this.loadStyleText([C]), super.connectedCallback(), this.$inner = h(".l-input__inner", this.root), a(this.$inner, "input", this._input), a(this.$inner, "change", this.#i), this.style.cssText =
|
|
34
|
+
c(this), this.loadStyleText([C]), super.connectedCallback(), this.$inner = h(".l-input__inner", this.root), a(this.$inner, "input", this._input), a(this.$inner, "change", this.#i), this.style.cssText = p(this._getStyleObj()) + this.getAttr("style", ""), this.error && o(this, "is-error"), this.getName() && this.formAttrs.id && g(this.formAttrs.id, "validateChange", this._validateChange);
|
|
35
35
|
}
|
|
36
36
|
disconnectedCallback() {
|
|
37
|
-
super.disconnectedCallback(), this.formAttrs.id && v(this.formAttrs.id, "validateChange", this._validateChange),
|
|
37
|
+
super.disconnectedCallback(), this.formAttrs.id && v(this.formAttrs.id, "validateChange", this._validateChange), u(this.$inner, "input", this._input);
|
|
38
38
|
}
|
|
39
39
|
attributeChange(t, i, e) {
|
|
40
40
|
if (t === "error") {
|
|
@@ -44,7 +44,7 @@ class y extends g {
|
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
46
|
const t = document.createDocumentFragment();
|
|
47
|
-
if (
|
|
47
|
+
if (d('[slot="prefix"]', this).length > 0) {
|
|
48
48
|
const r = n("slot", {
|
|
49
49
|
name: "prefix"
|
|
50
50
|
}), l = n("span", {
|
|
@@ -62,7 +62,7 @@ class y extends g {
|
|
|
62
62
|
part: "default",
|
|
63
63
|
type: this.type
|
|
64
64
|
});
|
|
65
|
-
if (t.appendChild(e),
|
|
65
|
+
if (t.appendChild(e), d('[slot="suffix"]', this).length > 0) {
|
|
66
66
|
const r = n("slot", {
|
|
67
67
|
name: "suffix"
|
|
68
68
|
}), l = n("span", {
|
|
@@ -105,7 +105,7 @@ class y extends g {
|
|
|
105
105
|
t.appendChild(i), this.root.appendChild(t), a(t, "click", this.#e);
|
|
106
106
|
}
|
|
107
107
|
} else
|
|
108
|
-
t && (
|
|
108
|
+
t && (u(t, "click", this.#e), t.remove());
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
#e = () => {
|
|
@@ -137,7 +137,7 @@ class y extends g {
|
|
|
137
137
|
return this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0;
|
|
138
138
|
}
|
|
139
139
|
_updateError() {
|
|
140
|
-
f(this, "is-error");
|
|
140
|
+
this.error ? o(this, "is-error") : f(this, "is-error");
|
|
141
141
|
}
|
|
142
142
|
_validateChange = (t, i) => {
|
|
143
143
|
const e = this.getName();
|
package/lib/list/index.d.ts
CHANGED
|
@@ -6,9 +6,8 @@ export default class List extends BaseComponent {
|
|
|
6
6
|
/** 是否显示无限加载模式 */
|
|
7
7
|
infinite: boolean;
|
|
8
8
|
private observer?;
|
|
9
|
-
private loadMoreEmit;
|
|
10
9
|
private $more?;
|
|
11
|
-
|
|
10
|
+
private _page;
|
|
12
11
|
static get observedAttributes(): string[] | null | undefined;
|
|
13
12
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
14
13
|
connectedCallback(): void;
|
package/lib/list/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import r from "../base.js";
|
|
2
|
-
import {
|
|
3
|
-
import { $one as
|
|
4
|
-
import { a } from "../animation-DttknHkX.js";
|
|
5
|
-
const
|
|
2
|
+
import { parseAttrValue as n } from "../utils/index.js";
|
|
3
|
+
import { $one as s } from "ph-utils/dom";
|
|
4
|
+
import { a as l } from "../animation-DttknHkX.js";
|
|
5
|
+
const a = ":host{display:block;overflow:auto;-webkit-overflow-scrolling:touch;height:100%;position:relative}.l-list-loadmore{padding:10px;display:flex;align-items:center;justify-content:center;color:#999}.l-list-icon{font-size:24px;margin-right:10px;transform:rotate3d(0,0,1,80deg)}";
|
|
6
6
|
class b extends r {
|
|
7
7
|
static baseName = "list";
|
|
8
8
|
/** 是否已经全部加载完成 */
|
|
@@ -10,27 +10,27 @@ class b extends r {
|
|
|
10
10
|
/** 是否显示无限加载模式 */
|
|
11
11
|
infinite = !0;
|
|
12
12
|
observer;
|
|
13
|
-
loadMoreEmit;
|
|
14
13
|
$more;
|
|
15
|
-
|
|
16
|
-
super(), n(this), this.loadMoreEmit = new CustomEvent("load-more");
|
|
17
|
-
}
|
|
14
|
+
_page = 0;
|
|
18
15
|
static get observedAttributes() {
|
|
19
|
-
return ["finish"];
|
|
16
|
+
return ["finish", "infinite"];
|
|
20
17
|
}
|
|
21
18
|
attributeChangedCallback(i, t, o) {
|
|
22
19
|
if (i === "finish") {
|
|
23
|
-
const
|
|
24
|
-
this.finish !==
|
|
20
|
+
const e = n(o, !1, i);
|
|
21
|
+
this.finish !== e && (this.finish = e, this._finishChange());
|
|
22
|
+
} else if (i === "infinite") {
|
|
23
|
+
const e = n(o, !0, i);
|
|
24
|
+
this.infinite !== e && (this.infinite = e);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
connectedCallback() {
|
|
28
|
-
this.loadStyleText([
|
|
29
|
-
i[0].isIntersecting && !this.finish && this.
|
|
30
|
-
}), this.$more =
|
|
28
|
+
this.loadStyleText([a, l]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
|
|
29
|
+
i[0].isIntersecting && !this.finish && (this._page++, this.setAttribute("loading", ""), this.emit("load", { detail: { page: this._page } }));
|
|
30
|
+
}), this.$more = s(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
|
|
31
31
|
}
|
|
32
32
|
disconnectedCallback() {
|
|
33
|
-
super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0)
|
|
33
|
+
super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0);
|
|
34
34
|
}
|
|
35
35
|
render() {
|
|
36
36
|
const i = ["<slot></slot>"];
|
|
@@ -46,9 +46,9 @@ class b extends r {
|
|
|
46
46
|
_finishChange() {
|
|
47
47
|
if (this.$more) {
|
|
48
48
|
this.observer && (this.finish ? this.observer.unobserve(this.$more) : this.observer.observe(this.$more));
|
|
49
|
-
const i =
|
|
49
|
+
const i = s(".l-list-loadmore-text", this.$more);
|
|
50
50
|
i && (i.textContent = this._loadingText());
|
|
51
|
-
let t =
|
|
51
|
+
let t = s(".l-list-icon", this.$more);
|
|
52
52
|
this.finish ? t && t.remove() : t == null && (t = document.createElement("l-loading-icon"), t.className = "l-list-icon l-rotate-anim", this.$more.prepend(t));
|
|
53
53
|
}
|
|
54
54
|
}
|
package/lib/md_input/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass as
|
|
1
|
+
import { addClass as n, $$ as r, $one as l, on as a, off as d, removeClass as u } from "ph-utils/dom";
|
|
2
2
|
import p from "../form/form_inner.js";
|
|
3
3
|
import { initAttr as m } from "../utils/index.js";
|
|
4
4
|
import { isBlank as s, random as h } from "ph-utils";
|
|
@@ -17,18 +17,18 @@ class v extends p {
|
|
|
17
17
|
m(this), this.loadStyleText(c), super.connectedCallback(), this.#e();
|
|
18
18
|
}
|
|
19
19
|
disconnectedCallback() {
|
|
20
|
-
super.disconnectedCallback(), this.#
|
|
20
|
+
super.disconnectedCallback(), this.#i();
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
s(this.value) ||
|
|
24
|
-
const t = document.createDocumentFragment(), e = `l-md-input-${h(8)}`,
|
|
23
|
+
s(this.value) || n(this, "l-has-value"), this.outline && n(this, "l-md-input-outline");
|
|
24
|
+
const t = document.createDocumentFragment(), e = `l-md-input-${h(8)}`, i = r("input", {
|
|
25
25
|
class: "l-md-input__inner",
|
|
26
26
|
type: this.htmlType,
|
|
27
|
-
name: this.
|
|
27
|
+
name: this.getName(),
|
|
28
28
|
inputmode: this.inputmode,
|
|
29
29
|
id: e
|
|
30
30
|
});
|
|
31
|
-
if (t.appendChild(
|
|
31
|
+
if (t.appendChild(i), this.label) {
|
|
32
32
|
const o = r("label", {
|
|
33
33
|
class: "l-md-input__label",
|
|
34
34
|
for: e
|
|
@@ -46,13 +46,13 @@ class v extends p {
|
|
|
46
46
|
const t = l("input", this.root);
|
|
47
47
|
t && a(t, "input", this.#t);
|
|
48
48
|
}
|
|
49
|
-
#
|
|
49
|
+
#i() {
|
|
50
50
|
const t = l("input", this.root);
|
|
51
51
|
t && d(t, "input", this.#t);
|
|
52
52
|
}
|
|
53
53
|
#t = (t) => {
|
|
54
|
-
const
|
|
55
|
-
this.setValue(
|
|
54
|
+
const i = t.target.value;
|
|
55
|
+
this.setValue(i), s(i) ? u(this, "l-has-value") : n(this, "l-has-value");
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
export {
|
package/lib/menu/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export default class Menu extends BaseComponent {
|
|
|
8
8
|
orientation: "horizontal" | "vertical";
|
|
9
9
|
/** 主题 */
|
|
10
10
|
theme: "light" | "dark";
|
|
11
|
+
/** 是否手风琴模式, 只有一个子菜单展开 */
|
|
12
|
+
accordion: boolean;
|
|
11
13
|
connectedCallback(): void;
|
|
12
14
|
static get observedAttributes(): string[];
|
|
13
15
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
package/lib/menu/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { on as
|
|
2
|
-
import
|
|
3
|
-
import { initAttr as
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
import { on as d, off as c, $$ as u, $ as h, iterate as f, $one as a } from "ph-utils/dom";
|
|
2
|
+
import m from "../base.js";
|
|
3
|
+
import { initAttr as b } from "../utils/index.js";
|
|
4
|
+
const p = ":host{--l-menu-width: 240px;--l-menu-height: auto;--l-menu-color: #333333;--l-menu-background: #ffffff;--l-menu-level: 0;--l-menu-item-height: 40px;--l-menu-active-color: var(--l-primary-color, #722ed1);--l-menu-active-background: var(--l-primary-color-light5, #f9f0ff);display:block;width:var(--l-menu-width);height:var(--l-menu-height);font-size:14px;position:relative;color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;transition:height .3s,width .3s;overflow:hidden;border-right:1px solid var(--l-border-color, #dedede)}";
|
|
5
|
+
class x extends m {
|
|
6
6
|
static baseName = "menu";
|
|
7
7
|
/** 当前选中的菜单项 key 数组, 用 , 分割 */
|
|
8
8
|
selectedKey = "";
|
|
@@ -10,54 +10,54 @@ class v extends f {
|
|
|
10
10
|
orientation = "vertical";
|
|
11
11
|
/** 主题 */
|
|
12
12
|
theme = "light";
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/** 是否手风琴模式, 只有一个子菜单展开 */
|
|
14
|
+
accordion = !1;
|
|
15
15
|
connectedCallback() {
|
|
16
|
-
|
|
16
|
+
b(this), this.classList.add(
|
|
17
17
|
"l-menu",
|
|
18
18
|
`l-menu--${this.orientation}`,
|
|
19
19
|
`l-menu-${this.theme}`
|
|
20
|
-
), this.loadStyleText(
|
|
20
|
+
), this.loadStyleText(p), super.connectedCallback();
|
|
21
21
|
}
|
|
22
22
|
static get observedAttributes() {
|
|
23
23
|
return ["selectedKeys", "orientation"];
|
|
24
24
|
}
|
|
25
|
-
attributeChangedCallback(
|
|
25
|
+
attributeChangedCallback(t, i, e) {
|
|
26
26
|
if (this.rendered) {
|
|
27
|
-
if (
|
|
28
|
-
this.selectedKey =
|
|
29
|
-
else if (
|
|
27
|
+
if (t === "selectedKeys")
|
|
28
|
+
this.selectedKey !== e && (this.selectedKey = e, this.updateSelectedKeys(e));
|
|
29
|
+
else if (t === "orientation") {
|
|
30
30
|
const s = this.classList;
|
|
31
|
-
s.remove(`l-menu--${
|
|
31
|
+
s.remove(`l-menu--${i}`), s.add(`l-menu--${e}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
afterInit() {
|
|
36
|
-
|
|
36
|
+
d(this, "click", this.#t), this.updateSelectedKeys(this.selectedKey);
|
|
37
37
|
}
|
|
38
38
|
beforeDestroy() {
|
|
39
|
-
|
|
39
|
+
c(this, "click", this.#t);
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
|
-
return
|
|
42
|
+
return u("slot");
|
|
43
43
|
}
|
|
44
|
-
#t = (
|
|
45
|
-
const { type:
|
|
46
|
-
|
|
44
|
+
#t = (t) => {
|
|
45
|
+
const { type: i, key: e, keyPaths: s, target: l } = this.#e(
|
|
46
|
+
t.target
|
|
47
47
|
);
|
|
48
|
-
l &&
|
|
48
|
+
l && (i === 2 ? l.hasAttribute("expanded") ? l.removeAttribute("expanded") : (l.setAttribute("expanded", ""), this.accordion && this.expandSubmenus(s, !0)) : i === 1 && (this.#i(s), this.updateSelectedKeys(e), this.emit("select", { detail: { key: e, keyPaths: s } })));
|
|
49
49
|
};
|
|
50
|
-
#i
|
|
51
|
-
let
|
|
52
|
-
const
|
|
50
|
+
#e(t, i) {
|
|
51
|
+
let e = 0, s = "", l;
|
|
52
|
+
const o = [];
|
|
53
53
|
do {
|
|
54
|
-
const
|
|
55
|
-
if (["L-MENU", "BODY"].includes(
|
|
54
|
+
const r = t.tagName;
|
|
55
|
+
if (["L-MENU", "BODY"].includes(r))
|
|
56
56
|
break;
|
|
57
|
-
const n =
|
|
58
|
-
n && (
|
|
59
|
-
} while (
|
|
60
|
-
return { type:
|
|
57
|
+
const n = t.getAttribute("key");
|
|
58
|
+
n && (s || (s = n), o.unshift(n), i && i(t, n)), e === 0 && (r === "L-MENU-ITEM" ? (e = 1, l = t) : r === "L-SUB-MENU" && (l = t, e = 2)), t = t.parentElement;
|
|
59
|
+
} while (e >= 0);
|
|
60
|
+
return { type: e, key: s, keyPaths: o, target: l };
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
63
63
|
* 展开与提供的 keys 对应的子菜单。
|
|
@@ -69,22 +69,27 @@ class v extends f {
|
|
|
69
69
|
* @param keys - 表示要展开的子菜单的 key 的字符串数组。
|
|
70
70
|
* @param collapseOther - 可选参数,默认为 false。是否折叠其他子菜单。
|
|
71
71
|
*/
|
|
72
|
-
expandSubmenus(
|
|
73
|
-
const
|
|
74
|
-
|
|
72
|
+
expandSubmenus(t, i = !1) {
|
|
73
|
+
const e = h("l-sub-menu[key]", this);
|
|
74
|
+
f(e, (s) => {
|
|
75
75
|
const l = s.getAttribute("key") || "";
|
|
76
|
-
|
|
76
|
+
t.includes(l) ? s.setAttribute("expanded", "") : i && s.removeAttribute("expanded");
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
updateSelectedKeys(
|
|
80
|
-
this.selectedKey =
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
updateSelectedKeys(t) {
|
|
80
|
+
this.selectedKey = t;
|
|
81
|
+
const i = a(`l-menu-item[key="${t}"]`, this);
|
|
82
|
+
i && (i.setAttribute("active", ""), this.#e(i, (e) => {
|
|
83
|
+
e.setAttribute("active", ""), e.setAttribute("expanded", "");
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
#i(t) {
|
|
87
|
+
const i = a("l-menu-item[active]", this);
|
|
88
|
+
i && this.#e(i, (e, s) => {
|
|
89
|
+
t.includes(s) || e.removeAttribute("active");
|
|
90
|
+
});
|
|
86
91
|
}
|
|
87
92
|
}
|
|
88
93
|
export {
|
|
89
|
-
|
|
94
|
+
x as default
|
|
90
95
|
};
|
package/lib/menu/sub_menu.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
export default class
|
|
2
|
+
export default class SubMenu extends BaseComponent {
|
|
3
3
|
#private;
|
|
4
4
|
static baseName: string;
|
|
5
5
|
/** 默认折叠子菜单 */
|
|
6
|
-
|
|
6
|
+
expanded: boolean;
|
|
7
|
+
/** 是否激活状态, 通常是下面的子菜单项被选中 */
|
|
8
|
+
active: boolean;
|
|
7
9
|
connectedCallback(): void;
|
|
8
10
|
afterInit(): void;
|
|
9
11
|
beforeDestroy(): void;
|
package/lib/menu/sub_menu.js
CHANGED
|
@@ -1,64 +1,82 @@
|
|
|
1
|
-
import { addClass as r,
|
|
2
|
-
import
|
|
3
|
-
import { initAttr as
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
import { addClass as r, $one as a, on as h, off as p, removeClass as d, queryHideNodeSize as u, toggleClass as m, $$ as n } from "ph-utils/dom";
|
|
2
|
+
import g from "../base.js";
|
|
3
|
+
import { initAttr as f, parseAttrValue as c } from "../utils/index.js";
|
|
4
|
+
const v = ":host{display:block;width:100%;overflow:hidden}.l-submenu-title{display:flex;align-items:center;padding:0 10px 0 calc(10px + var(--l-menu-level) * 15px);height:var(--l-menu-item-height);cursor:pointer;box-sizing:border-box;white-space:nowrap;position:relative;overflow:hidden;text-overflow:ellipsis;border-right:2px solid transparent;transition:color .3s,background-color .3s,border-color .3s}.l-submenu-title:hover{background-color:var(--l-primary-color-light5)}.l-menu{--l-menu-level: 1;display:block;width:var(--l-menu-width);height:var(--l-menu-height);font-size:14px;position:relative;color:var(--l-menu-color);background:var(--l-menu-background);box-sizing:border-box;transition:height .3s,width .3s;overflow:hidden;border-right:1px solid var(--l-border-color, #dedede)}.l-menu-icon-wrap{display:inline-flex;font-size:14px;margin-right:5px}.l-submenu-arrow-icon{position:absolute;top:50%;right:10px;transition:transform .3s;transform:translate3d(0,-50%,0) rotate(90deg);color:var(--l-info-color)}:host(.collapsed) .l-submenu-arrow-icon{transform:translate3d(0,-50%,0) rotate(0)}.l-menu--collapsed{display:none}:host(.is-active) .l-submenu-title{color:var(--l-primary-color)}";
|
|
5
|
+
class C extends g {
|
|
6
6
|
static baseName = "sub-menu";
|
|
7
7
|
/** 默认折叠子菜单 */
|
|
8
|
-
|
|
8
|
+
expanded = !1;
|
|
9
|
+
/** 是否激活状态, 通常是下面的子菜单项被选中 */
|
|
10
|
+
active = !1;
|
|
11
|
+
#e;
|
|
9
12
|
connectedCallback() {
|
|
10
|
-
this.loadStyleText(
|
|
13
|
+
this.loadStyleText(v), f(this), this.expanded || r(this, "collapsed"), this.active && r(this, "is-active"), super.connectedCallback();
|
|
11
14
|
}
|
|
12
15
|
afterInit() {
|
|
13
|
-
const e =
|
|
14
|
-
|
|
16
|
+
const e = a(".l-menu", this.root);
|
|
17
|
+
h(e, "transitionend", this.#t);
|
|
15
18
|
}
|
|
16
19
|
beforeDestroy() {
|
|
17
|
-
const e =
|
|
18
|
-
|
|
20
|
+
const e = a(".l-menu", this.root);
|
|
21
|
+
p(e, "transitionend", this.#t), this.#e && clearTimeout(this.#e);
|
|
19
22
|
}
|
|
20
23
|
static get observedAttributes() {
|
|
21
|
-
return ["
|
|
24
|
+
return ["expanded", "active"];
|
|
22
25
|
}
|
|
23
|
-
attributeChangedCallback(e,
|
|
24
|
-
if (this.rendered
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
26
|
+
attributeChangedCallback(e, i, l) {
|
|
27
|
+
if (this.rendered) {
|
|
28
|
+
if (e === "expanded") {
|
|
29
|
+
const o = c(l, !1, "expanded");
|
|
30
|
+
if (this.expanded !== o) {
|
|
31
|
+
this.expanded = o;
|
|
32
|
+
const t = a(".l-menu", this.root);
|
|
33
|
+
if (this.expanded) {
|
|
34
|
+
d(this, "collapsed");
|
|
35
|
+
const s = u(t, null);
|
|
36
|
+
t.style.height = "0", d(t, "l-menu--collapsed"), requestAnimationFrame(() => {
|
|
37
|
+
t.style.height = `${s.height}px`;
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
const s = t.getBoundingClientRect();
|
|
41
|
+
t.style.height = `${s.height}px`, r(this, "collapsed"), requestAnimationFrame(() => {
|
|
42
|
+
t.style.height = "0";
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
this.#e = setTimeout(() => {
|
|
46
|
+
this.#t({
|
|
47
|
+
target: t,
|
|
48
|
+
propertyName: "height"
|
|
49
|
+
});
|
|
50
|
+
}, 350);
|
|
37
51
|
}
|
|
52
|
+
} else if (e === "active") {
|
|
53
|
+
const o = c(l, !1, "active");
|
|
54
|
+
o !== this.active && (this.active = o, m(this, "is-active"));
|
|
38
55
|
}
|
|
39
56
|
}
|
|
40
57
|
}
|
|
41
58
|
render() {
|
|
42
|
-
const e = document.createDocumentFragment(),
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
|
|
59
|
+
const e = document.createDocumentFragment(), i = n("div", { class: "l-submenu-title" });
|
|
60
|
+
if (a('[slot="icon"]', this)) {
|
|
61
|
+
const s = n("span", { class: "l-menu-icon-wrap" });
|
|
62
|
+
s.appendChild(n("slot", { name: "icon" })), i.appendChild(s);
|
|
46
63
|
}
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
class: ["l-menu", this.
|
|
64
|
+
i.appendChild(n("slot", { name: "title" }));
|
|
65
|
+
const o = n("l-arrow-right-icon", { class: "l-submenu-arrow-icon" });
|
|
66
|
+
i.appendChild(o), e.appendChild(i);
|
|
67
|
+
const t = n("div", {
|
|
68
|
+
class: ["l-menu", this.expanded ? void 0 : "l-menu--collapsed"]
|
|
52
69
|
});
|
|
53
|
-
return
|
|
70
|
+
return t.appendChild(n("slot")), e.appendChild(t), e;
|
|
54
71
|
}
|
|
55
|
-
#
|
|
56
|
-
if (this.
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
#t = (e) => {
|
|
73
|
+
if (!this.expanded && e.propertyName === "height") {
|
|
74
|
+
this.#e && clearTimeout(this.#e);
|
|
75
|
+
const i = e.target;
|
|
76
|
+
i.style.removeProperty("height"), r(i, "l-menu--collapsed");
|
|
59
77
|
}
|
|
60
78
|
};
|
|
61
79
|
}
|
|
62
80
|
export {
|
|
63
|
-
|
|
81
|
+
C as default
|
|
64
82
|
};
|
|
@@ -9,7 +9,7 @@ export default class SelectOri extends FormInner {
|
|
|
9
9
|
connectedCallback(): void;
|
|
10
10
|
disconnectedCallback(): void;
|
|
11
11
|
render(): string;
|
|
12
|
-
protected
|
|
12
|
+
protected disabledChange(): void;
|
|
13
13
|
setOptions(options: Option[]): void;
|
|
14
14
|
appendOptions(options: Option[]): void;
|
|
15
15
|
reset(): void;
|
package/lib/select_ori/index.js
CHANGED
package/lib/utils/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function regist(component: any | any[], name?: string): void;
|
|
|
12
12
|
export declare function useId(): string;
|
|
13
13
|
export declare function parseAttrValue(value: string, defaultValue?: string): string;
|
|
14
14
|
export declare function parseAttrValue(value: string, defaultValue?: boolean, key?: string): boolean;
|
|
15
|
-
export declare function parseAttrValue(value: string, defaultValue?: number
|
|
15
|
+
export declare function parseAttrValue(value: string, defaultValue?: number): number;
|
|
16
16
|
/**
|
|
17
17
|
* 初始化元素的属性值。
|
|
18
18
|
* 遍历元素的所有属性,并对每个属性的值进行解析,然后将解析后的值赋给元素的相应属性。
|