litos-ui 0.19.0 → 0.20.1
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-DStAHzod.js → animation-Bo4jbSGK.js} +4 -3
- package/lib/{base-LvfO4mmL.js → base-Dyj1rzaK.js} +11 -12
- package/lib/base.d.ts +5 -4
- package/lib/base.js +19 -15
- package/lib/button/index.d.ts +2 -2
- package/lib/button/index.js +152 -2
- package/lib/button/style.d.ts +2 -0
- package/lib/button/style.js +2 -0
- package/lib/calendar/index.d.ts +2 -2
- package/lib/calendar/index.js +1 -1
- package/lib/{calendar-Clbg3qot.js → calendar-CvlUsN6w.js} +20 -23
- package/lib/card/index.d.ts +23 -0
- package/lib/card/index.js +2 -0
- package/lib/card-3DM-lJQV.js +63 -0
- package/lib/carousel/index.js +1 -1
- package/lib/carousel/item.js +1 -1
- package/lib/{carousel-Dgirxwzb.js → carousel-DvkZ1YXq.js} +23 -19
- package/lib/check/checkbox.js +1 -1
- package/lib/check/checkbox_group.js +1 -1
- package/lib/check/radio.js +1 -1
- package/lib/check/radio_group.js +1 -1
- package/lib/{check-BDOpD_0-.js → check-DFlwStH9.js} +10 -13
- package/lib/{check-CrlZ7zVL.js → check-doQ2ZpQj.js} +10 -10
- package/lib/{checkbox-D_bZGoUD.js → checkbox-DhGHJXwI.js} +1 -1
- package/lib/collapse/index.js +1 -1
- package/lib/collapse/item.js +1 -1
- package/lib/{collapse-BRxYoeJx.js → collapse-B6-Rn05A.js} +8 -10
- package/lib/color_picker/index.js +1 -1
- package/lib/{color_picker-AaFcIczZ.js → color_picker-0a-IGZY9.js} +3 -3
- package/lib/date_picker/index.d.ts +2 -2
- package/lib/date_picker/index.js +1 -1
- package/lib/{date_picker-HjkRma9j.js → date_picker-BDN2PAz5.js} +3 -7
- package/lib/date_picker_ori/index.js +1 -1
- package/lib/{date_picker_ori-1IOHZsan.js → date_picker_ori-BXFs1eET.js} +4 -6
- package/lib/description_panel/index.js +1 -1
- package/lib/{description_panel-DaqVcA6-.js → description_panel--AKXBzLL.js} +2 -6
- package/lib/dialog/dialog_box.d.ts +22 -0
- package/lib/dialog/dialog_box.js +98 -0
- package/lib/dialog/dialog_container.d.ts +7 -3
- package/lib/dialog/dialog_container.js +1 -1
- package/lib/dialog/index.d.ts +33 -11
- package/lib/dialog/index.js +48 -48
- package/lib/{dialog_container-CcTyfoaD.js → dialog_container-BNPQ9n0V.js} +34 -15
- package/lib/{esm-Cir9D6cn.js → esm-DAha108i.js} +67 -67
- package/lib/form/form_item.d.ts +3 -3
- package/lib/form/form_item.js +1 -1
- package/lib/form/index.d.ts +3 -3
- package/lib/form/index.js +1 -1
- package/lib/{form-BvZHaqAt.js → form-DJxvBiLy.js} +30 -32
- package/lib/{form_inner-52DR1IPu.js → form_inner-Cnwb6f_Q.js} +3 -5
- package/lib/{form_item-DtqChzc3.js → form_item-BqPMRABd.js} +7 -9
- package/lib/icon/arrow_down.js +1 -1
- package/lib/icon/arrow_left.js +1 -1
- package/lib/icon/arrow_right.js +1 -1
- package/lib/icon/arrow_up.js +1 -1
- package/lib/icon/base.d.ts +2 -2
- package/lib/icon/base.js +1 -1
- package/lib/icon/calendar.js +1 -1
- package/lib/icon/caret_bottom.js +1 -1
- package/lib/icon/caret_top.js +1 -1
- package/lib/icon/close.js +1 -1
- package/lib/icon/close_filled.js +1 -1
- package/lib/icon/d_arrow_left.js +1 -1
- package/lib/icon/d_arrow_right.js +1 -1
- package/lib/icon/font_icon.js +1 -1
- package/lib/icon/info.js +1 -1
- package/lib/icon/loading.js +1 -1
- package/lib/icon/moon.js +1 -1
- package/lib/icon/more.js +1 -1
- package/lib/icon/reduction.js +1 -1
- package/lib/icon/refresh.js +1 -1
- package/lib/icon/refresh_left.js +1 -1
- package/lib/icon/refresh_right.js +1 -1
- package/lib/icon/search.js +1 -1
- package/lib/icon/select.js +1 -1
- package/lib/icon/sort.js +1 -1
- package/lib/icon/success.js +1 -1
- package/lib/icon/sun.js +1 -1
- package/lib/icon/theme_default.js +1 -1
- package/lib/icon/warn.js +1 -1
- package/lib/icon/zoom_in.js +1 -1
- package/lib/icon/zoom_out.js +1 -1
- package/lib/image/image_preview.js +1 -1
- package/lib/image/index.js +1 -1
- package/lib/{image-BCUhVAFo.js → image-CVQai6NX.js} +19 -19
- package/lib/{image_preview-BeJzfEoF.js → image_preview-DfQAKSJH.js} +3 -5
- package/lib/index.d.ts +2 -0
- package/lib/index.js +71 -69
- package/lib/input/index.d.ts +2 -2
- package/lib/input/index.js +3 -5
- package/lib/{item-42bYhAkZ.js → item-CQ2Sknbz.js} +1 -1
- package/lib/{item-Dq6M7lxw.js → item-DI6mQXtB.js} +5 -7
- package/lib/{item-CX8C9X57.js → item-D_ZOPXuE.js} +1 -1
- package/lib/list/index.js +1 -1
- package/lib/{list-Dz1Ya118.js → list-MG8PRzos.js} +3 -3
- package/lib/loading/index.js +6 -4
- package/lib/mask/index.js +1 -1
- package/lib/{mask-BlDl9u8F.js → mask-Bx-yNIJv.js} +2 -6
- package/lib/mask-Ox6CoyFB.js +5 -0
- package/lib/md_input/index.js +1 -1
- package/lib/{md_input-DN3ceqsw.js → md_input-BX3bujz8.js} +2 -2
- package/lib/menu/index.d.ts +12 -4
- package/lib/menu/index.js +1 -1
- package/lib/menu-DKscK5mw.js +274 -0
- package/lib/message/index.js +1 -1
- package/lib/modal/index.d.ts +2 -2
- package/lib/modal/index.js +1 -1
- package/lib/modal/modal_box.js +13 -13
- package/lib/{modal-cjj3Nw1B.js → modal-Cwi3qlEf.js} +39 -33
- package/lib/page_header/index.js +1 -1
- package/lib/{page_header-BfuWJIdd.js → page_header-ujV3pncE.js} +2 -4
- package/lib/pagination/index.d.ts +25 -18
- package/lib/pagination/index.js +1 -1
- package/lib/{pagination-DpOSOFwl.js → pagination-aRbGd3Rf.js} +86 -83
- package/lib/polygon/index.js +1 -1
- package/lib/{polygon-BY1FAACc.js → polygon-DhhovlrG.js} +1 -1
- package/lib/qrcode/index.d.ts +2 -2
- package/lib/qrcode/index.js +1 -1
- package/lib/{qrcode-Bgr8gJzA.js → qrcode-Dip8uLSA.js} +1 -1
- package/lib/{radio-C7dkhgwc.js → radio-C9NPQWGI.js} +1 -1
- package/lib/select/index.d.ts +2 -2
- package/lib/select/index.js +1 -1
- package/lib/{select-Cis6kRjQ.js → select-BZMDj5VE.js} +33 -30
- package/lib/select_ori/index.d.ts +2 -2
- package/lib/select_ori/index.js +1 -1
- package/lib/{select_ori-DcJbNYYr.js → select_ori-C7sUZxen.js} +3 -3
- package/lib/space/index.js +1 -1
- package/lib/{space-BT_dVhhv.js → space-CKuTk0YB.js} +6 -5
- package/lib/style-gKR_qwzm.js +5 -0
- package/lib/styles/animation/index.d.ts +2 -0
- package/lib/styles/animation/index.js +2 -0
- package/lib/styles/mask/index.d.ts +2 -0
- package/lib/styles/mask/index.js +2 -0
- package/lib/switch/index.js +1 -1
- package/lib/{switch-UyhlgW7F.js → switch-wh2-ivty.js} +11 -9
- package/lib/tabbar/index.js +1 -1
- package/lib/tabbar/item.js +1 -1
- package/lib/{tabbar-DO0kB58Y.js → tabbar-CBXK-_AV.js} +1 -1
- package/lib/table/index.d.ts +7 -3
- package/lib/table/index.js +1 -1
- package/lib/{table-saZMryiV.js → table-BQxMD2Ae.js} +32 -33
- package/lib/tabs/index.js +4 -2
- package/lib/tag/index.js +1 -1
- package/lib/{tag-BtDcKdxo.js → tag-Di1z9PoZ.js} +3 -5
- package/lib/theme/index.js +1 -1
- package/lib/theme/theme_color.d.ts +1 -2
- package/lib/theme/theme_color.js +4 -5
- package/lib/{theme-Barcq234.js → theme-CLbBS-in.js} +9 -10
- package/lib/utils/context_provide.js +1 -1
- package/lib/utils/index.d.ts +1 -1
- package/lib/utils/popover.js +1 -1
- package/lib/utils/transition.js +1 -1
- package/package.json +11 -11
- package/lib/button-CC5NBWtI.js +0 -152
- package/lib/menu-BOmVa4xN.js +0 -224
package/lib/tabbar/item.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../item-
|
|
1
|
+
import { t as e } from "../item-D_ZOPXuE.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { parseAttrValue as t } from "./utils/index.js";
|
|
3
|
-
import { $$ as n, $one as r, addClass as i, create as a, isVisible as o, off as s, on as c, removeClass as l, shouldEventNext as u } from "ph-utils/
|
|
3
|
+
import { $$ as n, $one as r, addClass as i, create as a, isVisible as o, off as s, on as c, removeClass as l, shouldEventNext as u } from "ph-utils/browser";
|
|
4
4
|
import { isBlank as d, isNumeric as f } from "ph-utils";
|
|
5
5
|
//#region src/components/tabbar/index.less?inline
|
|
6
6
|
var p = ":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;height:var(--l-tabbar-height);align-items:stretch;gap:var(--l-tabbar-item-gap);box-sizing:border-box;background-color:#fff;flex-wrap:nowrap;display:flex;position:relative;overflow:hidden}: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);white-space:nowrap;overflow:auto}.l-tabbar--bar-line{background-color:var(--l-tabbar-line-color);border-radius:1px;width:32px;height:2px;transition:all .3s ease-in-out;position:absolute;bottom:0;left:0}: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{background-color:var(--l-tabbar-card-border-color);height:1px;position:absolute;bottom:0;left:0;right:0}", m = class extends e {
|
package/lib/table/index.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ type ChangeFixedParams = {
|
|
|
4
4
|
fixedColumn?: boolean;
|
|
5
5
|
fixedHead?: boolean;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
static baseName: string;
|
|
7
|
+
type TableState = {
|
|
9
8
|
/** 斑马纹 */
|
|
10
9
|
stripe: boolean;
|
|
11
10
|
/** 是否显示四周边框 */
|
|
@@ -18,6 +17,10 @@ export default class Table extends BaseComponent {
|
|
|
18
17
|
maxHeight?: number | string;
|
|
19
18
|
/** 表格布局 */
|
|
20
19
|
tableLayout?: "auto" | "fixed";
|
|
20
|
+
};
|
|
21
|
+
export default class Table extends BaseComponent<TableState> {
|
|
22
|
+
static baseName: string;
|
|
23
|
+
constructor();
|
|
21
24
|
columns?: Column[];
|
|
22
25
|
data?: any[];
|
|
23
26
|
sortInfo?: SortOption;
|
|
@@ -28,7 +31,8 @@ export default class Table extends BaseComponent {
|
|
|
28
31
|
setData(data: any[], sortInfo?: SortOption): void;
|
|
29
32
|
changeFixed(params?: ChangeFixedParams): void;
|
|
30
33
|
static get observedAttributes(): string[];
|
|
31
|
-
|
|
34
|
+
protected attributeChanged(name: string, _oldValue: string, newValue: string): void;
|
|
35
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
32
36
|
render(): HTMLElement;
|
|
33
37
|
rerender(partial: "head" | "body" | "all"): void;
|
|
34
38
|
private _changeCssVar;
|
package/lib/table/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../table-
|
|
1
|
+
import { t as e } from "../table-BQxMD2Ae.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
|
|
3
|
-
import { $$ as r, $one as i, formatStyle as a, iterate as o, off as s, on as c, shouldEventNext as l } from "ph-utils/
|
|
3
|
+
import { $$ as r, $one as i, formatStyle as a, iterate as o, off as s, on as c, shouldEventNext as l } from "ph-utils/browser";
|
|
4
4
|
import { random as u } from "ph-utils";
|
|
5
5
|
//#region src/components/table/index.less?inline
|
|
6
|
-
var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:var(--l-table-font-size,14px);display:inline-block;overflow:auto}.l-table{border-collapse:collapse;border-spacing:0;table-layout:var(--l-table-layout,auto);width:100%}.l-table th,.l-table td{border-bottom:1px solid var(--l-table-border-color,#e6e6e6)}.l-table th{padding:var(--l-table-th-padding,10px);text-align:left;background-color:var(--l-table-th-bg,#f2f2f2);color:var(--l-table-th-color,#000)}.l-table td{background-color:var(--l-table-td-bg,#fff);color:var(--l-table-td-color,#000);padding:var(--l-table-td-padding,10px);transition:background-color .3s}.l-table tr:hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table .l-table__empty-col{color:var(--l-table-empty-color,#999);text-align:center}.l-table-stripe tr:nth-child(2n) td{background-color:var(--l-table-stripe-bg,#fafafa)}.l-table-stripe tr:nth-child(2n):hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table-border th,.l-table-border td{border:1px solid var(--l-table-border-color,#e6e6e6)}.l-table-fixed{--l-table-layout:fixed}.l-table-fixed .l-fixed{z-index:1;box-sizing:border-box;position:sticky}.l-table-fixed thead.l-fixed,.l-table-fixed tfoot.l-fixed{z-index:2}.l-table .caret-wrapper{vertical-align:middle;justify-content:center;align-items:center;width:20px;height:14px;display:inline-flex;position:relative}.l-table .caret-wrapper .ascending{border-bottom-color:var(--l-table-sort-inactive-color,#c0c4cc);top:-5px}.l-table .caret-wrapper .descending{border-top-color:var(--l-table-sort-inactive-color,#c0c4cc);bottom:-3px}.l-table .sort-caret{border:5px solid #0000;border-radius:3px;width:0;height:0;display:inline-block;position:absolute}.l-table .sort-column{cursor:pointer}.l-table .sort-asc .ascending{border-bottom-color:var(--l-primary-color,#52c41a)}.l-table .sort-desc .descending{border-top-color:var(--l-primary-color,#52c41a)}", f = class extends e {
|
|
6
|
+
var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:var(--l-table-font-size,14px);display:inline-block;overflow:auto}.l-table{border-collapse:collapse;border-spacing:0;table-layout:var(--l-table-layout,auto);width:100%}.l-table th,.l-table td{border-bottom:1px solid var(--l-table-border-color,#e6e6e6)}.l-table th{padding:var(--l-table-th-padding,10px);text-align:left;background-color:var(--l-table-th-bg,#f2f2f2);color:var(--l-table-th-color,#000)}.l-table td{background-color:var(--l-table-td-bg,#fff);color:var(--l-table-td-color,#000);padding:var(--l-table-td-padding,10px);transition:background-color .3s}.l-table tr:hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table .l-table__empty-col{color:var(--l-table-empty-color,#999);text-align:center}.l-table-stripe tr:nth-child(2n) td{background-color:var(--l-table-stripe-bg,#fafafa)}.l-table-stripe tr:nth-child(2n):hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table-border th,.l-table-border td{border:1px solid var(--l-table-border-color,#e6e6e6)}.l-table-fixed{--l-table-layout:fixed}.l-table-fixed .l-fixed{z-index:1;box-sizing:border-box;position:-webkit-sticky;position:sticky}.l-table-fixed thead.l-fixed,.l-table-fixed tfoot.l-fixed{z-index:2}.l-table .caret-wrapper{vertical-align:middle;justify-content:center;align-items:center;width:20px;height:14px;display:inline-flex;position:relative}.l-table .caret-wrapper .ascending{border-bottom-color:var(--l-table-sort-inactive-color,#c0c4cc);top:-5px}.l-table .caret-wrapper .descending{border-top-color:var(--l-table-sort-inactive-color,#c0c4cc);bottom:-3px}.l-table .sort-caret{border:5px solid #0000;border-radius:3px;width:0;height:0;display:inline-block;position:absolute}.l-table .sort-column{cursor:pointer}.l-table .sort-asc .ascending{border-bottom-color:var(--l-primary-color,#52c41a)}.l-table .sort-desc .descending{border-top-color:var(--l-primary-color,#52c41a)}", f = class extends e {
|
|
7
7
|
static baseName = "table";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this._state = {
|
|
10
|
+
stripe: !0,
|
|
11
|
+
border: !1,
|
|
12
|
+
fixedHead: !1,
|
|
13
|
+
fixedColumn: !1
|
|
14
|
+
};
|
|
15
|
+
}
|
|
14
16
|
columns = [];
|
|
15
17
|
data = [];
|
|
16
18
|
sortInfo;
|
|
@@ -26,13 +28,13 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
|
|
|
26
28
|
}
|
|
27
29
|
changeFixed(e) {
|
|
28
30
|
let t = {
|
|
29
|
-
fixedHead: this.fixedHead,
|
|
30
|
-
fixedColumn: this.fixedColumn,
|
|
31
|
+
fixedHead: this._state.fixedHead,
|
|
32
|
+
fixedColumn: this._state.fixedColumn,
|
|
31
33
|
...e
|
|
32
34
|
};
|
|
33
|
-
if (this.fixedHead = t.fixedHead, this.fixedColumn = t.fixedColumn, this.rendered) {
|
|
35
|
+
if (this._state.fixedHead = t.fixedHead, this._state.fixedColumn = t.fixedColumn, this.rendered) {
|
|
34
36
|
let e = i(".l-table", this.root);
|
|
35
|
-
e && (this.fixedHead || this.fixedColumn ? e.classList.add("l-table-fixed") : e.classList.remove("l-table-fixed"));
|
|
37
|
+
e && (this._state.fixedHead || this._state.fixedColumn ? e.classList.add("l-table-fixed") : e.classList.remove("l-table-fixed"));
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
static get observedAttributes() {
|
|
@@ -44,33 +46,30 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
|
|
|
44
46
|
"table-layout"
|
|
45
47
|
];
|
|
46
48
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (a !== this[e]) switch (this[e] = a, e) {
|
|
49
|
+
attributeChanged(e, r, i) {
|
|
50
|
+
let a = t(e);
|
|
51
|
+
switch (a) {
|
|
51
52
|
case "stripe":
|
|
52
|
-
this._classAttrChannge("stripe", a);
|
|
53
|
-
break;
|
|
54
53
|
case "border":
|
|
55
|
-
this._classAttrChannge("border", a);
|
|
56
|
-
break;
|
|
57
54
|
case "fixedHead":
|
|
58
|
-
|
|
55
|
+
case "fixedColumn":
|
|
56
|
+
this._state[a] = n(i, !1, e);
|
|
59
57
|
break;
|
|
60
58
|
case "maxHeight":
|
|
61
|
-
this.
|
|
62
|
-
break;
|
|
63
|
-
case "tableLayout":
|
|
64
|
-
this._changeCssVar("table-layout", a);
|
|
59
|
+
this._state.maxHeight = i || void 0;
|
|
65
60
|
break;
|
|
61
|
+
case "tableLayout": this._state.tableLayout = i || void 0;
|
|
66
62
|
}
|
|
67
63
|
}
|
|
64
|
+
updateDOM(e) {
|
|
65
|
+
e.has("stripe") && this._classAttrChannge("stripe", this._state.stripe), e.has("border") && this._classAttrChannge("border", this._state.border), e.has("fixedHead") && (this._updateFixedHead(), this.changeFixed()), e.has("maxHeight") && this._changeMaxHeight(), e.has("tableLayout") && this._changeCssVar("layout", this._state.tableLayout);
|
|
66
|
+
}
|
|
68
67
|
render() {
|
|
69
68
|
let e = r("table", { class: [
|
|
70
69
|
"l-table",
|
|
71
|
-
this.stripe ? "l-table-stripe" : "",
|
|
72
|
-
this.border ? "l-table-border" : "",
|
|
73
|
-
this.fixedHead || this.fixedColumn ? "l-table-fixed" : ""
|
|
70
|
+
this._state.stripe ? "l-table-stripe" : "",
|
|
71
|
+
this._state.border ? "l-table-border" : "",
|
|
72
|
+
this._state.fixedHead || this._state.fixedColumn ? "l-table-fixed" : ""
|
|
74
73
|
] });
|
|
75
74
|
return e.appendChild(this._headRender()), e.appendChild(this._bodyRender()), e;
|
|
76
75
|
}
|
|
@@ -92,7 +91,7 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
|
|
|
92
91
|
t ? this.style.setProperty(n, t) : this.style.removeProperty(n);
|
|
93
92
|
}
|
|
94
93
|
_changeMaxHeight() {
|
|
95
|
-
let e = this.maxHeight;
|
|
94
|
+
let e = this._state.maxHeight;
|
|
96
95
|
e && typeof e == "number" && (e = `${e}px`), this._changeCssVar("max-height", e);
|
|
97
96
|
}
|
|
98
97
|
_classAttrChannge(e, t) {
|
|
@@ -104,13 +103,13 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
|
|
|
104
103
|
_updateFixedHead() {
|
|
105
104
|
if (this.rendered) {
|
|
106
105
|
let e = i("thead", this.root);
|
|
107
|
-
e && (e.classList.toggle("l-fixed", this.fixedHead), e.style.top = this.fixedHead ? "0" : "");
|
|
106
|
+
e && (e.classList.toggle("l-fixed", this._state.fixedHead), e.style.top = this._state.fixedHead ? "0" : "");
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
_headRender() {
|
|
111
110
|
let e = r("thead", {
|
|
112
|
-
class: { "l-fixed": this.fixedHead },
|
|
113
|
-
style: { top: this.fixedHead ? "0" : void 0 }
|
|
111
|
+
class: { "l-fixed": this._state.fixedHead },
|
|
112
|
+
style: { top: this._state.fixedHead ? "0" : void 0 }
|
|
114
113
|
});
|
|
115
114
|
return this.columns && this._rendHeadRow(e, this.columns), e;
|
|
116
115
|
}
|
|
@@ -191,7 +190,7 @@ var d = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:va
|
|
|
191
190
|
let n = e.id;
|
|
192
191
|
if (this._globalColStyles && n in this._globalColStyles) return this._globalColStyles[n][t];
|
|
193
192
|
let r = {};
|
|
194
|
-
e.width && (typeof e.width == "number" ?
|
|
193
|
+
e.width && (r.width = typeof e.width == "number" ? `${e.width}px` : e.width), e.fixed && (e.fixed === "left" ? (r.left = `${e.left}px`, r["box-shadow"] = "-4px 0 4px -4px #d9d9d9 inset") : e.fixed === "right" && (r.right = `${e.right}px`, r["box-shadow"] = "4px 0 4px -4px #d9d9d9 inset")), this._globalColStyles ||= {};
|
|
195
194
|
let i = a(r), o = {
|
|
196
195
|
th: i,
|
|
197
196
|
td: i + a(e.style || "")
|
package/lib/tabs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, $one as t, iterate as n, off as r, on as i } from "ph-utils/
|
|
1
|
+
import { $ as e, $one as t, iterate as n, off as r, on as i } from "ph-utils/browser";
|
|
2
2
|
//#region src/components/tabs/index.ts
|
|
3
3
|
function a() {
|
|
4
4
|
let a = e(".l-tabs");
|
|
@@ -21,7 +21,9 @@ function a() {
|
|
|
21
21
|
if (a) {
|
|
22
22
|
i(a, "change", o);
|
|
23
23
|
let t = a.getAttribute("name");
|
|
24
|
-
t && r.setAttribute("l-current-tab", t)
|
|
24
|
+
t && r.setAttribute("l-current-tab", t);
|
|
25
|
+
let s = e(".l-tabs__content[l-tab]", r);
|
|
26
|
+
n(s, (e) => {
|
|
25
27
|
e.getAttribute("l-tab") === t ? e.classList.remove("l-tabs__content--hide") : e.classList.add("l-tabs__content--hide");
|
|
26
28
|
});
|
|
27
29
|
}
|
package/lib/tag/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../tag-
|
|
1
|
+
import { t as e } from "../tag-Di1z9PoZ.js";
|
|
2
2
|
export { e as default };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { parseAttrValue as t } from "./utils/index.js";
|
|
3
|
-
import { $$ as n, $one as r, off as i, on as a, shouldEventNext as o } from "ph-utils/
|
|
4
|
-
import {
|
|
5
|
-
import { adjust as c } from "ph-utils/color";
|
|
3
|
+
import { $$ as n, $one as r, off as i, on as a, shouldEventNext as o } from "ph-utils/browser";
|
|
4
|
+
import { adjust as s, isBlank as c } from "ph-utils";
|
|
6
5
|
//#region src/components/tag/index.less?inline
|
|
7
6
|
var l = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-height,22px);border:1px solid var(--l-tag-border-color,var(--l-border-color,#dedede));background:var(--l-tag-background,#fff);white-space:nowrap;color:var(--l-tag-color,#333);border-radius:4px;justify-content:center;align-items:center;padding:0 5px;font-size:12px;line-height:1;display:inline-flex}:host(.l-tag--primary){--l-tag-border-color:var(--l-primary-color-light3,#d3adf7);--l-tag-background:var(--l-primary-color-light5,#f9f0ff);--l-tag-color:var(--l-primary-color-light3,#d3adf7)}:host(.l-tag--error){--l-tag-color:var(--l-error-color,#ed3f13);--l-tag-background:var(--l-error-color-light5,#fff1f0);--l-tag-border-color:var(--l-error-color,#ed3f13)}:host(.l-tag--success){--l-tag-color:var(--l-success-color,#a0d911);--l-tag-background:var(--l-success-color-light5,#fcffe6);--l-tag-border-color:var(--l-success-color,#a0d911)}:host(.l-tag--info){--l-tag-color:var(--l-info-color,#999);--l-tag-background:var(--l-info-color-light9,#f5f5f5);--l-tag-border-color:var(--l-border-color,#dedede)}:host(.l-tag--warning){--l-tag-color:var(--l-warning-color,#f90);--l-tag-background:var(--l-warning-color-light5,#fff5e6);--l-tag-border-color:var(--l-warning-color,#f90)}.l-tag-close{cursor:pointer;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;margin-left:3px;font-size:12px;transition:color .3s,background-color .3s;display:inline-flex}.l-tag-close:hover{background-color:var(--l-tag-color,#1890ff);color:#fff}", u = class extends e {
|
|
8
7
|
static baseName = "tag";
|
|
@@ -32,7 +31,6 @@ var l = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-he
|
|
|
32
31
|
if (e) return;
|
|
33
32
|
n.remove();
|
|
34
33
|
} else e && this.root.appendChild(this.#e());
|
|
35
|
-
break;
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
render() {
|
|
@@ -66,7 +64,7 @@ var l = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-he
|
|
|
66
64
|
t || this.classList.add(`l-tag--${e}`);
|
|
67
65
|
}
|
|
68
66
|
_toggleColorStyle(e) {
|
|
69
|
-
this.rendered && (
|
|
67
|
+
this.rendered && (c(e) ? (this.style.removeProperty("--l-tag-color"), this.style.removeProperty("--l-tag-border-color"), this.style.removeProperty("--l-tag-background")) : (this.style.setProperty("--l-tag-color", e), this.style.setProperty("--l-tag-border-color", e), this.style.setProperty("--l-tag-background", s(e, 5, !0))));
|
|
70
68
|
}
|
|
71
69
|
beforeDestroy() {
|
|
72
70
|
i(this.root, "click", this.#t);
|
package/lib/theme/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../theme-
|
|
1
|
+
import { t as e } from "../theme-CLbBS-in.js";
|
|
2
2
|
export { e as default };
|
|
@@ -7,8 +7,7 @@ export default class ThemeColor extends BaseComponent<ThemeColorState> {
|
|
|
7
7
|
static baseName: string;
|
|
8
8
|
constructor();
|
|
9
9
|
render_v2(): {
|
|
10
|
-
template
|
|
11
|
-
style?: string | string[];
|
|
10
|
+
template: string;
|
|
12
11
|
};
|
|
13
12
|
afterInit(): void;
|
|
14
13
|
}
|
package/lib/theme/theme_color.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import e from "../base.js";
|
|
2
|
-
import { $one as t,
|
|
3
|
-
import { applyColorTheme as r, getColorTheme as i } from "ph-utils/theme";
|
|
2
|
+
import { $one as t, applyColorTheme as n, getColorTheme as r, on as i } from "ph-utils/browser";
|
|
4
3
|
//#region src/components/theme/theme_color.ts
|
|
5
4
|
var a = class extends e {
|
|
6
5
|
static baseName = "theme-color";
|
|
7
6
|
constructor() {
|
|
8
|
-
super(), this.version = 2, this._state = { color:
|
|
7
|
+
super(), this.version = 2, this._state = { color: r() || "#722ed1" };
|
|
9
8
|
}
|
|
10
9
|
render_v2() {
|
|
11
10
|
return { template: `<l-color-picker value="${this._state.color}"></l-color-picker>` };
|
|
12
11
|
}
|
|
13
12
|
afterInit() {
|
|
14
13
|
let e = t("l-color-picker", this.root);
|
|
15
|
-
e &&
|
|
14
|
+
e && i(e, "change", this.#e);
|
|
16
15
|
}
|
|
17
16
|
#e = async (e) => {
|
|
18
17
|
let t = e.detail;
|
|
19
|
-
this._state.color = t, await
|
|
18
|
+
this._state.color = t, await n(t), this.emit("change", { detail: t });
|
|
20
19
|
};
|
|
21
20
|
};
|
|
22
21
|
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { initAttr as t } from "./utils/index.js";
|
|
3
|
-
import { $one as n,
|
|
4
|
-
import { applyTheme as o, getTheme as s } from "ph-utils/theme";
|
|
3
|
+
import { $one as n, applyTheme as r, create as i, getTheme as a, off as o, on as s } from "ph-utils/browser";
|
|
5
4
|
//#region src/components/theme/index.less?inline
|
|
6
5
|
var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn::part(default){--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-text-color:#9ca3af;--l-btn-hover-text-color:#666;width:var(--l-form-control-height,32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){color:#fff;background-color:#000}html.dark .l-theme-btn{--l-btn-hover-text-color:#fff}", l = [
|
|
7
6
|
{
|
|
@@ -26,7 +25,7 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
|
|
|
26
25
|
theme;
|
|
27
26
|
#e;
|
|
28
27
|
connectedCallback() {
|
|
29
|
-
t(this), this.theme =
|
|
28
|
+
t(this), this.theme = a(), this.loadStyleText(c), super.connectedCallback(), this.#s();
|
|
30
29
|
}
|
|
31
30
|
disconnectedCallback() {
|
|
32
31
|
super.disconnectedCallback(), this.#c();
|
|
@@ -40,7 +39,7 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
#t() {
|
|
43
|
-
let e =
|
|
42
|
+
let e = i("l-button", { class: "l-theme-btn l-theme-inner" });
|
|
44
43
|
return this.#n(e), e;
|
|
45
44
|
}
|
|
46
45
|
#n(e) {
|
|
@@ -48,7 +47,7 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
|
|
|
48
47
|
e.innerHTML = `<l-${t}-icon></l-${t}-icon>`;
|
|
49
48
|
}
|
|
50
49
|
#r() {
|
|
51
|
-
let e =
|
|
50
|
+
let e = i("l-select-ori", { class: "l-theme-inner" });
|
|
52
51
|
return e.value = this.theme, e.innerHTML = [
|
|
53
52
|
"<option value=\"auto\">跟随系统</option>",
|
|
54
53
|
"<option value=\"light\">浅色模式</option>",
|
|
@@ -56,11 +55,11 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
|
|
|
56
55
|
].join(""), e;
|
|
57
56
|
}
|
|
58
57
|
#i() {
|
|
59
|
-
let e =
|
|
58
|
+
let e = i("l-switch", { class: "l-theme-switch l-theme-inner" });
|
|
60
59
|
return e.value = this.theme === "dark", e.innerHTML = "<l-sun-icon slot=\"unchecked-action\"></l-sun-icon><l-moon-icon slot=\"checked-action\"></l-moon-icon>", e;
|
|
61
60
|
}
|
|
62
61
|
#a() {
|
|
63
|
-
let e =
|
|
62
|
+
let e = i("l-radio-group", { class: "l-theme-inner" });
|
|
64
63
|
return e.value = this.theme, e.innerHTML = l.map((e) => {
|
|
65
64
|
let t = "";
|
|
66
65
|
return t = this.label === "icon" ? `<${e.icon}></${e.icon}>` : e.text, `<l-radio value="${e.value}" button>${t}</l-radio>`;
|
|
@@ -73,13 +72,13 @@ var c = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn
|
|
|
73
72
|
let n = e.target.value;
|
|
74
73
|
t = this.type === "switch" ? n ? "dark" : "light" : n;
|
|
75
74
|
}
|
|
76
|
-
await
|
|
75
|
+
await r(t), this.theme = t, this.type === "button" && this.#n(this.#e), this.emit("change", { detail: t });
|
|
77
76
|
};
|
|
78
77
|
#s() {
|
|
79
|
-
this.#e = n(".l-theme-inner", this.root), this.type === "button" ?
|
|
78
|
+
this.#e = n(".l-theme-inner", this.root), this.type === "button" ? s(this.#e, "click", this.#o) : s(this.#e, "change", this.#o);
|
|
80
79
|
}
|
|
81
80
|
#c() {
|
|
82
|
-
this.#e &&= (this.type === "button" ?
|
|
81
|
+
this.#e &&= (this.type === "button" ? o(this.#e, "click", this.#o) : o(this.#e, "change", this.#o), void 0);
|
|
83
82
|
}
|
|
84
83
|
};
|
|
85
84
|
//#endregion
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -35,4 +35,4 @@ export declare function setAttrs(el: HTMLElement, attrs: [string, string | undef
|
|
|
35
35
|
*/
|
|
36
36
|
export declare function kebabToCamel(attr: string): string;
|
|
37
37
|
export declare function stopSignal(fn?: SignalStop): undefined;
|
|
38
|
-
export declare function unitNumberStr(value?: string, unit?: string): string | undefined;
|
|
38
|
+
export declare function unitNumberStr(value?: string | null | undefined, unit?: string): string | null | undefined;
|
package/lib/utils/popover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as e, $$ as t, $one as n, iterate as r, off as i, on as a, shouldEventNext as o } from "ph-utils/
|
|
1
|
+
import { $ as e, $$ as t, $one as n, iterate as r, off as i, on as a, shouldEventNext as o } from "ph-utils/browser";
|
|
2
2
|
//#region src/components/utils/popover.ts
|
|
3
3
|
function s(e, t, n, r, i = 10, a = "x") {
|
|
4
4
|
let o = a === "x" ? "width" : "height", s = [
|
package/lib/utils/transition.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litos-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "基于 Web Component 的 UI 组件库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component library",
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"alien-signals": "^3.2.1",
|
|
53
53
|
"iconify-icon": "^3.0.2",
|
|
54
|
-
"ph-utils": "^
|
|
54
|
+
"ph-utils": "^1.1.0",
|
|
55
55
|
"qrcode-generator-es": "^2.1.3",
|
|
56
|
-
"shiki": "^4.3
|
|
56
|
+
"shiki": "^4.4.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^26.0
|
|
60
|
-
"less": "^4.
|
|
61
|
-
"lightningcss": "^1.
|
|
62
|
-
"oxfmt": "^0.
|
|
63
|
-
"oxlint": "^1.
|
|
64
|
-
"preact": "^10.29.
|
|
65
|
-
"typescript": "^
|
|
66
|
-
"vite": "^8.
|
|
59
|
+
"@types/node": "^26.2.0",
|
|
60
|
+
"less": "^4.9.0",
|
|
61
|
+
"lightningcss": "^1.33.0",
|
|
62
|
+
"oxfmt": "^0.64.0",
|
|
63
|
+
"oxlint": "^1.79.0",
|
|
64
|
+
"preact": "^10.29.8",
|
|
65
|
+
"typescript": "^7.0.2",
|
|
66
|
+
"vite": "^8.2.2",
|
|
67
67
|
"vitepress": "^1.6.4"
|
|
68
68
|
}
|
|
69
69
|
}
|
package/lib/button-CC5NBWtI.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
|
|
3
|
-
import { t as i } from "./animation-DStAHzod.js";
|
|
4
|
-
import { $one as a, addClass as o, formatClass as s, formatStyle as c, off as l, on as u, removeClass as d } from "ph-utils/dom";
|
|
5
|
-
import { adjust as f } from "ph-utils/color";
|
|
6
|
-
//#region src/components/button/index.less?inline
|
|
7
|
-
var p = ":host{--l-btn-padding:0 15px;--l-btn-text-color:#fff;--l-btn-hover-text-color:var(--l-btn-text-color);--l-btn-active-text-color:var(--l-btn-text-color);--l-btn-border-color:var(--l-primary-color,#722ed1);--l-btn-background:var(--l-btn-border-color);--l-btn-hover-border-color:var(--l-primary-color-light1,#9254de);--l-btn-hover-background:var(--l-btn-hover-border-color);--l-btn-active-border-color:var(--l-primary-color-dark1,#531dab);--l-btn-active-background:var(--l-btn-active-border-color);--l-btn-disabled-color:#c9c9c9;--l-btn-disabled-background:#fbfbfb;--l-btn-disabled-border-color:#e6e6e6;--l-btn-height:var(--l-form-control-height,32px);width:auto;height:var(--l-btn-height);text-indent:0;box-sizing:border-box;border-radius:var(--l-border-radius,3px);display:inline-flex}:host([block]){width:100%}:host(.l-btn-small){--l-btn-height:24px;--l-btn-padding:0 7px}:host(.l-btn-large){--l-border-radius:6px;--l-btn-height:40px;--l-btn-padding:0 15px;font-size:16px}.l-btn{cursor:pointer;box-sizing:border-box;vertical-align:middle;width:100%;padding:var(--l-btn-padding);border-radius:inherit;height:100%;color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);justify-content:center;align-items:center;gap:var(--l-btn-gap,5px);line-height:1;font-size:inherit;outline:none;transition:border-color .3s,background-color .3s,color .3s;display:inline-flex;position:relative}.l-btn:hover{border-color:var(--l-btn-hover-border-color,var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn-box-shadow:hover{box-shadow:0 4px 12px var(--l-primary-color-light4)}.l-btn:active{border-color:var(--l-btn-active-border-color,var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal,.l-btn-normal-v2{--l-btn-text-color:auto;--l-btn-background:transparent;--l-btn-border-color:#d9d9d9;--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab);--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-hover-border-color:var(--l-btn-hover-text-color);--l-btn-active-border-color:var(--l-btn-active-text-color)}.l-btn-normal-v2{--l-btn-hover-background:var(--l-primary-color-light5);--l-btn-active-background:var(--l-primary-color-light4)}.l-btn-primary{--l-btn-background:var(--l-primary-color,#722ed1);--l-btn-hover-background:var(--l-primary-color-light1,#9254de);--l-btn-active-background:var(--l-primary-color-dark1,#531dab);--l-btn-disabled-border-color:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-background:var(--l-primary-color-light2,#b37feb);--l-btn-disabled-color:#fff}.l-btn:disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn.l-btn-loading{cursor:default}.l-btn-text{--l-btn-background:transparent;--l-btn-border-color:transparent;--l-btn-hover-border-color:transparent;--l-btn-active-border-color:transparent;--l-btn-disabled-background:transparent;--l-btn-disabled-border-color:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color:var(--l-primary-color,#722ed1);--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab)}.l-btn-ghost{--l-btn-text-color:var(--l-btn-border-color);--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-hover-text-color:var(--l-btn-hover-border-color);--l-btn-active-text-color:var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-control-height,32px) / 2)}.l-btn-circle{width:var(--l-form-control-height,32px);border-radius:50%;padding:0}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background:#ffffff14;--l-btn-disabled-color:#ffffff4d;--l-btn-disabled-border-color:#ffffff4d}", m = class extends e {
|
|
8
|
-
static baseName = "button";
|
|
9
|
-
$btn;
|
|
10
|
-
constructor() {
|
|
11
|
-
super(), this.version = 2, this._state = {
|
|
12
|
-
loading: !1,
|
|
13
|
-
htmlType: "button",
|
|
14
|
-
text: !1,
|
|
15
|
-
ghost: !1,
|
|
16
|
-
disabled: !1,
|
|
17
|
-
type: "normal",
|
|
18
|
-
shape: "default",
|
|
19
|
-
loadingText: "加载中……",
|
|
20
|
-
size: "default",
|
|
21
|
-
boxShadow: "box-shadow-none"
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
get disabled() {
|
|
25
|
-
return this._state.disabled;
|
|
26
|
-
}
|
|
27
|
-
set disabled(e) {
|
|
28
|
-
this.setDisabled(e);
|
|
29
|
-
}
|
|
30
|
-
setLoading(e) {
|
|
31
|
-
this.$btn && (e ? (o(this.$btn, "l-btn-loading"), this.$btn.disabled = !0, this.$btn.innerHTML = this.loadingBody()) : (d(this.$btn, "l-btn-loading"), this.$btn.disabled = this.disabled, this.$btn.innerHTML = "<slot></slot>"));
|
|
32
|
-
}
|
|
33
|
-
setDisabled(e) {
|
|
34
|
-
this._state.disabled = e, this.$btn && (this.$btn.disabled = e);
|
|
35
|
-
}
|
|
36
|
-
static get observedAttributes() {
|
|
37
|
-
return [
|
|
38
|
-
"loading",
|
|
39
|
-
"color",
|
|
40
|
-
"text",
|
|
41
|
-
"ghost",
|
|
42
|
-
"disabled",
|
|
43
|
-
"height",
|
|
44
|
-
"html-type",
|
|
45
|
-
"type",
|
|
46
|
-
"shape",
|
|
47
|
-
"loading-text",
|
|
48
|
-
"size",
|
|
49
|
-
"box-shadow"
|
|
50
|
-
];
|
|
51
|
-
}
|
|
52
|
-
attributeChanged(e, i, a) {
|
|
53
|
-
switch (e) {
|
|
54
|
-
case "color":
|
|
55
|
-
case "shape":
|
|
56
|
-
case "type":
|
|
57
|
-
case "size":
|
|
58
|
-
this._state[e] = a;
|
|
59
|
-
break;
|
|
60
|
-
case "height":
|
|
61
|
-
this._state[e] = r(a);
|
|
62
|
-
break;
|
|
63
|
-
case "text":
|
|
64
|
-
case "ghost":
|
|
65
|
-
case "disabled":
|
|
66
|
-
case "loading":
|
|
67
|
-
this._state[e] = n(a, !1, e);
|
|
68
|
-
break;
|
|
69
|
-
case "html-type":
|
|
70
|
-
case "loading-text":
|
|
71
|
-
this._state[t(e)] = a;
|
|
72
|
-
break;
|
|
73
|
-
case "box-shadow":
|
|
74
|
-
let i = n(a, !1, "box-shadow");
|
|
75
|
-
this._state.boxShadow = `box-shadow${i ? "" : "-none"}`;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
updateDOM(e) {
|
|
80
|
-
this.$btn && (e.has("loading") && this.setLoading(this._state.loading), e.has("disabled") && this.setDisabled(this.disabled), e.has("color") && this._state.color && (this.$btn.style.cssText = this.applyColor(this._state.color, this._state.text, this._state.ghost)), (e.has("type") || e.has("shape") || e.has("box-shadow")) && (this.$btn.className = this._resetBtnClass())), e.has("height") && this._updateHeight();
|
|
81
|
-
}
|
|
82
|
-
connectedCallback() {
|
|
83
|
-
this.className = `l-btn-${this._state.size || "default"} ${this.className}`, super.connectedCallback(), this.isFormButton() && u(this, "click", this._handleClick), this._updateHeight();
|
|
84
|
-
}
|
|
85
|
-
disconnectedCallback() {
|
|
86
|
-
super.disconnectedCallback(), this.isFormButton() && l(this, "click", this._handleClick), this.$btn = void 0;
|
|
87
|
-
}
|
|
88
|
-
isFormButton() {
|
|
89
|
-
let e = this.getHtmlType();
|
|
90
|
-
return e === "submit" || e === "reset";
|
|
91
|
-
}
|
|
92
|
-
getHtmlType() {
|
|
93
|
-
return this._state.htmlType;
|
|
94
|
-
}
|
|
95
|
-
render_v2() {
|
|
96
|
-
return this._changedProperties.clear(), {
|
|
97
|
-
style: [i, p],
|
|
98
|
-
template: this.render()
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
afterInit() {
|
|
102
|
-
this.$btn ||= a(".l-btn", this.root);
|
|
103
|
-
}
|
|
104
|
-
render() {
|
|
105
|
-
let e = document.createElement("button"), t = this._state.loading, n = this._state.text, r = this._state.ghost;
|
|
106
|
-
e.className = this._resetBtnClass(), (this.disabled || t) && (e.disabled = !0), e.type = this._state.htmlType;
|
|
107
|
-
let i = this.applyColor(this._state.color || "", n, r);
|
|
108
|
-
return i && (e.style.cssText = i), t ? e.innerHTML = this.loadingBody() : e.innerHTML = "<slot></slot>", e.setAttribute("part", "default"), e;
|
|
109
|
-
}
|
|
110
|
-
loadingBody() {
|
|
111
|
-
let e = this._state.loadingText, t = ["<l-loading-icon class=\"l-rotate-anim\"></l-loading-icon>"];
|
|
112
|
-
return e ? t.push(`<span>${e}</span>`) : t.push("<slot></slot>"), t.join("");
|
|
113
|
-
}
|
|
114
|
-
applyColor(e, t = !1, n = !1) {
|
|
115
|
-
if (!e) return "";
|
|
116
|
-
let r = f(e, 1, !0), i = f(e, 3, !1);
|
|
117
|
-
return c({
|
|
118
|
-
"--l-btn-border-color": t ? "transparent" : e,
|
|
119
|
-
"--l-btn-text-color": n || t ? e : "#ffffff",
|
|
120
|
-
"--l-btn-hover-text-color": n || t ? r : "#ffffff",
|
|
121
|
-
"--l-btn-background": n || t ? "transparent" : e,
|
|
122
|
-
"--l-btn-active-text-color": n || t ? i : "#ffffff",
|
|
123
|
-
"--l-btn-hover-border-color": t ? "transparent" : r,
|
|
124
|
-
"--l-btn-hover-background": n || t ? "transparent" : r,
|
|
125
|
-
"--l-btn-active-background": n || t ? "transparent" : i,
|
|
126
|
-
"--l-btn-active-border-color": t ? "transparent" : i
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
_updateHeight() {
|
|
130
|
-
this._state.height ? this.style.setProperty("--l-btn-height", this._state.height) : this.style.removeProperty("--l-btn-height");
|
|
131
|
-
}
|
|
132
|
-
_resetBtnClass() {
|
|
133
|
-
return s([
|
|
134
|
-
"l-btn",
|
|
135
|
-
`l-btn-${this._state.type}`,
|
|
136
|
-
`l-btn-${this._state.shape}`,
|
|
137
|
-
`l-btn-${this._state.boxShadow}`,
|
|
138
|
-
this._state.ghost ? "l-btn-ghost" : "",
|
|
139
|
-
this._state.text ? "l-btn-text" : "",
|
|
140
|
-
this._state.loading ? "l-btn-loading" : ""
|
|
141
|
-
]);
|
|
142
|
-
}
|
|
143
|
-
_handleClick = () => {
|
|
144
|
-
(this._state.htmlType === "reset" || this._state.htmlType === "submit") && this.emit("form-action", {
|
|
145
|
-
bubbles: !0,
|
|
146
|
-
composed: !0,
|
|
147
|
-
detail: this._state.htmlType
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
//#endregion
|
|
152
|
-
export { m as t };
|