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
package/lib/collapse/index.js
CHANGED
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { $$ as n, on as c, iterate as i, off as p } from "ph-utils/dom";
|
|
4
|
-
const h = ":host{--l-collapse-border-color: var(--l-border-color, #dedede);--l-collapse-border-radius: 0px;display:grid;grid-template-columns:1fr;gap:var(--l-collapse-gap, 0px);box-sizing:border-box}:host(.l-collapse-grid){grid-template-columns:repeat(auto-fill,minmax(200px,1fr));align-items:start}";
|
|
5
|
-
class x extends o {
|
|
6
|
-
static baseName = "collapse";
|
|
7
|
-
arrowPlacement = "left";
|
|
8
|
-
headerJustify = "flex-start";
|
|
9
|
-
/** 是否带有背景边框 */
|
|
10
|
-
background = !1;
|
|
11
|
-
gap;
|
|
12
|
-
borderRadius;
|
|
13
|
-
grid = !1;
|
|
14
|
-
accordion = !1;
|
|
15
|
-
#e = /* @__PURE__ */ new Set();
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
this.loadStyleText(h), this.#s(), super.connectedCallback();
|
|
18
|
-
}
|
|
19
|
-
static get observedAttributes() {
|
|
20
|
-
return [
|
|
21
|
-
"arrow-placement",
|
|
22
|
-
"header-justify",
|
|
23
|
-
"background",
|
|
24
|
-
"gap",
|
|
25
|
-
"border-radius",
|
|
26
|
-
"grid",
|
|
27
|
-
"accordion",
|
|
28
|
-
"name"
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
attributeChangedCallback(t, s, a) {
|
|
32
|
-
t = d(t);
|
|
33
|
-
const e = r(
|
|
34
|
-
a,
|
|
35
|
-
this[t],
|
|
36
|
-
t
|
|
37
|
-
);
|
|
38
|
-
t === "name" ? e && (this.#e.clear(), e.split("&").forEach((l) => {
|
|
39
|
-
this.#e.add(decodeURIComponent(l));
|
|
40
|
-
})) : e !== this[t] && (this[t] = e);
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
return n("slot");
|
|
44
|
-
}
|
|
45
|
-
#s() {
|
|
46
|
-
this.gap && this.gap !== "0px" && this.style.setProperty("--l-collapse-gap", this.gap), this.borderRadius && this.borderRadius !== "0px" && this.style.setProperty("--l-collapse-border-radius", this.borderRadius), this.grid && this.classList.add("l-collapse-grid");
|
|
47
|
-
}
|
|
48
|
-
afterInit() {
|
|
49
|
-
c(this, "expand-change", this.#t);
|
|
50
|
-
const t = this.children;
|
|
51
|
-
if (i(t, (s) => {
|
|
52
|
-
const a = s.getAttribute("name");
|
|
53
|
-
if (a)
|
|
54
|
-
if (this.#e.size > 0)
|
|
55
|
-
this.#e.has(a) && s.setAttribute("expand", "on");
|
|
56
|
-
else {
|
|
57
|
-
let e = s.getAttribute("expand");
|
|
58
|
-
e != null && (e = r(e, !1, "expand"), e && this.#e.add(a));
|
|
59
|
-
}
|
|
60
|
-
}), this.#e.size > 0) {
|
|
61
|
-
const s = this.children;
|
|
62
|
-
i(s, (a) => {
|
|
63
|
-
const e = a.getAttribute("name");
|
|
64
|
-
e && this.#e.has(e) && a.setAttribute("expand", "on");
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
beforeDestroy() {
|
|
69
|
-
p(this, "expand-change", this.#t);
|
|
70
|
-
}
|
|
71
|
-
#t = (t) => {
|
|
72
|
-
const s = t.detail;
|
|
73
|
-
if (s.expand) {
|
|
74
|
-
if (this.accordion) {
|
|
75
|
-
const a = this.children;
|
|
76
|
-
i(a, (e) => {
|
|
77
|
-
e.name !== s.name && (e.expand = !1);
|
|
78
|
-
}), this.#e.clear();
|
|
79
|
-
}
|
|
80
|
-
this.#e.add(s.name);
|
|
81
|
-
} else
|
|
82
|
-
this.#e.delete(s.name);
|
|
83
|
-
this.emit("change", { detail: { expandedNames: [...this.#e] } });
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
x as default
|
|
88
|
-
};
|
|
1
|
+
import { t as e } from "../collapse-C3IRHLeg.js";
|
|
2
|
+
export { e as default };
|
package/lib/collapse/item.d.ts
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { CollapseContext } from "./types";
|
|
3
|
+
type CollapaseItemState = {
|
|
4
|
+
prop: string;
|
|
5
|
+
headerText: string;
|
|
6
|
+
expand: boolean;
|
|
7
|
+
};
|
|
8
|
+
export default class CollapaseItem extends BaseComponent<CollapaseItemState> {
|
|
4
9
|
static baseName: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
private $header?;
|
|
11
|
+
context?: CollapseContext;
|
|
12
|
+
private _ctxStop?;
|
|
13
|
+
private _expandStop?;
|
|
14
|
+
expands?: Signal<string[]>;
|
|
15
|
+
constructor();
|
|
16
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
17
|
+
_setStyleAndClass(): void;
|
|
10
18
|
static get observedAttributes(): string[];
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
protected attributeChanged(name: string, oldValue: string, newValue: string): void;
|
|
20
|
+
render_v2(): {
|
|
21
|
+
template: DocumentFragment;
|
|
22
|
+
style: string;
|
|
23
|
+
};
|
|
13
24
|
afterInit(): void;
|
|
14
25
|
beforeDestroy(): void;
|
|
26
|
+
_handleExpandsChange: () => void;
|
|
27
|
+
_handleHeaderTap: () => void;
|
|
28
|
+
_updateLayout: () => void;
|
|
29
|
+
contextInject: (ctx: CollapseContext, exds: Signal<string[]>) => void;
|
|
30
|
+
_handleExpand(): void;
|
|
31
|
+
_emitChange: () => void;
|
|
32
|
+
_createContentElement(hide?: boolean): HTMLElement;
|
|
15
33
|
}
|
|
34
|
+
export {};
|
package/lib/collapse/item.js
CHANGED
|
@@ -1,115 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { $$ as o, $one as r, on as d, off as c, queryHideNodeSize as p } from "ph-utils/dom";
|
|
4
|
-
const h = ":host{display:block;box-sizing:border-box;border-bottom:1px solid var(--l-collapse-border-color);color:#333;font-size:14px}.l-collapse-item__header{padding:10px 0;cursor:pointer;display:flex;align-items:center;justify-content:flex-start;gap:5px}.l-collapse-item__header.arrow-right{flex-direction:row-reverse;justify-content:flex-end}.l-collapse-item__header.space-between{justify-content:space-between}.l-collapse-arrow-icon{transform:rotate3d(0,0,1,0);transition:transform .3s}.l-collapse-content{box-sizing:border-box;transition:height .3s;overflow-y:hidden}.l-collapse-content-box{padding-bottom:15px}:host(.l-collapse-expand) .l-collapse-arrow-icon{transform:rotate3d(0,0,1,90deg)}:host(.background){border-left:1px solid var(--l-collapse-border-color);border-right:1px solid var(--l-collapse-border-color);background-color:#00000005}:host(.background:first-child),:host(.background.space){border-top:1px solid var(--l-collapse-border-color)}:host(.background) .l-collapse-item__header{padding:10px 15px}:host(.background) .l-collapse-content{border-top:1px solid var(--l-collapse-border-color);background:#fff}:host(.background) .l-collapse-content-box{padding:15px}:host(:first-child){border-top-left-radius:var(--l-collapse-border-radius, 0px);border-top-right-radius:var(--l-collapse-border-radius, 0px)}:host(:last-child){border-bottom-left-radius:var(--l-collapse-border-radius, 0px);border-bottom-right-radius:var(--l-collapse-border-radius, 0px)}:host(.space){border-radius:var(--l-collapse-border-radius, 0px)}";
|
|
5
|
-
class u extends l {
|
|
6
|
-
static baseName = "collapse-item";
|
|
7
|
-
name = "";
|
|
8
|
-
headerText = "";
|
|
9
|
-
#e = !1;
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
this.loadStyleText(h), this.#s(), super.connectedCallback();
|
|
12
|
-
}
|
|
13
|
-
#s() {
|
|
14
|
-
this.expand ? this.classList.add("l-collapse-expand") : this.classList.remove("l-collapse-expand");
|
|
15
|
-
}
|
|
16
|
-
get expand() {
|
|
17
|
-
return this.#e;
|
|
18
|
-
}
|
|
19
|
-
set expand(e) {
|
|
20
|
-
this.#e = e, this.#r();
|
|
21
|
-
}
|
|
22
|
-
static get observedAttributes() {
|
|
23
|
-
return ["name", "header-text", "expand"];
|
|
24
|
-
}
|
|
25
|
-
attributeChangedCallback(e, t, a) {
|
|
26
|
-
e = i(e);
|
|
27
|
-
const s = n(
|
|
28
|
-
a,
|
|
29
|
-
this[e],
|
|
30
|
-
e
|
|
31
|
-
);
|
|
32
|
-
s !== this[e] && (this[e] = s);
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
const e = document.createDocumentFragment(), t = o("div", {
|
|
36
|
-
class: "l-collapse-item__header",
|
|
37
|
-
part: "header"
|
|
38
|
-
}), a = o("l-arrow-right-icon", { class: "l-collapse-arrow-icon" });
|
|
39
|
-
if (t.appendChild(a), this.headerText) {
|
|
40
|
-
const s = o("span", {
|
|
41
|
-
part: "header-text",
|
|
42
|
-
textContent: `${this.headerText}`
|
|
43
|
-
});
|
|
44
|
-
t.appendChild(s);
|
|
45
|
-
} else
|
|
46
|
-
t.appendChild(
|
|
47
|
-
o("slot", {
|
|
48
|
-
name: "header-text"
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
return e.appendChild(t), this.expand && e.appendChild(this.#a(!1)), e;
|
|
52
|
-
}
|
|
53
|
-
afterInit() {
|
|
54
|
-
const e = this.parentElement;
|
|
55
|
-
e && e.tagName.endsWith("COLLAPASE") && this.#o({
|
|
56
|
-
arrowPlacement: e.arrowPlacement,
|
|
57
|
-
headerJustify: e.headerJustify,
|
|
58
|
-
background: e.background,
|
|
59
|
-
gap: e.gap
|
|
60
|
-
});
|
|
61
|
-
const t = r(".l-collapse-item__header", this.root);
|
|
62
|
-
t && d(t, "click", this.#t);
|
|
63
|
-
}
|
|
64
|
-
beforeDestroy() {
|
|
65
|
-
const e = r(".l-collapse-item__header", this.root);
|
|
66
|
-
e && c(e, "click", this.#t);
|
|
67
|
-
}
|
|
68
|
-
#t = () => {
|
|
69
|
-
this.expand = !this.expand;
|
|
70
|
-
};
|
|
71
|
-
#o(e) {
|
|
72
|
-
let t = r(".l-collapse-item__header", this.root);
|
|
73
|
-
t && (e.arrowPlacement === "right" ? t.classList.add("arrow-right") : t.classList.remove("arrow-right"), e.headerJustify === "space-between" ? t.classList.add("space-between") : t.classList.remove("space-between")), e.background ? this.classList.add("background") : this.classList.remove("background"), e.gap && e.gap !== "0px" ? this.classList.add("space") : this.classList.remove("space");
|
|
74
|
-
}
|
|
75
|
-
#r() {
|
|
76
|
-
if (!this.rendered) return;
|
|
77
|
-
let e = r(".l-collapse-content", this.root), t = 0;
|
|
78
|
-
if (this.#e) {
|
|
79
|
-
this.classList.add("l-collapse-expand"), e || (e = this.#a(!0), this.root.appendChild(e));
|
|
80
|
-
const a = p(e, null);
|
|
81
|
-
e.style.height = `${a.height}px`, e.style.display = "block", t = a.height;
|
|
82
|
-
} else
|
|
83
|
-
this.classList.remove("l-collapse-expand"), e && (t = e.getBoundingClientRect().height);
|
|
84
|
-
if (e) {
|
|
85
|
-
const a = [{ height: "0px" }, { height: `${t}px` }];
|
|
86
|
-
this.#e || a.reverse();
|
|
87
|
-
let s = e.animate(a, {
|
|
88
|
-
duration: 150
|
|
89
|
-
});
|
|
90
|
-
this.#e || (s.onfinish = () => {
|
|
91
|
-
e.style.display = "none", s.onfinish = null, s = null;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
this.emit("expand-change", {
|
|
95
|
-
detail: { name: this.name, expand: this.expand }
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
#a(e = !0) {
|
|
99
|
-
const t = o("div", {
|
|
100
|
-
class: "l-collapse-content",
|
|
101
|
-
style: e ? "display: none;" : ""
|
|
102
|
-
});
|
|
103
|
-
return o(
|
|
104
|
-
"div",
|
|
105
|
-
{
|
|
106
|
-
class: "l-collapse-content-box",
|
|
107
|
-
innerHTML: "<slot></slot>"
|
|
108
|
-
},
|
|
109
|
-
t
|
|
110
|
-
), t;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export {
|
|
114
|
-
u as default
|
|
115
|
-
};
|
|
1
|
+
import { t as e } from "../item-DRsOV_Tc.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import e from "./base.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
|
|
3
|
+
import { n as i } from "./esm-sVEoAVPu.js";
|
|
4
|
+
import { $$ as a, off as o, on as s } from "ph-utils/dom";
|
|
5
|
+
//#region src/components/collapse/index.less?inline
|
|
6
|
+
var c = ":host{--l-collapse-border-color:var(--l-border-color,#dedede);--l-collapse-border-radius:0px;gap:var(--l-collapse-gap,0px);box-sizing:border-box;grid-template-columns:1fr;display:grid}:host(.l-collapse-grid){grid-template-columns:repeat(auto-fill,minmax(200px,1fr));align-items:start}", l = class extends e {
|
|
7
|
+
static baseName = "collapse";
|
|
8
|
+
context;
|
|
9
|
+
expands;
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this.version = 2, this.context = i({
|
|
12
|
+
arrowPlacement: "left",
|
|
13
|
+
headerJustify: "flex-start",
|
|
14
|
+
background: !1
|
|
15
|
+
}), this.expands = i([]), this._state = {
|
|
16
|
+
grid: !1,
|
|
17
|
+
accordion: !1
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
static get observedAttributes() {
|
|
21
|
+
return [
|
|
22
|
+
"arrow-placement",
|
|
23
|
+
"header-justify",
|
|
24
|
+
"background",
|
|
25
|
+
"gap",
|
|
26
|
+
"border-radius",
|
|
27
|
+
"grid",
|
|
28
|
+
"accordion",
|
|
29
|
+
"prop"
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
attributeChanged(e, i, a) {
|
|
33
|
+
switch (e) {
|
|
34
|
+
case "arrow-placement":
|
|
35
|
+
case "header-justify":
|
|
36
|
+
let i = { ...this.context() };
|
|
37
|
+
i[t(e)] = a, this.context(i);
|
|
38
|
+
break;
|
|
39
|
+
case "gap":
|
|
40
|
+
this.context({
|
|
41
|
+
...this.context(),
|
|
42
|
+
gap: r(a)
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
case "border-radius":
|
|
46
|
+
this._state.borderRadius = r(a);
|
|
47
|
+
break;
|
|
48
|
+
case "background":
|
|
49
|
+
this.context({
|
|
50
|
+
...this.context(),
|
|
51
|
+
background: n(a, !1, e)
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
case "accordion":
|
|
55
|
+
case "grid":
|
|
56
|
+
this._state[e] = n(a, !1, e);
|
|
57
|
+
break;
|
|
58
|
+
case "prop":
|
|
59
|
+
if (a !== this._state.prop) {
|
|
60
|
+
this._state.prop = a;
|
|
61
|
+
let e = [], t = a.split("&");
|
|
62
|
+
for (let n = 0, r = t.length; n < r; n++) e.push(t[n]);
|
|
63
|
+
this.expands(e);
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
updateDOM(e) {
|
|
69
|
+
(e.has("gap") || e.has("borderRadius") || e.has("grid")) && this._setStyleAndClass();
|
|
70
|
+
}
|
|
71
|
+
render_v2() {
|
|
72
|
+
return {
|
|
73
|
+
template: a("slot"),
|
|
74
|
+
style: c
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
_setStyleAndClass() {
|
|
78
|
+
this.context().gap ? this.style.setProperty("--l-collapse-gap", this.context().gap) : this.style.removeProperty("--l-collapse-gap"), this._state.borderRadius ? this.style.setProperty("--l-collapse-border-radius", this._state.borderRadius) : this.style.removeProperty("--l-collapse-border-radius"), this._state.grid ? this.classList.add("l-collapse-grid") : this.classList.remove("l-collapse-grid");
|
|
79
|
+
}
|
|
80
|
+
afterInit() {
|
|
81
|
+
this._setStyleAndClass(), s(this, "collapse-context-request", this._provide), s(this, "expand-change", this._onChange);
|
|
82
|
+
}
|
|
83
|
+
_provide(e) {
|
|
84
|
+
let { context: t, callback: n } = e.detail;
|
|
85
|
+
t === "collapse-context-request" && n(this.context, this.expands);
|
|
86
|
+
}
|
|
87
|
+
beforeDestroy() {
|
|
88
|
+
o(this, "collapse-context-request", this._provide), o(this, "expand-change", this._onChange);
|
|
89
|
+
}
|
|
90
|
+
_onChange = (e) => {
|
|
91
|
+
let t = e.detail, n = this.expands();
|
|
92
|
+
if (t.expand) this._state.accordion ? n = [t.prop] : n.includes(t.prop) || n.push(t.prop);
|
|
93
|
+
else {
|
|
94
|
+
let e = n.indexOf(t.prop);
|
|
95
|
+
e !== -1 && n.splice(e, 1);
|
|
96
|
+
}
|
|
97
|
+
this.expands([...n]), this._state.prop = n.join("&"), this.emit("change", { detail: {
|
|
98
|
+
expands: n,
|
|
99
|
+
value: this._state.prop
|
|
100
|
+
} });
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { l as t };
|
|
@@ -1,42 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initAttr as c, setAttrs as n } from "../utils/index.js";
|
|
4
|
-
import { i as l } from "../index-DY6m9Wbe.js";
|
|
5
|
-
const o = ":host{--l-input-width: 60px}";
|
|
6
|
-
class m extends r {
|
|
7
|
-
static baseName = "color-picker";
|
|
8
|
-
$picker;
|
|
9
|
-
_value = "#000000";
|
|
10
|
-
constructor() {
|
|
11
|
-
super(), c(this);
|
|
12
|
-
}
|
|
13
|
-
setValue(e) {
|
|
14
|
-
super.setValue(e), this.$picker && (this.$picker.value = e);
|
|
15
|
-
}
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
this.loadStyleText([l, o]), super.connectedCallback(), this.$picker = i("input", this.root), s(this.$picker, "change", this._handleChange);
|
|
18
|
-
}
|
|
19
|
-
disconnectedCallback() {
|
|
20
|
-
super.disconnectedCallback(), this.$picker && (a(this.$picker, "change", this._handleChange), this.$picker = void 0);
|
|
21
|
-
}
|
|
22
|
-
render() {
|
|
23
|
-
const e = document.createElement("input");
|
|
24
|
-
return n(e, [
|
|
25
|
-
["value", this.value],
|
|
26
|
-
["disabled", this.isDisabled()],
|
|
27
|
-
["name", this.getName()],
|
|
28
|
-
["type", "color"],
|
|
29
|
-
["class", "l-input l-color-picker"]
|
|
30
|
-
]), e;
|
|
31
|
-
}
|
|
32
|
-
disabledChange() {
|
|
33
|
-
this.$picker && (this.$picker.disabled = this.isDisabled());
|
|
34
|
-
}
|
|
35
|
-
_handleChange = (e) => {
|
|
36
|
-
const t = e.target.value;
|
|
37
|
-
super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
m as default
|
|
42
|
-
};
|
|
1
|
+
import { t as e } from "../color_picker-D0brKFm-.js";
|
|
2
|
+
export { e as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { initAttr as e, setAttrs as t } from "./utils/index.js";
|
|
2
|
+
import { t as n } from "./form_inner-DR9tyB_r.js";
|
|
3
|
+
import { t as r } from "./input-DjKxcxry.js";
|
|
4
|
+
import { $one as i, off as a, on as o } from "ph-utils/dom";
|
|
5
|
+
//#region src/components/color_picker/index.less?inline
|
|
6
|
+
var s = ":host{--l-input-width:60px}", c = class extends n {
|
|
7
|
+
static baseName = "color-picker";
|
|
8
|
+
$picker;
|
|
9
|
+
_value = "#000000";
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), e(this);
|
|
12
|
+
}
|
|
13
|
+
setValue(e) {
|
|
14
|
+
super.setValue(e), this.$picker && (this.$picker.value = e);
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.loadStyleText([r, s]), super.connectedCallback(), this.$picker = i("input", this.root), o(this.$picker, "change", this._handleChange);
|
|
18
|
+
}
|
|
19
|
+
disconnectedCallback() {
|
|
20
|
+
super.disconnectedCallback(), this.$picker &&= (a(this.$picker, "change", this._handleChange), void 0);
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
let e = document.createElement("input");
|
|
24
|
+
return t(e, [
|
|
25
|
+
["value", this.value],
|
|
26
|
+
["disabled", this.isDisabled()],
|
|
27
|
+
["name", this.getName()],
|
|
28
|
+
["type", "color"],
|
|
29
|
+
["class", "l-input l-color-picker"]
|
|
30
|
+
]), e;
|
|
31
|
+
}
|
|
32
|
+
disabledChange() {
|
|
33
|
+
this.$picker && (this.$picker.disabled = this.isDisabled());
|
|
34
|
+
}
|
|
35
|
+
_handleChange = (e) => {
|
|
36
|
+
let t = e.target.value;
|
|
37
|
+
super.setValue(t), this.dispatchEvent(new CustomEvent("change", { detail: t }));
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { c as t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import FormInner from "../form/form_inner";
|
|
2
|
+
type DatePickerState = {
|
|
3
|
+
width?: string;
|
|
4
|
+
};
|
|
5
|
+
export default class DatePicker extends FormInner<DatePickerState> {
|
|
6
|
+
static baseName: string;
|
|
7
|
+
private _popover;
|
|
8
|
+
constructor();
|
|
9
|
+
afterInit(): void;
|
|
10
|
+
beforeDestroy(): void;
|
|
11
|
+
static get observedAttributes(): string[];
|
|
12
|
+
attributeChange(name: string, oldValue: string, newValue: string): void;
|
|
13
|
+
protected updateDOM(changedProps: Set<string>): void;
|
|
14
|
+
render_v2(): {
|
|
15
|
+
template?: string | HTMLElement | DocumentFragment;
|
|
16
|
+
style?: string | string[];
|
|
17
|
+
};
|
|
18
|
+
private _popoverContentRender;
|
|
19
|
+
private _updateWidth;
|
|
20
|
+
private _handleTap;
|
|
21
|
+
private _onOuterTap;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { unitNumberStr as e } from "./utils/index.js";
|
|
2
|
+
import { t } from "./form_inner-DR9tyB_r.js";
|
|
3
|
+
import { t as n } from "./input_inner-BKJg9n9A.js";
|
|
4
|
+
import { Popover as r } from "./utils/popover.js";
|
|
5
|
+
import { $$ as i, on as a } from "ph-utils/dom";
|
|
6
|
+
//#region src/components/date_picker/index.less?inline
|
|
7
|
+
var o = ":host{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);width:var(--l-date-picker-width,140px);align-items:center;gap:8px;padding:0 8px;transition:border-color .3s;display:inline-flex}:host(:hover){border-color:var(--l-primary-color-light2,#66b3ff)}.icon{color:#00000059;flex-shrink:0;min-width:0}", s = class extends t {
|
|
8
|
+
static baseName = "date-picker";
|
|
9
|
+
_popover;
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this.version = 2, this._state = {}, this._popover = new r({
|
|
12
|
+
trigger: "manual",
|
|
13
|
+
reference: this,
|
|
14
|
+
placement: "bottom-start",
|
|
15
|
+
arrow: !1,
|
|
16
|
+
offset: 5,
|
|
17
|
+
theme: "date-picker",
|
|
18
|
+
contentRender: this._popoverContentRender,
|
|
19
|
+
onOutsideTap: this._onOuterTap
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
afterInit() {
|
|
23
|
+
this._updateWidth(), a(this, "click", this._handleTap);
|
|
24
|
+
}
|
|
25
|
+
beforeDestroy() {
|
|
26
|
+
this._popover.destroy(), a(this, "off", this._handleTap), this._popover = void 0;
|
|
27
|
+
}
|
|
28
|
+
static get observedAttributes() {
|
|
29
|
+
return ["width"];
|
|
30
|
+
}
|
|
31
|
+
attributeChange(t, n, r) {
|
|
32
|
+
switch (t) {
|
|
33
|
+
case "width":
|
|
34
|
+
this._state.width = e(r);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
updateDOM(e) {
|
|
39
|
+
e.has("width") && this._updateWidth();
|
|
40
|
+
}
|
|
41
|
+
render_v2() {
|
|
42
|
+
let e = document.createDocumentFragment(), t = i("input", {
|
|
43
|
+
class: "l-input__inner",
|
|
44
|
+
placeholder: "请选择日期"
|
|
45
|
+
});
|
|
46
|
+
e.appendChild(t);
|
|
47
|
+
let r = i("l-calendar-icon", { class: "icon" });
|
|
48
|
+
return e.appendChild(r), {
|
|
49
|
+
style: [o, n],
|
|
50
|
+
template: e
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
_popoverContentRender() {
|
|
54
|
+
let e = i("div", { class: "l-date-picker-panel" }), t = i("div", { class: "l-date-picker--header" }), n = i("button", {
|
|
55
|
+
type: "button",
|
|
56
|
+
"aria-label": "上一年",
|
|
57
|
+
class: "l-date-picker-header-btn",
|
|
58
|
+
innerHTML: "<l-d-arrow-left-icon></l-d-arrow-left-icon>"
|
|
59
|
+
});
|
|
60
|
+
t.appendChild(n);
|
|
61
|
+
let r = i("button", {
|
|
62
|
+
type: "button",
|
|
63
|
+
"aria-label": "上一月",
|
|
64
|
+
class: "l-date-picker-header-btn",
|
|
65
|
+
innerHTML: "<l-arrow-left-icon></l-arrow-left-icon>"
|
|
66
|
+
});
|
|
67
|
+
t.appendChild(r);
|
|
68
|
+
let a = i("button", {
|
|
69
|
+
class: "l-date-picker-header-btn l-date-picker-year-month",
|
|
70
|
+
textContent: "2026-04"
|
|
71
|
+
});
|
|
72
|
+
t.appendChild(a);
|
|
73
|
+
let o = i("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
"aria-label": "下一年",
|
|
76
|
+
class: "l-date-picker-header-btn",
|
|
77
|
+
innerHTML: "<l-arrow-right-icon></l-arrow-right-icon>"
|
|
78
|
+
});
|
|
79
|
+
t.appendChild(o);
|
|
80
|
+
let s = i("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
"aria-label": "下一月",
|
|
83
|
+
class: "l-date-picker-header-btn",
|
|
84
|
+
innerHTML: "<l-d-arrow-right-icon></l-d-arrow-right-icon>"
|
|
85
|
+
});
|
|
86
|
+
t.appendChild(s), e.appendChild(t);
|
|
87
|
+
let c = i("l-calendar", { class: "l-date-picker--calendar" }), l = i("div", { class: "l-date-picker--body" });
|
|
88
|
+
l.appendChild(c), e.appendChild(l);
|
|
89
|
+
let u = i("div", { class: "l-date-picker--footer" }), d = i("l-button", { textContent: "此刻" });
|
|
90
|
+
return u.appendChild(d), e.appendChild(u), e;
|
|
91
|
+
}
|
|
92
|
+
_updateWidth() {
|
|
93
|
+
this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
|
|
94
|
+
}
|
|
95
|
+
_handleTap = () => {
|
|
96
|
+
this._popover.isShow() || this._popover.show(this);
|
|
97
|
+
};
|
|
98
|
+
_onOuterTap = (e, t, n) => {
|
|
99
|
+
t || n || this._popover.hide();
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
//#endregion
|
|
103
|
+
export { s as t };
|