litos-ui 0.17.5 → 0.18.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-CTt9qgA7.js +4 -0
- package/lib/base-Dm0WS1pK.js +62 -0
- package/lib/base.js +111 -147
- package/lib/button/index.d.ts +8 -3
- package/lib/button/index.js +2 -137
- package/lib/button-CC5PmAb1.js +146 -0
- package/lib/calendar/index.d.ts +10 -5
- package/lib/calendar/index.js +2 -123
- package/lib/calendar-GpYHNmXG.js +149 -0
- package/lib/carousel/index.js +2 -280
- package/lib/carousel/item.js +2 -15
- package/lib/carousel-dT3FJPQo.js +272 -0
- package/lib/check/checkbox.js +2 -18
- package/lib/check/checkbox_group.js +6 -6
- package/lib/check/radio.js +2 -15
- package/lib/check/radio_group.js +9 -9
- package/lib/check-B0XraJvb.js +73 -0
- package/lib/check-CvGaONEx.js +117 -0
- package/lib/checkbox-DbWsmAaL.js +16 -0
- package/lib/collapse/index.d.ts +18 -11
- package/lib/collapse/index.js +2 -88
- package/lib/collapse/item.d.ts +28 -9
- package/lib/collapse/item.js +2 -115
- package/lib/collapse/types.d.ts +7 -0
- package/lib/collapse-C3IRHLeg.js +104 -0
- package/lib/color_picker/index.js +2 -42
- package/lib/color_picker-D0brKFm-.js +41 -0
- package/lib/date_picker/index.d.ts +23 -0
- package/lib/date_picker/index.js +3 -0
- package/lib/date_picker-DQGoiN8v.js +103 -0
- package/lib/date_picker_ori/index.js +2 -129
- package/lib/date_picker_ori-aRuSSi9D.js +122 -0
- package/lib/description_panel/index.js +2 -66
- package/lib/description_panel-BY2yljeC.js +57 -0
- package/lib/dialog/dialog_container.js +2 -131
- package/lib/dialog/index.js +67 -85
- package/lib/dialog_container-DcN87wj0.js +126 -0
- package/lib/esm-sVEoAVPu.js +244 -0
- package/lib/form/form_item.d.ts +1 -0
- package/lib/form/form_item.js +2 -136
- package/lib/form/index.js +2 -147
- package/lib/form-DdU0yK0k.js +154 -0
- package/lib/form_inner-DR9tyB_r.js +117 -0
- package/lib/form_item-Bv-YafZK.js +137 -0
- package/lib/icon/arrow_down.js +12 -12
- package/lib/icon/arrow_left.js +9 -9
- package/lib/icon/arrow_right.js +9 -9
- package/lib/icon/arrow_up.js +12 -12
- package/lib/icon/base.d.ts +16 -2
- package/lib/icon/base.js +2 -38
- package/lib/icon/calendar.d.ts +5 -0
- package/lib/icon/calendar.js +10 -0
- package/lib/icon/caret_bottom.js +9 -9
- package/lib/icon/caret_top.js +9 -9
- package/lib/icon/close.js +9 -9
- package/lib/icon/close_filled.js +12 -12
- package/lib/icon/d_arrow_left.js +12 -12
- package/lib/icon/d_arrow_right.js +12 -12
- package/lib/icon/font_icon.d.ts +2 -3
- package/lib/icon/font_icon.js +35 -39
- package/lib/icon/info.js +12 -12
- package/lib/icon/loading.js +9 -9
- package/lib/icon/moon.js +12 -12
- package/lib/icon/more.js +12 -12
- package/lib/icon/reduction.js +12 -12
- package/lib/icon/refresh.d.ts +5 -0
- package/lib/icon/refresh.js +10 -0
- package/lib/icon/refresh_left.js +12 -12
- package/lib/icon/refresh_right.js +9 -9
- package/lib/icon/search.js +9 -9
- package/lib/icon/select.js +12 -12
- package/lib/icon/sort.js +9 -9
- package/lib/icon/success.js +12 -12
- package/lib/icon/sun.js +12 -12
- package/lib/icon/theme_default.js +12 -12
- package/lib/icon/warn.js +12 -12
- package/lib/icon/zoom_in.js +12 -12
- package/lib/icon/zoom_out.js +12 -12
- package/lib/image/image_preview.js +2 -104
- package/lib/image/index.js +2 -176
- package/lib/image-COPKk8Jm.js +162 -0
- package/lib/image_preview-CYEup07F.js +92 -0
- package/lib/index.d.ts +5 -81
- package/lib/index.js +78 -169
- package/lib/input/index.d.ts +6 -2
- package/lib/input/index.js +188 -203
- package/lib/input-DjKxcxry.js +4 -0
- package/lib/input_inner-BKJg9n9A.js +4 -0
- package/lib/item-B7Elh5xE.js +14 -0
- package/lib/item-CvoJt3wp.js +60 -0
- package/lib/item-DRsOV_Tc.js +119 -0
- package/lib/list/index.js +2 -58
- package/lib/list-CU7vHS6s.js +51 -0
- package/lib/loading/index.d.ts +3 -2
- package/lib/loading/index.js +109 -127
- package/lib/mask/index.js +2 -105
- package/lib/mask-CEznzwji.js +112 -0
- package/lib/md_input/index.js +2 -60
- package/lib/md_input-DSQx5TMW.js +58 -0
- package/lib/menu/index.d.ts +30 -13
- package/lib/menu/index.js +2 -105
- package/lib/menu/types.d.ts +6 -0
- package/lib/menu/types.js +0 -0
- package/lib/menu-CzV6lOlw.js +224 -0
- package/lib/message/index.js +67 -60
- package/lib/modal/index.js +2 -196
- package/lib/modal/modal_box.js +87 -86
- package/lib/modal-DWyWrN-D.js +192 -0
- package/lib/page_header/index.js +2 -109
- package/lib/page_header-BJkEstRw.js +101 -0
- package/lib/pagination/index.js +2 -248
- package/lib/pagination-5t7AOeFV.js +210 -0
- package/lib/polygon/index.js +2 -27
- package/lib/polygon-C4Ow2lxi.js +20 -0
- package/lib/qrcode/index.d.ts +13 -4
- package/lib/qrcode/index.js +2 -57
- package/lib/qrcode-BKG2MibP.js +64 -0
- package/lib/radio-2mNSYujz.js +13 -0
- package/lib/select/index.js +3 -401
- package/lib/select-CAgggYh7.js +326 -0
- package/lib/select_ori/index.js +47 -50
- package/lib/space/index.js +2 -35
- package/lib/space-Bv-p0DL8.js +38 -0
- package/lib/switch/index.js +2 -50
- package/lib/switch-BaVBi5Ip.js +48 -0
- package/lib/tabbar/index.js +2 -109
- package/lib/tabbar/item.js +2 -58
- package/lib/tabbar-CI1xSj1G.js +96 -0
- package/lib/table/index.js +2 -269
- package/lib/table-DfL2hFqA.js +234 -0
- package/lib/tabs/index.js +38 -42
- package/lib/tag/index.js +2 -72
- package/lib/tag-72DwCkvq.js +76 -0
- package/lib/theme/index.js +2 -89
- package/lib/theme/theme_color.js +22 -26
- package/lib/theme-BRTI2-Yk.js +83 -0
- package/lib/utils/clickoutside.js +18 -18
- package/lib/utils/context_provide.js +21 -21
- package/lib/utils/event.js +13 -18
- package/lib/utils/index.js +55 -58
- package/lib/utils/popover.d.ts +4 -1
- package/lib/utils/popover.js +276 -352
- package/lib/utils/transition.js +33 -31
- package/package.json +14 -14
- package/styles/container.css +4 -0
- package/styles/datepicker.css +55 -0
- package/styles/popover.css +14 -1
- package/lib/animation-DttknHkX.js +0 -4
- package/lib/calendar/langs.js +0 -8
- package/lib/carousel/timer.js +0 -19
- package/lib/check/check.js +0 -118
- package/lib/check/index.js +0 -68
- package/lib/check-CksURvTv.js +0 -4
- package/lib/form/form_inner.js +0 -125
- package/lib/form/types.js +0 -1
- package/lib/index-CrMiSe0x.js +0 -249
- package/lib/index-DY6m9Wbe.js +0 -4
- package/lib/litos-ui.css +0 -1
- package/lib/menu/menu_item.d.ts +0 -6
- package/lib/menu/menu_item.js +0 -21
- package/lib/menu/sub_menu.d.ts +0 -15
- package/lib/menu/sub_menu.js +0 -83
- package/lib/table/types.js +0 -1
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { parseAttrValue as t } from "./utils/index.js";
|
|
3
|
+
import { $ as n, $$ as r, $one as i, getAttr as a, iterate as o, off as s, on as c, shouldEventNext as l } from "ph-utils/dom";
|
|
4
|
+
import { debounce as u } from "ph-utils/web";
|
|
5
|
+
//#region src/components/carousel/index.less?inline
|
|
6
|
+
var d = ":host{box-sizing:border-box;width:100%;height:180px;margin:0 auto;display:block;position:relative;overflow:hidden}.container{box-sizing:border-box;min-width:900%;height:100%;display:flex;position:relative}.nav-button{cursor:pointer;z-index:20;color:#fff;background-color:#292d3d4d;border:none;border-radius:50%;outline:none;justify-content:center;align-items:center;width:30px;height:30px;margin:0;padding:0;font-size:16px;transition:background-color .3s;display:flex;position:absolute;top:50%;transform:translateY(-50%)}.nav-button:hover{background-color:#292d3d66}.nav-button:active{background-color:#292d3d80}.nav-prev{left:20px}.nav-next{right:20px}.pagination{z-index:2;justify-content:center;align-items:center;gap:8px;width:100%;display:flex;position:absolute;bottom:10px;left:0}.bullet{cursor:pointer;background-color:#0000004d;border-radius:50%;width:8px;height:8px;transition:background-color .3s;display:inline-block}.bullet.active{background-color:var(--l-primary-color,#722ed1)}";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/components/carousel/timer.ts
|
|
9
|
+
function f(e, t = 3e3) {
|
|
10
|
+
let n = 0, r = !1, i = null;
|
|
11
|
+
function a() {
|
|
12
|
+
r || (r = !0, n = 0, i = requestAnimationFrame(s));
|
|
13
|
+
}
|
|
14
|
+
function o() {
|
|
15
|
+
r = !1, i &&= (cancelAnimationFrame(i), null);
|
|
16
|
+
}
|
|
17
|
+
function s(a) {
|
|
18
|
+
r && (n ||= a, a - n >= t && (e(), n = a), i = requestAnimationFrame(s));
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
start: a,
|
|
22
|
+
stop: o
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/components/carousel/index.ts
|
|
27
|
+
var p = class extends e {
|
|
28
|
+
static baseName = "carousel";
|
|
29
|
+
arrows = "hover";
|
|
30
|
+
currentIndex = 0;
|
|
31
|
+
allIndex = -1;
|
|
32
|
+
#e = 0;
|
|
33
|
+
loop = !0;
|
|
34
|
+
observer;
|
|
35
|
+
autoplay = !1;
|
|
36
|
+
#t = void 0;
|
|
37
|
+
#n = 0;
|
|
38
|
+
#r = !1;
|
|
39
|
+
#i = 0;
|
|
40
|
+
#a = 0;
|
|
41
|
+
#o;
|
|
42
|
+
static get observedAttributes() {
|
|
43
|
+
return [
|
|
44
|
+
"arrows",
|
|
45
|
+
"loop",
|
|
46
|
+
"current-index",
|
|
47
|
+
"autoplay"
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
attributeChangedCallback(e, n, r) {
|
|
51
|
+
switch (e) {
|
|
52
|
+
case "arrows":
|
|
53
|
+
let e = t(r, "hover");
|
|
54
|
+
if (e !== this.arrows) {
|
|
55
|
+
this.arrows = e;
|
|
56
|
+
let t = document.createDocumentFragment();
|
|
57
|
+
this.renderArrows(t), this.root.appendChild(t);
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case "loop":
|
|
61
|
+
this.loop = t(r, !1, "loop");
|
|
62
|
+
break;
|
|
63
|
+
case "current-index":
|
|
64
|
+
let n = t(r, 0);
|
|
65
|
+
n !== this.currentIndex && this.#h(this.loop ? n + 1 : n);
|
|
66
|
+
break;
|
|
67
|
+
case "autoplay":
|
|
68
|
+
let i = t(r, !1, "autoplay");
|
|
69
|
+
i !== this.autoplay && (this.autoplay = i, this.#t && (i ? this.#t.start() : this.#t.stop()));
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
this.loadStyleText(d), this.style.setProperty("--carousel-width", `${Math.floor(this.clientWidth)}px`);
|
|
75
|
+
let e = a(this, "height");
|
|
76
|
+
e && this.style.setProperty("height", `${e}px`), this.#d(), super.connectedCallback();
|
|
77
|
+
}
|
|
78
|
+
afterInit() {
|
|
79
|
+
this.setAttribute("data-page", "__stop__"), c(this.root, "click", this.#p), this.#c(), this.#t = f(() => {
|
|
80
|
+
this.#m("next");
|
|
81
|
+
}), this.autoplay && this.#t.start(), this.#o = i(".container", this.root), c(this.#o, "pointerdown", this.#b), c(this.#o, "pointerup", this.#S), c(this.#o, "pointermove", this.#x), c(this.#o, "pointercancel", this.#w), c(this.#o, "pointerleave", this.#w);
|
|
82
|
+
}
|
|
83
|
+
beforeDestroy() {
|
|
84
|
+
s(this, "mouseenter", this.#g), s(this, "mouseleave", this.#_), s(this.root, "click", this.#p), s(this.#o, "pointerdown", this.#b), s(this.#o, "pointerup", this.#S), s(this.#o, "pointermove", this.#x), s(this.#o, "pointercancel", this.#w), s(this.#o, "pointerleave", this.#w), this.#o = void 0, this.#l(!0), this.#t.stop(), this.#t = void 0;
|
|
85
|
+
}
|
|
86
|
+
render() {
|
|
87
|
+
let e = document.createDocumentFragment(), t = "";
|
|
88
|
+
if (this.allIndex > 0) {
|
|
89
|
+
let e = this.loop ? this.currentIndex + 1 : this.currentIndex, n = Math.floor(e * this.clientWidth * -1);
|
|
90
|
+
t = `transform:translateX(${n}px);`;
|
|
91
|
+
let r = Math.floor(this.clientWidth * (this.allIndex + 3));
|
|
92
|
+
t += `min-width:${r}px;`, this.#e = n;
|
|
93
|
+
}
|
|
94
|
+
let n = r("div", {
|
|
95
|
+
class: "container",
|
|
96
|
+
style: t,
|
|
97
|
+
"data-container": "1"
|
|
98
|
+
});
|
|
99
|
+
n.appendChild(r("slot")), e.appendChild(n), this.renderArrows(e);
|
|
100
|
+
let i = r("div", {
|
|
101
|
+
class: "pagination",
|
|
102
|
+
part: "pagination"
|
|
103
|
+
});
|
|
104
|
+
return this.allIndex >= 0 && i.replaceChildren(this.#s()), e.appendChild(i), e;
|
|
105
|
+
}
|
|
106
|
+
renderArrows(e) {
|
|
107
|
+
if (this.arrows !== "never") this.renderNavigationButton("prev", e), this.renderNavigationButton("next", e), this.arrows === "hover" && (c(this, "mouseenter", this.#g), c(this, "mouseleave", this.#_));
|
|
108
|
+
else {
|
|
109
|
+
s(this, "mouseenter", this.#g), s(this, "mouseleave", this.#_);
|
|
110
|
+
let e = n(".nav-button", this.root);
|
|
111
|
+
e.length && o(e, (e) => {
|
|
112
|
+
e.remove();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
#s() {
|
|
117
|
+
let e = document.createDocumentFragment();
|
|
118
|
+
for (let t = 0; t <= this.allIndex; t++) e.appendChild(r("div", {
|
|
119
|
+
class: ["bullet", t === this.currentIndex ? "active" : ""],
|
|
120
|
+
"aria-label": `第 ${t + 1} 页`,
|
|
121
|
+
"data-page": `${t}`,
|
|
122
|
+
id: `bullet-${t}`
|
|
123
|
+
}));
|
|
124
|
+
return e;
|
|
125
|
+
}
|
|
126
|
+
renderNavigationButton(e = "prev", t) {
|
|
127
|
+
let n = i(`.nav-${e}`, this.root);
|
|
128
|
+
if (n == null) {
|
|
129
|
+
let i = e === "prev" ? "left" : "right";
|
|
130
|
+
n = r("button", {
|
|
131
|
+
class: `nav-button nav-${e}`,
|
|
132
|
+
type: "button",
|
|
133
|
+
innerHTML: `<l-arrow-${i}-icon></l-arrow-${i}-icon>`,
|
|
134
|
+
"aria-label": e,
|
|
135
|
+
"data-page": e
|
|
136
|
+
}), t.appendChild(n);
|
|
137
|
+
}
|
|
138
|
+
this.arrows === "always" ? n.style.display = "flex" : n.style.display = "none";
|
|
139
|
+
}
|
|
140
|
+
#c() {
|
|
141
|
+
this.observer ??= new MutationObserver(this.#f), this.observer.observe(this, { childList: !0 });
|
|
142
|
+
}
|
|
143
|
+
#l(e = !1) {
|
|
144
|
+
this.observer && (this.observer.disconnect(), e && (this.observer = void 0));
|
|
145
|
+
}
|
|
146
|
+
#u = u(() => {
|
|
147
|
+
let e = i("#cloneFirst", this);
|
|
148
|
+
e && e.remove();
|
|
149
|
+
let t = i("#cloneLast", this);
|
|
150
|
+
if (t && t.remove(), this.#d(), this.#o) {
|
|
151
|
+
if (this.allIndex > 0) {
|
|
152
|
+
let e = Math.floor(this.clientWidth * (this.allIndex + 3));
|
|
153
|
+
this.#o.style.minWidth = `${e}px`;
|
|
154
|
+
} else this.#o.style.minWidth = "900%";
|
|
155
|
+
let e = this.loop ? this.currentIndex + 1 : this.currentIndex, t = Math.floor(e * this.clientWidth * -1);
|
|
156
|
+
this.#o.style.transform = `translateX(${t}px)`, this.#e = t;
|
|
157
|
+
}
|
|
158
|
+
let n = i(".pagination", this.root);
|
|
159
|
+
n && n.replaceChildren(this.#s()), this.#c();
|
|
160
|
+
}, 300);
|
|
161
|
+
#d() {
|
|
162
|
+
let e = this.children, t = e.length;
|
|
163
|
+
if (t > 0 && this.loop) {
|
|
164
|
+
let n = e[0].cloneNode(!0);
|
|
165
|
+
n.id = "cloneFirst";
|
|
166
|
+
let r = e[t - 1].cloneNode(!0);
|
|
167
|
+
r.id = "cloneLast", this.children[t - 1].insertAdjacentElement("afterend", n), this.children[0].insertAdjacentElement("beforebegin", r);
|
|
168
|
+
}
|
|
169
|
+
this.allIndex = this.children.length - (this.loop ? 3 : 1);
|
|
170
|
+
}
|
|
171
|
+
#f = (e) => {
|
|
172
|
+
for (let t of e) t.type === "childList" && (this.#l(), this.#u());
|
|
173
|
+
};
|
|
174
|
+
#p = (e) => {
|
|
175
|
+
let [t, n] = l(e, "data-page", this.root);
|
|
176
|
+
t && this.#m(n);
|
|
177
|
+
};
|
|
178
|
+
#m(e) {
|
|
179
|
+
this.#t.stop();
|
|
180
|
+
let t = this.loop ? this.currentIndex + 1 : this.currentIndex, n = t;
|
|
181
|
+
if (e === "prev") n = this.loop && this.currentIndex === 0 ? 0 : t - 1, n < 0 && (n = 0);
|
|
182
|
+
else if (e === "next") n = this.loop && this.currentIndex === this.allIndex ? this.allIndex + 2 : t + 1, !this.loop && n > this.allIndex && (n = this.allIndex);
|
|
183
|
+
else {
|
|
184
|
+
let t = Number(e);
|
|
185
|
+
t !== this.currentIndex && (n = this.loop ? t + 1 : t);
|
|
186
|
+
}
|
|
187
|
+
n !== t && this.#h(n), requestAnimationFrame(() => {
|
|
188
|
+
this.#C();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
#h(e) {
|
|
192
|
+
if (this.#o) {
|
|
193
|
+
let t = Math.floor(e * this.clientWidth * -1), n = this.#o.style.transform;
|
|
194
|
+
this.#o.animate([{ transform: n }, { transform: `translateX(${t}px)` }], { duration: 300 }).addEventListener("finish", () => {
|
|
195
|
+
let n = t;
|
|
196
|
+
this.loop && e === this.allIndex + 2 ? n = Math.floor(this.clientWidth * -1) : this.loop && e === 0 && (n = Math.floor(this.clientWidth * (this.allIndex + 1) * -1)), this.#o.style.transform = `translateX(${n}px)`, this.#e = n;
|
|
197
|
+
}, { once: !0 });
|
|
198
|
+
}
|
|
199
|
+
this.loop && this.allIndex > 0 && e === this.allIndex + 2 ? this.currentIndex = 0 : this.loop && this.allIndex > 0 && e === 0 ? this.currentIndex = this.allIndex : this.currentIndex = this.loop ? e - 1 : e;
|
|
200
|
+
let t = i(".bullet.active", this.root);
|
|
201
|
+
t && t.classList.remove("active");
|
|
202
|
+
let n = i(`#bullet-${this.currentIndex}`, this.root);
|
|
203
|
+
n && n.classList.add("active");
|
|
204
|
+
}
|
|
205
|
+
#g = () => {
|
|
206
|
+
this.arrows === "hover" && o(n(".nav-button", this.root), (e) => {
|
|
207
|
+
e.style.display = "flex", this.#v(e, !0);
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
#_ = () => {
|
|
211
|
+
this.arrows === "hover" && o(n(".nav-button", this.root), (e) => {
|
|
212
|
+
this.#v(e, !1);
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
#v(e, t = !0) {
|
|
216
|
+
let n = e.getAttribute("data-page") === "prev" ? -10 : 10, r = [];
|
|
217
|
+
t ? r.push({
|
|
218
|
+
opacity: 0,
|
|
219
|
+
transform: `translate3d(${n}px, -50%, 0)`
|
|
220
|
+
}, {
|
|
221
|
+
opacity: 1,
|
|
222
|
+
transform: "translate3d(0px, -50%, 0)"
|
|
223
|
+
}) : r.push({
|
|
224
|
+
opacity: 1,
|
|
225
|
+
transform: "translate3d(0px, -50%, 0)"
|
|
226
|
+
}, {
|
|
227
|
+
opacity: 0,
|
|
228
|
+
transform: `translate3d(${n}px, -50%, 0)`
|
|
229
|
+
});
|
|
230
|
+
let i = e.animate(r, {
|
|
231
|
+
duration: 300,
|
|
232
|
+
fill: "both"
|
|
233
|
+
});
|
|
234
|
+
t || i.addEventListener("finish", () => {
|
|
235
|
+
e.style.display = "none";
|
|
236
|
+
}, { once: !0 });
|
|
237
|
+
}
|
|
238
|
+
#y = () => {
|
|
239
|
+
let e = i(".container", this.root);
|
|
240
|
+
e.style.transition = "transform 0.3s", requestAnimationFrame(() => {
|
|
241
|
+
e.style.transform = `translateX(${this.#e}px)`;
|
|
242
|
+
}), e.addEventListener("transitionend", () => {
|
|
243
|
+
e.style.transition = "";
|
|
244
|
+
}, { once: !0 });
|
|
245
|
+
};
|
|
246
|
+
#b = (e) => {
|
|
247
|
+
this.#n = e.clientX, this.#r = !0, this.#i = Date.now(), this.#t.stop();
|
|
248
|
+
};
|
|
249
|
+
#x = (e) => {
|
|
250
|
+
this.#r && (this.#a && cancelAnimationFrame(this.#a), this.#a = requestAnimationFrame(() => {
|
|
251
|
+
let t = Math.floor(e.clientX - this.#n);
|
|
252
|
+
if (!this.loop && (t < 0 && this.currentIndex === this.allIndex || t > 0 && this.currentIndex === 0)) return;
|
|
253
|
+
let n = this.#e + t;
|
|
254
|
+
this.#o.style.transform = `translateX(${n}px)`;
|
|
255
|
+
}), e.preventDefault());
|
|
256
|
+
};
|
|
257
|
+
#S = (e) => {
|
|
258
|
+
if (!this.#r) return;
|
|
259
|
+
let t = Date.now() - this.#i, n = e.clientX - this.#n;
|
|
260
|
+
if (this.#r = !1, n === 0) return;
|
|
261
|
+
let r = "cancel";
|
|
262
|
+
t <= 200 ? n >= 20 ? r = "prev" : n <= -20 && (r = "next") : n >= this.clientWidth / 2 ? r = "prev" : n <= -this.clientWidth / 2 && (r = "next"), r === "cancel" ? this.#y() : this.#m(r), this.#C();
|
|
263
|
+
};
|
|
264
|
+
#C = () => {
|
|
265
|
+
this.autoplay && this.#t.start();
|
|
266
|
+
};
|
|
267
|
+
#w = () => {
|
|
268
|
+
this.#r && (this.#r = !1, this.#y(), this.#C());
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
//#endregion
|
|
272
|
+
export { p as t };
|
package/lib/check/checkbox.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
|
|
3
|
-
const o = ':host(.is-indeterminate) .l-check__inner{background-color:var(--l-primary-color, #722ed1)}:host(.is-indeterminate) .l-check__inner:after{content:"";width:calc(var(--l-check-size) * .4);height:1px;display:block;border:1px solid #fff;border-right:none;border-top:none;border-left:none;transform:rotate(0);margin-top:0}.l-check__inner:after,:host(.is-checked) .l-check__inner:after{content:"";width:calc(var(--l-check-size) * .6);height:calc(var(--l-check-size) * .3);display:block;border:solid 1px transparent;border-right:none;border-top:none;transform:rotate(-45deg);transition:border-color .2s ease-in-out;margin-top:-3px}:host(.is-checked) .l-check__inner{background-color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner:after{border-color:#fff}:host(.is-disabled) .l-check__inner{background-color:var(--l-disabled-color, #e6e6e6);border-color:var(--l-disabled-color, #e6e6e6)}';
|
|
4
|
-
class i extends e {
|
|
5
|
-
static baseName = "checkbox";
|
|
6
|
-
constructor() {
|
|
7
|
-
super(), this._inputType = "checkbox";
|
|
8
|
-
}
|
|
9
|
-
connectedCallback() {
|
|
10
|
-
this.loadStyleText([r, o]), super.connectedCallback();
|
|
11
|
-
}
|
|
12
|
-
_doChangeAction() {
|
|
13
|
-
this.getChecked() ? this.setChecked(!1) : this.setChecked(!0), this.emitChange();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
i as default
|
|
18
|
-
};
|
|
1
|
+
import { t as e } from "../checkbox-DbWsmAaL.js";
|
|
2
|
+
export { e as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
c as default
|
|
1
|
+
import { t as e } from "../check-B0XraJvb.js";
|
|
2
|
+
//#region src/components/check/checkbox_group.ts
|
|
3
|
+
var t = class extends e {
|
|
4
|
+
static baseName = "checkbox-group";
|
|
7
5
|
};
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as default };
|
package/lib/check/radio.js
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
|
|
3
|
-
const o = '.l-check__inner{border-radius:50%}.l-check__inner:after{content:"";display:block;width:60%;height:60%;background-color:transparent;border-radius:50%;transition:background-color .3s ease-in-out}:host(.is-checked) .l-check__inner:after{background-color:var(--l-primary-color, #722ed1)}:host(.is-disabled) .l-check__inner{border-color:var(--l-disabled-color, #e6e6e6)}:host(.is-disabled) .l-check__inner:after{background-color:var(--l-disabled-color, #e6e6e6)}';
|
|
4
|
-
class t extends e {
|
|
5
|
-
static baseName = "radio";
|
|
6
|
-
connectedCallback() {
|
|
7
|
-
this.loadStyleText([r, o]), super.connectedCallback();
|
|
8
|
-
}
|
|
9
|
-
_doChangeAction() {
|
|
10
|
-
this.setChecked(!0), this.emitChange();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
t as default
|
|
15
|
-
};
|
|
1
|
+
import { t as e } from "../radio-2mNSYujz.js";
|
|
2
|
+
export { e as default };
|
package/lib/check/radio_group.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
s as default
|
|
1
|
+
import { t as e } from "../check-B0XraJvb.js";
|
|
2
|
+
//#region src/components/check/radio_group.ts
|
|
3
|
+
var t = class extends e {
|
|
4
|
+
static baseName = "radio-group";
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this.multiple = !1;
|
|
7
|
+
}
|
|
10
8
|
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as default };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { unitNumberStr as e } from "./utils/index.js";
|
|
2
|
+
import { n as t } from "./esm-sVEoAVPu.js";
|
|
3
|
+
import { t as n } from "./form_inner-DR9tyB_r.js";
|
|
4
|
+
import { $$ as r, off as i, on as a } from "ph-utils/dom";
|
|
5
|
+
//#region src/components/check/index.less?inline
|
|
6
|
+
var o = ":host{align-items:center;gap:var(--l-check-gap,0px);display:flex}", s = class extends n {
|
|
7
|
+
values;
|
|
8
|
+
multiple;
|
|
9
|
+
_state;
|
|
10
|
+
setValue(e) {
|
|
11
|
+
super.setValue(e), this.rendered && this.updateChecked();
|
|
12
|
+
}
|
|
13
|
+
constructor() {
|
|
14
|
+
super(!1), this.multiple = !0, this.values = t([]), this._state = {};
|
|
15
|
+
}
|
|
16
|
+
static get observedAttributes() {
|
|
17
|
+
return [
|
|
18
|
+
"disabled",
|
|
19
|
+
"value",
|
|
20
|
+
"name",
|
|
21
|
+
"inner-block",
|
|
22
|
+
"gap"
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
attributeChange(t, n, r) {
|
|
26
|
+
switch (t) {
|
|
27
|
+
case "gap":
|
|
28
|
+
this._state.gap = e(r);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
updateDOM(e) {
|
|
33
|
+
e.has("gap") && this._updateGap();
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
this.loadStyleText([o]), this.updateChecked(), super.connectedCallback(), this._updateGap();
|
|
37
|
+
}
|
|
38
|
+
afterInit() {
|
|
39
|
+
a(this.root, "change", this.#e), a(this, "check-context-request", this._privide);
|
|
40
|
+
}
|
|
41
|
+
beforeDestroy() {
|
|
42
|
+
i(this.root, "change", this.#e), i(this, "check-context-request", this._privide), this.values([]);
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return r("slot");
|
|
46
|
+
}
|
|
47
|
+
_privide = (e) => {
|
|
48
|
+
let { context: t, callback: n } = e.detail;
|
|
49
|
+
t === "check-context-request" && n(this.values);
|
|
50
|
+
};
|
|
51
|
+
_updateGap = () => {
|
|
52
|
+
this._state.gap ? this.style.setProperty("--l-check-gap", this._state.gap) : this.style.removeProperty("--l-check-gap");
|
|
53
|
+
};
|
|
54
|
+
#e = (e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
let t = e.detail.value, n = this.values(), r = n.indexOf(t);
|
|
57
|
+
this.multiple ? (r === -1 ? n.push(t) : n.splice(r, 1), this.setAttribute("value", n.join("&"))) : r === -1 && this.setAttribute("value", t), this.emit("change", {
|
|
58
|
+
detail: { value: this.multiple ? n : t },
|
|
59
|
+
composed: !0
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
updateChecked() {
|
|
63
|
+
let e = [];
|
|
64
|
+
if (this.value) if (this.multiple) {
|
|
65
|
+
let t = this.value.split("&");
|
|
66
|
+
e.push(...t.map((e) => decodeURIComponent(e)));
|
|
67
|
+
} else e = [this.value];
|
|
68
|
+
else e = [];
|
|
69
|
+
this.values(e);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { s as t };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { parseAttrValue as e, stopSignal as t } from "./utils/index.js";
|
|
2
|
+
import { t as n } from "./esm-sVEoAVPu.js";
|
|
3
|
+
import { t as r } from "./form_inner-DR9tyB_r.js";
|
|
4
|
+
import { $$ as i, addClass as a, off as o, on as s, removeClass as c, toggleClass as l } from "ph-utils/dom";
|
|
5
|
+
//#region src/components/check/check.ts
|
|
6
|
+
var u = class extends r {
|
|
7
|
+
_checked;
|
|
8
|
+
_inputType;
|
|
9
|
+
$input;
|
|
10
|
+
_groupCtx;
|
|
11
|
+
_groupCtxStop;
|
|
12
|
+
setChecked(e) {
|
|
13
|
+
this._checked = e, this.checkedChange();
|
|
14
|
+
}
|
|
15
|
+
getChecked() {
|
|
16
|
+
return this._checked;
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super(), this._checked = !1, this._inputType = "radio", Object.defineProperty(this, "checked", {
|
|
20
|
+
configurable: !0,
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
get: this.getChecked,
|
|
23
|
+
set: this.setChecked
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
static get observedAttributes() {
|
|
27
|
+
return [
|
|
28
|
+
"checked",
|
|
29
|
+
"label",
|
|
30
|
+
"button",
|
|
31
|
+
"indeterminate",
|
|
32
|
+
...r.observedAttributes
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
super.connectedCallback(), this.getChecked() && this.setChecked(!0), this.isDisabled() && a(this, "is-disabled"), this._updateIndeterminate(), this.emitInject("check-context-request", (e) => {
|
|
37
|
+
this._groupCtx = e;
|
|
38
|
+
}), this._groupCtxStop = n(() => {
|
|
39
|
+
if (this.value == null) return;
|
|
40
|
+
let e = this._groupCtx ? this._groupCtx() : [];
|
|
41
|
+
this.setChecked(e.includes(this.value));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
afterInit() {
|
|
45
|
+
s(this, "click", this.#e);
|
|
46
|
+
}
|
|
47
|
+
beforeDestroy() {
|
|
48
|
+
o(this, "click", this.#e), this._groupCtxStop = t(this._groupCtxStop);
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
let e = document.createDocumentFragment(), t = i("input", {
|
|
52
|
+
type: this._inputType,
|
|
53
|
+
class: "l-check__input",
|
|
54
|
+
name: this.getName(),
|
|
55
|
+
value: this.value,
|
|
56
|
+
checked: this.getChecked(),
|
|
57
|
+
disabled: this.isDisabled() ? "disabled" : void 0
|
|
58
|
+
});
|
|
59
|
+
if (this.$input = t, e.appendChild(t), !this._state.button) {
|
|
60
|
+
let t = i("span", { class: "l-check__inner" });
|
|
61
|
+
e.appendChild(t);
|
|
62
|
+
}
|
|
63
|
+
let n = i("label", {
|
|
64
|
+
class: "l-check__label",
|
|
65
|
+
part: "label"
|
|
66
|
+
}), r = i("slot", { textContent: this._state.label });
|
|
67
|
+
return n.appendChild(r), e.appendChild(n), e;
|
|
68
|
+
}
|
|
69
|
+
attributeChange(t, n, r) {
|
|
70
|
+
switch (t) {
|
|
71
|
+
case "checked":
|
|
72
|
+
let n = e(r, !1, "checked");
|
|
73
|
+
this.setChecked(n);
|
|
74
|
+
break;
|
|
75
|
+
case "button":
|
|
76
|
+
this._state[t] = e(r, !1, t);
|
|
77
|
+
break;
|
|
78
|
+
case "indeterminate":
|
|
79
|
+
let i = e(r, !1, t);
|
|
80
|
+
this._state.indeterminate = i, this._updateIndeterminate();
|
|
81
|
+
break;
|
|
82
|
+
case "label":
|
|
83
|
+
this._state.label = r;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
checkedChange() {
|
|
88
|
+
this.getChecked() ? a(this, "is-checked") : c(this, "is-checked"), this.$input && (this.$input.checked = this.getChecked());
|
|
89
|
+
}
|
|
90
|
+
disabledChange() {
|
|
91
|
+
l(this, "is-disabled"), this.$input && (this.$input.disabled = this.isDisabled());
|
|
92
|
+
}
|
|
93
|
+
_updateIndeterminate() {
|
|
94
|
+
this._state.indeterminate ? a(this, "is-indeterminate") : c(this, "is-indeterminate");
|
|
95
|
+
}
|
|
96
|
+
#e = () => {
|
|
97
|
+
if (!this.isDisabled()) if (this.value && this._groupCtx) this.emitChange();
|
|
98
|
+
else {
|
|
99
|
+
let e = this._inputType === "radio" ? !0 : !this.getChecked();
|
|
100
|
+
this.setChecked(e), this.emitChange();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
emitChange() {
|
|
104
|
+
this.emit("change", {
|
|
105
|
+
detail: {
|
|
106
|
+
value: this.value,
|
|
107
|
+
name: this.getName(),
|
|
108
|
+
checked: this.getChecked()
|
|
109
|
+
},
|
|
110
|
+
composed: !0,
|
|
111
|
+
bubbles: !0
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
_doChangeAction() {}
|
|
115
|
+
}, d = ":host{--l-check-size:14px;cursor:pointer;outline:none;align-items:center;width:auto;transition:color .3s,border-color .3s,background-color .3s;display:inline-flex;position:relative}.l-check__input{z-index:-1;opacity:0;width:0;height:0;margin:0;position:absolute}.l-check__inner{width:var(--l-check-size,14px);height:var(--l-check-size,14px);box-sizing:border-box;border:1px solid #dcddd9;border-radius:3px;flex-shrink:0;justify-content:center;align-items:center;margin-right:5px;transition:border-color .3s ease-in-out;display:flex;position:relative}.l-check__label{cursor:inherit;line-height:1;transition:color .3s}:host(.is-checked){color:var(--l-primary-color,#722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color,#722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color,#e6e6e6)}:host([button]){height:var(--l-form-control-height,32px);border-radius:inherit;border:1px solid #c0c4cc;border-left-width:0;justify-content:center;margin-left:0;padding:0 15px}:host([button]:first-child){border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}:host([button]:last-child){border-top-right-radius:3px;border-bottom-right-radius:3px}:host([button].is-checked){background-color:var(--l-primary-color,#722ed1);color:#fff;border-color:var(--l-primary-color,#722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color,#722ed1)}";
|
|
116
|
+
//#endregion
|
|
117
|
+
export { u as n, d as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { n as e, t } from "./check-CvGaONEx.js";
|
|
2
|
+
//#region src/components/check/checkbox.less?inline
|
|
3
|
+
var n = ":host(.is-indeterminate) .l-check__inner{background-color:var(--l-primary-color,#722ed1)}:host(.is-indeterminate) .l-check__inner:after{content:\"\";width:calc(var(--l-check-size) * .4);border:none;border-bottom:1px solid #fff;height:1px;margin-top:0;display:block;transform:rotate(0)}.l-check__inner:after,:host(.is-checked) .l-check__inner:after{content:\"\";width:calc(var(--l-check-size) * .6);height:calc(var(--l-check-size) * .3);border-top:none;border-bottom:1px solid #0000;border-left:1px solid #0000;border-right:none;margin-top:-3px;transition:border-color .2s ease-in-out;display:block;transform:rotate(-45deg)}:host(.is-checked) .l-check__inner{background-color:var(--l-primary-color,#722ed1)}:host(.is-checked) .l-check__inner:after{border-color:#fff}:host(.is-disabled) .l-check__inner{background-color:var(--l-disabled-color,#e6e6e6);border-color:var(--l-disabled-color,#e6e6e6)}", r = class extends e {
|
|
4
|
+
static baseName = "checkbox";
|
|
5
|
+
constructor() {
|
|
6
|
+
super(), this._inputType = "checkbox";
|
|
7
|
+
}
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
this.loadStyleText([t, n]), super.connectedCallback();
|
|
10
|
+
}
|
|
11
|
+
_doChangeAction() {
|
|
12
|
+
this.getChecked() ? this.setChecked(!1) : this.setChecked(!0), this.emitChange();
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as t };
|
package/lib/collapse/index.d.ts
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
|
|
3
|
-
#private;
|
|
4
|
-
static baseName: string;
|
|
5
|
-
arrowPlacement?: "left" | "right";
|
|
6
|
-
headerJustify?: "flex-start" | "flex-end" | "space-between";
|
|
7
|
-
/** 是否带有背景边框 */
|
|
8
|
-
background?: boolean;
|
|
9
|
-
gap?: string;
|
|
2
|
+
type CollapseState = {
|
|
10
3
|
borderRadius?: string;
|
|
11
4
|
grid?: boolean;
|
|
12
5
|
accordion?: boolean;
|
|
13
|
-
|
|
6
|
+
prop?: string;
|
|
7
|
+
};
|
|
8
|
+
export default class Collapase extends BaseComponent<CollapseState> {
|
|
9
|
+
static baseName: string;
|
|
10
|
+
private context;
|
|
11
|
+
private expands;
|
|
12
|
+
constructor();
|
|
14
13
|
static get observedAttributes(): string[];
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
attributeChanged(name: string, oldValue: string, newValue: string): void;
|
|
15
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
16
|
+
render_v2(): {
|
|
17
|
+
template: HTMLElement;
|
|
18
|
+
style: string;
|
|
19
|
+
};
|
|
20
|
+
_setStyleAndClass(): void;
|
|
17
21
|
afterInit(): void;
|
|
22
|
+
private _provide;
|
|
18
23
|
beforeDestroy(): void;
|
|
24
|
+
_onChange: (e: CustomEvent) => void;
|
|
19
25
|
}
|
|
26
|
+
export {};
|