litos-ui 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base.d.ts +3 -2
- package/lib/base.js +11 -8
- package/lib/button/index.d.ts +21 -5
- package/lib/button/index.js +115 -62
- package/lib/button/index.less_inline.js +2 -3
- package/lib/button/style.js +1 -2
- package/lib/calendar/index.js +22 -24
- package/lib/calendar/index.less_inline.js +1 -2
- package/lib/calendar/langs.js +1 -2
- package/lib/card/index.js +8 -9
- package/lib/card/index.less_inline.js +1 -2
- package/lib/carousel/index.js +10 -11
- package/lib/carousel/index.less_inline.js +1 -2
- package/lib/carousel/item.js +1 -2
- package/lib/carousel/item.less_inline.js +1 -2
- package/lib/carousel/timer.js +1 -2
- package/lib/check/check.d.ts +40 -8
- package/lib/check/check.js +200 -65
- package/lib/check/check.less_inline.js +2 -3
- package/lib/check/checkbox.js +2 -3
- package/lib/check/checkbox.less_inline.js +2 -3
- package/lib/check/checkbox_group.js +1 -2
- package/lib/check/index.d.ts +28 -8
- package/lib/check/index.js +151 -46
- package/lib/check/index.less_inline.js +1 -2
- package/lib/check/radio.js +2 -3
- package/lib/check/radio.less_inline.js +1 -2
- package/lib/check/radio_group.js +2 -3
- package/lib/collapse/index.d.ts +12 -4
- package/lib/collapse/index.js +80 -46
- package/lib/collapse/index.less_inline.js +2 -3
- package/lib/collapse/item.d.ts +35 -9
- package/lib/collapse/item.js +219 -57
- package/lib/collapse/item.less_inline.js +2 -3
- package/lib/collapse/types.d.ts +17 -3
- package/lib/color_picker/index.d.ts +4 -2
- package/lib/color_picker/index.js +26 -17
- package/lib/color_picker/index.less_inline.js +1 -2
- package/lib/date_picker/index.d.ts +5 -1
- package/lib/date_picker/index.js +39 -23
- package/lib/date_picker/index.less_inline.js +1 -2
- package/lib/date_picker_ori/index.d.ts +7 -2
- package/lib/date_picker_ori/index.js +123 -47
- package/lib/date_picker_ori/index.less_inline.js +1 -2
- package/lib/description_panel/index.js +2 -10
- package/lib/description_panel/index.less_inline.js +1 -2
- package/lib/dialog/dialog_box.js +28 -29
- package/lib/dialog/dialog_container.css_inline.js +1 -2
- package/lib/dialog/dialog_container.js +13 -14
- package/lib/dialog/dialog_container_style.js +1 -2
- package/lib/dialog/index.js +1 -2
- package/lib/dropdown/index.d.ts +39 -0
- package/lib/dropdown/index.js +98 -0
- package/lib/entries/base.js +1 -2
- package/lib/entries/button.js +5 -6
- package/lib/entries/calendar.js +5 -6
- package/lib/entries/card.js +5 -6
- package/lib/entries/carousel-item.js +5 -6
- package/lib/entries/carousel.js +5 -6
- package/lib/entries/checkbox-group.js +5 -6
- package/lib/entries/checkbox.js +5 -6
- package/lib/entries/collapse-item.d.ts +0 -1
- package/lib/entries/collapse-item.js +6 -6
- package/lib/entries/collapse.d.ts +0 -1
- package/lib/entries/collapse.js +11 -6
- package/lib/entries/color-picker.js +5 -6
- package/lib/entries/date-picker-ori.js +5 -6
- package/lib/entries/date-picker.js +5 -6
- package/lib/entries/description-panel.js +5 -6
- package/lib/entries/dialog-box.js +1 -2
- package/lib/entries/dialog-container.js +5 -6
- package/lib/entries/dialog.js +1 -2
- package/lib/entries/dropdown.d.ts +2 -0
- package/lib/entries/dropdown.js +1 -0
- package/lib/entries/form-item.js +5 -6
- package/lib/entries/form.js +5 -6
- package/lib/entries/icon-arrow-down.js +5 -6
- package/lib/entries/icon-arrow-left.js +5 -6
- package/lib/entries/icon-arrow-right.js +5 -6
- package/lib/entries/icon-arrow-up.js +5 -6
- package/lib/entries/icon-base.js +5 -6
- package/lib/entries/icon-calendar.js +5 -6
- package/lib/entries/icon-caret-bottom.js +5 -6
- package/lib/entries/icon-caret-top.js +5 -6
- package/lib/entries/icon-close-filled.js +5 -6
- package/lib/entries/icon-close.js +5 -6
- package/lib/entries/icon-copy.js +5 -6
- package/lib/entries/icon-d-arrow-left.js +5 -6
- package/lib/entries/icon-d-arrow-right.js +5 -6
- package/lib/entries/icon-delete.js +5 -6
- package/lib/entries/icon-eye-outline.js +5 -6
- package/lib/entries/icon-font-icon.js +5 -6
- package/lib/entries/icon-info.js +5 -6
- package/lib/entries/icon-loading.js +5 -6
- package/lib/entries/icon-minus.js +5 -6
- package/lib/entries/icon-moon.js +5 -6
- package/lib/entries/icon-more.js +5 -6
- package/lib/entries/icon-picture.js +5 -6
- package/lib/entries/icon-plus.js +5 -6
- package/lib/entries/icon-reduction.js +5 -6
- package/lib/entries/icon-refresh-left.js +5 -6
- package/lib/entries/icon-refresh-right.js +5 -6
- package/lib/entries/icon-refresh.js +5 -6
- package/lib/entries/icon-search.js +5 -6
- package/lib/entries/icon-select.js +5 -6
- package/lib/entries/icon-sort.js +5 -6
- package/lib/entries/icon-success.js +5 -6
- package/lib/entries/icon-sun.js +5 -6
- package/lib/entries/icon-theme-default.js +5 -6
- package/lib/entries/icon-warn.js +5 -6
- package/lib/entries/icon-zoom-in.js +5 -6
- package/lib/entries/icon-zoom-out.js +5 -6
- package/lib/entries/image-preview.js +5 -6
- package/lib/entries/image.js +5 -6
- package/lib/entries/input-number.js +5 -6
- package/lib/entries/input.js +5 -6
- package/lib/entries/list.js +5 -6
- package/lib/entries/loading.js +1 -2
- package/lib/entries/mask.js +5 -6
- package/lib/entries/md-input.js +5 -6
- package/lib/entries/menu.js +5 -6
- package/lib/entries/message.js +1 -2
- package/lib/entries/modal-box.js +1 -2
- package/lib/entries/modal.js +5 -6
- package/lib/entries/notification-box.js +1 -2
- package/lib/entries/notification.js +1 -2
- package/lib/entries/page-header.js +5 -6
- package/lib/entries/pagination.js +5 -6
- package/lib/entries/polygon.js +5 -6
- package/lib/entries/popconfirm.js +1 -2
- package/lib/entries/popover.js +1 -2
- package/lib/entries/qrcode.js +5 -6
- package/lib/entries/radio-group.js +5 -6
- package/lib/entries/radio.js +5 -6
- package/lib/entries/select-ori.js +5 -6
- package/lib/entries/select.js +5 -6
- package/lib/entries/space.js +5 -6
- package/lib/entries/switch.js +5 -6
- package/lib/entries/tabbar-item.js +5 -6
- package/lib/entries/tabbar.js +5 -6
- package/lib/entries/table.js +5 -6
- package/lib/entries/tabs.js +1 -2
- package/lib/entries/tag.js +5 -6
- package/lib/entries/theme-color.js +5 -6
- package/lib/entries/theme.js +5 -6
- package/lib/entries/transition.js +1 -2
- package/lib/entries/upload.js +5 -6
- package/lib/entries/utils.js +1 -3
- package/lib/form/accessibility.d.ts +15 -0
- package/lib/form/accessibility.js +56 -0
- package/lib/form/autocomplete.d.ts +21 -0
- package/lib/form/autocomplete.js +59 -0
- package/lib/form/context.d.ts +157 -0
- package/lib/form/context.js +88 -0
- package/lib/form/form_inner.d.ts +99 -24
- package/lib/form/form_inner.js +424 -72
- package/lib/form/form_item.d.ts +35 -11
- package/lib/form/form_item.js +210 -78
- package/lib/form/form_item.less_inline.js +2 -3
- package/lib/form/form_item_style.d.ts +3 -0
- package/lib/form/form_item_style.js +7 -0
- package/lib/form/index.d.ts +69 -15
- package/lib/form/index.js +501 -101
- package/lib/form/index.less_inline.js +1 -2
- package/lib/form/owner.d.ts +78 -0
- package/lib/form/owner.js +138 -0
- package/lib/form/style.d.ts +3 -0
- package/lib/form/style.js +7 -0
- package/lib/icon/arrow_down.js +1 -2
- package/lib/icon/arrow_left.js +1 -2
- package/lib/icon/arrow_right.js +1 -2
- package/lib/icon/arrow_up.js +1 -2
- package/lib/icon/base.js +1 -2
- package/lib/icon/calendar.js +1 -2
- package/lib/icon/caret_bottom.js +1 -2
- package/lib/icon/caret_top.js +1 -2
- package/lib/icon/close.js +1 -2
- package/lib/icon/close_filled.js +1 -2
- package/lib/icon/copy.js +1 -2
- package/lib/icon/d_arrow_left.js +1 -2
- package/lib/icon/d_arrow_right.js +1 -2
- package/lib/icon/delete.js +1 -2
- package/lib/icon/eye_outline.js +1 -2
- package/lib/icon/font_icon.js +1 -2
- package/lib/icon/icon_style.js +1 -2
- package/lib/icon/index.less_inline.js +1 -2
- package/lib/icon/info.js +1 -2
- package/lib/icon/loading.js +1 -2
- package/lib/icon/minus.js +1 -2
- package/lib/icon/moon.js +1 -2
- package/lib/icon/more.js +1 -2
- package/lib/icon/picture.js +1 -2
- package/lib/icon/plus.js +1 -2
- package/lib/icon/reduction.js +1 -2
- package/lib/icon/refresh.js +1 -2
- package/lib/icon/refresh_left.js +1 -2
- package/lib/icon/refresh_right.js +1 -2
- package/lib/icon/search.js +1 -2
- package/lib/icon/select.js +1 -2
- package/lib/icon/sort.js +1 -2
- package/lib/icon/success.js +1 -2
- package/lib/icon/sun.js +1 -2
- package/lib/icon/theme_default.js +1 -2
- package/lib/icon/warn.js +1 -2
- package/lib/icon/zoom_in.js +1 -2
- package/lib/icon/zoom_out.js +1 -2
- package/lib/image/image_preview.js +1 -2
- package/lib/image/image_preview.less_inline.js +1 -2
- package/lib/image/index.js +1 -2
- package/lib/image/index.less_inline.js +1 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +91 -91
- package/lib/input/index.d.ts +14 -0
- package/lib/input/index.js +126 -31
- package/lib/input/index.less_inline.js +2 -3
- package/lib/input/input_inner.less_inline.js +1 -2
- package/lib/input/style.d.ts +1 -0
- package/lib/input/style.js +5 -7
- package/lib/input_number/index.d.ts +7 -0
- package/lib/input_number/index.js +70 -48
- package/lib/input_number/index.less_inline.js +1 -2
- package/lib/input_number/style.js +1 -2
- package/lib/list/index.js +4 -5
- package/lib/list/index.less_inline.js +1 -2
- package/lib/loading/index.js +1 -2
- package/lib/mask/index.js +2 -7
- package/lib/mask/index.less_inline.js +1 -2
- package/lib/md_input/index.d.ts +11 -2
- package/lib/md_input/index.js +63 -27
- package/lib/md_input/index.less_inline.js +2 -3
- package/lib/menu/index.js +2 -7
- package/lib/menu/index.less_inline.js +1 -2
- package/lib/message/index.js +1 -2
- package/lib/modal/index.js +15 -16
- package/lib/modal/index.less_inline.js +1 -2
- package/lib/modal/modal_box.js +24 -25
- package/lib/notification/index.js +15 -29
- package/lib/notification/index.less_inline.js +1 -2
- package/lib/notification/notification_box.js +2 -3
- package/lib/notification/placement.js +1 -2
- package/lib/notification/style.js +1 -2
- package/lib/page_header/index.js +1 -2
- package/lib/page_header/index.less_inline.js +1 -2
- package/lib/pagination/index.js +2 -7
- package/lib/pagination/index.less_inline.js +1 -2
- package/lib/polygon/index.js +1 -2
- package/lib/polygon/index.less_inline.js +1 -2
- package/lib/qrcode/index.js +1 -2
- package/lib/qrcode/index.less_inline.js +1 -2
- package/lib/select/index.d.ts +19 -2
- package/lib/select/index.js +128 -74
- package/lib/select/index.less_inline.js +1 -2
- package/lib/select_ori/index.d.ts +9 -1
- package/lib/select_ori/index.js +36 -24
- package/lib/select_ori/index.less_inline.js +1 -2
- package/lib/space/index.js +1 -2
- package/lib/space/index.less_inline.js +1 -2
- package/lib/styles/animation/index.css_inline.js +1 -2
- package/lib/styles/animation/index.js +1 -2
- package/lib/styles/mask/index.css_inline.js +1 -2
- package/lib/styles/mask/index.js +1 -2
- package/lib/switch/index.d.ts +6 -0
- package/lib/switch/index.js +31 -16
- package/lib/switch/index.less_inline.js +1 -2
- package/lib/tabbar/index.js +1 -2
- package/lib/tabbar/index.less_inline.js +1 -2
- package/lib/tabbar/item.js +1 -2
- package/lib/tabbar/item.less_inline.js +1 -2
- package/lib/table/index.js +1 -2
- package/lib/table/index.less_inline.js +1 -2
- package/lib/tabs/index.js +1 -2
- package/lib/tag/index.d.ts +11 -3
- package/lib/tag/index.js +25 -24
- package/lib/tag/index.less_inline.js +2 -3
- package/lib/theme/appearance.d.ts +5 -0
- package/lib/theme/appearance.js +34 -0
- package/lib/theme/index.js +83 -39
- package/lib/theme/index.less_inline.js +1 -2
- package/lib/theme/theme_color.js +1 -2
- package/lib/upload/index.js +28 -41
- package/lib/upload/index.less_inline.js +2 -3
- package/lib/upload/style.js +1 -2
- package/lib/utils/clickoutside.js +1 -2
- package/lib/utils/event.js +1 -2
- package/lib/utils/index.d.ts +27 -6
- package/lib/utils/index.js +26 -6
- package/lib/utils/popover.js +7 -16
- package/lib/utils/transition.js +1 -2
- package/package.json +16 -13
- package/styles/dark.css +10 -2
- package/styles/dropdown.css +46 -0
- package/styles/reset.css +0 -1
- package/styles/select.css +5 -0
- package/styles/themes/apple.css +47 -0
- package/styles/{theme-coral.css → themes/coral.css} +5 -3
- package/styles/themes/deep-sea-blue.css +12 -0
- package/styles/themes/gamboge.css +15 -0
- package/styles/{theme-jade.css → themes/jade.css} +5 -3
- package/styles/themes/lotus-seed.css +12 -0
- package/styles/{theme-tangerine.css → themes/tangerine.css} +5 -3
- package/styles/themes.css +8 -0
- package/styles/vars.css +8 -2
- package/types/preact.d.ts +42 -0
- package/lib/form/types.d.ts +0 -7
- package/lib/utils/context_provide.d.ts +0 -10
- package/lib/utils/context_provide.js +0 -22
- package/lib/utils/locale.d.ts +0 -6
- package/lib/utils/locale.js +0 -34
- package/lib/utils/signal_types.d.ts +0 -5
package/lib/collapse/item.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import e from "../base.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { $$ as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { parseAttrValue as t } from "../utils/index.js";
|
|
3
|
+
import n from "./item.less_inline.js";
|
|
4
|
+
import { $$ as r, off as i, on as a } from "utilane/browser";
|
|
5
|
+
// src/components/collapse/item.ts
|
|
6
|
+
var o = "a[href],button,input,select,textarea,label,summary,audio[controls],video[controls],[contenteditable]:not([contenteditable=\"false\"]),[tabindex],[role=\"button\"],[role=\"link\"],[role=\"checkbox\"],[role=\"radio\"],[role=\"switch\"]", s = `${o},[hidden],[aria-hidden="true"],script,style,template`, c = "collapse-panel", l = "collapse-toggle", u = 150;
|
|
7
|
+
function d(e) {
|
|
8
|
+
return e.nodeType === Node.TEXT_NODE ? e.textContent ?? "" : !(e instanceof Element) || e.matches(s) ? "" : Array.from(e.childNodes, d).join("");
|
|
9
|
+
}
|
|
10
|
+
var f = class extends e {
|
|
8
11
|
static baseName = "collapse-item";
|
|
9
12
|
$header;
|
|
13
|
+
$toggle;
|
|
14
|
+
$titleSlot;
|
|
15
|
+
_captionObserver;
|
|
10
16
|
context;
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
_pendingExpand;
|
|
18
|
+
_pendingGroup;
|
|
19
|
+
_setGroupExpand;
|
|
20
|
+
_unregisterGroupItem;
|
|
21
|
+
_visualExpanded = !1;
|
|
22
|
+
_expandFrame;
|
|
23
|
+
_expandAnimation;
|
|
24
|
+
_stopWatchingExpansion;
|
|
13
25
|
expands;
|
|
14
26
|
constructor() {
|
|
15
27
|
super(), this.version = 2, this._state = {
|
|
@@ -19,100 +31,250 @@ var d = class extends e {
|
|
|
19
31
|
};
|
|
20
32
|
}
|
|
21
33
|
updateDOM(e) {
|
|
22
|
-
e.has("
|
|
34
|
+
e.has("header-text") && this._updateHeaderText(), e.has("toggle-label") && this._updateToggleLabel(), e.has("heading-level") && this.$toggle?.parentElement?.setAttribute("aria-level", this._headingLevel());
|
|
23
35
|
}
|
|
24
36
|
_setStyleAndClass() {
|
|
25
|
-
this._state.expand ? this.classList.add("l-collapse-expand") : this.classList.remove("l-collapse-expand");
|
|
37
|
+
this._state.expand ? this.classList.add("l-collapse-expand") : this.classList.remove("l-collapse-expand"), this.$toggle?.setAttribute("aria-expanded", String(this._state.expand));
|
|
26
38
|
}
|
|
27
39
|
static get observedAttributes() {
|
|
28
40
|
return [
|
|
29
41
|
"prop",
|
|
30
42
|
"header-text",
|
|
31
|
-
"expand"
|
|
43
|
+
"expand",
|
|
44
|
+
"heading-level",
|
|
45
|
+
"toggle-label"
|
|
32
46
|
];
|
|
33
47
|
}
|
|
34
|
-
attributeChanged(e,
|
|
48
|
+
attributeChanged(e, n, r) {
|
|
35
49
|
switch (e) {
|
|
36
50
|
case "prop":
|
|
51
|
+
this._state.prop = r ?? "";
|
|
52
|
+
break;
|
|
37
53
|
case "header-text":
|
|
38
|
-
this._state
|
|
54
|
+
this._state.headerText = r ?? "";
|
|
39
55
|
break;
|
|
40
56
|
case "expand":
|
|
41
|
-
let
|
|
42
|
-
|
|
57
|
+
let e = t(r, !1, "expand");
|
|
58
|
+
this.rendered && this._applyAttributeExpand(e), (!this.rendered || this._pendingGroup) && (this._pendingExpand = e);
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
61
|
render_v2() {
|
|
46
|
-
|
|
47
|
-
let e = document.createDocumentFragment(), t = a("div", {
|
|
62
|
+
let e = document.createDocumentFragment(), t = r("div", {
|
|
48
63
|
class: "l-collapse-item__header",
|
|
49
64
|
part: "header"
|
|
50
|
-
}),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
}), i = r("div", {
|
|
66
|
+
class: "l-collapse-item__heading",
|
|
67
|
+
role: "heading",
|
|
68
|
+
"aria-level": this._headingLevel()
|
|
69
|
+
}), a = r("button", {
|
|
70
|
+
class: "l-collapse-item__toggle",
|
|
71
|
+
id: l,
|
|
72
|
+
type: "button",
|
|
73
|
+
"aria-expanded": String(this._state.expand),
|
|
74
|
+
"aria-controls": c
|
|
75
|
+
});
|
|
76
|
+
a.append(r("l-arrow-right-icon", {
|
|
77
|
+
class: "l-collapse-arrow-icon",
|
|
78
|
+
"aria-hidden": "true"
|
|
79
|
+
})), i.append(a), t.append(i);
|
|
80
|
+
let o = this._state.headerText;
|
|
81
|
+
o ? a.append(this._createHeaderText(o)) : t.append(r("slot", { name: "header-text" }));
|
|
82
|
+
let s = this._createContentElement(!this._state.expand);
|
|
83
|
+
return s.id = c, s.inert = !this._state.expand, s.setAttribute("role", "group"), s.setAttribute("aria-labelledby", l), e.append(t, s), {
|
|
59
84
|
template: e,
|
|
60
|
-
style:
|
|
85
|
+
style: n
|
|
61
86
|
};
|
|
62
87
|
}
|
|
88
|
+
_headingLevel() {
|
|
89
|
+
let e = this.getAttribute("heading-level") ?? "";
|
|
90
|
+
return /^[1-6]$/.test(e) ? e : "3";
|
|
91
|
+
}
|
|
92
|
+
_createHeaderText(e) {
|
|
93
|
+
return r("span", {
|
|
94
|
+
part: "header-text",
|
|
95
|
+
textContent: e
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
_updateHeaderText() {
|
|
99
|
+
if (!this.$header || !this.$toggle) return;
|
|
100
|
+
let e = this.$toggle.querySelector("[part=\"header-text\"]"), t = this._state.headerText;
|
|
101
|
+
if (t) e ? e.textContent = t : this.$toggle.append(this._createHeaderText(t)), this.$titleSlot ? (this.$titleSlot.remove(), this._setTitleSlot()) : this._updateToggleLabel();
|
|
102
|
+
else if (!this.$titleSlot) {
|
|
103
|
+
e?.remove();
|
|
104
|
+
let t = r("slot", { name: "header-text" });
|
|
105
|
+
this.$header.append(t), this._setTitleSlot(t);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
_setTitleSlot(e) {
|
|
109
|
+
this.$titleSlot?.removeEventListener("slotchange", this._observeTitleCaption), this.$titleSlot = e, e?.addEventListener("slotchange", this._observeTitleCaption), this._observeTitleCaption();
|
|
110
|
+
}
|
|
111
|
+
_observeTitleCaption = () => {
|
|
112
|
+
this._captionObserver?.disconnect();
|
|
113
|
+
for (let e of this.$titleSlot?.assignedElements() ?? []) this._captionObserver ??= new MutationObserver(this._updateToggleLabel), this._captionObserver.observe(e, {
|
|
114
|
+
subtree: !0,
|
|
115
|
+
childList: !0,
|
|
116
|
+
characterData: !0,
|
|
117
|
+
attributes: !0,
|
|
118
|
+
attributeFilter: [
|
|
119
|
+
"hidden",
|
|
120
|
+
"aria-hidden",
|
|
121
|
+
"href",
|
|
122
|
+
"controls",
|
|
123
|
+
"contenteditable",
|
|
124
|
+
"tabindex",
|
|
125
|
+
"role"
|
|
126
|
+
]
|
|
127
|
+
});
|
|
128
|
+
this._updateToggleLabel();
|
|
129
|
+
};
|
|
130
|
+
_updateToggleLabel = () => {
|
|
131
|
+
if (!this.$toggle) return;
|
|
132
|
+
let e = this.getAttribute("toggle-label")?.trim();
|
|
133
|
+
if (e) this.$toggle.setAttribute("aria-label", e);
|
|
134
|
+
else if (this._state.headerText.trim()) this.$toggle.removeAttribute("aria-label");
|
|
135
|
+
else {
|
|
136
|
+
let e = this.$titleSlot?.assignedElements().map(d).join(" ").trim();
|
|
137
|
+
this.$toggle.setAttribute("aria-label", e || "Toggle panel");
|
|
138
|
+
}
|
|
139
|
+
};
|
|
63
140
|
afterInit() {
|
|
64
|
-
this.
|
|
141
|
+
this._visualExpanded = this._state.expand, this.$header = this.root.querySelector(".l-collapse-item__header") ?? void 0, this.$toggle = this.$header?.querySelector("button") ?? void 0, this._setTitleSlot(this.$header?.querySelector("slot") ?? void 0), this._setStyleAndClass(), this._pendingExpand === !1 && !this._state.expand && (this._pendingExpand = void 0), this._connectGroup() || (this._pendingGroup = this.closest("l-collapse") ?? void 0, this._pendingGroup?.addEventListener("collapse-context-ready", this._handleGroupReady, { once: !0 }), this._pendingExpand !== void 0 && this._applyExpand(this._pendingExpand), this._pendingGroup || (this._pendingExpand = void 0)), this.$header && a(this.$header, "click", this._handleHeaderTap);
|
|
142
|
+
}
|
|
143
|
+
_connectGroup() {
|
|
144
|
+
if (this.emitInject("collapse-context-request", this._receiveGroupContext), !this.context) return !1;
|
|
145
|
+
let e = this._pendingExpand;
|
|
146
|
+
return this._pendingExpand = void 0, e !== void 0 && this._applyAttributeExpand(e), this._unregisterGroupItem || this._updateLayout(), this._handleExpandsChange(), !0;
|
|
65
147
|
}
|
|
148
|
+
_receiveGroupContext = (e, t, n, r) => {
|
|
149
|
+
this.contextInject(e, t, n), this._unregisterGroupItem?.(), this._unregisterGroupItem = r?.({
|
|
150
|
+
getProp: () => this._state.prop,
|
|
151
|
+
applyExpand: (e) => this._applyExpand(e)
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
_handleGroupReady = () => {
|
|
155
|
+
this._pendingGroup = void 0, this._connectGroup();
|
|
156
|
+
};
|
|
66
157
|
beforeDestroy() {
|
|
67
|
-
this.
|
|
158
|
+
this._expandFrame !== void 0 && (cancelAnimationFrame(this._expandFrame), this._expandFrame = void 0), this._cancelExpandAnimation(), this._pendingGroup?.removeEventListener("collapse-context-ready", this._handleGroupReady), this._pendingGroup = void 0, this._pendingExpand = void 0, this._unregisterGroupItem?.(), this._unregisterGroupItem = void 0, this.context && this.classList.remove("background", "space"), this.context = void 0, this.expands = void 0, this._setGroupExpand = void 0, this.$header && i(this.$header, "click", this._handleHeaderTap), this.$header = void 0, this.$toggle = void 0, this._setTitleSlot();
|
|
68
159
|
}
|
|
69
160
|
_handleExpandsChange = () => {
|
|
70
|
-
this.expands && this.expands().includes(this._state.prop)
|
|
161
|
+
this.expands && this._applyExpand(this.expands().includes(this._state.prop));
|
|
71
162
|
};
|
|
72
|
-
_handleHeaderTap = () => {
|
|
73
|
-
|
|
163
|
+
_handleHeaderTap = (e) => {
|
|
164
|
+
if (e?.defaultPrevented) return;
|
|
165
|
+
for (let t of e?.composedPath() ?? []) {
|
|
166
|
+
if (t === this.$header || t === this.$toggle) break;
|
|
167
|
+
if (t instanceof Element && t.matches(o)) return;
|
|
168
|
+
}
|
|
169
|
+
let t = {
|
|
170
|
+
prop: this._state.prop,
|
|
171
|
+
expand: !this._state.expand
|
|
172
|
+
};
|
|
173
|
+
this._applyExpand(t.expand), this._pendingGroup && (this._pendingExpand = t.expand), this._setGroupExpand?.(t, !0), this._emitChange(t);
|
|
74
174
|
};
|
|
175
|
+
_applyExpand(e) {
|
|
176
|
+
e !== this._state.expand && (this._state.expand = e, this._handleExpand());
|
|
177
|
+
}
|
|
178
|
+
_applyAttributeExpand(e) {
|
|
179
|
+
this._applyExpand(e), this._setGroupExpand?.({
|
|
180
|
+
prop: this._state.prop,
|
|
181
|
+
expand: e
|
|
182
|
+
});
|
|
183
|
+
}
|
|
75
184
|
_updateLayout = () => {
|
|
76
185
|
if (!this.context) return;
|
|
77
186
|
let e = this.context();
|
|
78
187
|
this.$header && (e.arrowPlacement === "right" ? this.$header.classList.add("arrow-right") : this.$header.classList.remove("arrow-right"), e.headerJustify === "space-between" ? this.$header.classList.add("space-between") : this.$header.classList.remove("space-between")), e.background ? this.classList.add("background") : this.classList.remove("background"), e.gap ? this.classList.add("space") : this.classList.remove("space");
|
|
79
188
|
};
|
|
80
|
-
contextInject = (e, t) => {
|
|
81
|
-
this.context = e, this.expands = t;
|
|
189
|
+
contextInject = (e, t, n) => {
|
|
190
|
+
this.context = e, this.expands = t, this._setGroupExpand = n;
|
|
82
191
|
};
|
|
83
192
|
_handleExpand() {
|
|
84
193
|
if (!this.rendered) return;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
194
|
+
this._setStyleAndClass();
|
|
195
|
+
let e = this.root.getElementById(c);
|
|
196
|
+
e && (!this._state.expand && e.matches(":focus-within") && this.$toggle?.focus({ preventScroll: !0 }), e.inert = !this._state.expand, this.rendered && this._expandFrame === void 0 && this._visualExpanded !== this._state.expand && (this._expandFrame = requestAnimationFrame(() => {
|
|
197
|
+
this._expandFrame = void 0, this._commitExpansion();
|
|
198
|
+
})));
|
|
199
|
+
}
|
|
200
|
+
_commitExpansion() {
|
|
201
|
+
let e = this.root.getElementById(c);
|
|
202
|
+
if (!this.rendered || !e) return;
|
|
203
|
+
let t = this._state.expand;
|
|
204
|
+
if (t === this._visualExpanded) {
|
|
205
|
+
this._expandAnimation?.playState === "finished" && this._settleExpansion(e, t);
|
|
206
|
+
return;
|
|
98
207
|
}
|
|
99
|
-
this.
|
|
208
|
+
this._visualExpanded = t;
|
|
209
|
+
let n = this.ownerDocument.defaultView?.matchMedia("(prefers-reduced-motion: reduce)");
|
|
210
|
+
if (n?.matches || typeof e.animate != "function") {
|
|
211
|
+
this._settleExpansion(e, t);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
let r = e.style.display === "none" ? 0 : parseFloat(getComputedStyle(e).height) || 0;
|
|
215
|
+
this._cancelExpandAnimation(), t && (e.style.display = "block");
|
|
216
|
+
let i = t ? this._expandedHeight(e) : 0;
|
|
217
|
+
r === i ? this._settleExpansion(e, t) : (this._playHeightAnimation(e, t, r, i, u), this._watchExpansion(e, t, n, i));
|
|
100
218
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
219
|
+
_expandedHeight(e) {
|
|
220
|
+
let t = e.firstElementChild;
|
|
221
|
+
if (!t) return 0;
|
|
222
|
+
let n = getComputedStyle(e), r = parseFloat(getComputedStyle(t).height);
|
|
223
|
+
return Number.isFinite(r) ? r + parseFloat(n.borderTopWidth) + parseFloat(n.borderBottomWidth) : 0;
|
|
224
|
+
}
|
|
225
|
+
_playHeightAnimation(e, t, n, r, i) {
|
|
226
|
+
this._cancelHeightAnimation();
|
|
227
|
+
let a = e.animate([{ height: `${n}px` }, { height: `${r}px` }], {
|
|
228
|
+
duration: i,
|
|
229
|
+
fill: "both"
|
|
230
|
+
});
|
|
231
|
+
this._expandAnimation = a, a.onfinish = () => {
|
|
232
|
+
this._expandAnimation === a && this._state.expand === t && this._settleExpansion(e, t);
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
_watchExpansion(e, t, n, r) {
|
|
236
|
+
let i, a = () => {
|
|
237
|
+
i?.disconnect(), n?.removeEventListener("change", o);
|
|
238
|
+
}, o = (t) => {
|
|
239
|
+
t.matches && this._stopWatchingExpansion === a && this._settleExpansion(e, this._state.expand);
|
|
240
|
+
};
|
|
241
|
+
this._stopWatchingExpansion = a, n?.addEventListener("change", o);
|
|
242
|
+
let s = e.firstElementChild;
|
|
243
|
+
t && s && typeof ResizeObserver < "u" && (i = new ResizeObserver(() => {
|
|
244
|
+
let t = this._expandAnimation;
|
|
245
|
+
if (!t || this._stopWatchingExpansion !== a || !this._state.expand) return;
|
|
246
|
+
let n = Number(t.effect?.getComputedTiming().endTime ?? 0) - Number(t.currentTime);
|
|
247
|
+
if (n <= 0) return;
|
|
248
|
+
let i = this._expandedHeight(e);
|
|
249
|
+
if (Math.abs(i - r) < .5) return;
|
|
250
|
+
let o = parseFloat(getComputedStyle(e).height) || 0;
|
|
251
|
+
r = i, this._playHeightAnimation(e, !0, o, i, n);
|
|
252
|
+
}), i.observe(s, { box: "border-box" }));
|
|
253
|
+
}
|
|
254
|
+
_settleExpansion(e, t) {
|
|
255
|
+
this._cancelExpandAnimation(), this._visualExpanded = t, e.style.display = t ? "block" : "none";
|
|
256
|
+
}
|
|
257
|
+
_cancelExpandAnimation() {
|
|
258
|
+
this._stopWatchingExpansion?.(), this._stopWatchingExpansion = void 0, this._cancelHeightAnimation();
|
|
259
|
+
}
|
|
260
|
+
_cancelHeightAnimation() {
|
|
261
|
+
let e = this._expandAnimation;
|
|
262
|
+
e && (this._expandAnimation = void 0, e.onfinish = null, e.cancel());
|
|
263
|
+
}
|
|
264
|
+
_emitChange = (e = {
|
|
265
|
+
prop: this._state.prop,
|
|
266
|
+
expand: this._state.expand
|
|
267
|
+
}) => {
|
|
268
|
+
this.emit("expand-change", { detail: e });
|
|
106
269
|
};
|
|
107
270
|
_createContentElement(e = !0) {
|
|
108
|
-
return
|
|
271
|
+
return r("div", {
|
|
109
272
|
class: "l-collapse-content",
|
|
110
273
|
style: e ? "display: none;" : ""
|
|
111
|
-
}, [
|
|
274
|
+
}, [r("div", {
|
|
112
275
|
class: "l-collapse-content-box",
|
|
113
276
|
innerHTML: "<slot></slot>"
|
|
114
277
|
})]);
|
|
115
278
|
}
|
|
116
279
|
};
|
|
117
|
-
|
|
118
|
-
export { d as default };
|
|
280
|
+
export { f as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
var e = ":host{box-sizing:border-box;border-bottom:1px solid var(--l-collapse-border-color);color
|
|
3
|
-
//#endregion
|
|
1
|
+
// src/components/collapse/item.less?inline
|
|
2
|
+
var e = ":host{box-sizing:border-box;border-bottom:1px solid var(--l-collapse-border-color);border-left:var(--l-collapse-frame-width,0px) solid var(--l-collapse-border-color);border-right:var(--l-collapse-frame-width,0px) solid var(--l-collapse-border-color);border-top:var(--l-collapse-spaced-border-width,0px) solid var(--l-collapse-border-color);border-radius:var(--l-collapse-spaced-radius,revert-layer);background-color:var(--l-collapse-item-background,transparent);color:var(--l-text-color,#333);font-size:14px;display:block}.l-collapse-item__header{padding:var(--l-collapse-header-padding,10px 0);cursor:pointer;flex-direction:var(--l-collapse-header-direction,row);align-items:center;justify-content:var(--l-collapse-header-justify,flex-start);gap:5px;display:flex}.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-item__heading,.l-collapse-item__toggle{flex-direction:inherit;justify-content:inherit;gap:inherit;min-width:0;display:flex}.l-collapse-item__heading:only-child{flex:1}.l-collapse-item__toggle{appearance:none;width:100%;color:inherit;font:inherit;text-align:start;cursor:inherit;background:0 0;border:0;align-items:center;padding:0}.l-collapse-item__toggle:focus-visible{outline-offset:2px;box-shadow:0 0 0 2px var(--l-primary-color,#007bff);outline:2px solid}.l-collapse-arrow-icon{transition:transform .3s;transform:rotate(0)}@media (prefers-reduced-motion:reduce){.l-collapse-arrow-icon{transition:none}}.l-collapse-content{box-sizing:border-box;border-top:var(--l-collapse-frame-width,0px) solid var(--l-collapse-border-color);background:var(--l-collapse-content-background,transparent);overflow-y:hidden}.l-collapse-content-box{box-sizing:border-box;padding:var(--l-collapse-content-padding,0 0 15px);display:flow-root}:host(.l-collapse-expand) .l-collapse-arrow-icon{transform:rotate(90deg)}:host(:first-child){border-top-width:var(--l-collapse-frame-width,0px)}:host(.background){border-left:1px solid var(--l-collapse-border-color);border-right:1px solid var(--l-collapse-border-color);background-color:var(--_l-collapse-header-fill,#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:var(--_l-collapse-panel-fill,#fff)}:host(.background) .l-collapse-content-box{padding:15px}@layer collapse-joined-corners{: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)}";
|
|
4
3
|
export { e as default };
|
package/lib/collapse/types.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type CollapseAccessor<T> = {
|
|
2
|
+
(): T;
|
|
3
|
+
(value: T): void;
|
|
4
|
+
};
|
|
5
|
+
export type CollapseExpandChange = {
|
|
6
|
+
prop: string;
|
|
7
|
+
expand: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type SetCollapseItemExpand = (detail: CollapseExpandChange, notify?: boolean) => void;
|
|
10
|
+
export type CollapseItemBinding = {
|
|
11
|
+
getProp: () => string;
|
|
12
|
+
applyExpand: (expand: boolean) => void;
|
|
13
|
+
};
|
|
14
|
+
export type RegisterCollapseItem = (item: CollapseItemBinding) => () => void;
|
|
15
|
+
export type CollapseLayout = {
|
|
3
16
|
arrowPlacement: "left" | "right";
|
|
4
17
|
headerJustify: "flex-start" | "flex-end" | "space-between";
|
|
5
18
|
/** 是否带有背景边框 */
|
|
6
19
|
background: boolean;
|
|
7
20
|
gap?: string;
|
|
8
|
-
}
|
|
21
|
+
};
|
|
22
|
+
export type CollapseContext = CollapseAccessor<CollapseLayout>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import FormInner from "../form/form_inner";
|
|
2
2
|
export default class ColorPicker extends FormInner {
|
|
3
3
|
static baseName: string;
|
|
4
|
+
static get observedAttributes(): string[];
|
|
4
5
|
$picker?: HTMLInputElement;
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
protected get intrinsicDefaultValue(): string;
|
|
7
|
+
protected parseDefaultValue(value: string | null): string;
|
|
8
|
+
private normalizeColor;
|
|
7
9
|
setValue(value: any): void;
|
|
8
10
|
connectedCallback(): void;
|
|
9
11
|
disconnectedCallback(): void;
|
|
@@ -1,31 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { $one as
|
|
6
|
-
|
|
7
|
-
var
|
|
1
|
+
import e from "../form/form_inner.js";
|
|
2
|
+
import { setAttrs as t } from "../utils/index.js";
|
|
3
|
+
import n from "../input/index.less_inline.js";
|
|
4
|
+
import r from "./index.less_inline.js";
|
|
5
|
+
import { $one as i, off as a, on as o } from "utilane/browser";
|
|
6
|
+
// src/components/color_picker/index.ts
|
|
7
|
+
var s = class extends e {
|
|
8
8
|
static baseName = "color-picker";
|
|
9
|
+
static get observedAttributes() {
|
|
10
|
+
return [...new Set(e.observedAttributes)];
|
|
11
|
+
}
|
|
9
12
|
$picker;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
get intrinsicDefaultValue() {
|
|
14
|
+
return "#000000";
|
|
15
|
+
}
|
|
16
|
+
parseDefaultValue(e) {
|
|
17
|
+
return this.normalizeColor(e);
|
|
18
|
+
}
|
|
19
|
+
normalizeColor(e) {
|
|
20
|
+
let t = typeof e == "string" ? e.trim() : "";
|
|
21
|
+
return /^#[0-9a-f]{6}$/i.test(t) ? t.toLowerCase() : this.intrinsicDefaultValue;
|
|
13
22
|
}
|
|
14
23
|
setValue(e) {
|
|
15
|
-
|
|
24
|
+
let t = this.normalizeColor(e);
|
|
25
|
+
this.$picker && (this.$picker.value = t), super.setValue(t);
|
|
16
26
|
}
|
|
17
27
|
connectedCallback() {
|
|
18
|
-
this.loadStyleText([
|
|
28
|
+
this.loadStyleText([n, r]), super.connectedCallback(), this.$picker = i("input", this.root), this.syncNativeValue(), o(this.$picker, "change", this._handleChange);
|
|
19
29
|
}
|
|
20
30
|
disconnectedCallback() {
|
|
21
|
-
super.disconnectedCallback(), this.$picker &&= (
|
|
31
|
+
super.disconnectedCallback(), this.$picker &&= (a(this.$picker, "change", this._handleChange), void 0);
|
|
22
32
|
}
|
|
23
33
|
render() {
|
|
24
34
|
let e = document.createElement("input");
|
|
25
35
|
return t(e, [
|
|
26
36
|
["value", this.value],
|
|
27
37
|
["disabled", this.isDisabled()],
|
|
28
|
-
["name", this.getName()],
|
|
29
38
|
["type", "color"],
|
|
30
39
|
["class", "l-input l-color-picker"]
|
|
31
40
|
]), e;
|
|
@@ -34,9 +43,9 @@ var c = class extends n {
|
|
|
34
43
|
this.$picker && (this.$picker.disabled = this.isDisabled());
|
|
35
44
|
}
|
|
36
45
|
_handleChange = (e) => {
|
|
46
|
+
e.stopPropagation();
|
|
37
47
|
let t = e.target.value;
|
|
38
|
-
|
|
48
|
+
this.setValue(t), this.validateInput(), this.emit("change", { detail: t });
|
|
39
49
|
};
|
|
40
50
|
};
|
|
41
|
-
|
|
42
|
-
export { c as default };
|
|
51
|
+
export { s as default };
|
|
@@ -4,8 +4,9 @@ type DatePickerState = {
|
|
|
4
4
|
};
|
|
5
5
|
export default class DatePicker extends FormInner<DatePickerState> {
|
|
6
6
|
static baseName: string;
|
|
7
|
-
private _popover
|
|
7
|
+
private _popover?;
|
|
8
8
|
constructor();
|
|
9
|
+
private _createPopover;
|
|
9
10
|
afterInit(): void;
|
|
10
11
|
beforeDestroy(): void;
|
|
11
12
|
static get observedAttributes(): string[];
|
|
@@ -17,6 +18,9 @@ export default class DatePicker extends FormInner<DatePickerState> {
|
|
|
17
18
|
};
|
|
18
19
|
private _popoverContentRender;
|
|
19
20
|
private _updateWidth;
|
|
21
|
+
setValue(value: any): void;
|
|
22
|
+
protected disabledChange(): void;
|
|
23
|
+
private _handleInput;
|
|
20
24
|
private _handleTap;
|
|
21
25
|
private _onOuterTap;
|
|
22
26
|
}
|
package/lib/date_picker/index.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "
|
|
1
|
+
import e from "../form/form_inner.js";
|
|
2
|
+
import t from "./index.less_inline.js";
|
|
3
3
|
import n from "../input/input_inner.less_inline.js";
|
|
4
|
-
import {
|
|
5
|
-
import i from "
|
|
6
|
-
import { $$ as a,
|
|
7
|
-
|
|
8
|
-
var
|
|
4
|
+
import { unitNumberStr as r } from "../utils/index.js";
|
|
5
|
+
import { Popover as i } from "../utils/popover.js";
|
|
6
|
+
import { $$ as a, $one as o, off as s, on as c } from "utilane/browser";
|
|
7
|
+
// src/components/date_picker/index.ts
|
|
8
|
+
var l = class extends e {
|
|
9
9
|
static baseName = "date-picker";
|
|
10
10
|
_popover;
|
|
11
11
|
constructor() {
|
|
12
|
-
super(), this.version = 2, this._state = {}
|
|
12
|
+
super(), this.version = 2, this._state = {};
|
|
13
|
+
}
|
|
14
|
+
_createPopover() {
|
|
15
|
+
this._popover = new i({
|
|
13
16
|
trigger: "manual",
|
|
14
17
|
reference: this,
|
|
15
18
|
placement: "bottom-start",
|
|
@@ -21,29 +24,30 @@ var s = class extends t {
|
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
afterInit() {
|
|
24
|
-
this._updateWidth(),
|
|
27
|
+
this._updateWidth(), this._createPopover(), this.syncNativeValue(), this.disabledChange(), c(this.root, "input", this._handleInput), c(this, "click", this._handleTap);
|
|
25
28
|
}
|
|
26
29
|
beforeDestroy() {
|
|
27
|
-
this._popover
|
|
30
|
+
this._popover?.destroy(), s(this, "click", this._handleTap), s(this.root, "input", this._handleInput), this._popover = void 0;
|
|
28
31
|
}
|
|
29
32
|
static get observedAttributes() {
|
|
30
|
-
return ["width"];
|
|
33
|
+
return [.../* @__PURE__ */ new Set([...e.observedAttributes, "width"])];
|
|
31
34
|
}
|
|
32
|
-
attributeChange(t, n
|
|
33
|
-
|
|
35
|
+
attributeChange(e, t, n) {
|
|
36
|
+
e === "width" && (this._state.width = r(n));
|
|
34
37
|
}
|
|
35
38
|
updateDOM(e) {
|
|
36
39
|
e.has("width") && this._updateWidth();
|
|
37
40
|
}
|
|
38
41
|
render_v2() {
|
|
39
|
-
let e = document.createDocumentFragment(),
|
|
42
|
+
let e = document.createDocumentFragment(), r = a("input", {
|
|
40
43
|
class: "l-input__inner",
|
|
41
|
-
placeholder: "请选择日期"
|
|
44
|
+
placeholder: "请选择日期",
|
|
45
|
+
value: this.value ?? ""
|
|
42
46
|
});
|
|
43
|
-
e.appendChild(
|
|
44
|
-
let
|
|
45
|
-
return e.appendChild(
|
|
46
|
-
style: [
|
|
47
|
+
e.appendChild(r);
|
|
48
|
+
let i = a("l-calendar-icon", { class: "icon" });
|
|
49
|
+
return e.appendChild(i), {
|
|
50
|
+
style: [t, n],
|
|
47
51
|
template: e
|
|
48
52
|
};
|
|
49
53
|
}
|
|
@@ -63,6 +67,7 @@ var s = class extends t {
|
|
|
63
67
|
});
|
|
64
68
|
t.appendChild(r);
|
|
65
69
|
let i = a("button", {
|
|
70
|
+
type: "button",
|
|
66
71
|
class: "l-date-picker-header-btn l-date-picker-year-month",
|
|
67
72
|
textContent: "2026-04"
|
|
68
73
|
});
|
|
@@ -89,12 +94,23 @@ var s = class extends t {
|
|
|
89
94
|
_updateWidth() {
|
|
90
95
|
this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
|
|
91
96
|
}
|
|
97
|
+
setValue(e) {
|
|
98
|
+
super.setValue(e);
|
|
99
|
+
let t = o("input", this.root);
|
|
100
|
+
t && (t.value = e ?? ""), this.syncNativeValue();
|
|
101
|
+
}
|
|
102
|
+
disabledChange() {
|
|
103
|
+
let e = o("input", this.root);
|
|
104
|
+
e && (e.disabled = this.isDisabled()), this.isDisabled() && this._popover?.hide();
|
|
105
|
+
}
|
|
106
|
+
_handleInput = (e) => {
|
|
107
|
+
this.isDisabled() || (this.setValue(e.target.value), this.validateInput());
|
|
108
|
+
};
|
|
92
109
|
_handleTap = () => {
|
|
93
|
-
this._popover.isShow()
|
|
110
|
+
this.isDisabled() || this._popover && !this._popover.isShow() && this._popover.show(this);
|
|
94
111
|
};
|
|
95
112
|
_onOuterTap = (e, t, n) => {
|
|
96
|
-
t || n || this._popover
|
|
113
|
+
t || n || this._popover?.hide();
|
|
97
114
|
};
|
|
98
115
|
};
|
|
99
|
-
|
|
100
|
-
export { s as default };
|
|
116
|
+
export { l as default };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
// src/components/date_picker/index.less?inline
|
|
2
2
|
var e = ":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}";
|
|
3
|
-
//#endregion
|
|
4
3
|
export { e as default };
|
|
@@ -3,7 +3,7 @@ type DateInputType = "date" | "datetime-local" | "time" | "month" | "week";
|
|
|
3
3
|
type DatePickerOriState = {
|
|
4
4
|
/** 是否显示日期范围选择 */
|
|
5
5
|
range: boolean;
|
|
6
|
-
/**
|
|
6
|
+
/** 区间 change 的延时,0 表示在下一个定时器任务派发。 */
|
|
7
7
|
delay: number;
|
|
8
8
|
type: DateInputType;
|
|
9
9
|
width?: string;
|
|
@@ -17,7 +17,12 @@ export default class DatePicker extends FormInner {
|
|
|
17
17
|
static baseName: string;
|
|
18
18
|
_state: DatePickerOriState;
|
|
19
19
|
constructor();
|
|
20
|
-
|
|
20
|
+
protected parseDefaultValue(value: string | null): string;
|
|
21
|
+
setValue(value: string | null | undefined): void;
|
|
22
|
+
/** 范围业务值仍是逗号串,原生日期约束分别校验两个端点。 */
|
|
23
|
+
protected get nativeConstraintValues(): readonly unknown[];
|
|
24
|
+
protected get nativeBadInput(): boolean;
|
|
25
|
+
protected disabledChange(): void;
|
|
21
26
|
static get observedAttributes(): string[];
|
|
22
27
|
connectedCallback(): void;
|
|
23
28
|
afterInit(): void;
|