litos-ui 0.20.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.d.ts +3 -2
- package/lib/base.js +7 -7
- 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/card/index.d.ts +23 -0
- package/lib/card/index.js +2 -0
- package/lib/card-3DM-lJQV.js +63 -0
- package/lib/date_picker/index.d.ts +2 -2
- 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 +45 -47
- package/lib/{dialog_container-Bq6HsKey.js → dialog_container-BNPQ9n0V.js} +32 -14
- package/lib/form/form_item.d.ts +2 -2
- package/lib/form/form_item.js +1 -1
- package/lib/{form_item-CFIkfH29.js → form_item-BqPMRABd.js} +5 -5
- package/lib/icon/base.d.ts +2 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +70 -68
- package/lib/input/index.d.ts +2 -2
- package/lib/list/index.js +1 -1
- package/lib/{list-Dg5u5dgr.js → list-MG8PRzos.js} +2 -2
- package/lib/mask-Ox6CoyFB.js +5 -0
- package/lib/menu/index.d.ts +2 -2
- package/lib/modal/index.d.ts +2 -2
- package/lib/modal/index.js +1 -1
- package/lib/modal/modal_box.js +12 -12
- package/lib/{modal-iwxqmAqW.js → modal-Cwi3qlEf.js} +36 -32
- package/lib/pagination/index.d.ts +2 -2
- package/lib/qrcode/index.d.ts +2 -2
- package/lib/select/index.d.ts +2 -2
- package/lib/select_ori/index.d.ts +2 -2
- 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/theme/theme_color.d.ts +1 -2
- package/package.json +1 -1
- package/lib/button-CDYYpQu6.js +0 -151
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import e from "./base.js";
|
|
2
2
|
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { t as i } from "./mask-Ox6CoyFB.js";
|
|
4
|
+
import { $$ as a, $one as o, off as s, on as c, shouldEventNext as l, transition as u } from "ph-utils/browser";
|
|
4
5
|
//#region src/components/modal/index.less?inline
|
|
5
|
-
var
|
|
6
|
+
var d = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex,100)}.l-modal-wrapper{width:100%;height:100%;z-index:calc(var(--l-modal-zindex,100) + 1);position:fixed;top:0;left:0}.l-modal{--l-modal-translate:translate3d(0, 80px, 0);border-radius:var(--l-modal-border-radius,5px);width:var(--l-modal-width,27%);opacity:1;transform:var(--l-modal-translate) scale3d(1, 1, 1);background-color:#fff;margin:auto;transition:opacity .3s,transform .3s;position:relative;box-shadow:0 0 8px #0000001a}.l-modal-header{padding:var(--l-modal-header-padding,10px);border-bottom:1px solid var(--l-modal-line-color,#0000000f);align-items:center;gap:5px;font-size:16px;font-weight:600;display:flex}.l-modal-footer{padding:var(--l-modal-footer-padding,10px);border-top:1px solid var(--l-modal-line-color,#0000000f);justify-content:flex-end;gap:10px;display:flex}.l-modal-container{padding:var(--l-modal-container-padding,15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height:auto;position:absolute}.l-modal-close1{top:8px;right:5px}.l-modal-close1::part(default){border:none;width:auto;height:auto;padding:5px;font-size:16px}.l-modal-close2{top:-10px;right:-10px}.l-modal-close2::part(default){background-color:#fff;width:20px;height:20px;padding:0}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translate(0,0)scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:#0000;justify-content:center;padding:20px 10px 5px;display:flex}.l-modal--mobile .l-modal-container{--l-modal-container-padding:5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{text-align:center;justify-content:stretch;align-items:stretch;gap:0;height:50px;padding:0;display:flex}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color,#0000000f)}.l-modal--middle{--l-modal-translate:translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate:translate3d(0, -100%, 0);border-bottom-right-radius:0;border-bottom-left-radius:0;width:100%;top:100%}@media screen and (width<=768px){:host{--l-modal-width:80%}}", f = class extends e {
|
|
6
7
|
static baseName = "modal";
|
|
7
8
|
_bodyOverflow = "";
|
|
8
9
|
constructor() {
|
|
@@ -78,7 +79,7 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
78
79
|
}
|
|
79
80
|
updateDOM(e) {
|
|
80
81
|
if (e.has("show") && (this._state.show ? this.#e() : this.#t()), e.has("width") && this._setWidth(), e.has("confirm-loading")) {
|
|
81
|
-
let e =
|
|
82
|
+
let e = o("l-button[modal-action=\"ok\"]", this.root);
|
|
82
83
|
e && e.setAttribute("loading", this._state.confirmLoading.toString());
|
|
83
84
|
}
|
|
84
85
|
e.has("z-index") && this._setZIndex();
|
|
@@ -87,7 +88,10 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
87
88
|
this._setWidth(), this._setZIndex(), this._state.show && this.#e();
|
|
88
89
|
}
|
|
89
90
|
render_v2() {
|
|
90
|
-
return {
|
|
91
|
+
return {
|
|
92
|
+
style: [d],
|
|
93
|
+
styleSheets: [i]
|
|
94
|
+
};
|
|
91
95
|
}
|
|
92
96
|
_setZIndex() {
|
|
93
97
|
this._state.zIndex ? this.style.setProperty("--l-modal-zindex", this._state.zIndex) : this.style.removeProperty("--l-modal-zindex");
|
|
@@ -97,22 +101,22 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
97
101
|
}
|
|
98
102
|
#e() {
|
|
99
103
|
this._bodyOverflow = getComputedStyle(document.body).overflow, this.classList.add("open"), document.body.style.overflow = "hidden";
|
|
100
|
-
let e =
|
|
104
|
+
let e = o(".l-modal-wrapper", this.root);
|
|
101
105
|
if (e) {
|
|
102
|
-
let e =
|
|
103
|
-
e &&
|
|
104
|
-
let t =
|
|
105
|
-
|
|
106
|
+
let e = o(".l-mask", this.root);
|
|
107
|
+
e && u(e, "mask-transition");
|
|
108
|
+
let t = o(".l-modal", this.root);
|
|
109
|
+
u(t, "modal-transition");
|
|
106
110
|
} else {
|
|
107
111
|
let t = document.createDocumentFragment(), n = null;
|
|
108
|
-
this._state.mask && (n =
|
|
112
|
+
this._state.mask && (n = a("div", {
|
|
109
113
|
class: "l-mask l-modal-mask",
|
|
110
114
|
part: "mask"
|
|
111
|
-
}), t.appendChild(n)), e =
|
|
115
|
+
}), t.appendChild(n)), e = a("div", {
|
|
112
116
|
class: "l-modal-wrapper",
|
|
113
117
|
part: "wrapper"
|
|
114
118
|
});
|
|
115
|
-
let r =
|
|
119
|
+
let r = a("div", {
|
|
116
120
|
class: [
|
|
117
121
|
"l-modal",
|
|
118
122
|
`l-modal--${this._state.mobile ? "mobile" : "pc"}`,
|
|
@@ -121,39 +125,39 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
121
125
|
part: "default"
|
|
122
126
|
});
|
|
123
127
|
if (r.setAttribute("modal-action", "modal"), this._state.close !== 0) {
|
|
124
|
-
let e =
|
|
128
|
+
let e = a("l-button", {
|
|
125
129
|
shape: "circle",
|
|
126
130
|
type: "normal",
|
|
127
131
|
class: `l-btn-modal-close l-modal-close${this._state.close}`,
|
|
128
132
|
"modal-action": "close",
|
|
129
133
|
part: "close-btn"
|
|
130
|
-
}), t =
|
|
134
|
+
}), t = a("l-close-icon");
|
|
131
135
|
e.appendChild(t), r.appendChild(e);
|
|
132
136
|
}
|
|
133
137
|
if (this._state.header) {
|
|
134
|
-
let e =
|
|
138
|
+
let e = a("header", {
|
|
135
139
|
class: "l-modal-header",
|
|
136
140
|
part: "header"
|
|
137
|
-
}), t =
|
|
141
|
+
}), t = a("slot", { name: "header" });
|
|
138
142
|
t.textContent = this._state.headerTitle || "", e.appendChild(t), r.appendChild(e);
|
|
139
143
|
}
|
|
140
|
-
let
|
|
144
|
+
let i = a("div", {
|
|
141
145
|
class: "l-modal-container",
|
|
142
146
|
part: "container"
|
|
143
|
-
}), o =
|
|
144
|
-
if (
|
|
145
|
-
let e =
|
|
147
|
+
}), o = a("slot");
|
|
148
|
+
if (i.appendChild(o), r.appendChild(i), this._state.footer) {
|
|
149
|
+
let e = a("footer", {
|
|
146
150
|
class: "l-modal-footer",
|
|
147
151
|
part: "footer"
|
|
148
|
-
}), t =
|
|
152
|
+
}), t = a("slot", { name: "footer" });
|
|
149
153
|
if (this._state.cancel) {
|
|
150
|
-
let e =
|
|
154
|
+
let e = a("l-button", {
|
|
151
155
|
class: "l-modal-footer-btn",
|
|
152
156
|
text: this._state.mobile
|
|
153
157
|
});
|
|
154
158
|
e.textContent = this._state.cancelText, e.setAttribute("modal-action", "cancel"), t.appendChild(e);
|
|
155
159
|
}
|
|
156
|
-
let n =
|
|
160
|
+
let n = a("l-button", {
|
|
157
161
|
type: "primary",
|
|
158
162
|
class: "l-modal-footer-btn",
|
|
159
163
|
loading: this._state.confirmLoading,
|
|
@@ -161,29 +165,29 @@ var u = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var
|
|
|
161
165
|
});
|
|
162
166
|
n.textContent = this._state.okText, n.setAttribute("modal-action", "ok"), t.appendChild(n), e.appendChild(t), r.appendChild(e);
|
|
163
167
|
}
|
|
164
|
-
e.appendChild(r), e.setAttribute("role", "dialog"), e.setAttribute("modal-action", "mask"),
|
|
168
|
+
e.appendChild(r), e.setAttribute("role", "dialog"), e.setAttribute("modal-action", "mask"), c(e, "click", this.#r), t.appendChild(e), this.appendToRoot(t), u(r, "modal-transition"), n && u(n, "mask-transition");
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
#t() {
|
|
168
172
|
document.body.style.setProperty("overflow", this._bodyOverflow);
|
|
169
|
-
let e =
|
|
170
|
-
|
|
173
|
+
let e = o(".l-modal", this.root);
|
|
174
|
+
u(e, "modal-transition", "leave", () => {
|
|
171
175
|
this._state.destroyOnClose && this.#n(), this.classList.remove("open"), this.emit("close");
|
|
172
176
|
});
|
|
173
|
-
let t =
|
|
174
|
-
t &&
|
|
177
|
+
let t = o(".l-mask", this.root);
|
|
178
|
+
t && u(t, "mask-transition", "leave");
|
|
175
179
|
}
|
|
176
180
|
disconnectedCallback() {
|
|
177
181
|
this.#n(), super.disconnectedCallback();
|
|
178
182
|
}
|
|
179
183
|
#n() {
|
|
180
|
-
let e =
|
|
181
|
-
e && (
|
|
182
|
-
let t =
|
|
184
|
+
let e = o(".l-modal-wrapper", this.root);
|
|
185
|
+
e && (s(e, "click", this.#r), this.root.removeChild(e));
|
|
186
|
+
let t = o(".l-mask", this.root);
|
|
183
187
|
t && this.root.removeChild(t);
|
|
184
188
|
}
|
|
185
189
|
#r = (e) => {
|
|
186
|
-
let [t, n] =
|
|
190
|
+
let [t, n] = l(e, "modal-action", this.root);
|
|
187
191
|
if (t) {
|
|
188
192
|
let e = "";
|
|
189
193
|
this._state.maskClosable && n === "mask" || n === "cancel" || n === "close" ? e = "cancel" : n === "ok" && (e = "ok"), e && this.dispatchEvent(new CustomEvent(e, { detail: { action: n } }));
|
|
@@ -25,8 +25,8 @@ export default class Pagination extends BaseComponent<PaginationProps> {
|
|
|
25
25
|
rerender(): void;
|
|
26
26
|
render(): string;
|
|
27
27
|
render_v2(): {
|
|
28
|
-
template
|
|
29
|
-
style
|
|
28
|
+
template: string;
|
|
29
|
+
style: string;
|
|
30
30
|
};
|
|
31
31
|
afterInit(): void;
|
|
32
32
|
beforeDestroy(): void;
|
package/lib/qrcode/index.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export default class Qrcode extends BaseComponent<QrcodeState> {
|
|
|
23
23
|
afterInit(): void;
|
|
24
24
|
beforeDestroy(): void;
|
|
25
25
|
render_v2(): {
|
|
26
|
-
template
|
|
27
|
-
style
|
|
26
|
+
template: string;
|
|
27
|
+
style: string;
|
|
28
28
|
};
|
|
29
29
|
render(): string;
|
|
30
30
|
}
|
package/lib/select/index.d.ts
CHANGED
|
@@ -75,8 +75,8 @@ export default class Select extends FormInner<SelectState> {
|
|
|
75
75
|
afterInit(): void;
|
|
76
76
|
beforeDestroy(): void;
|
|
77
77
|
render_v2(): {
|
|
78
|
-
template
|
|
79
|
-
style
|
|
78
|
+
template: DocumentFragment;
|
|
79
|
+
style: string[];
|
|
80
80
|
};
|
|
81
81
|
render(): DocumentFragment;
|
|
82
82
|
protected disabledChange(): void;
|
|
@@ -10,8 +10,8 @@ export default class SelectOri extends FormInner {
|
|
|
10
10
|
connectedCallback(): void;
|
|
11
11
|
disconnectedCallback(): void;
|
|
12
12
|
render_v2(): {
|
|
13
|
-
template
|
|
14
|
-
style
|
|
13
|
+
template: string;
|
|
14
|
+
style: string[];
|
|
15
15
|
};
|
|
16
16
|
render(): string;
|
|
17
17
|
protected disabledChange(): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
//#region src/components/button/index.less?inline
|
|
2
|
+
var e = ":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}", t = new CSSStyleSheet();
|
|
3
|
+
t.replaceSync(e);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { t };
|
|
@@ -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/package.json
CHANGED
package/lib/button-CDYYpQu6.js
DELETED
|
@@ -1,151 +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/browser";
|
|
5
|
-
import { adjust as f } from "ph-utils";
|
|
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
|
-
}
|
|
77
|
-
}
|
|
78
|
-
updateDOM(e) {
|
|
79
|
-
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();
|
|
80
|
-
}
|
|
81
|
-
connectedCallback() {
|
|
82
|
-
this.className = `l-btn-${this._state.size || "default"} ${this.className}`, super.connectedCallback(), this.isFormButton() && u(this, "click", this._handleClick), this._updateHeight();
|
|
83
|
-
}
|
|
84
|
-
disconnectedCallback() {
|
|
85
|
-
super.disconnectedCallback(), this.isFormButton() && l(this, "click", this._handleClick), this.$btn = void 0;
|
|
86
|
-
}
|
|
87
|
-
isFormButton() {
|
|
88
|
-
let e = this.getHtmlType();
|
|
89
|
-
return e === "submit" || e === "reset";
|
|
90
|
-
}
|
|
91
|
-
getHtmlType() {
|
|
92
|
-
return this._state.htmlType;
|
|
93
|
-
}
|
|
94
|
-
render_v2() {
|
|
95
|
-
return this._changedProperties.clear(), {
|
|
96
|
-
style: [i, p],
|
|
97
|
-
template: this.render()
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
afterInit() {
|
|
101
|
-
this.$btn ||= a(".l-btn", this.root);
|
|
102
|
-
}
|
|
103
|
-
render() {
|
|
104
|
-
let e = document.createElement("button"), t = this._state.loading, n = this._state.text, r = this._state.ghost;
|
|
105
|
-
e.className = this._resetBtnClass(), (this.disabled || t) && (e.disabled = !0), e.type = this._state.htmlType;
|
|
106
|
-
let i = this.applyColor(this._state.color || "", n, r);
|
|
107
|
-
return i && (e.style.cssText = i), e.innerHTML = t ? this.loadingBody() : "<slot></slot>", e.setAttribute("part", "default"), e;
|
|
108
|
-
}
|
|
109
|
-
loadingBody() {
|
|
110
|
-
let e = this._state.loadingText, t = ["<l-loading-icon class=\"l-rotate-anim\"></l-loading-icon>"];
|
|
111
|
-
return e ? t.push(`<span>${e}</span>`) : t.push("<slot></slot>"), t.join("");
|
|
112
|
-
}
|
|
113
|
-
applyColor(e, t = !1, n = !1) {
|
|
114
|
-
if (!e) return "";
|
|
115
|
-
let r = f(e, 1, !0), i = f(e, 3, !1);
|
|
116
|
-
return c({
|
|
117
|
-
"--l-btn-border-color": t ? "transparent" : e,
|
|
118
|
-
"--l-btn-text-color": n || t ? e : "#ffffff",
|
|
119
|
-
"--l-btn-hover-text-color": n || t ? r : "#ffffff",
|
|
120
|
-
"--l-btn-background": n || t ? "transparent" : e,
|
|
121
|
-
"--l-btn-active-text-color": n || t ? i : "#ffffff",
|
|
122
|
-
"--l-btn-hover-border-color": t ? "transparent" : r,
|
|
123
|
-
"--l-btn-hover-background": n || t ? "transparent" : r,
|
|
124
|
-
"--l-btn-active-background": n || t ? "transparent" : i,
|
|
125
|
-
"--l-btn-active-border-color": t ? "transparent" : i
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
_updateHeight() {
|
|
129
|
-
this._state.height ? this.style.setProperty("--l-btn-height", this._state.height) : this.style.removeProperty("--l-btn-height");
|
|
130
|
-
}
|
|
131
|
-
_resetBtnClass() {
|
|
132
|
-
return s([
|
|
133
|
-
"l-btn",
|
|
134
|
-
`l-btn-${this._state.type}`,
|
|
135
|
-
`l-btn-${this._state.shape}`,
|
|
136
|
-
`l-btn-${this._state.boxShadow}`,
|
|
137
|
-
this._state.ghost ? "l-btn-ghost" : "",
|
|
138
|
-
this._state.text ? "l-btn-text" : "",
|
|
139
|
-
this._state.loading ? "l-btn-loading" : ""
|
|
140
|
-
]);
|
|
141
|
-
}
|
|
142
|
-
_handleClick = () => {
|
|
143
|
-
(this._state.htmlType === "reset" || this._state.htmlType === "submit") && this.emit("form-action", {
|
|
144
|
-
bubbles: !0,
|
|
145
|
-
composed: !0,
|
|
146
|
-
detail: this._state.htmlType
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
//#endregion
|
|
151
|
-
export { m as t };
|