litos-ui 0.14.1 → 0.15.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/index.d.ts +2 -0
- package/lib/index.js +36 -34
- package/lib/tabbar/index.d.ts +2 -22
- package/lib/tabbar/index.js +47 -121
- package/lib/tabbar/item.d.ts +12 -0
- package/lib/tabbar/item.js +58 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export { default as List } from "./list";
|
|
|
45
45
|
export { default as Polygon } from "./polygon";
|
|
46
46
|
export { default as ColorPicker } from "./color_picker";
|
|
47
47
|
export { default as Tabbar } from "./tabbar";
|
|
48
|
+
export { default as TabbarItem } from "./tabbar/item";
|
|
48
49
|
export { default as Theme } from "./theme";
|
|
49
50
|
export { default as ThemeColor } from "./theme/theme_color";
|
|
50
51
|
export { default as DatePicker } from "./date_picker";
|
|
@@ -100,6 +101,7 @@ declare global {
|
|
|
100
101
|
"l-polygon": import("./polygon").default
|
|
101
102
|
"l-color-picker": import("./color_picker").default
|
|
102
103
|
"l-tabbar": import("./tabbar").default
|
|
104
|
+
"l-tabbar-item": import("./tabbar/item").default
|
|
103
105
|
"l-theme": import("./theme").default
|
|
104
106
|
"l-theme-color": import("./theme/theme_color").default
|
|
105
107
|
"l-date-picker": import("./date_picker").default
|
package/lib/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { createTransition as t, getPopoverOffsetX as r, getPopoverOffsetY as a,
|
|
|
2
2
|
import { set as c, remove as I } from "./utils/clickoutside.js";
|
|
3
3
|
import { default as C } from "./base.js";
|
|
4
4
|
import { default as h } from "./message/index.js";
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
5
|
+
import { default as b } from "./popover/index.js";
|
|
6
|
+
import { default as P } from "./popconfirm/index.js";
|
|
7
|
+
import { default as S } from "./dialog/index.js";
|
|
8
|
+
import { default as k } from "./dialog/dialog_container.js";
|
|
9
|
+
import { default as D } from "./loading/index.js";
|
|
10
10
|
import { default as L } from "./modal/index.js";
|
|
11
11
|
import { default as B } from "./icon/base.js";
|
|
12
12
|
import { default as G } from "./icon/arrow_down.js";
|
|
@@ -29,10 +29,10 @@ import { default as co } from "./icon/close.js";
|
|
|
29
29
|
import { default as io } from "./icon/info.js";
|
|
30
30
|
import { default as go } from "./icon/success.js";
|
|
31
31
|
import { default as Ao } from "./icon/warn.js";
|
|
32
|
-
import { default as
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
35
|
-
import { default as
|
|
32
|
+
import { default as Mo } from "./icon/close_filled.js";
|
|
33
|
+
import { default as Ro } from "./form/index.js";
|
|
34
|
+
import { default as To } from "./form/form_item.js";
|
|
35
|
+
import { default as wo } from "./check/radio_group.js";
|
|
36
36
|
import { default as vo } from "./check/radio.js";
|
|
37
37
|
import { default as Oo } from "./check/checkbox.js";
|
|
38
38
|
import { default as Fo } from "./check/checkbox_group.js";
|
|
@@ -45,14 +45,15 @@ import { default as Ho } from "./list/index.js";
|
|
|
45
45
|
import { default as Ko } from "./polygon/index.js";
|
|
46
46
|
import { default as Qo } from "./color_picker/index.js";
|
|
47
47
|
import { default as _o } from "./tabbar/index.js";
|
|
48
|
-
import { default as oe } from "./
|
|
49
|
-
import { default as te } from "./theme/
|
|
50
|
-
import { default as ae } from "./
|
|
51
|
-
import { default as se } from "./
|
|
52
|
-
import { default as le } from "./menu/
|
|
53
|
-
import { default as pe } from "./menu/
|
|
54
|
-
import { default as xe } from "./
|
|
55
|
-
import { default as ce } from "./carousel/
|
|
48
|
+
import { default as oe } from "./tabbar/item.js";
|
|
49
|
+
import { default as te } from "./theme/index.js";
|
|
50
|
+
import { default as ae } from "./theme/theme_color.js";
|
|
51
|
+
import { default as se } from "./date_picker/index.js";
|
|
52
|
+
import { default as le } from "./menu/index.js";
|
|
53
|
+
import { default as pe } from "./menu/menu_item.js";
|
|
54
|
+
import { default as xe } from "./menu/sub_menu.js";
|
|
55
|
+
import { default as ce } from "./carousel/index.js";
|
|
56
|
+
import { default as ie } from "./carousel/item.js";
|
|
56
57
|
export {
|
|
57
58
|
G as ArrowDownIcon,
|
|
58
59
|
U as ArrowLeftIcon,
|
|
@@ -63,48 +64,49 @@ export {
|
|
|
63
64
|
yo as Button,
|
|
64
65
|
E as CaretBottomIcon,
|
|
65
66
|
q as CaretTopIcon,
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
ce as Carousel,
|
|
68
|
+
ie as CarouselItem,
|
|
68
69
|
Oo as Checkbox,
|
|
69
70
|
Fo as CheckboxGroup,
|
|
70
|
-
|
|
71
|
+
Mo as CloseFilledIcon,
|
|
71
72
|
co as CloseIcon,
|
|
72
73
|
Qo as ColorPicker,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
se as DatePicker,
|
|
75
|
+
S as Dialog,
|
|
76
|
+
k as DialogContainer,
|
|
76
77
|
J as FontIcon,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
Ro as Form,
|
|
79
|
+
To as FormItem,
|
|
79
80
|
io as InfoIcon,
|
|
80
81
|
Vo as Input,
|
|
81
82
|
Ho as List,
|
|
82
|
-
|
|
83
|
+
D as Loading,
|
|
83
84
|
N as LoadingIcon,
|
|
84
85
|
zo as MdInput,
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
le as Menu,
|
|
87
|
+
pe as MenuItem,
|
|
87
88
|
h as Message,
|
|
88
89
|
L as Modal,
|
|
89
90
|
eo as MoonIcon,
|
|
90
91
|
Ko as Polygon,
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
P as Popconfirm,
|
|
93
|
+
b as Popover,
|
|
93
94
|
vo as Radio,
|
|
94
|
-
|
|
95
|
+
wo as RadioGroup,
|
|
95
96
|
ro as ReductionIcon,
|
|
96
97
|
fo as RefreshLeftIcon,
|
|
97
98
|
uo as RefreshRightIcon,
|
|
98
99
|
Z as SearchIcon,
|
|
99
100
|
Xo as SelectOri,
|
|
100
101
|
mo as SortIcon,
|
|
101
|
-
|
|
102
|
+
xe as SubMenu,
|
|
102
103
|
go as SuccessIcon,
|
|
103
104
|
$ as SunIcon,
|
|
104
105
|
jo as Switch,
|
|
105
106
|
_o as Tabbar,
|
|
106
|
-
oe as
|
|
107
|
-
te as
|
|
107
|
+
oe as TabbarItem,
|
|
108
|
+
te as Theme,
|
|
109
|
+
ae as ThemeColor,
|
|
108
110
|
xo as ThemeDefaultIcon,
|
|
109
111
|
Ao as WarnIcon,
|
|
110
112
|
c as addClickOutside,
|
package/lib/tabbar/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
type TabbarItem = {
|
|
3
|
-
name: string;
|
|
4
|
-
text?: string | (() => string | HTMLElement);
|
|
5
|
-
icon?: string | (() => string | HTMLElement);
|
|
6
|
-
};
|
|
7
2
|
export default class Tabbar extends BaseComponent {
|
|
8
3
|
#private;
|
|
9
4
|
static baseName: string;
|
|
@@ -17,26 +12,12 @@ export default class Tabbar extends BaseComponent {
|
|
|
17
12
|
name?: string;
|
|
18
13
|
gap?: string;
|
|
19
14
|
private $line?;
|
|
20
|
-
constructor();
|
|
21
15
|
connectedCallback(): void;
|
|
22
16
|
static get observedAttributes(): string[] | null | undefined;
|
|
23
17
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
24
|
-
disconnectedCallback(): void;
|
|
25
18
|
render(): any;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* @param items - 选项卡栏项目的数组。
|
|
29
|
-
* 该方法首先清空选项卡栏的包装器元素,然后根据传入的项目数组创建并追加新的选项卡项目。
|
|
30
|
-
*/
|
|
31
|
-
setItems(items: TabbarItem[]): void;
|
|
32
|
-
/**
|
|
33
|
-
* 向标签栏添加项目。
|
|
34
|
-
* @param items 要添加的标签栏项目数组。
|
|
35
|
-
* @returns 无返回值。
|
|
36
|
-
*/
|
|
37
|
-
addItems(items: TabbarItem[]): void;
|
|
38
|
-
private _init;
|
|
39
|
-
private _destroy;
|
|
19
|
+
afterInit(): void;
|
|
20
|
+
beforeDestroy(): void;
|
|
40
21
|
private _handleClick;
|
|
41
22
|
private _updateActive;
|
|
42
23
|
/**
|
|
@@ -45,4 +26,3 @@ export default class Tabbar extends BaseComponent {
|
|
|
45
26
|
*/
|
|
46
27
|
private _updateLine;
|
|
47
28
|
}
|
|
48
|
-
export {};
|
package/lib/tabbar/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isBlank as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { addClass as
|
|
5
|
-
const
|
|
6
|
-
class
|
|
1
|
+
import { isBlank as h, isNumeric as c } from "ph-utils";
|
|
2
|
+
import d from "../base.js";
|
|
3
|
+
import { parseAttrValue as l } from "../utils/index.js";
|
|
4
|
+
import { addClass as b, removeClass as o, $one as r, create as n, $$ as p, on as f, off as m, shouldEventNext as u, isVisible as v } from "ph-utils/dom";
|
|
5
|
+
const g = ":host{--l-tabbar-hover-color: var(--l-primary-color-light1, #9254de);--l-tabbar-active-color: var(--l-primary-color, #722ed1);--l-tabbar-item-gap: 0;--l-tabbar-height: 38px;position:relative;overflow:hidden;height:var(--l-tabbar-height);background-color:#fff;display:flex;flex-wrap:nowrap;align-items:stretch;gap:var(--l-tabbar-item-gap);box-sizing:border-box}:host(.l-tabbar--nav){--l-tabbar-height: 50px;--l-tabbar-item-grow: 1;width:100%}:host(.l-tabbar--bar){--l-tabbar-bar-vertical-padding: 10px;--l-tabbar-item-gap: 30px;--l-tabbar-line-color: var(--l-primary-color, #722ed1);overflow:auto;white-space:nowrap}.l-tabbar--bar-line{position:absolute;width:32px;left:0;bottom:0;border-radius:1px;height:2px;background-color:var(--l-tabbar-line-color);transition:all .3s ease-in-out}:host(.l-tabbar--card){--l-tabbar-card-border-color: #f5f7fa;--l-tabbar-line-color: #fff;--l-tabbar-item-gap: 0;--l-tabbar-card-border-radius: 5px}.l-tabbar-card-border{position:absolute;left:0;right:0;bottom:0;height:1px;background-color:var(--l-tabbar-card-border-color)}";
|
|
6
|
+
class _ extends d {
|
|
7
7
|
static baseName = "tabbar";
|
|
8
8
|
/**
|
|
9
9
|
* 标签类型:
|
|
@@ -15,96 +15,46 @@ class R extends v {
|
|
|
15
15
|
name;
|
|
16
16
|
gap;
|
|
17
17
|
$line;
|
|
18
|
-
constructor() {
|
|
19
|
-
super(), y(this);
|
|
20
|
-
}
|
|
21
18
|
connectedCallback() {
|
|
22
|
-
this.loadStyleText(
|
|
19
|
+
this.loadStyleText(g), b(this, `l-tabbar--${this.type}`), this.#t(), super.connectedCallback();
|
|
23
20
|
}
|
|
24
21
|
static get observedAttributes() {
|
|
25
22
|
return ["name", "type", "justify-content", "gap"];
|
|
26
23
|
}
|
|
27
|
-
attributeChangedCallback(
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
this.name =
|
|
31
|
-
} else if (
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
let
|
|
35
|
-
|
|
24
|
+
attributeChangedCallback(t, e, a) {
|
|
25
|
+
if (t === "name") {
|
|
26
|
+
const i = l(a, void 0);
|
|
27
|
+
this.name = i, this._updateActive(), this._updateLine();
|
|
28
|
+
} else if (t === "type") {
|
|
29
|
+
const i = l(a, "nav");
|
|
30
|
+
if (i !== this.type && (o(this, `l-tabbar--${this.type}`), this.type = i, o(this, `l-tabbar--${i}`), i === "card")) {
|
|
31
|
+
let s = r(".l-tabbar-card-border", this.root);
|
|
32
|
+
s || (s = n("div", { class: "l-tabbar-card-border" }), this.root.appendChild(s));
|
|
36
33
|
}
|
|
37
34
|
} else {
|
|
38
|
-
const
|
|
39
|
-
this[
|
|
40
|
-
const i = l(".l-tabbar-wrapper", this.root);
|
|
41
|
-
i && (i.style.cssText = this.#t()), e === "gap" && (!p(this.gap) && !this.gap.startsWith("0") ? h(this, "l-tabbar-gap") : f(this, "l-tabbar-gap"));
|
|
35
|
+
const i = l(a, void 0);
|
|
36
|
+
this[t] = i, this.#t();
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
disconnectedCallback() {
|
|
45
|
-
super.disconnectedCallback(), this._destroy();
|
|
46
|
-
}
|
|
47
39
|
render() {
|
|
48
|
-
const
|
|
49
|
-
if (t.
|
|
50
|
-
const
|
|
51
|
-
t.appendChild(
|
|
52
|
-
} else {
|
|
53
|
-
const r = u("[l-name]", this);
|
|
54
|
-
r.length > 0 && x(r, (i) => {
|
|
55
|
-
const c = i.getAttribute("l-name");
|
|
56
|
-
if (c) {
|
|
57
|
-
const o = i.cloneNode(!0);
|
|
58
|
-
o.classList.add("l-tabbar-item"), o.setAttribute("part", "item"), c === this.name && o.classList.add("active");
|
|
59
|
-
const n = l("[l-icon]", o), s = u(":not([l-icon])", o);
|
|
60
|
-
if (n) {
|
|
61
|
-
const d = b("div", {
|
|
62
|
-
class: [
|
|
63
|
-
"l-tabbar-item-icon",
|
|
64
|
-
s.length === 0 ? "only" : void 0
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
d.appendChild(n.cloneNode(!0)), n.replaceWith(d);
|
|
68
|
-
}
|
|
69
|
-
t.appendChild(o);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
if (e.appendChild(t), this.type === "card") {
|
|
74
|
-
const r = b("div", { class: "l-tabbar-card-border" });
|
|
75
|
-
e.appendChild(r);
|
|
40
|
+
const t = document.createDocumentFragment();
|
|
41
|
+
if (t.appendChild(p("slot")), this.type === "card") {
|
|
42
|
+
const e = n("div", { class: "l-tabbar-card-border" });
|
|
43
|
+
t.appendChild(e);
|
|
76
44
|
}
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 设置选项卡栏的项目列表。
|
|
81
|
-
* @param items - 选项卡栏项目的数组。
|
|
82
|
-
* 该方法首先清空选项卡栏的包装器元素,然后根据传入的项目数组创建并追加新的选项卡项目。
|
|
83
|
-
*/
|
|
84
|
-
setItems(e) {
|
|
85
|
-
const t = l(".l-tabbar-wrapper", this.root);
|
|
86
|
-
t && (t.innerHTML = "", t.appendChild(this.#e(e)));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 向标签栏添加项目。
|
|
90
|
-
* @param items 要添加的标签栏项目数组。
|
|
91
|
-
* @returns 无返回值。
|
|
92
|
-
*/
|
|
93
|
-
addItems(e) {
|
|
94
|
-
const t = l(".l-tabbar-wrapper", this.root);
|
|
95
|
-
t && t.appendChild(this.#e(e));
|
|
45
|
+
return t;
|
|
96
46
|
}
|
|
97
|
-
|
|
98
|
-
|
|
47
|
+
afterInit() {
|
|
48
|
+
f(this.root, "click", this._handleClick), setTimeout(() => {
|
|
99
49
|
this._updateLine();
|
|
100
50
|
}, 300);
|
|
101
51
|
}
|
|
102
|
-
|
|
103
|
-
|
|
52
|
+
beforeDestroy() {
|
|
53
|
+
m(this.root, "click", this._handleClick), this.$line = void 0;
|
|
104
54
|
}
|
|
105
|
-
_handleClick = (
|
|
106
|
-
const [
|
|
107
|
-
|
|
55
|
+
_handleClick = (t) => {
|
|
56
|
+
const [e, a] = u(t, "name", this);
|
|
57
|
+
e && a !== this.name && (this.name = a, console.log(a), this.dispatchEvent(
|
|
108
58
|
new CustomEvent("change", {
|
|
109
59
|
detail: {
|
|
110
60
|
name: a
|
|
@@ -113,10 +63,10 @@ class R extends v {
|
|
|
113
63
|
), this._updateActive(), this._updateLine());
|
|
114
64
|
};
|
|
115
65
|
_updateActive() {
|
|
116
|
-
const t =
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
66
|
+
const t = r(".active", this);
|
|
67
|
+
t && o(t, "active");
|
|
68
|
+
const e = r(`[name="${this.name}"]`, this);
|
|
69
|
+
e && b(e, "active");
|
|
120
70
|
}
|
|
121
71
|
/**
|
|
122
72
|
* 初始化线条的方法,在微任务队列中执行。
|
|
@@ -125,53 +75,29 @@ class R extends v {
|
|
|
125
75
|
_updateLine() {
|
|
126
76
|
queueMicrotask(() => {
|
|
127
77
|
if (!this.name || this.type === "nav" || !this.rendered) return;
|
|
128
|
-
const
|
|
78
|
+
const t = r(".active", this);
|
|
129
79
|
if (!t) return;
|
|
130
|
-
const
|
|
80
|
+
const e = t.offsetLeft;
|
|
131
81
|
if (!this.$line) {
|
|
132
|
-
const
|
|
133
|
-
|
|
82
|
+
const a = n("div", { class: "l-tabbar--bar-line" });
|
|
83
|
+
a.part = "line", this.root.appendChild(a), this.$line = r(".l-tabbar--bar-line", this.root);
|
|
134
84
|
}
|
|
135
|
-
this.$line.style.cssText = `width:${t.offsetWidth}px;left:${
|
|
136
|
-
left:
|
|
85
|
+
this.$line.style.cssText = `width:${t.offsetWidth}px;left:${e}px`, v(t, this) || this.scrollTo({
|
|
86
|
+
left: e,
|
|
137
87
|
behavior: "smooth"
|
|
138
88
|
});
|
|
139
89
|
});
|
|
140
90
|
}
|
|
141
91
|
#t() {
|
|
142
|
-
const
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
#e(e) {
|
|
150
|
-
const t = document.createDocumentFragment();
|
|
151
|
-
for (let a = 0, r = e.length; a < r; a++) {
|
|
152
|
-
const i = e[a], c = b("div", {
|
|
153
|
-
class: A([
|
|
154
|
-
"l-tabbar-item",
|
|
155
|
-
this.name === i.name ? "active" : void 0
|
|
156
|
-
]),
|
|
157
|
-
"l-name": i.name,
|
|
158
|
-
part: "item"
|
|
159
|
-
}), o = i.icon;
|
|
160
|
-
if (o) {
|
|
161
|
-
const s = b("div", { class: "l-tabbar-item-icon" });
|
|
162
|
-
let d = typeof o == "string" ? o : o();
|
|
163
|
-
typeof d == "string" ? s.innerHTML = d : s.appendChild(d), c.appendChild(s);
|
|
164
|
-
}
|
|
165
|
-
const n = i.text;
|
|
166
|
-
if (n) {
|
|
167
|
-
let s = typeof n == "string" ? n : n();
|
|
168
|
-
typeof s == "string" ? c.appendChild(b(s)) : c.appendChild(s);
|
|
169
|
-
}
|
|
170
|
-
t.appendChild(c);
|
|
92
|
+
const t = this.getAttr("justify-content");
|
|
93
|
+
if (h(t) ? this.style.removeProperty("justify-content") : this.style.setProperty("justify-content", t), h(this.gap))
|
|
94
|
+
this.style.removeProperty("--l-tabbar-item-gap"), o(this, "l-tabbar-gap");
|
|
95
|
+
else {
|
|
96
|
+
let e = this.gap;
|
|
97
|
+
c(e, { isPositive: !0 }) && (e = `${e}px`), b(this, "l-tabbar-gap"), this.style.setProperty("--l-tabbar-item-gap", e);
|
|
171
98
|
}
|
|
172
|
-
return t;
|
|
173
99
|
}
|
|
174
100
|
}
|
|
175
101
|
export {
|
|
176
|
-
|
|
102
|
+
_ as default
|
|
177
103
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class TabbarItem extends BaseComponent {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
icon?: boolean;
|
|
7
|
+
onlyIcon?: boolean;
|
|
8
|
+
static get observedAttributes(): string[] | null | undefined;
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
11
|
+
render(): DocumentFragment;
|
|
12
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import l from "../base.js";
|
|
2
|
+
import { parseAttrValue as s } from "../utils/index.js";
|
|
3
|
+
import { addClass as i, $one as a, $$ as r, removeClass as c } from "ph-utils/dom";
|
|
4
|
+
const d = ":host{color:#666;transition:all .3s ease-in-out;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;line-height:1;flex-direction:column;flex-grow:var(--l-tabbar-item-grow, 0);box-sizing:border-box}:host(:hover){color:var(--l-tabbar-hover-color)}:host(.active){color:var(--l-tabbar-active-color)}.icon-wrapper{font-size:18px;margin-bottom:3px;display:flex;justify-content:center;align-items:center}.icon-wrapper.only{font-size:24px;margin-bottom:0}:host(.l-item--card){padding:0 15px;background:#f5f7fa;border:1px solid #f0f0f0}:host(.l-item--card:first-child){border-top-left-radius:var(--l-tabbar-card-border-radius)}:host(.l-item--card:last-child){border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-item--card.active){background:#fff}:host(.l-item--gap){border-top-left-radius:var(--l-tabbar-card-border-radius);border-top-right-radius:var(--l-tabbar-card-border-radius)}";
|
|
5
|
+
class m extends l {
|
|
6
|
+
static baseName = "tabbar-item";
|
|
7
|
+
name;
|
|
8
|
+
icon;
|
|
9
|
+
onlyIcon;
|
|
10
|
+
static get observedAttributes() {
|
|
11
|
+
return ["name", "label", "icon", "only-icon"];
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
this.loadStyleText(d), console.log(this.parentElement);
|
|
15
|
+
const t = this.parentElement;
|
|
16
|
+
t.gap && i(this, "l-item--gap"), t.type === "card" && i(this, "l-item--card"), super.connectedCallback();
|
|
17
|
+
}
|
|
18
|
+
attributeChangedCallback(t, o, e) {
|
|
19
|
+
if (t === "icon" || t === "only-icon") {
|
|
20
|
+
const n = s(e, !1, "icon");
|
|
21
|
+
this[t] = n, this.#t();
|
|
22
|
+
} else
|
|
23
|
+
this[t] = e;
|
|
24
|
+
}
|
|
25
|
+
#t() {
|
|
26
|
+
if (!this.rendered) return;
|
|
27
|
+
let t = a(".icon-wrapper", this.root);
|
|
28
|
+
this.icon ? t ? this.onlyIcon ? i(t, "only") : c(t, "only") : (t = r("div", {
|
|
29
|
+
class: ["icon-wrapper", this.onlyIcon ? "only" : ""],
|
|
30
|
+
innerHTML: "<slot name='icon'></slot>"
|
|
31
|
+
}), this.root.prepend(t)) : t && t.remove();
|
|
32
|
+
let o = a("slot:not([name])", this.root);
|
|
33
|
+
if (this.onlyIcon)
|
|
34
|
+
o && o.remove();
|
|
35
|
+
else if (!o) {
|
|
36
|
+
const e = r("slot");
|
|
37
|
+
this.root.appendChild(e);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
const t = document.createDocumentFragment();
|
|
42
|
+
if (this.icon) {
|
|
43
|
+
const o = r("div", {
|
|
44
|
+
class: ["icon-wrapper", this.onlyIcon ? "only" : ""],
|
|
45
|
+
innerHTML: "<slot name='icon'></slot>"
|
|
46
|
+
});
|
|
47
|
+
t.appendChild(o);
|
|
48
|
+
}
|
|
49
|
+
if (!this.onlyIcon) {
|
|
50
|
+
const o = r("slot");
|
|
51
|
+
t.appendChild(o);
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export {
|
|
57
|
+
m as default
|
|
58
|
+
};
|